mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-15 09:48:53 +00:00
add from impls for u32/usize
This commit is contained in:
parent
6fe5062548
commit
1c9c7280b7
1 changed files with 13 additions and 0 deletions
|
@ -38,6 +38,19 @@ impl Id {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<u32> for Id {
|
||||
fn from(n: u32) -> Self {
|
||||
Id::from_u32(n)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<usize> for Id {
|
||||
fn from(n: usize) -> Self {
|
||||
assert!(n < Id::MAX_USIZE);
|
||||
Id::from_u32(n as u32)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Id> for u32 {
|
||||
fn from(n: Id) -> Self {
|
||||
n.as_u32()
|
||||
|
|
Loading…
Reference in a new issue