Crate mcmp [−] [src]
Multi producer, multi consumer
The goal of this crate is to offer a simple, not too unefficent and thread-safe implementation of a multi producer and multi consumer buffer.
How to use it
There is only one thing to be aware of : it's that a consumer must be present before the buffer is full, if not the insert method will fail and return an error.
Example of usage
use mcmp::{Buffer, Producer, Consumer}; //Create a bufer os size 25. let buffer = Buffer::new(25); let producer = buffer.get_producer(); let consumer = buffer.get_consumer(); let _ = producer.insert(5); let res = consumer.export().unwrap(); assert_eq!(res, 5);
To see more example, go to the test section in the code (at the end of lib.rs)
TODO
- Add the option to change the buffer size after it has been created
- Add non-blocking call to the buffer
- Document all the function , the return and way to use it
- The readme
- ...
Contributing
Any contribution is welcome, just make a push request on the git repo ascosciated with this crate.
Structs
Buffer | |
Consumer | |
Producer |
Enums
ErrorAcess |