Enum TrySendError

pub enum TrySendError<T>

An error returned from the try_send method.

The error contains the message being sent so it can be recovered.

Variants

Full(T)

The message could not be sent because the channel is full.

If this is a zero-capacity channel, then the error indicates that there was no receiver available to receive the message at the time.

Disconnected(T)

The message could not be sent because the channel is disconnected.

Implementations

impl<T> TrySendError<T>

fn into_inner(self) -> T

Unwraps the message.

Examples

use crossbeam_channel::bounded;

let (s, r) = bounded(0);

if let Err(err) = s.try_send("foo") {
    assert_eq!(err.into_inner(), "foo");
}
fn is_full(&self) -> bool

Returns true if the send operation failed because the channel is full.

fn is_disconnected(&self) -> bool

Returns true if the send operation failed because the channel is disconnected.

Trait Implementations

impl<T> Debug for TrySendError<T>

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

impl<T> Display for TrySendError<T>

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

impl<T> From<SendError<T>> for TrySendError<T>

fn from(err: SendError<T>) -> TrySendError<T>

impl<T: Clone> Clone for TrySendError<T>

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

impl<T: Copy> Copy for TrySendError<T>

impl<T: Eq> Eq for TrySendError<T>

impl<T: PartialEq> PartialEq for TrySendError<T>

fn eq(&self, other: &TrySendError<T>) -> bool

impl<T: PartialEq> StructuralPartialEq for TrySendError<T>

impl<T: Send> Error for TrySendError<T>

Auto Trait Implementations

impl<T> Freeze for TrySendError<T> where T: Freeze + Freeze,

impl<T> RefUnwindSafe for TrySendError<T> where T: RefUnwindSafe + RefUnwindSafe,

impl<T> Send for TrySendError<T> where T: Send + Send,

impl<T> Sync for TrySendError<T> where T: Sync + Sync,

impl<T> Unpin for TrySendError<T> where T: Unpin + Unpin,

impl<T> UnsafeUnpin for TrySendError<T> where T: UnsafeUnpin + UnsafeUnpin,

impl<T> UnwindSafe for TrySendError<T> where T: UnwindSafe + UnwindSafe,

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for TrySendError<T>

fn from(t: T) -> T

Returns the argument unchanged.

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

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> ToString for TrySendError<T> where T: Display + ?Sized,

fn to_string(&self) -> String

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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