| Crates.io | lifo |
| lib.rs | lifo |
| version | 0.1.1 |
| created_at | 2024-10-23 10:06:57.686455+00 |
| updated_at | 2024-10-23 11:37:44.24227+00 |
| description | Simple last-in first-out api wrapper for std `VecDeque |
| homepage | |
| repository | https://github.com/Da1sypetals/lifo |
| max_upload_size | |
| id | 1419909 |
| size | 2,721 |
Simple last-in first-out api wrapper for std VecDeque<T>.
use std::collections::VecDeque;
pub type Deque<T> = VecDeque<T>;
/// ### Defaults the behavior of `push` and `pop`.
pub trait Lifo<T> {
fn push(&mut self, value: T);
fn pop(&mut self) -> Option<T>;
}
impl<T> Lifo<T> for Deque<T> {
/// ### Push back
#[inline(always)]
fn push(&mut self, value: T) {
self.push_back(value);
}
/// ### Pop front
#[inline(always)]
fn pop(&mut self) -> Option<T> {
self.pop_front()
}
}