fn num_metrics()

in rust/ccommon-rs/src/metric/mod.rs [77:90]


    fn num_metrics() -> usize {
        use std::mem::size_of;

        // If this assert fails then there was no way that
        // options upholds it's safety requirements so it's
        // better to fail here.
        assert!(size_of::<Self>() % size_of::<metric>() == 0);

        // If this assert fails then we'll pass an invalid
        // size to several ccommon methods.
        assert!(size_of::<Self>() / size_of::<metric>() < std::u32::MAX as usize);

        size_of::<Self>() / size_of::<metric>()
    }