dynp

Crates.iodynp
lib.rsdynp
version0.1.12
sourcesrc
created_at2023-09-24 21:10:32.501128
updated_at2023-10-08 23:01:19.450863
descriptionDynamic property system that emphasizes the use of the Newtype pattern.
homepage
repositoryhttps://github.com/chillin-capybara/dynp
max_upload_size
id982179
size22,596
(chillin-capybara)

documentation

README

dynp

codecov

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
Commit count: 19

cargo fmt