| Crates.io | field_count_derive |
| lib.rs | field_count_derive |
| version | 0.1.1 |
| created_at | 2020-09-22 19:01:37.363728+00 |
| updated_at | 2020-09-23 10:06:05.5183+00 |
| description | Derive the field count for a struct |
| homepage | |
| repository | https://github.com/discosultan/field-count |
| max_upload_size | |
| id | 291741 |
| size | 3,095 |
Derive the field count for a struct.
# Cargo.toml
[dependencies]
field_count = "0.1"
// main.rs
use field_count::FieldCount;
#[derive(FieldCount)]
struct MyStruct {
first_field: i32,
second_field: String,
third_field: u16,
}
fn main() {
println!("{}", MyStruct::field_count()); // 3
}
This crate was inspired by the following StackOverflow answer by Lukas Kalbertodt.