Struct SockRef
pub struct SockRef<'s> { /* private fields */ }
A reference to a Socket that can be used to configure socket types other
than the Socket type itself.
This allows for example a TcpStream, found in the standard library, to
be configured using all the additional methods found in the Socket API.
SockRef can be created from any socket type that implements AsFd
(Unix) or AsSocket (Windows) using the From implementation.
Examples
Below is an example of converting a TcpStream into a SockRef.
use ;
use SockRef;
#
Trait Implementations
impl Debug for SockRef<'_>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<'s> Deref for SockRef<'s>
type Target = Socket;fn deref(&self) -> &Self::Target
impl<'s, S> From<&'s S> for SockRef<'s>
where
S: AsFd,
fn from(socket: &'s S) -> SelfThe caller must ensure
Sis actually a socket.
Auto Trait Implementations
impl<'s> Freeze for SockRef<'s>
impl<'s> RefUnwindSafe for SockRef<'s>
impl<'s> Send for SockRef<'s>
impl<'s> Sync for SockRef<'s>
impl<'s> Unpin for SockRef<'s>
impl<'s> UnsafeUnpin for SockRef<'s>
impl<'s> UnwindSafe for SockRef<'s>
Blanket Implementations
impl<P, T> Receiver for SockRef<'s>
where
P: Deref<Target = T> + ?Sized,
T: ?Sized,
type Target = T;
impl<T> Any for SockRef<'s>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for SockRef<'s>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for SockRef<'s>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for SockRef<'s>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for SockRef<'s>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for SockRef<'s>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for SockRef<'s>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>