| Crates.io | sub-model |
| lib.rs | sub-model |
| version | 0.2.0 |
| created_at | 2022-04-13 12:06:17.317592+00 |
| updated_at | 2022-08-11 09:56:14.285756+00 |
| description | a proc marco for easy generate sub models |
| homepage | https://github.com/Goodjooy/sub-model |
| repository | |
| max_upload_size | |
| id | 566960 |
| size | 60,124 |
The project is not completed
Genericproc_marco onto field on SubModelsusing all or none define sub model type
all default all of the field is a part of the sub modelnone default is an empty structin the all or none
#[sub_model(all("foo"),none("foo2"))]
name = "foo"there a a set of information can be define
vis the visibility of the sub model, default pubname the name of the sub modelextra_field the extra field of the sub model, can use like that
ty define the type of extra fieldfrom define how to create the value in this field, it accept a path to a function without any params#[all(
name = "foo",
extra_field(
foo(ty = "bool", from = "Default::default")
))]
the example add a new field named foo with type bool,create by Default::default to sub model foo
extra other marco that add to this new sub model, for example#[all(
name = "foo",
extra(
derive(Debug, Serialize, Deserialize)
))]
the example make the sub model foo can serialize and deserialize