Crates.io | dynstack |
lib.rs | dynstack |
version | 0.4.0 |
source | src |
created_at | 2018-11-06 08:50:52.351406 |
updated_at | 2020-03-24 03:57:36.295445 |
description | A stack for trait objects that minimizes allocations |
homepage | |
repository | https://github.com/archshift/dynstack |
max_upload_size | |
id | 94988 |
size | 32,594 |
COMPATIBILITY NOTE: dynstack
relies on an underspecified fat pointer representation. Though
it isn't expected to change in the foreseeable future, this crate expects Rust 1.34's representation.
dynstack
can mostly replace anywhere you'd use a stack, or a vector that doesn't
require removal from its center.
let mut stack = DynStack::<dyn Debug>::new();
dyn_push!(stack, "hello, world!");
dyn_push!(stack, 0usize);
dyn_push!(stack, [1, 2, 3, 4, 5, 6]);
for item in stack.iter() {
println!("{:?}", item);
}
// prints:
// "hello, world!"
// 0
// [1, 2, 3, 4, 5, 6]