Struct lilos::spsc::Permit

source ·
pub struct Permit<'q, T> { /* private fields */ }
Expand description

A “permit” giving its holder the right to push one element into a queue, without waiting.

This is produced by Push::try_reserve/Push::reserve when they find space available in the queue. The key property here is that producing a Permit does not, by itself, change the queue state – you can turn around and Drop the Permit without losing data or pushing anything. This makes cancel safety much easier to reason about.

Implementations§

source§

impl<T> Permit<'_, T>

source

pub fn push(self, value: T)

Pushes value to the queue, consuming this Permit.

The push operation is guaranteed to succeed synchronously, since holding a Permit is proof that the next cell at the head of the queue is available for use.

Trait Implementations§

source§

impl<'q, T: Debug> Debug for Permit<'q, T>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'q, T> RefUnwindSafe for Permit<'q, T>where T: RefUnwindSafe,

§

impl<'q, T> Send for Permit<'q, T>where T: Send,

§

impl<'q, T> Sync for Permit<'q, T>where T: Sync,

§

impl<'q, T> Unpin for Permit<'q, T>

§

impl<'q, T> !UnwindSafe for Permit<'q, T>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.