Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'lib/la-arena/src/lib.rs')
| -rw-r--r-- | lib/la-arena/src/lib.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/la-arena/src/lib.rs b/lib/la-arena/src/lib.rs index 9fe6d60623..0e218806f7 100644 --- a/lib/la-arena/src/lib.rs +++ b/lib/la-arena/src/lib.rs @@ -17,6 +17,12 @@ pub use map::ArenaMap; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct RawIdx(u32); +impl Default for RawIdx { + fn default() -> Self { + Self(u32::MAX) + } +} + impl From<RawIdx> for u32 { fn from(raw: RawIdx) -> u32 { raw.0 @@ -47,6 +53,12 @@ pub struct Idx<T> { _ty: PhantomData<fn() -> T>, } +impl<T> Default for Idx<T> { + fn default() -> Self { + Self::from_raw(RawIdx::default()) + } +} + impl<T> Clone for Idx<T> { fn clone(&self) -> Self { *self |