#![allow(missing_docs)]
use core::num::NonZeroU32;
intid_core::define_newtype_id! {
pub struct Plain(u32);
}
intid_core::define_newtype_counter! {
#[derive(Default)]
pub struct Counter(u32);
}
intid_core::define_newtype_counter! {
pub struct CounterNonzero(NonZeroU32);
}
#[test]
fn verify_derive() {
assert_id::<Plain>();
assert_counter::<Counter>();
assert_counter::<CounterNonzero>();
assert_eq!(
<CounterNonzero as intid_core::IntegerIdCounter>::START
.0
.get(),
1
);
}
fn assert_id<T: intid_core::IntegerId>() {}
fn assert_contiguous<T: intid_core::IntegerIdContiguous>() {
assert_id::<T>();
}
fn assert_counter<T: intid_core::IntegerIdCounter>() {
assert_contiguous::<T>();
assert_eq!(T::START.to_int(), T::START_INT);
}