[][src]Struct calloop::generic::Generic

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]

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: Ready)[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 set_pollopts(&mut self, pollopts: PollOpt)[src]

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 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<EventedFd<Fd>>[src]

pub fn from_fd_source(source: Fd) -> Generic<EventedFd<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<EventedRawFd>[src]

pub fn from_raw_fd(fd: RawFd) -> Generic<EventedRawFd>[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: Evented + 'static> EventSource for Generic<E>[src]

type Event = Event<E>

The type of events generated by your sources

impl<E: Evented + 'static> Evented for Generic<E>[src]

Auto Trait Implementations

impl<E> !Send for Generic<E>

impl<E> !Sync for Generic<E>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]