#dyn #slice #traits

nightly no-std dyn-slice

&dyn [Trait] implementation, inspired by a Reddit thread

16 releases (8 stable)

3.2.0 Jan 21, 2024
3.2.0-alpha.3 Dec 24, 2023
3.2.0-alpha.2 Nov 11, 2023
3.1.1 Sep 21, 2023
1.0.0 Jul 16, 2023

#359 in Data structures

Download history 42/week @ 2023-11-05 10/week @ 2023-11-12 31/week @ 2023-11-19 49/week @ 2023-11-26 18/week @ 2023-12-03 14/week @ 2023-12-10 222/week @ 2023-12-24 207/week @ 2023-12-31 1/week @ 2024-01-07 3/week @ 2024-01-14 34/week @ 2024-01-21 50/week @ 2024-01-28 18/week @ 2024-02-04 86/week @ 2024-02-11 319/week @ 2024-02-18

474 downloads per month

MIT/Apache

96KB
2K SLoC

Rust

Dyn-Slice

An implementation of a &dyn [Trait]-like reference, inspired by a Reddit thread.

dyn-slices are slices of trait object. Indexing into one yields a trait object reference. The vtable pointer is only stored once.

cargo add dyn-slice

Latest documentation
Examples

dyn-slice on crates.io
dyn-slice on lib.rs
dyn-slice on GitHub

Warning

This was originally just a proof of concept and may has some bugs, so it may be best not to use it in production (or any important) code.

With that said, feel free to use it in code that does not have to be reliable and to open an issue if you find any bugs.

License

Dyn-Slice is dual-licensed under either the Apache License Version 2.0 or MIT license at your option.

Dependencies

~315–760KB
~18K SLoC