3 releases (breaking)

0.2.0 Apr 30, 2020
0.1.0 Apr 30, 2020
0.0.0 Apr 29, 2020

#102 in #struct-fields

Download history 10/week @ 2024-02-19 25/week @ 2024-02-26 8/week @ 2024-03-04 5/week @ 2024-03-11 2/week @ 2024-03-18 2/week @ 2024-03-25 60/week @ 2024-04-01 6/week @ 2024-04-08 14/week @ 2024-04-15 23/week @ 2024-04-22

103 downloads per month
Used in ibkr_client_portal

MIT/Apache

8KB
129 lines

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");
}

Dependencies

~0.4–1MB
~21K SLoC