Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ramirezmike/oioo
A data structure built in Rust intended as an alternative to FIFO or LIFO: One-in, One-out.
https://github.com/ramirezmike/oioo
Last synced: 26 days ago
JSON representation
A data structure built in Rust intended as an alternative to FIFO or LIFO: One-in, One-out.
- Host: GitHub
- URL: https://github.com/ramirezmike/oioo
- Owner: ramirezmike
- Created: 2020-06-19T14:15:25.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-18T01:53:53.000Z (about 3 years ago)
- Last Synced: 2024-10-28T17:29:32.153Z (2 months ago)
- Language: Rust
- Size: 3.05 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OIOO
A data structure built in Rust intended as an alternative to FIFO or LIFO: One-in, One-out.
## Features
* stores items pushed into the data structure which can later be retrieved randomly
* each item is padded with a number of empty slots based on recommended social-distance guidelines
* max capacity of the OIOO is determined upon creation
* excess items added to the OIOO are contained in a queue which is automatically used to fill the main store when space becomes available.
* support for multiple Phases which alter the capabilities of the OIOO```rust
// create a Phase Two (50%) capacity OIOO
let mut oioo = oioo::OIOO::::new(oioo::Phase::Two { occupancy: 10 });
oioo.one_in(10);
oioo.one_in(20);
oioo.one_in(30);
oioo.one_in(40);
oioo.one_in(50);
oioo.one_in(60); // exceeds occupancy, contained in queue
// random from 10, 20, 30, 40 or 50. The value "60" is automatically pushed into the empty space.
println!("{}", oioo.one_out().unwrap() as usize);// random from 10, 20, 30, 40, 50 or 60, excluding value printed above
println!("{}", oioo.one_out().unwrap() as usize);
```![Example](example.jpg?raw=true "Example")