Crates.io | composite_types |
lib.rs | composite_types |
version | 0.1.1 |
source | src |
created_at | 2023-11-05 01:44:03.642454 |
updated_at | 2023-11-05 01:46:41.053564 |
description | Compose type definitions in the style of typescript. |
homepage | |
repository | https://github.com/zb3qk/type_combinations |
max_upload_size | |
id | 1025706 |
size | 49,201 |
Introducing type definitions in the style of Typescript to Rust!
use proc_macro_def::{compose_type};
struct FieldType {}
mod module {
compose_type! {
struct Example {
field: Option<FieldType>
}
struct MyStruct = Required(Example);
struct MyStruct2 = Optional(MyStruct);
pub struct MyStruct3 = Required(MyStruct);
}
const EXAMPLE: MyStruct = MyStruct2 {
field: None
};
}
struct Example2 {
field: Option<MyStruct3>
}
compose_type!
macrocompose_type!
as you normally wouldcompose_type!
, but cannot compose with themcompose_type!
to be used to compose new typescompose_type!
and use them in your project