Struct lib::LinuxTuplesConnection [] [src]

pub struct LinuxTuplesConnection {
    pub connection: SocketAddr,
}

Used to connect to LinuxTuples server

Examples

let conn = LinuxTuplesConnection { addr };

Fields

connection

Methods

impl LinuxTuplesConnection

fn put_tuple(&self, tuple: &Vec<E>) -> Result<bool>

Puts tuple to the tuple space

Examples

conn.put_tuple(&vec![E::I(123), E::S("123".to_string())]);

Errors

Returns Err if disconnected, or incorrect data arrived

fn get_tuple(&self, tuple: &Vec<E>) -> Result<Vec<E>>

Gets tuple from the tuple space

Examples

let tuple = conn.get_tuple(&vec![E::I(123), E::None]).unwrap();

Errors

Returns Err if disconnected, or incorrect data arrived

fn read_tuple(&self, tuple: &Vec<E>) -> Result<Vec<E>>

Reads tuple from the tuple space

Examples

let tuple = conn.read_tuple(&vec![E::I(123), E::None]).unwrap();

Errors

Returns Err if disconnected, or incorrect data arrived

fn get_nb_tuple(&self, tuple: &Vec<E>) -> Result<Vec<E>>

Gets tuple from the tuple space; non-blocking

If nothing found, returns empty vector.

Examples

let tuple = conn.get_nb_tuple(&vec![E::I(123), E::S("123".to_string())]).unwrap();

Errors

Returns Err if disconnected, or incorrect data arrived

fn read_nb_tuple(&self, tuple: &Vec<E>) -> Result<Vec<E>>

Reads tuple from the tuple space; non-blocking

If nothing found, returns empty vector.

Examples

let tuple = conn.read_nb_tuple(&vec![E::I(123), E::S("123".to_string())]).unwrap();

Errors

Returns Err if disconnected, or incorrect data arrived

fn read_all_tuples(&self, tuples: &Vec<Vec<E>>) -> Result<Vec<Vec<E>>>

Reads all tuples from the tuple space that satisfy templates

If nothing found, returns empty vector. If template list is empty, returns all tuples in the space.

Examples

let tuple_list = conn.read_all_tuples(&vec![vec![E::I(123), E::None], vec![E::S("123".to_string()), E::None]]).unwrap();

Errors

Returns Err if disconnected, or incorrect data arrived

fn number_of_tuples(&self, tuples: &Vec<Vec<E>>) -> Result<i32>

Calculates a number tuples from the tuple space that satisfy templates

If nothing found, 0. If template list is empty, returns number of all tuples in the space.

Examples

let count = conn.number_of_tuples(&vec![vec![E::I(123), E::None], vec![E::S("123".to_string()), E::None]]).unwrap();

Errors

Returns Err if disconnected, or incorrect data arrived

fn replace_tuple(&self, tuple: &Vec<E>, replacement: &Vec<E>) -> Result<bool>

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.

fn server_log(&self) -> Result<String>

Returns a list of operations done to a tuple.

Examples

let log = conn.server_log();

Errors

Returns Err if disconnected, or incorrect data arrived

fn print_tuple(tuple: &Vec<E>)

Prints a tuple to the standard output

# Examples LinuxTuplesConnection::print_tuple(&vec![E::I(123)]);

Trait Implementations

Derived Implementations

impl Clone for LinuxTuplesConnection

fn clone(&self) -> LinuxTuplesConnection

1.0.0fn clone_from(&mut self, source: &Self)