| Crates.io | rbuckets |
| lib.rs | rbuckets |
| version | 0.1.0 |
| created_at | 2025-06-13 20:38:38.729989+00 |
| updated_at | 2025-06-13 20:38:38.729989+00 |
| description | A Rust library for managing buckets of items with various operations. |
| homepage | |
| repository | https://github.com/gntem/rbuckets |
| max_upload_size | |
| id | 1711867 |
| size | 14,213 |
A generic Rust bucket structure with history and item limits.
use rbuckets::RBucket;
fn main() {
// Create a new bucket for fruit, with default limits
let mut fruit_bucket = RBucket::new("fruit".to_string(), None, None);
// Add apples and bananas
fruit_bucket.add_item("apple");
fruit_bucket.add_item("banana");
// Add multiple items at once
fruit_bucket.add_items(vec!["apple", "banana"]);
// Iterate over items
for fruit in fruit_bucket.iter() {
println!("Fruit: {}", fruit);
}
// Poll (remove) the first item
if let Some(fruit) = fruit_bucket.poll() {
println!("Polled: {}", fruit);
}
// Undo the last poll
fruit_bucket.undo();
}
MIT