3 releases (breaking)

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

#152 in #struct-fields

Download history 1/week @ 2024-12-04 7/week @ 2024-12-11 5/week @ 2025-02-05 104/week @ 2025-02-12 5/week @ 2025-02-26

114 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–0.9MB
~19K SLoC