Skip to main content

Mpsc

Struct Mpsc 

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

The queue (see the module documentation).

Implementations§

Source§

impl<T> Mpsc<T>

Source

pub const fn new() -> Mpsc<T>

An empty queue.

Source

pub fn push(&self, value: T)

Adds value (any thread). Sequentially consistent, so a consumer that announces it is about to sleep and then checks Mpsc::is_empty either sees the value or is seen by the producer’s following check of that announcement.

Source

pub fn is_empty(&self) -> bool

Whether the queue looks empty (a push may be landing concurrently).

Source

pub fn take(&self, into: &mut Vec<T>)

Moves every queued value into into, oldest first (the consumer thread).

Trait Implementations§

Source§

impl<T> Debug for Mpsc<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T> Default for Mpsc<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> Drop for Mpsc<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<T: Send> Send for Mpsc<T>

Source§

impl<T: Send> Sync for Mpsc<T>

Auto Trait Implementations§

§

impl<T> !Freeze for Mpsc<T>

§

impl<T> Forget for Mpsc<T>

§

impl<T> Move for Mpsc<T>

§

impl<T> RefUnwindSafe for Mpsc<T>

§

impl<T> Unpin for Mpsc<T>
where Atomic<*mut Node<T>>: Unpin, PhantomData<Box<Node<T>>>: Unpin,

§

impl<T> UnsafeUnpin for Mpsc<T>
where Atomic<*mut Node<T>>: UnsafeUnpin, PhantomData<Box<Node<T>>>: UnsafeUnpin,

§

impl<T> UnwindSafe for Mpsc<T>
where Atomic<*mut Node<T>>: UnwindSafe, PhantomData<Box<Node<T>>>: UnwindSafe,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.