[][src]Trait field_count::FieldCount

pub trait FieldCount {
    fn field_count() -> usize;
}

A data structure the exposes the number of fields it has.

This trait can be derived:

use field_count::FieldCount;

#[derive(FieldCount)]
struct MyStruct
{
   first_field: i32,
   second_field: String,
   third_field: u16,
}

println!("{}", MyStruct::field_count()); // 3

Required methods

fn field_count() -> usize

Get the number of fields on a struct.

Loading content...

Implementors

Loading content...