[][src]Struct winit_main::EventReceiver

pub struct EventReceiver(_);

Handle for receiving events from the main event loop.

Unlike a raw std::sync::mpsc::Receiver, this never returns error on disconnection, because disconnection can only occur for a brief moment between the main event loop beginning to shut down, and the process as a whole exiting. Therefore, when this receives a disconnection error from the underlying receiver, it enters an infinite sleep cycle as it waits for the OS to kill the process.

Implementations

impl EventReceiver[src]

pub fn recv(&self) -> Event<'static, Blocker>[src]

Receive an event, blocking until one is available.

pub fn recv_timeout(&self, timeout: Duration) -> Option<Event<'static, Blocker>>[src]

Attempt to receive an event, blocking until one is available, or the timeout duration has passed.

pub fn try_recv(&self) -> Option<Event<'static, Blocker>>[src]

Try to receive an event immediately, never blocking.

pub fn iter<'a>(&'a self) -> impl Iterator<Item = Event<'static, Blocker>> + 'a[src]

Iterator form of self.recv(). Blocking iterator that never ends.

pub fn try_iter<'a>(
    &'a self
) -> impl Iterator<Item = Event<'static, Blocker>> + 'a
[src]

Iterator form of self.try_recv(). Non-blocking iterator that drains the events currently in the queue.

Auto Trait Implementations

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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.