pub struct Generic<F, E = Error>where
F: AsFd,{
pub interest: Interest,
pub mode: Mode,
/* private fields */
}Expand description
A generic event source wrapping a FD-backed type
Fields§
§interest: InterestThe programmed interest
mode: ModeThe programmed mode
Implementations§
Source§impl<F> Generic<F>where
F: AsFd,
impl<F> Generic<F>where
F: AsFd,
Sourcepub fn new(file: F, interest: Interest, mode: Mode) -> Generic<F>
pub fn new(file: F, interest: Interest, mode: Mode) -> Generic<F>
Wrap a FD-backed type into a Generic event source that uses
std::io::Error as its error type.
Sourcepub fn new_with_error<E>(
file: F,
interest: Interest,
mode: Mode,
) -> Generic<F, E>
pub fn new_with_error<E>( file: F, interest: Interest, mode: Mode, ) -> Generic<F, E>
Wrap a FD-backed type into a Generic event source using an arbitrary error type.
Trait Implementations§
Source§impl<F, E> EventSource for Generic<F, E>
impl<F, E> EventSource for Generic<F, E>
Source§type Error = E
type Error = E
The error type returned from
process_events() (not the user callback!).Source§fn process_events<C>(
&mut self,
readiness: Readiness,
token: Token,
callback: C,
) -> Result<PostAction, <Generic<F, E> as EventSource>::Error>where
C: FnMut(<Generic<F, E> as EventSource>::Event, &mut <Generic<F, E> as EventSource>::Metadata) -> <Generic<F, E> as EventSource>::Ret,
fn process_events<C>(
&mut self,
readiness: Readiness,
token: Token,
callback: C,
) -> Result<PostAction, <Generic<F, E> as EventSource>::Error>where
C: FnMut(<Generic<F, E> as EventSource>::Event, &mut <Generic<F, E> as EventSource>::Metadata) -> <Generic<F, E> as EventSource>::Ret,
Process any relevant events Read more
Source§fn register(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory,
) -> Result<(), Error>
fn register( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory, ) -> Result<(), Error>
Register yourself to this poll instance Read more
Source§fn reregister(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory,
) -> Result<(), Error>
fn reregister( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory, ) -> Result<(), Error>
Re-register your file descriptors Read more
Source§fn unregister(&mut self, poll: &mut Poll) -> Result<(), Error>
fn unregister(&mut self, poll: &mut Poll) -> Result<(), Error>
Unregister your file descriptors Read more
Source§const NEEDS_EXTRA_LIFECYCLE_EVENTS: bool = false
const NEEDS_EXTRA_LIFECYCLE_EVENTS: bool = false
Whether this source needs to be sent the
EventSource::before_sleep
and EventSource::before_handle_events notifications. These are opt-in because
they require more expensive checks, and almost all sources will not need these notificationsSource§fn before_sleep(&mut self) -> Result<Option<(Readiness, Token)>, Error>
fn before_sleep(&mut self) -> Result<Option<(Readiness, Token)>, Error>
Notification that a single
poll is about to begin Read moreSource§fn before_handle_events(&mut self, events: EventIterator<'_>)
fn before_handle_events(&mut self, events: EventIterator<'_>)
Notification that polling is complete, and
EventSource::process_events will
be called with the given events for this source. The iterator may be empty,
which indicates that no events were generated for this source Read moreAuto Trait Implementations§
impl<F, E> Freeze for Generic<F, E>where
F: Freeze,
impl<F, E> RefUnwindSafe for Generic<F, E>where
F: RefUnwindSafe,
impl<F, E> Send for Generic<F, E>
impl<F, E> Sync for Generic<F, E>
impl<F, E> Unpin for Generic<F, E>
impl<F, E> UnwindSafe for Generic<F, E>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more