field_count_derive

Crates.iofield_count_derive
lib.rsfield_count_derive
version0.1.1
sourcesrc
created_at2020-09-22 19:01:37.363728
updated_at2020-09-23 10:06:05.5183
descriptionDerive the field count for a struct
homepage
repositoryhttps://github.com/discosultan/field-count
max_upload_size
id291741
size3,095
Jaanus Varus (discosultan)

documentation

README

field_count

Derive the field count for a struct.

📦 Getting Started

# 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
}

🙏 Credits

This crate was inspired by the following StackOverflow answer by Lukas Kalbertodt.

Commit count: 8

cargo fmt