Expand description
Defines the IntegerId trait, for types that can be identified by an integer value.
This crate simply re-exports all types from the intid_core crate.
This reduces compile times by allowing crates to avoid proc macros.
It is inspired by the separation between serde_core and serde introduced in serde-rs/serde#2608.
Note that many of the use-cases of a derive(...) macro can be achieved just as well (or better)
using the intid::define_newtype_id declarative macro.
Modules§
- trusted
- Since
IntegerIdandIntegerIdContiguousare safe traits, it is not possible for unsafe code to rely on them for correctness. - uint
- Defines the
UnsignedPrimInttrait and its generic operations. - utils
- Miscellaneous utilities relating to the
IntegerIdtrait.
Macros§
- define_
newtype_ counter - Defines a new type
IntegerIdCounter, which wraps anotherIntegerIdCounter - define_
newtype_ id - Defines a newtype
IntegerId, which wraps anotherIntegerId. - impl_
newtype_ id_ body - Implements the body of the
IntegerIdtrait for a newtype struct.
Traits§
- EnumId
- An
IntegerIdwhich are limited to small set of indexes. - Equivalent
Id - A type that can be for lookup as an
IntegerId. - Integer
Id - An identifier which can be sensibly converted to/from an unsigned integer value.
- Integer
IdContiguous - Indicates that an id occupies contiguous range of contiguous values,
and all values between
IntegerId::MIN_IDandIntegerId::MAX_IDare valid. - Integer
IdCounter - An
IntegerIdthat can be sensibly used as a counter, starting at aSelf::STARTvalue and being incremented from there. - Unsigned
Prim Int - An unsigned primitive integer.
Derive Macros§
- EnumId
- Implements
EnumIdfor a C-like enum, enabling use of theEnumMapandEnumSetcollections. - Integer
Id - Implements
IntegerIdfor a newtype struct or C-like enum. - Integer
IdContiguous - Implements
IntegerIdContiguousfor a newtype struct. - Integer
IdCounter - Implements
IntegerIdCounterfor a newtype struct.