More TryFrom<&SignedInteger> implementations
This commit is contained in:
parent
6143ddc93d
commit
c7b252ca9d
|
@ -144,3 +144,31 @@ impl<'a> From<&'a SignedInteger> for BigInt {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&SignedInteger> for i64 {
|
||||
type Error = ();
|
||||
fn try_from(v: &SignedInteger) -> Result<Self, Self::Error> {
|
||||
i128::try_from(v)?.try_into().map_err(|_| ())
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&SignedInteger> for u64 {
|
||||
type Error = ();
|
||||
fn try_from(v: &SignedInteger) -> Result<Self, Self::Error> {
|
||||
u128::try_from(v)?.try_into().map_err(|_| ())
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&SignedInteger> for isize {
|
||||
type Error = ();
|
||||
fn try_from(v: &SignedInteger) -> Result<Self, Self::Error> {
|
||||
i128::try_from(v)?.try_into().map_err(|_| ())
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&SignedInteger> for usize {
|
||||
type Error = ();
|
||||
fn try_from(v: &SignedInteger) -> Result<Self, Self::Error> {
|
||||
u128::try_from(v)?.try_into().map_err(|_| ())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue