BufReadExtWithFormat

Trait BufReadExtWithFormat 

Source
pub trait BufReadExtWithFormat<Char = char>: BufReadExt<Char>
where Char: CharExt + Into<char> + Copy, for<'a> &'a [Char]: CharSet<Item = Char>, for<'a> &'a str: StrExt<'a, Char>,
{ // Provided methods fn try_get_non_skipped<S>(&mut self, skip: S) -> Result<char, StreamError> where S: CharSet<Item = Char> { ... } fn try_skip_all<S>(&mut self, skip: S) -> Result<usize, StreamError> where S: CharSet<Item = Char> { ... } fn try_get_until_in_line<F>( &mut self, pattern: F, ) -> Result<&str, StreamError> where F: CharSet<Item = Char> { ... } fn try_get_while_in_line<F>( &mut self, pattern: F, ) -> Result<&str, PatternError<StreamError>> where F: Pattern<Item = Char> { ... } fn try_get_string_some<S, A>( &mut self, skip: S, accept: A, ) -> Result<&str, PatternError<StreamError>> where S: CharSet<Item = Char>, A: Pattern<Item = Char> { ... } fn try_get_line_trimmed<S>(&mut self, skip: S) -> Result<&str, StreamError> where S: CharSet<Item = Char> { ... } fn try_get_line_some_trimmed<S>( &mut self, skip: S, ) -> Result<&str, StreamError> where S: CharSet<Item = Char> { ... } }
Expand description

Extension trait for BufReadExt with CharSet and Pattern.

Provided Methods§

Source

fn try_get_non_skipped<S>(&mut self, skip: S) -> Result<char, StreamError>
where S: CharSet<Item = Char>,

Get a single non-skipped character.

Source

fn try_skip_all<S>(&mut self, skip: S) -> Result<usize, StreamError>
where S: CharSet<Item = Char>,

Skip all skipped characters until a non-skipped character is found or end of file.

Source

fn try_get_until_in_line<F>(&mut self, pattern: F) -> Result<&str, StreamError>
where F: CharSet<Item = Char>,

Read until a character in pattern is found or end of line.

Source

fn try_get_while_in_line<F>( &mut self, pattern: F, ) -> Result<&str, PatternError<StreamError>>
where F: Pattern<Item = Char>,

Read while matching the pattern.

Source

fn try_get_string_some<S, A>( &mut self, skip: S, accept: A, ) -> Result<&str, PatternError<StreamError>>
where S: CharSet<Item = Char>, A: Pattern<Item = Char>,

Get a single skipped-separated string. If current line is empty or all skipped, it will read a new line.

Source

fn try_get_line_trimmed<S>(&mut self, skip: S) -> Result<&str, StreamError>
where S: CharSet<Item = Char>,

Get a single line. The trailing white spaces will be consumed and trimmed.

It can return an empty string.

Source

fn try_get_line_some_trimmed<S>(&mut self, skip: S) -> Result<&str, StreamError>
where S: CharSet<Item = Char>,

Get a single not-empty line. Both leading and trailing white spaces will be consumed and trimmed.

Repeatedly read a new line if current line is empty.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S, Char> BufReadExtWithFormat<Char> for S
where S: ?Sized + BufReadExt<Char>, Char: CharExt + Into<char> + Copy, for<'a> &'a [Char]: CharSet<Item = Char>, for<'a> &'a str: StrExt<'a, Char>,