pub struct InputStream<B> { /* private fields */ }Expand description
C++-like Stream.
This struct provides a way to read from a buffer that implements BufRead.
It implements BufReadExt for reading characters, strings, and lines.
Implementations§
Trait Implementations§
Source§impl<B: BufRead> BufReadExt for InputStream<B>
impl<B: BufRead> BufReadExt for InputStream<B>
Source§fn get_cur_line(&self) -> &str
fn get_cur_line(&self) -> &str
Get the current line whatever state it is.
Source§fn read_buf(&mut self) -> Result<bool, StreamError>
fn read_buf(&mut self) -> Result<bool, StreamError>
Try to fill the buffer with a new line, ignoring the current line. Read more
Source§fn fill_buf(&mut self) -> Result<(), StreamError>
fn fill_buf(&mut self) -> Result<(), StreamError>
Fill the buffer with a new line, ignoring the current line. Read more
Source§fn get_line(&mut self) -> Result<&str, StreamError>
fn get_line(&mut self) -> Result<&str, StreamError>
Get the current line. Read a new line if current line is empty.
Source§fn get_in_cur_line(&mut self) -> Result<Option<char>, StreamError>
fn get_in_cur_line(&mut self) -> Result<Option<char>, StreamError>
Get the next character in current line, if any.
Source§fn peek_in_cur_line(&mut self) -> Option<char>
fn peek_in_cur_line(&mut self) -> Option<char>
Peek the next character in current line, if any.
Source§fn fill_buf_if_eol(&mut self) -> Result<bool, StreamError>
fn fill_buf_if_eol(&mut self) -> Result<bool, StreamError>
Fill the buffer with a new line if the current line is empty. Read more
Source§fn try_peek(&mut self) -> Result<char, StreamError>
fn try_peek(&mut self) -> Result<char, StreamError>
Peek a single character. Read a new line if current line is empty.
Source§fn try_skip_any(&mut self) -> Result<(), StreamError>
fn try_skip_any(&mut self) -> Result<(), StreamError>
Skip a single character.
Source§fn try_skip_eol(&mut self) -> Result<Option<bool>, StreamError>
fn try_skip_eol(&mut self) -> Result<Option<bool>, StreamError>
Go to the next line if the remaining part are end of line characters. Read more
Auto Trait Implementations§
impl<B> Freeze for InputStream<B>where
B: Freeze,
impl<B> RefUnwindSafe for InputStream<B>where
B: RefUnwindSafe,
impl<B> Send for InputStream<B>where
B: Send,
impl<B> Sync for InputStream<B>where
B: Sync,
impl<B> Unpin for InputStream<B>where
B: Unpin,
impl<B> UnwindSafe for InputStream<B>where
B: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<S, Char> BufReadExtWithFormat<Char> for S
impl<S, Char> BufReadExtWithFormat<Char> for S
Source§fn try_get_non_skipped<S>(&mut self, skip: S) -> Result<char, StreamError>where
S: CharSet<Item = Char>,
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>,
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>,
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>,
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>>
fn try_get_string_some<S, A>( &mut self, skip: S, accept: A, ) -> Result<&str, PatternError<StreamError>>
Get a single
skipped-separated string.
If current line is empty or all skipped, it will read a new line.Source§impl<T, U> ReadInto<U> for Twhere
T: BufReadExt,
U: ReadFrom,
impl<T, U> ReadInto<U> for Twhere
T: BufReadExt,
U: ReadFrom,
Source§type Error = ReadError<<U as ReadFrom>::ParseError>
type Error = ReadError<<U as ReadFrom>::ParseError>
Errors that come from ReadOneFrom. Read more
Source§fn try_read(&mut self) -> Result<U, <T as ReadInto<U>>::Error>
fn try_read(&mut self) -> Result<U, <T as ReadInto<U>>::Error>
Read from
self and parse into Self.Source§fn try_read_m_n(
&mut self,
m: usize,
n: usize,
) -> Result<Vec<Vec<U>>, <T as ReadInto<U>>::Error>
fn try_read_m_n( &mut self, m: usize, n: usize, ) -> Result<Vec<Vec<U>>, <T as ReadInto<U>>::Error>
Source§fn read(&mut self) -> T
fn read(&mut self) -> T
Unwrap the result of ReadInto::try_read.
Source§impl<T, U> ReadOneInto<T> for Uwhere
T: ReadOneFrom,
U: BufReadExt,
impl<T, U> ReadOneInto<T> for Uwhere
T: ReadOneFrom,
U: BufReadExt,
Source§type Error = ReadError<<T as ReadOneFrom>::ParseError>
type Error = ReadError<<T as ReadOneFrom>::ParseError>
Errors that come from ReadOneFrom. Read more
Source§fn try_read_one(&mut self) -> Result<T, <U as ReadOneInto<T>>::Error>
fn try_read_one(&mut self) -> Result<T, <U as ReadOneInto<T>>::Error>
Read one from
self and parse into T.Source§fn try_read_in_char(&mut self) -> Result<T, <U as ReadOneInto<T>>::Error>
fn try_read_in_char(&mut self) -> Result<T, <U as ReadOneInto<T>>::Error>
Read an element in a single non-whitespace character from
self, parse into T.Source§fn try_read_in_line_trimmed(
&mut self,
) -> Result<T, <U as ReadOneInto<T>>::Error>
fn try_read_in_line_trimmed( &mut self, ) -> Result<T, <U as ReadOneInto<T>>::Error>
Read an element in the remained line from
self, parse into T.Source§fn try_read_in_line_some_trimmed(
&mut self,
) -> Result<T, <U as ReadOneInto<T>>::Error>
fn try_read_in_line_some_trimmed( &mut self, ) -> Result<T, <U as ReadOneInto<T>>::Error>
Read an element in a single trimmed line that is not empty from
self, parse into T.Source§fn try_read_all(&mut self) -> Result<Vec<T>, <U as ReadOneInto<T>>::Error>
fn try_read_all(&mut self) -> Result<Vec<T>, <U as ReadOneInto<T>>::Error>
Read all remaining elements from
stream.Source§fn try_read_any_in_line(
&mut self,
) -> Result<Vec<T>, <U as ReadOneInto<T>>::Error>
fn try_read_any_in_line( &mut self, ) -> Result<Vec<T>, <U as ReadOneInto<T>>::Error>
Read all elements in current line from
self.Source§fn try_read_some_in_line(
&mut self,
) -> Result<Vec<T>, <U as ReadOneInto<T>>::Error>
fn try_read_some_in_line( &mut self, ) -> Result<Vec<T>, <U as ReadOneInto<T>>::Error>
Read all elements in a non-empty line from
self.Source§fn read_one(&mut self) -> T
fn read_one(&mut self) -> T
Unwrap the result of ReadOneInto::try_read_one.
Source§fn read_in_char(&mut self) -> T
fn read_in_char(&mut self) -> T
Unwrap the result of ReadOneInto::try_read_in_char.
Source§fn read_in_line_trimmed(&mut self) -> T
fn read_in_line_trimmed(&mut self) -> T
Unwrap the result of ReadOneInto::try_read_in_line_trimmed.
Source§fn read_in_line_some_trimmed(&mut self) -> T
fn read_in_line_some_trimmed(&mut self) -> T
Unwrap the result of ReadOneInto::try_read_in_line_some_trimmed.
Source§fn read_all(&mut self) -> Vec<T>
fn read_all(&mut self) -> Vec<T>
Unwrap the result of ReadOneInto::try_read_all.
Source§fn read_any_in_line(&mut self) -> Vec<T>
fn read_any_in_line(&mut self) -> Vec<T>
Unwrap the result of ReadOneInto::try_read_any_in_line.
Source§fn read_some_in_line(&mut self) -> Vec<T>
fn read_some_in_line(&mut self) -> Vec<T>
Unwrap the result of ReadOneInto::try_read_some_in_line.