2 releases

0.1.1 Sep 23, 2020
0.1.0 Sep 22, 2020

#20 in #u16

Download history 8633/week @ 2024-10-02 9028/week @ 2024-10-09 9673/week @ 2024-10-16 8690/week @ 2024-10-23 8302/week @ 2024-10-30 7417/week @ 2024-11-06 10131/week @ 2024-11-13 8894/week @ 2024-11-20 5755/week @ 2024-11-27 7884/week @ 2024-12-04 6396/week @ 2024-12-11 4632/week @ 2024-12-18 1211/week @ 2024-12-25 3652/week @ 2025-01-01 7905/week @ 2025-01-08 6431/week @ 2025-01-15

19,577 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