/// Replaces one tuple with another in the space
///
///
/// # Examples
///
/// ```
/// conn.replace_tuple(&vec![E::I(123)], &vec![E::S("123".to_string())]).unwrap();
/// ```
///
/// # Errors
///
/// Returns Err if source tuple wasn't found or data was corrupted/socket disconnected.
Replaces one tuple with another in the space
Replaces one tuple with another in the space
pub fn replace_tuple(&self, tuple: &Vec<E>, replacement: &Vec<E>) -> std::io::Result<bool> {
			let mut stream_err = TcpStream::connect(&self.connection);
			match stream_err {
				Ok(mut stream) => {
					stream.write_all(&ti(REPLACE));
					send_tuple(tuple, &mut stream);
					send_tuple(replacement, &mut stream);
					let mut buff_4:[u8; 4] = [0; 4];
					stream.read_exact(&mut buff_4);
					let op:i32 = unsafe { transmute(buff_4) };
					if op != REPLACE {
						return Err(std::io::Error::new(std::io::ErrorKind::InvalidData, "Replace failed"));
					} else {
						return Ok(true);
					}
				}
				Err(why) => {
					return Err(why);
				}
			}
	}
pub fn replace_tuple ( & self , tuple : & Vec < E > , replacement : & Vec < E > ) -> std :: io :: Result < bool > { let mut stream_err = TcpStream :: connect ( & self . connection ) ; match stream_err { Ok ( mut stream ) => { stream . write_all ( & ti ( REPLACE ) ) ; send_tuple ( tuple , & mut stream ) ; send_tuple ( replacement , & mut stream ) ; let mut buff_4 : [ u8 ; 4 ] = [ 0 ; 4 ] ; stream . read_exact ( & mut buff_4 ) ; let op : i32 = unsafe { transmute ( buff_4 ) } ; if op != REPLACE { return Err ( std :: io :: Error :: new ( std :: io :: ErrorKind :: InvalidData , " " ) ) ; } else { return Ok ( true ) ; } } Err ( why ) => { return Err ( why ) ; } } }
Replaces one tuple with another in the space
Replaces one tuple with another in the space
&self
tuple
&Vec<E>
replacement
&Vec<E>
examples
None
errors
Returns Err if source tuple wasn't found or data was corrupted/socket disconnected.
Returns Err if source tuple wasn ' t found or data was corrupted / socket disconnected .