general-structs

Crates.iogeneral-structs
lib.rsgeneral-structs
version0.2.0
sourcesrc
created_at2024-05-27 18:12:58.563966
updated_at2024-05-28 01:45:16.359771
descriptionGeneral-structures - this library allows you to create structures with common fields, and those that are different can be specified individually.
homepagehttps://github.com/MayorDi/general-structs
repositoryhttps://github.com/MayorDi/general-structs
max_upload_size
id1253647
size18,927
Dmitriy Mayorov (MayorDi)

documentation

README

General-structs

general-structures - this library allows you to create structures with common fields, and those that are different can be specified individually.

Example

general_structs! {
    #[derive(Debug, Clone, Copy)]
    struct Foo1 + Foo2<T> + Foo3 {
        bar1: f32,
        pub bar2: usize,
    }

    Foo2<T> {
        generic_bar: T
    }
}

Result:

#[derive(Debug, Clone, Copy)]
struct Foo1 {
    bar1: f32,
    pub bar2: usize,
}

#[derive(Debug, Clone, Copy)]
struct Foo2<T> {
    bar1: f32,
    pub bar2: usize,
    generic_bar: T
}
    
#[derive(Debug, Clone, Copy)]
struct Foo3 {
    bar1: f32,
    pub bar2: usize,
}
Commit count: 5

cargo fmt