pub struct NonFiniteFloat { /* private fields */ }Expand description
A float JSON cannot represent: an infinity or a NaN.
JSON’s grammar has no spelling for either, and serde_json refuses to build a
Number from one. TOML’s grammar does — inf, -inf, nan are literals —
so a .toml input can carry one straight into a -f json emission, where it
used to be silently replaced by 0.
The lone JSON impossibility, which is why to_json returns this type
directly where to_toml returns the TomlError enum. A second one would
be the moment to introduce the wrapper, not before: an enum with one variant
buys a consumer nothing and costs it a match.
Carries paths and the value’s TOML spelling, and stops short of a trailing newline like its TOML-side siblings.
Trait Implementations§
Source§impl Debug for NonFiniteFloat
impl Debug for NonFiniteFloat
Source§impl Display for NonFiniteFloat
impl Display for NonFiniteFloat
Source§impl Error for NonFiniteFloat
impl Error for NonFiniteFloat
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for NonFiniteFloat
impl RefUnwindSafe for NonFiniteFloat
impl Send for NonFiniteFloat
impl Sync for NonFiniteFloat
impl Unpin for NonFiniteFloat
impl UnsafeUnpin for NonFiniteFloat
impl UnwindSafe for NonFiniteFloat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more