Sender

Struct Sender 

Source
pub struct Sender<C, T>
where C: Controller<Item = T>,
{ /* private fields */ }
Expand description

Channel transmitter end-point.

Implementations§

Source§

impl<C, T> Sender<C, T>
where C: Controller<Item = T>, T: Send + Sync,

Source

pub fn ctrl(&self) -> Ctrl<C, T>

Return a Ctrl, which can be used to access the internal Controller.

Source

pub fn send_blocking(&self, n: T) -> Result<(), Error<T>>

Send an element over channel.

If the channel has a limit, and the limit has been reached, then block and wait until a Receiver has make more room available on the queue.

§Errors

Error::CantFit means the node was rejected by the Controller. Error::Closed means there are no more Receivers available.

Source

pub async fn send_async(&self, n: T) -> Result<(), Error<T>>

Send an element over channel.

If the channel has a limit, and the limit has been reached, then block and wait until a Receiver has make more room available on the queue.

§Errors

Error::CantFit means the Controller rejected the node. Error::Closed means no Receivers remain.

Source

pub fn try_send(&self, n: T) -> Result<(), Error<T>>

Fallible sending.

§Errors

Error::CantFit means the Controller permanently rejected the node. Error::WontFit means the Controller temporarily rejected the node. Error::Closed means not Receivers remain.

Source

pub fn force_send(&self, n: T) -> Result<(), Error<T>>

Forcibly add an element to the queue.

If the queue has a limit and the queue is full, then the oldest node will be removed before the new element is added.

§Errors

Error::CantFit means the Controller rejected the node. Error::Closed means no Receivers remain.

Source

pub fn force_send_oc(&self, n: T, overflow: Overflow) -> Result<(), Error<T>>

Forcibly add an element to rhe channel, allowing the caller to determine how overflow is handled.

§Errors

Error::CantFit means the Controller rejected the node. Error::Closed means no Receivers remain.

Trait Implementations§

Source§

impl<C, T> Clone for Sender<C, T>
where C: Controller<Item = T>,

Source§

fn clone(&self) -> Self

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<C, T> Drop for Sender<C, T>
where C: Controller<Item = T>,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<C, T> Freeze for Sender<C, T>

§

impl<C, T> !RefUnwindSafe for Sender<C, T>

§

impl<C, T> Send for Sender<C, T>
where C: Send, T: Send,

§

impl<C, T> Sync for Sender<C, T>
where C: Send, T: Send,

§

impl<C, T> Unpin for Sender<C, T>

§

impl<C, T> !UnwindSafe for Sender<C, 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.