pub struct Lexer { /* private fields */ }

Implementations§

Examples found in repository?
src/lexer.rs (line 814)
813
814
815
816
817
818
819
820
821
    fn str_to_num(s: &str) -> Number {
        if let Some(i) = Lexer::str_to_int(s) {
            Number::Int(i)
        } else if let Some(f) = Lexer::str_to_float(s) {
            Number::Float(f)
        } else {
            Number::None
        }
    }
Examples found in repository?
src/lexer.rs (line 816)
813
814
815
816
817
818
819
820
821
    fn str_to_num(s: &str) -> Number {
        if let Some(i) = Lexer::str_to_int(s) {
            Number::Int(i)
        } else if let Some(f) = Lexer::str_to_float(s) {
            Number::Float(f)
        } else {
            Number::None
        }
    }
Examples found in repository?
src/lexer.rs (line 747)
742
743
744
745
746
747
748
749
750
751
752
753
754
    pub fn str_to_float(s: &str) -> Option<FloatType> {
        let bytes = s.as_bytes();
        let mut i = 0;
        i = Lexer::skip_spaces(bytes, i);
        if Lexer::starts_with_0x(bytes, i) {
            Lexer::str_to_hex_float(&bytes[2..])
        } else {
            match s.parse::<FloatType>() {
                Ok(f) => Some(f),
                Err(_e) => None,
            }
        }
    }

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.