Struct calloop::generic::Generic [−][src]
pub struct Generic<E: Evented + 'static> { /* fields omitted */ }
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.
Methods
impl<E: Evented + 'static> Generic<E>
[src]
impl<E: Evented + 'static> Generic<E>
pub fn new(source: E) -> Generic<E>
[src]
pub fn new(source: E) -> Generic<E>
Wrap a 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.
pub fn set_interest(&mut self, interest: Ready)
[src]
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.
pub fn set_pollopts(&mut self, pollopts: PollOpt)
[src]
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.
pub fn unwrap(self) -> Rc<RefCell<E>>
[src]
pub fn unwrap(self) -> Rc<RefCell<E>>
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.
impl<Fd: AsRawFd> Generic<EventedFd<Fd>>
[src]
impl<Fd: AsRawFd> Generic<EventedFd<Fd>>
pub fn from_fd_source(source: Fd) -> Generic<EventedFd<Fd>>
[src]
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.
Trait Implementations
impl<E: Evented + 'static> Evented for Generic<E>
[src]
impl<E: Evented + 'static> Evented for Generic<E>
fn register(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt
) -> Result<()>
[src]
fn register(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt
) -> Result<()>
Register self
with the given Poll
instance. Read more
fn reregister(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt
) -> Result<()>
[src]
fn reregister(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt
) -> Result<()>
Re-register self
with the given Poll
instance. Read more
fn deregister(&self, poll: &Poll) -> Result<()>
[src]
fn deregister(&self, poll: &Poll) -> Result<()>
Deregister self
from the given Poll
instance Read more
impl<E: Evented + 'static> EventSource for Generic<E>
[src]
impl<E: Evented + 'static> EventSource for Generic<E>
type Event = Event<E>
The type of events generated by your sources
fn interest(&self) -> Ready
[src]
fn interest(&self) -> Ready
The interest value that will be given to mio
when registering your source
fn pollopts(&self) -> PollOpt
[src]
fn pollopts(&self) -> PollOpt
The pollopt value that will be given to mio
when registering your source
fn make_dispatcher<Data: 'static, F: FnMut(Event<E>, &mut Data) + 'static>(
&self,
callback: F
) -> Rc<RefCell<EventDispatcher<Data>>>
[src]
fn make_dispatcher<Data: 'static, F: FnMut(Event<E>, &mut Data) + 'static>(
&self,
callback: F
) -> Rc<RefCell<EventDispatcher<Data>>>
Wrap an user callback into a dispatcher, that will convert an mio
readiness into an event Read more