Struct concurrency_traits::queue::SemaphoreQueue[][src]

pub struct SemaphoreQueue<T, S, CS> { /* fields omitted */ }
Expand description

A queue based on a semaphore to block on.

Implementations

impl<T, S, CS> SemaphoreQueue<T, S, CS> where
    S: ReadoutSemaphore
[src]

pub fn len(&self) -> S::Count[src]

Gets the length of the queue.

pub fn is_empty(&self) -> bool where
    S::Count: Zero
[src]

Tells whether the queue is empty.

Trait Implementations

impl<T, S, CS> AsyncPrependQueue for SemaphoreQueue<T, S, CS> where
    T: Send,
    S: AsyncSemaphore + Send + Sync,
    CS: ThreadFunctions
[src]

fn push_front_async<'life0, 'async_trait>(
    &'life0 self,
    value: Self::Item
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Adds to the front of the queue asynchronously

impl<T, S, CS> AsyncQueue for SemaphoreQueue<T, S, CS> where
    T: Send,
    S: AsyncSemaphore + Send + Sync,
    CS: ThreadFunctions
[src]

fn push_async<'life0, 'async_trait>(
    &'life0 self,
    value: Self::Item
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Appends to the queue asynchronously.

fn pop_async<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Self::Item> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Receives from the queue asynchronously.

impl<T, S, CS> AsyncReverseQueue for SemaphoreQueue<T, S, CS> where
    T: Send,
    S: AsyncSemaphore + Send + Sync,
    CS: ThreadFunctions
[src]

fn pop_back_async<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Self::Item> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Reads the back of the queue

impl<T, S, CS> AsyncTimeoutQueue for SemaphoreQueue<T, S, CS> where
    T: Send,
    S: AsyncTimeoutSemaphore + Send + Sync,
    CS: ThreadFunctions
[src]

fn push_timeout_async<'life0, 'async_trait>(
    &'life0 self,
    value: Self::Item,
    __arg2: Duration
) -> Pin<Box<dyn Future<Output = Result<(), Self::Item>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Pushes an item to the queue asynchronously with a timeout

fn pop_timeout_async<'life0, 'async_trait>(
    &'life0 self,
    timeout: Duration
) -> Pin<Box<dyn Future<Output = Option<Self::Item>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Pops an item from the queue asynchronously with a timeout

impl<T: Debug, S: Debug, CS: Debug> Debug for SemaphoreQueue<T, S, CS>[src]

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

Formats the value using the given formatter. Read more

impl<T, S, CS> Default for SemaphoreQueue<T, S, CS> where
    S: Default
[src]

fn default() -> Self[src]

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

impl<T, S, CS> PrependQueue for SemaphoreQueue<T, S, CS> where
    S: Semaphore,
    CS: ThreadFunctions
[src]

fn push_front(&self, value: Self::Item)[src]

Adds an item to the front of the queue blocking until able

impl<T, S, CS> Queue for SemaphoreQueue<T, S, CS> where
    S: Semaphore,
    CS: ThreadFunctions
[src]

fn push(&self, value: Self::Item)[src]

Appends an item to the end of the queue blocking until appended

fn pop(&self) -> Self::Item[src]

Blocks until an item is received from the queue

impl<T, S, CS> ReverseQueue for SemaphoreQueue<T, S, CS> where
    S: Semaphore,
    CS: ThreadFunctions
[src]

fn pop_back(&self) -> Self::Item[src]

Reads from the back of the queue

impl<T, S, CS> TimeoutQueue for SemaphoreQueue<T, S, CS> where
    S: TimeoutSemaphore,
    CS: ThreadFunctions
[src]

fn push_timeout(&self, value: Self::Item, _: Duration) -> Result<(), Self::Item>[src]

Appends an item to the end of the queue blocking until appended or timeout

fn pop_timeout(&self, timeout: Duration) -> Option<Self::Item>[src]

Blocks until an item is received from the queue or timeout

impl<T, S, CS> TryPrependQueue for SemaphoreQueue<T, S, CS> where
    S: TrySemaphore,
    CS: ThreadFunctions
[src]

fn try_push_front(&self, value: Self::Item) -> Result<(), Self::Item>[src]

Adds an item to the front of the queue without blocking

impl<T, S, CS> TryQueue for SemaphoreQueue<T, S, CS> where
    S: TrySemaphore,
    CS: ThreadFunctions
[src]

type Item = T

The type the queue holds.

fn try_push(&self, value: Self::Item) -> Result<(), Self::Item>[src]

Tries to append an item to the queue returning None if unsuccessful

fn try_pop(&self) -> Option<Self::Item>[src]

Tries to receive an item from the queue returning None if none available Read more

impl<T, S, CS> TryReverseQueue for SemaphoreQueue<T, S, CS> where
    S: TrySemaphore,
    CS: ThreadFunctions
[src]

fn try_pop_back(&self) -> Option<Self::Item>[src]

Non blocking version of receive_back

impl<T, S, CS> AsyncDoubleEndedQueue for SemaphoreQueue<T, S, CS> where
    T: Send,
    S: AsyncSemaphore + Send + Sync,
    CS: ThreadFunctions
[src]

impl<T, S, CS> DoubleEndedQueue for SemaphoreQueue<T, S, CS> where
    S: Semaphore,
    CS: ThreadFunctions
[src]

impl<T, S, CS> TryDoubleEndedQueue for SemaphoreQueue<T, S, CS> where
    S: TrySemaphore,
    CS: ThreadFunctions
[src]

Auto Trait Implementations

impl<T, S, CS> !RefUnwindSafe for SemaphoreQueue<T, S, CS>

impl<T, S, CS> Send for SemaphoreQueue<T, S, CS> where
    S: Send,
    T: Send

impl<T, S, CS> Sync for SemaphoreQueue<T, S, CS> where
    S: Sync,
    T: Send

impl<T, S, CS> Unpin for SemaphoreQueue<T, S, CS> where
    S: Unpin,
    T: Unpin

impl<T, S, CS> UnwindSafe for SemaphoreQueue<T, S, CS> where
    S: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.