[−][src]Struct calloop::generic::Generic
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: MioSource + 'static> Generic<E>
[src]
pub fn new(source: E) -> Generic<E>
[src]
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.
pub fn from_rc(source: Rc<RefCell<E>>) -> Generic<E>
[src]
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.
pub fn set_interest(&mut self, interest: Interest)
[src]
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 clone_inner(&self) -> Rc<RefCell<E>>
[src]
Get a clone of the inner Rc
wrapping your event source
pub fn unwrap(self) -> Rc<RefCell<E>>
[src]
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<SourceFd<Fd>>
[src]
pub fn from_fd_source(source: Fd) -> Generic<SourceFd<Fd>>
[src]
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.
impl Generic<SourceRawFd>
[src]
pub fn from_raw_fd(fd: RawFd) -> Generic<SourceRawFd>
[src]
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
impl<E: MioSource + 'static> EventSource for Generic<E>
[src]
type Event = Event<E>
The type of events generated by your sources
fn interest(&self) -> Interest
[src]
fn as_mio_source(&mut self) -> Option<&mut dyn MioSource>
[src]
fn make_dispatcher<Data: 'static, F: FnMut(Event<E>, &mut Data) + 'static>(
&mut self,
callback: F,
_: &Arc<Waker>
) -> Rc<RefCell<dyn EventDispatcher<Data>>>
[src]
&mut self,
callback: F,
_: &Arc<Waker>
) -> Rc<RefCell<dyn EventDispatcher<Data>>>
impl<E: MioSource + 'static> Source for Generic<E>
[src]
Auto Trait Implementations
impl<E> !RefUnwindSafe for Generic<E>
impl<E> !Send for Generic<E>
impl<E> !Sync for Generic<E>
impl<E> Unpin for Generic<E>
impl<E> !UnwindSafe for Generic<E>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,