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>
impl<C, T> Sender<C, T>
Sourcepub fn ctrl(&self) -> Ctrl<C, T>
pub fn ctrl(&self) -> Ctrl<C, T>
Return a Ctrl, which can be used to access the internal
Controller.
Sourcepub fn send_blocking(&self, n: T) -> Result<(), Error<T>>
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.
Sourcepub async fn send_async(&self, n: T) -> Result<(), Error<T>>
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.
Sourcepub fn try_send(&self, n: T) -> Result<(), Error<T>>
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.
Sourcepub fn force_send(&self, n: T) -> Result<(), Error<T>>
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.
Sourcepub fn force_send_oc(&self, n: T, overflow: Overflow) -> Result<(), Error<T>>
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.