Crates.io | derive-build |
lib.rs | derive-build |
version | 0.1.1 |
source | src |
created_at | 2023-04-11 15:43:17.09987 |
updated_at | 2023-04-11 17:25:21.904594 |
description | An opinionated builder macro in Rust |
homepage | |
repository | https://github.com/andrewgazelka/derive-build |
max_upload_size | |
id | 836136 |
size | 18,951 |
An opinionated builder macro in Rust
#[derive(Default, Build, Eq, PartialEq, Debug)]
struct Request {
#[required]
url: String,
path: Option<String>,
messages: Vec<String>,
}
fn main() {
let request = Request::new("example.com")
.path("tester")
.message("hello")
.message("goodbye");
let expected = Request {
url: "example.com".to_string(),
path: Some("tester".to_string()),
messages: vec!["hello".to_string(), "goodbye".to_string()],
};
assert_eq!(request, expected);
}
Option<T>
fieldsVec<T>
fieldsCow<'a, T>
fields&'a T
) fieldsInto<T>
conversionsHashMap<K, V>
fieldsHashSet<T>
fieldsBTreeMap<K, V>
fieldsBTreeSet<T>
fieldsBox<T>
fieldsRc<T>
fieldsArc<T>
fields