3 releases
0.1.12 | Oct 8, 2023 |
---|---|
0.1.11 | Sep 28, 2023 |
0.1.10 | Sep 24, 2023 |
#7 in #property
18KB
271 lines
dynp
A dynamic, type-safe property system that emphasizes the use of the Newtype pattern.
💡 Inspiration
This library was ispired by the iZotope/glassproperties
C++ library; big credits to the amazing authors of that library.
📦 Features
- Property collection
- Property assignment
- Property retrieval
- Property subscriptions (with callbacks / closures)
👨💻 Usage
The following snipped should give you a basic idea what this library is about.
use dynp::PropertyCollection;
// define a custom property using the Newtype pattern
#[derive(Copy, Clone, Debug)]
struct CustomProperty(i32);
fn main() {
// create a new property collection
let mut collection = PropertyCollection::new();
// assign a new property
collection.assign(CustomProperty(42));
// get the property
match collection.get::<CustomProperty>() {
Some(prop) => {
println!("Property: {:?}", prop);
},
None => {
println!("Property does not exist");
}
};
}
🚧 Roadmap
- Property deserialization
- Performance tests and improvements
- Improved documentation