Trait fast_float::FastFloat

source ·
pub trait FastFloat: Float {
    // Provided methods
    fn parse_float<S: AsRef<[u8]>>(s: S) -> Result<Self> { ... }
    fn parse_float_partial<S: AsRef<[u8]>>(s: S) -> Result<(Self, usize)> { ... }
}
Expand description

Trait for numerical float types that can be parsed from string.

Provided Methods§

source

fn parse_float<S: AsRef<[u8]>>(s: S) -> Result<Self>

Parse a decimal number from string into float (full).

§Errors

Will return an error either if the string is not a valid decimal number. or if any characterse are left remaining unparsed.

source

fn parse_float_partial<S: AsRef<[u8]>>(s: S) -> Result<(Self, usize)>

Parse a decimal number from string into float (partial).

This method parses as many characters as possible and returns the resulting number along with the number of digits processed (in case of success, this number is always positive).

§Errors

Will return an error either if the string doesn’t start with a valid decimal number – that is, if no zero digits were processed.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl FastFloat for f32

source§

impl FastFloat for f64

Implementors§