Trait lexical_core::FromLexical[][src]

pub trait FromLexical: Number {
    fn from_lexical(bytes: &[u8]) -> Result<Self>;
fn from_lexical_partial(bytes: &[u8]) -> Result<(Self, usize)>; }

Trait for numerical types that can be parsed from bytes.

Required methods

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

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.

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

Numeric overflow takes precedence over the presence of an invalid digit, and therefore may mask an invalid digit error.

  • bytes - Slice containing a numeric string.

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

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.

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 FromLexical for f32[src]

impl FromLexical for f64[src]

impl FromLexical for u8[src]

impl FromLexical for u16[src]

impl FromLexical for u32[src]

impl FromLexical for u64[src]

impl FromLexical for usize[src]

impl FromLexical for u128[src]

impl FromLexical for i8[src]

impl FromLexical for i16[src]

impl FromLexical for i32[src]

impl FromLexical for i64[src]

impl FromLexical for isize[src]

impl FromLexical for i128[src]

Loading content...

Implementors

Loading content...