Struct SourceFd
struct SourceFd<'a>(159)
Adapter for RawFd providing an event::Source implementation.
SourceFd enables registering any type with an FD with Poll.
While only implementations for TCP and UDP are provided, Mio supports
registering any FD that can be registered with the underlying OS selector.
SourceFd provides the necessary bridge.
Note that SourceFd takes a &RawFd. This is because SourceFd does
not take ownership of the FD. Specifically, it will not manage any
lifecycle related operations, such as closing the FD on drop. It is expected
that the SourceFd is constructed right before a call to
Registry::register. See the examples for more detail.
Examples
Basic usage.
# use Error;
#
Implementing event::Source for a custom type backed by a RawFd.
use ;
use SourceFd;
use RawFd;
use io;
#
Implementations
impl<'a> Debug for SourceFd<'a>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<'a> Freeze for SourceFd<'a>
impl<'a> RefUnwindSafe for SourceFd<'a>
impl<'a> Send for SourceFd<'a>
impl<'a> Source for SourceFd<'a>
fn register(self: &mut Self, registry: &Registry, token: Token, interests: Interest) -> Result<()>fn reregister(self: &mut Self, registry: &Registry, token: Token, interests: Interest) -> Result<()>fn deregister(self: &mut Self, registry: &Registry) -> Result<()>
impl<'a> Sync for SourceFd<'a>
impl<'a> Unpin for SourceFd<'a>
impl<'a> UnsafeUnpin for SourceFd<'a>
impl<'a> UnwindSafe for SourceFd<'a>
impl<T> Any for SourceFd<'a>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for SourceFd<'a>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for SourceFd<'a>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for SourceFd<'a>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into for SourceFd<'a>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for SourceFd<'a>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for SourceFd<'a>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>