Crates.io | colonbuilder |
lib.rs | colonbuilder |
version | 0.1.6 |
source | src |
created_at | 2023-02-25 12:39:57.247588 |
updated_at | 2023-02-26 01:16:35.208189 |
description | A rust builder offers from_str method to build struct from colon separate string. |
homepage | |
repository | https://github.com/Celthi/ColonBuilder.git |
max_upload_size | |
id | 794320 |
size | 15,522 |
Build structure from colon separate fields like
name:colon builder
hobbies: book,game,football
TV: once a while
Sample code
#[derive(ColonBuilder)]
struct Person {
#[cb(require)]
name: String,
hobbies: Vec<String>,
#[cb(abbr="TV")]
favoriteTVShows: Option<String>
}
let p = Person::from_str("name:lu\nTV:show");
cargo expand --test test_builder
to expand the test file test_builder.rs