pub trait QueueStreamedFn<T>where
T: Deserialize + Sized,{
// Required methods
fn fetch(&self, buffer: &mut T, time: TickType) -> Result<()>;
fn fetch_from_isr(&self, buffer: &mut T) -> Result<()>;
fn post(&self, item: &T, time: TickType) -> Result<()>;
fn post_from_isr(&self, item: &T) -> Result<()>;
fn delete(&mut self);
}Expand description
Type-safe queue for structured message passing.
This trait provides a queue that works with specific types, offering compile-time type safety for queue operations.
§Type Parameters
T- The message type (must implementToBytes)
§Examples
ⓘ
use osal_rs::os::{QueueStreamed, QueueStreamedFn, ToBytes};
struct Message {
id: u32,
value: i16,
}
let queue = QueueStreamed::<Message>::new(10, size_of::<Message>()).unwrap();
let msg = Message { id: 1, value: 42 };
queue.post(&msg, 100).unwrap();
let mut received = Message { id: 0, value: 0 };
queue.fetch(&mut received, 100).unwrap();Required Methods§
Sourcefn fetch_from_isr(&self, buffer: &mut T) -> Result<()>
fn fetch_from_isr(&self, buffer: &mut T) -> Result<()>
Sourcefn post_from_isr(&self, item: &T) -> Result<()>
fn post_from_isr(&self, item: &T) -> Result<()>
Implementors§
impl<T> QueueStreamed<T> for QueueStreamed<T>where
T: StructSerde,
Available on non-crate feature
serde only.