Struct Sender

Source
pub struct Sender<T, E>(/* private fields */);

Implementations§

Source§

impl<T, E> Sender<T, E>

Source

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

Send a single record to the receiver.

If the queue is currently full this call will block and wait for space to become available.

§Panic

If this function has already returned an application-defined error, then calling this method again will panic. Handle errors on first opportunity.

Source

pub fn send_batch<I>(&self, it: I) -> Result<(), Error<E>>
where I: Iterator<Item = T>,

Send a batch of records.

All records will be transferred. If the queue is full, this call will block until space becomes available.

Source

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

Non-blocking send.

Attempt to send a node.

Source

pub fn send_async(&self, n: T) -> SendFuture<'_, T, E>

Return a Future that will send a record to the receiver or wait until space becomes available in the queue.

§Cancel safety

The returned SendFuture is not cancel safe.

Source

pub fn send_batch_async<I>(&self, it: I) -> SendFuture<'_, T, E>
where I: Iterator<Item = T>,

Return a Future that will send records to the receiver or wait until space becomes available in the queue.

§Cancel safety

The returned SendFuture is not cancel safe.

Source

pub fn fail(self, e: E)

Terminate the channel with an application-defined error.

This will cause the Receiver to return an Error::App(E) error.

Trait Implementations§

Source§

impl<T, E> Drop for Sender<T, E>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T, E> !UnwindSafe for Sender<T, E>

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> 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, 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.