Struct mles_utils::MsgConn [] [src]

pub struct MsgConn { /* fields omitted */ }

Msg connection structure

This structure defines the Mles connection for simple synchronous connections.

Methods

impl MsgConn
[src]

[src]

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());

[src]

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());

[src]

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());

[src]

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());

[src]

Connects to the defined address with a message.

[src]

Connects to the defined address (without a message).

[src]

Send a message. Blocks until a message is sent.

Errors

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

[src]

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.

[src]

Closes the connection.