stack-any 0.1.2

A library that provides a type that owns same size type on the stack for type erasure.
Documentation
  • Coverage
  • 100%
    7 out of 7 items documented6 out of 7 items with examples
  • Size
  • Source code size: 23.27 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.43 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • GossiperLoturot/stack-any
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • GossiperLoturot

stack-any

crates.io doc.rs

A library that provides a type that owns same size type on the stack for type erasure.

Usage

let mut stacks = [
    stack_any::stack_any!(Vec<i32>, vec![]),
    stack_any::stack_any!(Vec<char>, vec![]),
];

stacks[0].downcast_mut::<Vec<i32>>().unwrap().push(5);
stacks[1].downcast_mut::<Vec<char>>().unwrap().push('x');

assert_eq!(stacks[0].downcast_ref(), Some(&vec![5]));
assert_eq!(stacks[1].downcast_ref(), Some(&vec!['x']));