Type Alias DeviceEventSender

Source
pub type DeviceEventSender = UnboundedSender<DeviceEvent>;

Aliased Type§

struct DeviceEventSender(/* private fields */);

Implementations

§

impl<T> UnboundedSender<T>

pub fn poll_ready(&self, _: &mut Context<'_>) -> Poll<Result<(), SendError>>

Check if the channel is ready to receive a message.

pub fn is_closed(&self) -> bool

Returns whether this channel is closed without needing a context.

pub fn close_channel(&self)

Closes this channel from the sender side, preventing any new messages.

pub fn disconnect(&mut self)

Disconnects this sender from the channel, closing it if there are no more senders left.

pub fn start_send(&mut self, msg: T) -> Result<(), SendError>

Send a message on the channel.

This method should only be called after poll_ready has been used to verify that the channel is ready to receive a message.

pub fn unbounded_send(&self, msg: T) -> Result<(), TrySendError<T>>

Sends a message along this channel.

This is an unbounded sender, so this function differs from Sink::send by ensuring the return type reflects that the channel is always ready to receive messages.

pub fn same_receiver(&self, other: &UnboundedSender<T>) -> bool

Returns whether the senders send to the same receiver.

pub fn is_connected_to(&self, receiver: &UnboundedReceiver<T>) -> bool

Returns whether the sender send to this receiver.

pub fn hash_receiver<H>(&self, hasher: &mut H)
where H: Hasher,

Hashes the receiver into the provided hasher

pub fn len(&self) -> usize

Return the number of messages in the queue or 0 if channel is disconnected.

pub fn is_empty(&self) -> bool

Return false is channel has no queued messages, true otherwise.

Trait Implementations

§

impl<T> Clone for UnboundedSender<T>

§

fn clone(&self) -> UnboundedSender<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T> Debug for UnboundedSender<T>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> Sink<T> for UnboundedSender<T>

§

type Error = SendError

The type of value produced by the sink when an error occurs.
§

fn poll_ready( self: Pin<&mut UnboundedSender<T>>, cx: &mut Context<'_>, ) -> Poll<Result<(), <UnboundedSender<T> as Sink<T>>::Error>>

Attempts to prepare the Sink to receive a value. Read more
§

fn start_send( self: Pin<&mut UnboundedSender<T>>, msg: T, ) -> Result<(), <UnboundedSender<T> as Sink<T>>::Error>

Begin the process of sending a value to the sink. Each call to this function must be preceded by a successful call to poll_ready which returned Poll::Ready(Ok(())). Read more
§

fn poll_flush( self: Pin<&mut UnboundedSender<T>>, _: &mut Context<'_>, ) -> Poll<Result<(), <UnboundedSender<T> as Sink<T>>::Error>>

Flush any remaining output from this sink. Read more
§

fn poll_close( self: Pin<&mut UnboundedSender<T>>, _: &mut Context<'_>, ) -> Poll<Result<(), <UnboundedSender<T> as Sink<T>>::Error>>

Flush any remaining output and close this sink, if necessary. Read more