pub struct TriggerQueue<'a, T: Debug, const CAPACITY: usize> { /* private fields */ }Implementations§
Source§impl<'a, T: Debug, const CAPACITY: usize> TriggerQueue<'a, T, CAPACITY>
impl<'a, T: Debug, const CAPACITY: usize> TriggerQueue<'a, T, CAPACITY>
Sourcepub fn new(
mtx_handle: &'a MutexHandle<FixedSizeQueue<T, CAPACITY>>,
free_handle: &'a UnnamedSemaphoreHandle,
used_handle: &'a UnnamedSemaphoreHandle,
) -> Self
pub fn new( mtx_handle: &'a MutexHandle<FixedSizeQueue<T, CAPACITY>>, free_handle: &'a UnnamedSemaphoreHandle, used_handle: &'a UnnamedSemaphoreHandle, ) -> Self
Creates a new TriggerQueue which uses the ClockType::default() in
TriggerQueue::timed_push() and TriggerQueue::timed_pop().
Sourcepub fn new_with_custom_clock(
mtx_handle: &'a MutexHandle<FixedSizeQueue<T, CAPACITY>>,
free_handle: &'a UnnamedSemaphoreHandle,
used_handle: &'a UnnamedSemaphoreHandle,
clock_type: ClockType,
) -> Self
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().
Sourcepub fn try_push(&self, value: T) -> bool
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.
Sourcepub fn timed_push(&self, value: T, timeout: Duration) -> bool
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.
Sourcepub fn blocking_push(&self, value: T)
pub fn blocking_push(&self, value: T)
Blocks the process until the value could be pushed into the queue.
Sourcepub fn try_pop(&self) -> Option<T>
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.
Sourcepub fn timed_pop(&self, timeout: Duration) -> Option<T>
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.
Sourcepub fn blocking_pop(&self) -> T
pub fn blocking_pop(&self) -> T
Blocks until a value could be acquired from the queue.