[−][src]Struct mles_utils::MsgConn
Msg connection structure
This structure defines the Mles connection for simple synchronous connections.
Implementations
impl MsgConn
[src]
pub fn new(uid: String, channel: String) -> MsgConn
[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());
pub fn get_uid(&self) -> 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());
pub fn get_channel(&self) -> String
[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());
pub fn get_key(&self) -> Option<u64>
[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());
pub fn connect_with_message(self, raddr: SocketAddr, msg: Vec<u8>) -> MsgConn
[src]
Connects to the defined address with a message.
pub fn connect(self, raddr: SocketAddr) -> MsgConn
[src]
Connects to the defined address (without a message).
pub fn send_message(self, msg: Vec<u8>) -> MsgConn
[src]
Send a message. Blocks until a message is sent.
Errors
If a message cannot be sent, stream is set to None.
pub fn read_message(self) -> (MsgConn, Vec<u8>)
[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.
pub fn close(self) -> MsgConn
[src]
Closes the connection.
Auto Trait Implementations
impl RefUnwindSafe for MsgConn
impl Send for MsgConn
impl Sync for MsgConn
impl Unpin for MsgConn
impl UnwindSafe for MsgConn
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,