Struct calloop::generic::Generic

source ·
pub struct Generic<F: AsRawFd, E = Error> {
    pub file: F,
    pub interest: Interest,
    pub mode: Mode,
    /* private fields */
}
Expand description

A generic event source wrapping a FD-backed type

Fields§

§file: F

The wrapped FD-backed type

§interest: Interest

The programmed interest

§mode: Mode

The programmed mode

Implementations§

source§

impl<F: AsRawFd> Generic<F, Error>

source

pub fn new(file: F, interest: Interest, mode: Mode) -> Generic<F, Error>

Wrap a FD-backed type into a Generic event source that uses std::io::Error as its error type.

source

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.

source§

impl<F: AsRawFd, E> Generic<F, E>

source

pub fn unwrap(self) -> F

Unwrap the Generic source to retrieve the underlying type

Trait Implementations§

source§

impl<F: Debug + AsRawFd, E: Debug> Debug for Generic<F, E>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<F, E> EventSource for Generic<F, E>
where F: AsRawFd, E: Into<Box<dyn Error + Send + Sync>>,

§

type Event = Readiness

The type of events generated by your source.
§

type Metadata = F

Some metadata of your event source Read more
§

type Ret = Result<PostAction, E>

The return type of the user callback Read more
§

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, Self::Error>
where C: FnMut(Self::Event, &mut Self::Metadata) -> Self::Ret,

Process any relevant events Read more
source§

fn register( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory ) -> Result<()>

Register yourself to this poll instance Read more
source§

fn reregister( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory ) -> Result<()>

Re-register your file descriptors Read more
source§

fn unregister(&mut self, poll: &mut Poll) -> Result<()>

Unregister your file descriptors Read more
source§

fn pre_run<F>(&mut self, _callback: F) -> Result<()>
where F: FnMut(Self::Event, &mut Self::Metadata) -> Self::Ret,

Notification that a polling session is going to start Read more
source§

fn post_run<F>(&mut self, _callback: F) -> Result<()>
where F: FnMut(Self::Event, &mut Self::Metadata) -> Self::Ret,

Notification that the current polling session ended Read more

Auto Trait Implementations§

§

impl<F, E> RefUnwindSafe for Generic<F, E>

§

impl<F, E> Send for Generic<F, E>
where E: Send, F: Send,

§

impl<F, E> Sync for Generic<F, E>
where E: Sync, F: Sync,

§

impl<F, E> Unpin for Generic<F, E>
where E: Unpin, F: Unpin,

§

impl<F, E> UnwindSafe for Generic<F, E>
where E: UnwindSafe, F: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.