index_type 0.4.1

Type-safe newtype indices for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
#![no_std]
use core::num::NonZeroU32;

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
struct SafeIndex(NonZeroU32);

fn main() {
    // This should fail if size_of is not in prelude
    let _ = size_of::<SafeIndex>();
}