Skip to content

Commit

Permalink
Also into usize
Browse files Browse the repository at this point in the history
  • Loading branch information
eytans committed Oct 6, 2024
1 parent 4839263 commit ce48c5a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,24 @@ impl Into<u32> for Id {
}
}

impl Into<usize> for Id {
fn into(self) -> usize {
self.0 as usize
}
}

impl Into<u32> for &Id {
fn into(self) -> u32 {
self.0
}
}

impl Into<usize> for &Id {
fn into(self) -> usize {
self.0 as usize
}
}

impl std::fmt::Debug for Id {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
Expand Down

0 comments on commit ce48c5a

Please sign in to comment.