Struct calloop::generic::Generic

source ·
pub struct Generic<E: Evented + 'static> { /* private fields */ }
Expand description

A generic event source wrapping an Evented type

It will simply forward the readiness and an acces to the wrapped Evented type to the suer callback. See the Event type in this module.

Implementations

Wrap an Evented type into a Generic event source

It is initialized with no interest nor poll options, as such you should set them using the set_interest and set_pollopts methods before inserting it in the event loop.

Wrap an Evented type from an Rc into a Generic event source

Same as the new method, but you can provide a source that is alreay in a reference counted pointer, so that Generic won’t add a new layer. This is useful if you need to share this source accross multiple modules, and calloop is not the first one to be initialized.

Change the interest for this evented source

If the source was already inserted in an event loop, it needs to be re-registered for the change to take effect.

Change the poll options for this evented source

If the source was already inserted in an event loop, it needs to be re-registered for the change to take effect.

Get a clone of the inner Rc wrapping your event source

Unwrap the Generic source to retrieve the underlying Evented.

If you didn’t clone the Rc<RefCell<E>> from the Event<E> you received, the returned Rc should be unique.

Wrap a file descriptor based source into a Generic event source.

This will only work with poll-compatible file descriptors, which typically not include basic files.

Wrap a raw file descriptor into a Generic event source.

This will only work with poll-compatible file descriptors, which typically not include basic files.

This does not take ownership of the file descriptor, hence you are responsible of its correct lifetime.

Trait Implementations

The type of events generated by your sources
The interest value that will be given to mio when registering your source
The pollopt value that will be given to mio when registering your source
Wrap an user callback into a dispatcher, that will convert an mio readiness into an event Read more
Register self with the given Poll instance. Read more
Re-register self with the given Poll instance. Read more
Deregister self from the given Poll instance Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.