FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    CharacterReader

    struct · ferroui-base · v0.5.0

    struct CharacterReader<'a>
    

    A forward-only reader over a string.

    View source

    Members

    parse_arguments

    fn parse_arguments(self: &mut Self, open: char, close: char) -> Result<Vec<String>, ExpressionParseError>
    

    Parses a list of arguments enclosed in open/close and separated by ,. The reader must be positioned on open.

    Source

    parse_arguments_with_delimiter

    fn parse_arguments_with_delimiter(self: &mut Self, open: char, close: char, delimiter: char) -> Result<Vec<String>, ExpressionParseError>
    

    Parses a list of arguments enclosed in open/close and separated by delimiter. The reader must be positioned on open.

    Source

    new

    fn new(s: &'a str) -> Self
    

    Creates a reader positioned at the start of s.

    Source

    end

    fn end(self: &Self) -> bool
    

    Gets a value indicating whether the whole input has been consumed.

    Source

    peek

    fn peek(self: &Self) -> Option<char>
    

    Gets the next character without consuming it, or None at the end.

    Source

    position

    fn position(self: &Self) -> i32
    

    Gets the number of characters consumed so far.

    As upstream, Self::skip does not advance the position.

    Source

    take

    fn take(self: &mut Self) -> Option<char>
    

    Consumes and returns the next character, or returns None at the end.

    Source

    skip_whitespace

    fn skip_whitespace(self: &mut Self)
    

    Consumes leading white space.

    Source

    take_if

    fn take_if(self: &mut Self, c: char) -> bool
    

    Consumes the next character if it equals c.

    Source

    take_if_str

    fn take_if_str(self: &mut Self, s: &str) -> bool
    

    Consumes s if the remaining input starts with it.

    Source

    take_if_fn

    fn take_if_fn(self: &mut Self, condition: impl Fn(char) -> bool) -> bool
    

    Consumes the next character if it satisfies condition.

    Source

    take_until

    fn take_until(self: &mut Self, c: char) -> &'a str
    

    Consumes and returns everything up to (not including) the first c, or the rest of the input when c does not occur.

    Source

    take_while

    fn take_while(self: &mut Self, condition: impl Fn(char) -> bool) -> &'a str
    

    Consumes and returns the longest prefix whose characters all satisfy condition.

    Source

    try_peek

    fn try_peek(self: &Self, count: usize) -> &'a str
    

    Returns the next count characters without consuming them, or an empty string when fewer than count characters remain.

    Source

    peek_whitespace

    fn peek_whitespace(self: &Self) -> &'a str
    

    Returns the leading white space without consuming it.

    Source

    skip

    fn skip(self: &mut Self, count: usize)
    

    Consumes count characters without advancing Self::position (as upstream).

    Panics

    Panics when fewer than count characters remain; callers skip only what they have peeked.

    Source

    parse_identifier

    fn parse_identifier(self: &mut Self) -> &'a str
    

    Parses an identifier: a letter or _ followed by letters, _, marks, connector punctuation, format characters and decimal digits. Returns an empty string (consuming nothing) when the input does not start with an identifier.

    Source

    parse_type_identifier

    fn parse_type_identifier(self: &mut Self) -> &'a str
    

    Parses an identifier that may name a nested type, e.g. "Outer+Inner".

    Source

    parse_number

    fn parse_number(self: &mut Self) -> &'a str
    

    Parses a run of decimal digits (possibly empty).

    Source

    check_keyword

    fn check_keyword(self: &Self, keyword: &str) -> bool
    

    Checks whether the input continues with optional white space followed by keyword, without consuming anything.

    Source

    take_if_keyword

    fn take_if_keyword(self: &mut Self, keyword: &str) -> bool
    

    Consumes optional white space followed by keyword if the input continues with it.

    As upstream, the consumed characters are skipped without advancing CharacterReader::position.

    Source

    parse_style_class

    fn parse_style_class(self: &mut Self) -> &'a str
    

    Parses a style class name: an identifier that may also contain -. Returns an empty string (consuming nothing) when the input does not start with a class name.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ErasedDestructor
    • IntoEither
    • Clone
    • Debug

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.