pub struct Channel<T> { /* private fields */ }
Expand description
The receiving end of the channel
This is the event source to be inserted into your EventLoop
.
Implementations§
source§impl<T> Channel<T>
impl<T> Channel<T>
sourcepub fn recv(&self) -> Result<T, RecvError>
pub fn recv(&self) -> Result<T, RecvError>
Proxy for mpsc::Receiver::recv
to manually poll events.
Note: Normally you would want to use the Channel
by inserting
it into an event loop instead. Use this for example to immediately
dispatch pending events after creation.
sourcepub fn try_recv(&self) -> Result<T, TryRecvError>
pub fn try_recv(&self) -> Result<T, TryRecvError>
Proxy for mpsc::Receiver::try_recv
to manually poll events.
Note: Normally you would want to use the Channel
by inserting
it into an event loop instead. Use this for example to immediately
dispatch pending events after creation.
Trait Implementations§
source§impl<T> EventSource for Channel<T>
impl<T> EventSource for Channel<T>
§type Error = ChannelError
type Error = ChannelError
The error type returned from
process_events()
(not the user callback!).source§fn process_events<C>(
&mut self,
readiness: Readiness,
token: Token,
callback: C
) -> Result<PostAction, Self::Error>
fn process_events<C>( &mut self, readiness: Readiness, token: Token, callback: C ) -> Result<PostAction, Self::Error>
Process any relevant events Read more
source§fn register(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory
) -> Result<()>
fn register( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory ) -> Result<()>
Register yourself to this poll instance Read more
source§fn reregister(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory
) -> Result<()>
fn reregister( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory ) -> Result<()>
Re-register your file descriptors Read more
source§fn unregister(&mut self, poll: &mut Poll) -> Result<()>
fn unregister(&mut self, poll: &mut Poll) -> Result<()>
Unregister your file descriptors Read more
impl<T: Send> Send for Channel<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Channel<T>
impl<T> !Sync for Channel<T>
impl<T> Unpin for Channel<T>
impl<T> !UnwindSafe for Channel<T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more