Struct mpmc_ringbuf::core::MsgQueue
source · pub struct MsgQueue<T> { /* private fields */ }Expand description
main struct for controlling buffer blocks
Users should crate a new buffer block with fn add_producer, and explicitly delete the buffer
blocks with fn delete_consumer
If users want to add a producer and produce some data, make sure you call fn add_producer ahead,
otherwise there are none data block for storing the data.
Implementations§
source§impl<T> MsgQueue<T>where
T: Default + Clone,
impl<T> MsgQueue<T>where
T: Default + Clone,
@TODO MsgQueue should manage the exist blocks for querying
pub fn new() -> MsgQueue<T>
sourcepub fn set_dynamic(&mut self, block_length: u64)
pub fn set_dynamic(&mut self, block_length: u64)
only can call before using get_consumer and add_consumer
pub fn set_fixed(&mut self, block_length: u64, buf_size: u64)
pub fn add_producer(&mut self) -> MsgQueueWriter<T>
sourcepub fn get_consumer(&mut self, id: u64) -> MsgQueueReader<T>
pub fn get_consumer(&mut self, id: u64) -> MsgQueueReader<T>
get_consumer won’t panic even buffer block doesn’t exist, system will check the matched block and create it when it doesn’t exist.