[][src]Struct gaea::Queue

pub struct Queue { /* fields omitted */ }

User space readiness queue.

A simple, single threaded user space readiness event queue. This implements event::Source which can be used to poll for readiness events.

Polling this event source never returns an error.

Examples

use gaea::{Event, Queue, Ready, event, poll};

let mut queue = Queue::new();
let mut events = Vec::new();

// Add a new event.
let event = Event::new(event::Id(0), Ready::READABLE);
queue.add(event);

// Now we poll for events. Note that this is safe to unwrap as polling
// `Queue` never returns an error.
poll::<_, ()>(&mut [&mut queue], &mut events, None).unwrap();

assert_eq!(events.get(0), Some(&event));

Methods

impl Queue[src]

pub fn new() -> Queue[src]

Create a new user space readiness event queue.

pub fn add(&mut self, event: Event)[src]

Add a new readiness event.

Trait Implementations

impl<ES, E> Source<ES, E> for Queue where
    ES: Sink
[src]

fn blocking_poll(
    &mut self,
    event_sink: &mut ES,
    timeout: Option<Duration>
) -> Result<(), E>
[src]

A blocking poll for readiness events. Read more

impl Default for Queue[src]

impl Debug for Queue[src]

Auto Trait Implementations

impl Send for Queue

impl Sync for Queue

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]