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
sourceimpl<E: Evented + 'static> Generic<E>
impl<E: Evented + 'static> Generic<E>
sourcepub fn new(source: E) -> Generic<E>
pub fn new(source: E) -> Generic<E>
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.
sourcepub fn from_rc(source: Rc<RefCell<E>>) -> Generic<E>
pub fn from_rc(source: Rc<RefCell<E>>) -> Generic<E>
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.
sourcepub fn set_interest(&mut self, interest: Ready)
pub fn set_interest(&mut self, interest: Ready)
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.
sourcepub fn set_pollopts(&mut self, pollopts: PollOpt)
pub fn set_pollopts(&mut self, pollopts: PollOpt)
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.
sourcepub fn clone_inner(&self) -> Rc<RefCell<E>>
pub fn clone_inner(&self) -> Rc<RefCell<E>>
Get a clone of the inner Rc
wrapping your event source
sourceimpl<Fd: AsRawFd> Generic<EventedFd<Fd>>
impl<Fd: AsRawFd> Generic<EventedFd<Fd>>
sourcepub fn from_fd_source(source: Fd) -> Generic<EventedFd<Fd>>
pub fn from_fd_source(source: Fd) -> Generic<EventedFd<Fd>>
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.
sourceimpl Generic<EventedRawFd>
impl Generic<EventedRawFd>
sourcepub fn from_raw_fd(fd: RawFd) -> Generic<EventedRawFd>
pub fn from_raw_fd(fd: RawFd) -> Generic<EventedRawFd>
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
sourceimpl<E: Evented + 'static> EventSource for Generic<E>
impl<E: Evented + 'static> EventSource for Generic<E>
sourcefn interest(&self) -> Ready
fn interest(&self) -> Ready
mio
when registering your sourcesourcefn pollopts(&self) -> PollOpt
fn pollopts(&self) -> PollOpt
mio
when registering your sourcesourcefn make_dispatcher<Data: 'static, F: FnMut(Event<E>, &mut Data) + 'static>(
&self,
callback: F
) -> Rc<RefCell<dyn EventDispatcher<Data>>>
fn make_dispatcher<Data: 'static, F: FnMut(Event<E>, &mut Data) + 'static>(
&self,
callback: F
) -> Rc<RefCell<dyn EventDispatcher<Data>>>
mio
readiness
into an event Read more