Sender

Struct Sender 

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

Sending side of the channel.

Implementations§

Source§

impl<T> Sender<T>

Source

pub fn try_send(&self, value: T) -> Result<(), SendError<T>>

Attempts to send the value into the channel.

Source

pub fn send(&self, value: T) -> SendValue<'_, T>

Returns a future that sends a value into the channel, waiting if the channel is full.

If the returned Future returns an error it means the Receiver and Manager are disconnected and no more values will be read from the channel. This is the same error as SendError::Disconnected. SendError::Full will never be returned, the Future will return Poll::Pending instead.

Source

pub fn join(&self) -> Join<'_, T>

Returns a Future that waits until the other side of the channel is disconnected.

Source

pub fn capacity(&self) -> usize

Returns the capacity of the channel.

Source

pub fn is_connected(&self) -> bool

Returns true if the Receiver and or the Manager are connected.

§Notes

Unlike Receiver::is_connected this method takes the Manager into account. This is done to support the use case in which an actor is restarted and a new receiver is created for it.

Source

pub fn has_manager(&self) -> bool

Returns true if the Manager is connected.

Source

pub fn same_channel(&self, other: &Sender<T>) -> bool

Returns true if senders send into the same channel.

Source

pub fn sends_to(&self, receiver: &Receiver<T>) -> bool

Returns true if this sender sends to the receiver.

Source

pub fn id(&self) -> Id

Returns the id of this sender.

Trait Implementations§

Source§

impl<T> Clone for Sender<T>

§Safety

Only 2 ^ 30 (a billion) Senders may be alive concurrently, more then enough for all practical use cases.

Source§

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

Returns a duplicate of the value. Read more
1.0.0 · 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> Drop for Sender<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

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

Source§

impl<T> Sync for Sender<T>

Source§

impl<T> Unpin for Sender<T>

Auto Trait Implementations§

§

impl<T> Freeze for Sender<T>

§

impl<T> !RefUnwindSafe 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.