Trait rubble::link::queue::PacketQueue[][src]

pub trait PacketQueue {
    type Producer: Producer;
    type Consumer: Consumer;
    fn split(self) -> (Self::Producer, Self::Consumer);
}
Expand description

A splittable SPSC queue for data channel PDUs.

Implementations of this trait must fit at least one data channel packet with a total size of MIN_DATA_PDU_BUF bytes (header and payload).

Associated Types

Producing (writing) half of the queue.

Consuming (reading) half of the queue.

Required methods

Splits the queue into its producing and consuming ends.

Note that this takes self by value, while many queue implementations provide a split method that takes &'a mut self and returns producer and consumer types with lifetimes in them. These implementations still work with this interface, however: PacketQueue needs to be implemented generically over a lifetime 'a, for a self type &'a mut OtherQueue, then the associated Producer and Consumer types can make use of the lifetime 'a.

For an example of that, see the provided impl for &'a mut SimpleQueue in this file.

Implementors