2 releases

0.1.1 Sep 23, 2020
0.1.0 Sep 22, 2020

#80 in #i32

Download history 10061/week @ 2024-11-18 5550/week @ 2024-11-25 7931/week @ 2024-12-02 6809/week @ 2024-12-09 5902/week @ 2024-12-16 1734/week @ 2024-12-23 2199/week @ 2024-12-30 6415/week @ 2025-01-06 9114/week @ 2025-01-13 6049/week @ 2025-01-20 5421/week @ 2025-01-27 7217/week @ 2025-02-03 9529/week @ 2025-02-10 7443/week @ 2025-02-17 7956/week @ 2025-02-24 8049/week @ 2025-03-03

33,337 downloads per month
Used in neptune-cash

Custom license

3KB

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.

Dependencies

~1.5MB
~38K SLoC