Stack-allocated dynamically-sized types
This crate provides a simple way of returnings DSTs up to a certain size without requiring a heap allocation.
This crate provides two types - Value
(which is a fixed-size allocation for a single DST), and Stack
(a fixed-size buffer
for multiple DSTs arranged in a LIFO stack.
One of the most obvious uses is to allow returning capturing closures without having to box them. In the example below, the closure
takes ownership of value
, and is saved to a StackDST
```rust
use stack_dst::Value as StackDST;
fn makeclosure(value: u64) -> StackDST
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.