Skip to content

Commit

Permalink
Fix parse decimal number
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored and oovm committed Sep 26, 2023
1 parent 0e9734b commit 175f996
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Rust Nightly
uses: actions-rs/toolchain@v1
with:
Expand Down
12 changes: 10 additions & 2 deletions projects/nyar-number/src/number/from.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
use super::*;

impl FromStr for NyarReal {
type Err = NyarNumberError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Self::from_str_radix(s, 10)
}
}

impl Num for NyarReal {
type FromStrRadixErr = NyarNumberError;

Expand Down Expand Up @@ -41,8 +49,8 @@ macro_rules! impl_integer {
fn from(value: $ty) -> Self {
Self::Rational(NyarRational::from(value))
}
}
)*};
}
)*};
}

impl_integer![u8, u16, u32, u64, u128, usize, BigUint, &BigUint];
Expand Down
1 change: 1 addition & 0 deletions projects/nyar-number/src/number/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use shredder::Scan;
use std::{
fmt::{Debug, Display, Formatter},
ops::{Add, Div, Mul, Neg, Rem, Sub},
str::FromStr,
};

mod arith;
Expand Down

0 comments on commit 175f996

Please sign in to comment.