pub struct AsyncQueue { /* private fields */ }Expand description
Async-capable wrappers for OSAL primitives.
Async-capable wrappers for OSAL primitives.
Async-capable wrappers for OSAL primitives.
An async-capable queue wrapping an Arc<Queue>.
Both the synchronous and asynchronous APIs are available. When using the synchronous API, pending async waiters are woken automatically.
Implementations§
Source§impl AsyncQueue
impl AsyncQueue
Sourcepub fn new(size: u32, message_size: u32) -> Result<Self>
pub fn new(size: u32, message_size: u32) -> Result<Self>
Creates an AsyncQueue that owns a new OSAL queue.
size is the maximum number of items; message_size is each item’s
size in bytes.
§Errors
Returns the underlying OSAL error if the queue cannot be created.
Sourcepub fn post(&self, item: &[u8], timeout_ms: u64) -> Result<()>
pub fn post(&self, item: &[u8], timeout_ms: u64) -> Result<()>
Posts item synchronously and wakes any async task waiting to receive.
Sourcepub fn fetch(&self, buf: &mut [u8], timeout_ms: u64) -> Result<()>
pub fn fetch(&self, buf: &mut [u8], timeout_ms: u64) -> Result<()>
Fetches an item synchronously and wakes any async task waiting to send.
Sourcepub fn fetch_async<'a>(&'a self, buf: &'a mut [u8]) -> FetchFuture<'a> ⓘ
pub fn fetch_async<'a>(&'a self, buf: &'a mut [u8]) -> FetchFuture<'a> ⓘ
Returns a Future that resolves when an item has been fetched into buf.
Sourcepub fn post_async<'a>(&'a self, item: &'a [u8]) -> PostFuture<'a> ⓘ
pub fn post_async<'a>(&'a self, item: &'a [u8]) -> PostFuture<'a> ⓘ
Returns a Future that resolves when item has been posted to the queue.