multi_stack_queue
A crate for stack-allocated fixed-length multiqueues. A multiqueue is an array of a given number of queues, each able to be accessed independently.
Usage
The generic definition is the following :
With :
T- type contained in the queuesN- length of each queueM- number of queues
Example usecases
- When writing a simple micro-kernel, the scheduler may need some sort of multiple Round-Robins. Having it allocated on the stack removes the need for a heap allocator, which can be useful when working on this kind of ressource-limited target.
Examples
use MultiStackQueue;
let mut msq: = new;
let value = TestStruct ;
msq.push.unwrap;
assert_eq!;
Roadmap
- Using arrays of
Option<T>requires thatTimplements theCopytrait, which may not be the case. A different approach is to use default values instead ofOption::Noneto initialize the arrays. This way,Tmust need not implementCopybutDefault, which may be beneficial in some usecases. Another idea would be to make use of theMaybeUnInittype. - Add options in the generic definition of
MultiStackQueueto enable the user to specify the procedure in case of apushon a full queue or apopon an empty queue. For instance, one could wish trying to push an element to a full queue would simply push it to the following queue (and same thing when trying topopan element). This would add a sort of "spill mechanism"