[][src]Enum socket_collection::Socket

pub enum Socket {
    Udp(UdpSock),
    Tcp(TcpSock),
}

Protocol agnostic socket that wraps UdpSock and TcpSock.

Variants

Methods

impl Socket
[src]

Specify data encryption context which will determine how outgoing data is encrypted.

Specify data decryption context which will determine how incoming data is decrypted.

Get the local address socket is bound to.

Get the address socket was connected to.

Set Time To Live value for the underlying socket.

Retrieve Time To Live value.

Retrieve last socket error, if one exists.

Read message from the connected socket. Call this method once socket becomes readable.

Returns:

  • Ok(Some(data)): data has been successfully read from the socket
  • Ok(None): there is not enough data in the socket. Call read() again in the next invocation of the ready handler.
  • Err(error): there was an error reading from the socket.

Write a message to the connected socket.

Returns:

  • Ok(true): the message has been successfully written.
  • Ok(false): the message has been queued, but not yet fully written. will be attempted in the next write schedule.
  • Err(error): there was an error while writing to the socket.

Sets linger time for connection based protocols.

Trait Implementations

impl From<UdpSock> for Socket
[src]

impl From<TcpSock> for Socket
[src]

Auto Trait Implementations

impl Send for Socket

impl Sync for Socket

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> UnsafeAny for T where
    T: Any

impl<T> Same for T

Should always be Self