#container #dynamically-sized #memory-management #traits #inline #slice #object

no-std inline_dyn

A container type for storing dynamically-sized types inline

4 releases

0.2.1 Dec 12, 2023
0.2.0 Oct 6, 2022
0.1.1 Feb 13, 2021
0.1.0 Oct 13, 2020

#717 in Rust patterns

26 downloads per month
Used in r3_support_rp2040

MIT/Apache

47KB
959 lines

inline_dyn

crates.io version docs.rs Build Status

A container type for storing dynamically-sized types (e.g., trait objects, slices) inline.

Example

Creating an owned trait object without dynamic allocation:

use inline_dyn::fmt::InlineDynDisplay;

// Can store any type that implements `Display` as long as it is layout
// compatible with `usize`.
let val: InlineDynDisplay = <InlineDynDisplay>::new(42u8);
assert_eq!(val.to_string(), "42");

License

Licensed under either of Apache License (Version 2.0) or MIT license at your discretion.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~62KB