pub struct QueueHandle(/* private fields */);Expand description
Queue handle.
This handle is used to interact with queues created by the driver implementation.
Implementations§
Source§impl QueueHandle
impl QueueHandle
Sourcepub unsafe fn from_ptr(ptr: QueuePtr) -> Self
pub unsafe fn from_ptr(ptr: QueuePtr) -> Self
Recovers the object from a leaked pointer.
§Safety
- The caller must only use pointers created using
Self::leak. - The caller must ensure the pointer is not shared.
Sourcepub unsafe fn ref_from_ptr(ptr: &QueuePtr) -> &Self
pub unsafe fn ref_from_ptr(ptr: &QueuePtr) -> &Self
Creates a reference to this object from a leaked pointer.
This function is used in the esp-radio code to interact with the queue.
§Safety
- The caller must only use pointers created using
Self::leak.
Sourcepub unsafe fn send_to_front(
&self,
item: *const u8,
timeout_us: Option<u32>,
) -> bool
pub unsafe fn send_to_front( &self, item: *const u8, timeout_us: Option<u32>, ) -> bool
Enqueues a high-priority item.
If the queue is full, this function will block for the given timeout. If timeout is None, the function will block indefinitely.
This function returns true if the item was successfully enqueued, false otherwise.
§Safety
The caller must ensure that item can be dereferenced and points to an allocation of
a size equal to the queue’s item size.
Sourcepub unsafe fn send_to_back(
&self,
item: *const u8,
timeout_us: Option<u32>,
) -> bool
pub unsafe fn send_to_back( &self, item: *const u8, timeout_us: Option<u32>, ) -> bool
Enqueues an item.
If the queue is full, this function will block for the given timeout. If timeout is None, the function will block indefinitely.
This function returns true if the item was successfully enqueued, false otherwise.
§Safety
The caller must ensure that item can be dereferenced and points to an allocation of
a size equal to the queue’s item size.
Sourcepub unsafe fn try_send_to_back_from_isr(
&self,
item: *const u8,
higher_priority_task_waken: Option<&mut bool>,
) -> bool
pub unsafe fn try_send_to_back_from_isr( &self, item: *const u8, higher_priority_task_waken: Option<&mut bool>, ) -> bool
Attempts to enqueues an item.
If the queue is full, this function will immediately return false.
If a higher priority task is woken up by this operation, the higher_prio_task_waken flag
is set to true.
§Safety
The caller must ensure that item can be dereferenced and points to an allocation of
a size equal to the queue’s item size.
Sourcepub unsafe fn receive(&self, item: *mut u8, timeout_us: Option<u32>) -> bool
pub unsafe fn receive(&self, item: *mut u8, timeout_us: Option<u32>) -> bool
Dequeues an item from the queue.
If the queue is empty, this function will block for the given timeout. If timeout is None, the function will block indefinitely.
This function returns true if the item was successfully dequeued, false otherwise.
§Safety
The caller must ensure that item can be dereferenced and points to an allocation of
a size equal to the queue’s item size.
Sourcepub unsafe fn try_receive_from_isr(
&self,
item: *mut u8,
higher_priority_task_waken: Option<&mut bool>,
) -> bool
pub unsafe fn try_receive_from_isr( &self, item: *mut u8, higher_priority_task_waken: Option<&mut bool>, ) -> bool
Attempts to dequeue an item from the queue.
If the queue is empty, this function will return false immediately.
This function returns true if the item was successfully dequeued, false otherwise.
If a higher priority task is woken up by this operation, the higher_prio_task_waken flag
is set to true.
§Safety
The caller must ensure that item can be dereferenced and points to an allocation of
a size equal to the queue’s item size.
Sourcepub unsafe fn remove(&self, item: *const u8)
pub unsafe fn remove(&self, item: *const u8)
Removes an item from the queue.
§Safety
The caller must ensure that item can be dereferenced and points to an allocation of
a size equal to the queue’s item size.
Sourcepub fn messages_waiting(&self) -> usize
pub fn messages_waiting(&self) -> usize
Returns the number of messages in the queue.