Crates.io | crabstructor |
lib.rs | crabstructor |
version | 0.2.1-beta |
source | src |
created_at | 2024-08-25 18:47:22.642972 |
updated_at | 2024-09-04 19:45:17.159078 |
description | Simple constructor generator for named structures |
homepage | |
repository | |
max_upload_size | |
id | 1351362 |
size | 24,990 |
#[derive(Constructor, PartialEq, Debug)]
struct Example {
#[init(10)]
field: i32,
}
assert_eq!(Example::new(), Example {field: 10});
#[derive(Constructor, PartialEq, Debug)]
struct Example {
#[new("string")]
field: Arc<String>,
}
assert_eq!(Example::new(), Example {field: Arc::new("string".into())});
#[derive(Constructor, PartialEq, Debug)]
struct Example {
#[new(arc_string: String)]
field: Arc<String>,
}
assert_eq!(Example::new("string".to_string()), Example {field: Arc::new("string".into())});
This is dev version of lib