Skip to main content

Sender

Struct Sender 

Source
pub struct Sender<T> { /* private fields */ }
Expand description

A broadcast sender that can be used with the postage::Sink trait. Can be cloned.

The sender task is suspended when the internal buffer is filled.

Note: no implementation of the futures::Sink trait is provided for the broadcast Sender.

Implementations§

Source§

impl<T> Sender<T>

Source

pub fn subscribe(&self) -> Receiver<T>

Subscribes to the channel, creating a new receiver. The receiver will observe all messages sent after the call to subscribe.

Messages currently in the buffer are not received.

Trait Implementations§

Source§

impl<T> Clone for Sender<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Sender<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T> Sink for Sender<T>
where T: Clone,

Source§

type Item = T

Source§

fn poll_send( self: Pin<&mut Self>, cx: &mut Context<'_>, value: Self::Item, ) -> PollSend<Self::Item>

Attempts to accept the message, without blocking. Read more
Source§

fn send(&mut self, value: Self::Item) -> SendFuture<'_, Self>

Attempts to send a message into the sink. Read more
Source§

fn try_send( &mut self, value: Self::Item, ) -> Result<(), TrySendError<Self::Item>>
where Self: Unpin,

Attempts to send a message over the sink, without blocking. Read more
Source§

fn after<Before>(self, before: Before) -> ChainSink<Before, Self>
where Before: Sink<Item = Self::Item>, Self: Sized,

Chains two sink implementations. Messages will be transmitted to the argument until it rejects a message. Then messages will be transmitted to self.
Source§

fn filter<Filter>(self, filter: Filter) -> FilterSink<Filter, Self>
where Filter: FnMut(&Self::Item) -> bool, Self: Sized,

Filters messages, forwarding them to the sink if the filter returns true
Source§

impl<T: Send> Send for Sender<T>

Source§

impl<T: Send> Sync for Sender<T>

Auto Trait Implementations§

§

impl<T> Freeze for Sender<T>

§

impl<T> !RefUnwindSafe for Sender<T>

§

impl<T> Unpin for Sender<T>

§

impl<T> UnsafeUnpin for Sender<T>

§

impl<T> !UnwindSafe for Sender<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.