Trait lexical_core::FromLexicalLossy[][src]

pub trait FromLexicalLossy: FromLexical {
    fn from_lexical_lossy(bytes: &[u8]) -> Result<Self>;
fn from_lexical_partial_lossy(bytes: &[u8]) -> Result<(Self, usize)>; }

Trait for floating-point types that can be parsed using lossy algorithms from bytes.

Required methods

fn from_lexical_lossy(bytes: &[u8]) -> Result<Self>[src]

Lossy, checked parser for a string-to-number conversion.

This method parses the entire string, returning an error if any invalid digits are found during parsing. This parser is lossy, so numerical rounding may occur during parsing.

Returns a Result containing either the parsed value, or an error containing any errors that occurred during parsing.

  • bytes - Slice containing a numeric string.

fn from_lexical_partial_lossy(bytes: &[u8]) -> Result<(Self, usize)>[src]

Lossy, checked parser for a string-to-number conversion.

This method parses until an invalid digit is found (or the end of the string), returning the number of processed digits and the parsed value until that point. This parser is lossy, so numerical rounding may occur during parsing.

Returns a Result containing either the parsed value and the number of processed digits, or an error containing any errors that occurred during parsing.

  • bytes - Slice containing a numeric string.
Loading content...

Implementations on Foreign Types

impl FromLexicalLossy for f32[src]

impl FromLexicalLossy for f64[src]

Loading content...

Implementors

Loading content...