expose ParseFixedError
This commit is contained in:
parent
76a8e07f54
commit
9674a05d7f
|
@ -154,10 +154,28 @@ struct Parse<'a> {
|
|||
int: &'a str,
|
||||
frac: &'a str,
|
||||
}
|
||||
|
||||
/**
|
||||
An error which can be returned when parsing a fixed-point number.
|
||||
|
||||
# Examples
|
||||
|
||||
```rust
|
||||
use fixed::{types::I16F16, ParseFixedError};
|
||||
// This string is not a fixed-point number.
|
||||
let s = "something completely different (_!_!_)";
|
||||
let error: ParseFixedError = match s.parse::<I16F16>() {
|
||||
Ok(_) => unreachable!(),
|
||||
Err(error) => error,
|
||||
};
|
||||
println!("Parse error: {}", error);
|
||||
```
|
||||
*/
|
||||
#[derive(Debug)]
|
||||
pub struct ParseFixedError {
|
||||
kind: ParseErrorKind,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
enum ParseErrorKind {
|
||||
InvalidDigit,
|
||||
|
|
|
@ -226,12 +226,12 @@ pub mod types;
|
|||
mod wide_div;
|
||||
mod wrapping;
|
||||
|
||||
pub use crate::wrapping::Wrapping;
|
||||
use crate::{
|
||||
arith::MulDivDir,
|
||||
frac::{IsLessOrEqual, True, Unsigned, U128, U16, U32, U64, U8},
|
||||
sealed::{Fixed, Float, Int, SealedFixed, SealedFloat, SealedInt},
|
||||
};
|
||||
pub use crate::{from_str::ParseFixedError, wrapping::Wrapping};
|
||||
use core::{
|
||||
cmp::Ordering,
|
||||
hash::{Hash, Hasher},
|
||||
|
@ -288,10 +288,9 @@ are implemented by the Rust compiler.
|
|||
# Examples
|
||||
|
||||
```rust
|
||||
use fixed::frac::U3;
|
||||
use fixed::",
|
||||
use fixed::{frac::U3, ",
|
||||
$s_fixed,
|
||||
";
|
||||
"};
|
||||
let eleven = ",
|
||||
$s_fixed,
|
||||
"::<U3>::from_int(11);
|
||||
|
|
Loading…
Reference in New Issue