mixin

Crates.iomixin
lib.rsmixin
version0.2.0
sourcesrc
created_at2020-04-29 06:53:59.669082
updated_at2020-04-30 13:09:11.004387
descriptionmixin macros
homepagehttps://github.com/DenisKolodin/mixin
repositoryhttps://github.com/DenisKolodin/mixin
max_upload_size
id235241
size9,393
Denis Kolodin (therustmonk)

documentation

https://docs.rs/mixin/

README

mixin macros

This crate contains mixin macros that combines fields and implementations of different structs.

Example:

#[mixin::declare]
pub struct Named {
    name: String,
}

#[mixin::expand]
impl Named {
    pub fn name(&self) -> &str {
        &self.name
    }
}

#[mixin::insert(Named)]
pub struct MyStruct {}

#[test]
fn test_it() {
    let my_struct = MyStruct { name: "MixIn Works" };
    assert_eq!(my_struct.name(), "MixIn Works");
}
Commit count: 9

cargo fmt