Skip to content

Commit

Permalink
Use existing macros to implement 128-bit From impls
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 19, 2022
1 parent c183125 commit ec0456a
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,19 +732,8 @@ impl_from_signed!(i8, i16, i32, i64, isize);

#[cfg(feature = "arbitrary_precision")]
serde_if_integer128! {
impl From<i128> for Number {
fn from(i: i128) -> Self {
let n = itoa::Buffer::new().format(i).to_owned();
Number { n }
}
}

impl From<u128> for Number {
fn from(u: u128) -> Self {
let n = itoa::Buffer::new().format(u).to_owned();
Number { n }
}
}
impl_from_unsigned!(u128);
impl_from_signed!(i128);
}

impl Number {
Expand Down

0 comments on commit ec0456a

Please sign in to comment.