#id #type #numeric #traits #swapped

id-ish

Numeric ID types that can be swapped in & out

3 releases

0.0.3 Aug 13, 2021
0.0.2 Feb 11, 2021
0.0.1 Feb 7, 2021

#2797 in Rust patterns

25 downloads per month

GPL-3.0+

13KB
292 lines

ID-ish

Provides traits for ID types.

Provides two traits at the top level:

  • ID
  • MaybeID

And two at in id_containers:

  • WithID
  • TakeID

MaybeID has two methods:

  • as_u128
  • into_inner

ID has none, but builds on MaybeID.

Stuff

  • MaybeID has implementations on (), all integer types (i128/u128 optional), and uuid::Uuid (optional).
  • ID has implementations on all integer types, and uuid::Uuid.
  • WithID/TakeID have a default macro that "derives" a WithID/TakeID implementation that's valid for any structure with a leading id field.

lib.rs:

ID-ish

Provides ID-ish types & traits for use in software.

Dependencies

~60KB