TriggerQueue

Struct TriggerQueue 

Source
pub struct TriggerQueue<'a, T: Debug, const CAPACITY: usize> { /* private fields */ }

Implementations§

Source§

impl<'a, T: Debug, const CAPACITY: usize> TriggerQueue<'a, T, CAPACITY>

Source

pub fn new( mtx_handle: &'a MutexHandle<FixedSizeQueue<T, CAPACITY>>, free_handle: &'a UnnamedSemaphoreHandle, used_handle: &'a UnnamedSemaphoreHandle, ) -> Self

Source

pub fn new_with_custom_clock( mtx_handle: &'a MutexHandle<FixedSizeQueue<T, CAPACITY>>, free_handle: &'a UnnamedSemaphoreHandle, used_handle: &'a UnnamedSemaphoreHandle, clock_type: ClockType, ) -> Self

Creates a new TriggerQueue which uses the user provided clock in TriggerQueue::timed_push() and TriggerQueue::timed_pop().

Source

pub fn try_push(&self, value: T) -> bool

Tries to push a value into the queue. When the queue is full it returns false, otherwise true.

Source

pub fn timed_push(&self, value: T, timeout: Duration) -> bool

Tries to push a value into the queue until the timeout is reached. If the sample was pushed into the queue it returns true, otherwise false.

Source

pub fn blocking_push(&self, value: T)

Blocks the process until the value could be pushed into the queue.

Source

pub fn try_pop(&self) -> Option<T>

Tries to pop a value out of the queue. If the queue was empty it returns None otherwise the value packed inside the Option.

Source

pub fn timed_pop(&self, timeout: Duration) -> Option<T>

Tries to pop a value out of the queue until the timeout is reached. If a value could not be acquired it returns None.

Source

pub fn blocking_pop(&self) -> T

Blocks until a value could be acquired from the queue.

Source

pub fn clear(&self)

Empties the queue.

Source

pub fn capacity(&self) -> usize

Returns the capacity of the queue.

Source

pub fn len(&self) -> usize

Returns the amount of values stored inside the queue

Source

pub fn is_full(&self) -> bool

Returns true if the queue is full, otherwise false

Source

pub fn is_empty(&self) -> bool

Returns true if the queue is empty, otherwise false

Trait Implementations§

Source§

impl<'a, T: Debug + Debug, const CAPACITY: usize> Debug for TriggerQueue<'a, T, CAPACITY>

Source§

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

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

impl<T: Debug + ZeroCopySend, const CAPACITY: usize> ZeroCopySend for TriggerQueue<'_, T, CAPACITY>

Source§

unsafe fn type_name() -> &'static str

The unique identifier of the type. It shall be used to identify a specific type across processes and languages. Read more

Auto Trait Implementations§

§

impl<'a, T, const CAPACITY: usize> Freeze for TriggerQueue<'a, T, CAPACITY>

§

impl<'a, T, const CAPACITY: usize> !RefUnwindSafe for TriggerQueue<'a, T, CAPACITY>

§

impl<'a, T, const CAPACITY: usize> Send for TriggerQueue<'a, T, CAPACITY>
where T: Send,

§

impl<'a, T, const CAPACITY: usize> Sync for TriggerQueue<'a, T, CAPACITY>
where T: Sync + Send,

§

impl<'a, T, const CAPACITY: usize> Unpin for TriggerQueue<'a, T, CAPACITY>
where T: Unpin,

§

impl<'a, T, const CAPACITY: usize> !UnwindSafe for TriggerQueue<'a, T, CAPACITY>

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.