#extension #store #dynamically #data #type

extendable

A library for creating extendable types in Rust

1 unstable release

0.1.0 Apr 21, 2024

#11 in #dynamically

Download history 134/week @ 2024-04-20 8/week @ 2024-04-27

142 downloads per month

MIT license

6KB
87 lines

extendable

A crate providing an Extensions type similar to http::Extensions.

Why not the extensions crate?

extensions requires that self for the methods on Extensions be 'static, which might not be desirable for your use case.

License

This project is licensed under the MIT license.


lib.rs:

A type that can be used to dynamically store data by type.

Examples

use extendable::Extensions;

let mut extensions = Extensions::default();
extensions.insert(false);

let bool_ext = extensions.get::<bool>();
assert_eq!(bool_ext, Some(&false));

No runtime deps