[−][src]Enum socket_collection::Socket
Variants
Udp(UdpSock)
Tcp(TcpSock)
Methods
impl Socket
[src]
impl Socket
pub fn set_encrypt_ctx(&mut self, enc_ctx: EncryptContext) -> Res<()>
[src]
pub fn set_encrypt_ctx(&mut self, enc_ctx: EncryptContext) -> Res<()>
Specify data encryption context which will determine how outgoing data is encrypted.
pub fn set_decrypt_ctx(&mut self, dec_ctx: DecryptContext) -> Res<()>
[src]
pub fn set_decrypt_ctx(&mut self, dec_ctx: DecryptContext) -> Res<()>
Specify data decryption context which will determine how incoming data is decrypted.
pub fn local_addr(&self) -> Res<SocketAddr>
[src]
pub fn local_addr(&self) -> Res<SocketAddr>
Get the local address socket is bound to.
pub fn peer_addr(&self) -> Res<SocketAddr>
[src]
pub fn peer_addr(&self) -> Res<SocketAddr>
Get the address socket was connected to.
pub fn set_ttl(&self, ttl: u32) -> Res<()>
[src]
pub fn set_ttl(&self, ttl: u32) -> Res<()>
Set Time To Live value for the underlying socket.
pub fn ttl(&self) -> Res<u32>
[src]
pub fn ttl(&self) -> Res<u32>
Retrieve Time To Live value.
pub fn take_error(&self) -> Res<Option<Error>>
[src]
pub fn take_error(&self) -> Res<Option<Error>>
Retrieve last socket error, if one exists.
pub fn read<T: DeserializeOwned + Serialize>(&mut self) -> Res<Option<T>>
[src]
pub fn read<T: DeserializeOwned + Serialize>(&mut self) -> Res<Option<T>>
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 theready
handler. - Err(error): there was an error reading from the socket.
pub fn write<T: Serialize>(&mut self, msg: Option<(T, Priority)>) -> Res<bool>
[src]
pub fn write<T: Serialize>(&mut self, msg: Option<(T, Priority)>) -> Res<bool>
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.
pub fn set_linger(&self, dur: Option<Duration>) -> Res<()>
[src]
pub fn set_linger(&self, dur: Option<Duration>) -> Res<()>
Sets linger time for connection based protocols.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> UnsafeAny for T where
T: Any,
impl<T> UnsafeAny for T where
T: Any,
impl<T> Same for T
impl<T> Same for T
type Output = T
Should always be Self