Crate intid

Crate intid 

Source
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 IntegerId and IntegerIdContiguous are safe traits, it is not possible for unsafe code to rely on them for correctness.
uint
Defines the UnsignedPrimInt trait and its generic operations.
utils
Miscellaneous utilities relating to the IntegerId trait.

Macros§

define_newtype_counter
Defines a new type IntegerIdCounter, which wraps another IntegerIdCounter
define_newtype_id
Defines a newtype IntegerId, which wraps another IntegerId.
impl_newtype_id_body
Implements the body of the IntegerId trait for a newtype struct.

Traits§

EnumId
An IntegerId which are limited to small set of indexes.
EquivalentId
A type that can be for lookup as an IntegerId.
IntegerId
An identifier which can be sensibly converted to/from an unsigned integer value.
IntegerIdContiguous
Indicates that an id occupies contiguous range of contiguous values, and all values between IntegerId::MIN_ID and IntegerId::MAX_ID are valid.
IntegerIdCounter
An IntegerId that can be sensibly used as a counter, starting at a Self::START value and being incremented from there.
UnsignedPrimInt
An unsigned primitive integer.

Derive Macros§

EnumId
Implements EnumId for a C-like enum, enabling use of the EnumMap and EnumSet collections.
IntegerId
Implements IntegerId for a newtype struct or C-like enum.
IntegerIdContiguous
Implements IntegerIdContiguous for a newtype struct.
IntegerIdCounter
Implements IntegerIdCounter for a newtype struct.