Struct mles_utils::MsgConn

source ·
pub struct MsgConn { /* private fields */ }
Expand description

Msg connection structure

This structure defines the Mles connection for simple synchronous connections.

Implementations

Create a new MsgConn object for a connection.

Example
use mles_utils::MsgConn;

let conn = MsgConn::new("My uid".to_string(), "My channel".to_string());

Gets the defined uid.

Example
use mles_utils::MsgConn;

let conn = MsgConn::new("My uid".to_string(), "My channel".to_string());
assert_eq!("My uid".to_string(), conn.get_uid());

Gets the defined channel.

Example
use mles_utils::MsgConn;

let conn = MsgConn::new("My uid".to_string(), "My channel".to_string());
assert_eq!("My channel".to_string(), conn.get_channel());

Gets the defined key.

Example
use mles_utils::MsgConn;

//key is set only when connection is initiated..
let conn = MsgConn::new("My uid".to_string(), "My channel".to_string());
assert_eq!(true, conn.get_key().is_none());

Connects to the defined address with a message.

Connects to the defined address (without a message).

Send a message. Blocks until a message is sent.

Errors

If a message cannot be sent, stream is set to None.

Reads a message with non-zero message content. Blocks until a message is received.

Errors

If message cannot be read, an empty message is returned.

Closes the connection.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.