Struct domain::master::bufscanner::BufScanner [−][src]
pub struct BufScanner<R: Read> { /* fields omitted */ }
A scanner using a buffer atop a reader.
The strategy implemented for the buffer is to read byte by byte from the underlying reader and flush it every time a successfully read token ends at the buffer’s end (which should happen quite a lot). This may not be the smartest way of doing this, but it is simple and memory-efficient.
Methods
impl<R: Read> BufScanner<R>
[src]
impl<R: Read> BufScanner<R>
pub fn new(reader: R) -> Self
[src]
pub fn new(reader: R) -> Self
Creates a new scanner using the given reader.
pub fn with_pos(reader: R, pos: Pos) -> Self
[src]
pub fn with_pos(reader: R, pos: Pos) -> Self
Creates a new scanner using the given reader and position.
The scanner will assume that the current position of reader
corresponds to the human-friendly position pos
.
impl BufScanner<File>
[src]
impl BufScanner<File>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
[src]
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Attempts to opens a file and create a scanner for it.
impl<T: AsRef<[u8]>> BufScanner<Cursor<T>>
[src]
impl<T: AsRef<[u8]>> BufScanner<Cursor<T>>
Trait Implementations
impl<R: Clone + Read> Clone for BufScanner<R>
[src]
impl<R: Clone + Read> Clone for BufScanner<R>
fn clone(&self) -> BufScanner<R>
[src]
fn clone(&self) -> BufScanner<R>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<R: Debug + Read> Debug for BufScanner<R>
[src]
impl<R: Debug + Read> Debug for BufScanner<R>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<R: Read> Scanner for BufScanner<R>
[src]
impl<R: Read> Scanner for BufScanner<R>
fn is_eof(&mut self) -> bool
[src]
fn is_eof(&mut self) -> bool
Fundamental Methods Read more
fn pos(&self) -> Pos
[src]
fn pos(&self) -> Pos
Returns the current position of the scanner.
fn scan_word<T, F>(&mut self, f: F) -> ScanResult<T> where
F: FnOnce(&[u8]) -> SyntaxResult<T>,
[src]
fn scan_word<T, F>(&mut self, f: F) -> ScanResult<T> where
F: FnOnce(&[u8]) -> SyntaxResult<T>,
Scans a word token. Read more
fn scan_word_into<T, U, F, G>(&mut self, target: T, f: F, g: G) -> ScanResult<U> where
F: FnMut(&mut T, u8, bool) -> SyntaxResult<()>,
G: FnOnce(T) -> SyntaxResult<U>,
[src]
fn scan_word_into<T, U, F, G>(&mut self, target: T, f: F, g: G) -> ScanResult<U> where
F: FnMut(&mut T, u8, bool) -> SyntaxResult<()>,
G: FnOnce(T) -> SyntaxResult<U>,
fn scan_quoted<T, F>(&mut self, f: F) -> ScanResult<T> where
F: FnOnce(&[u8]) -> SyntaxResult<T>,
[src]
fn scan_quoted<T, F>(&mut self, f: F) -> ScanResult<T> where
F: FnOnce(&[u8]) -> SyntaxResult<T>,
Scans a quoted word. Read more
fn scan_quoted_bytes<F>(&mut self, f: F) -> ScanResult<()> where
F: FnMut(u8, bool) -> SyntaxResult<()>,
[src]
fn scan_quoted_bytes<F>(&mut self, f: F) -> ScanResult<()> where
F: FnMut(u8, bool) -> SyntaxResult<()>,
Scans a quoted word, processing the content characters separatedly. Read more
fn scan_phrase<T, F>(&mut self, f: F) -> ScanResult<T> where
F: FnOnce(&[u8]) -> SyntaxResult<T>,
[src]
fn scan_phrase<T, F>(&mut self, f: F) -> ScanResult<T> where
F: FnOnce(&[u8]) -> SyntaxResult<T>,
Scans phrase: a normal or quoted word. Read more
fn scan_phrase_bytes<F>(&mut self, f: F) -> ScanResult<()> where
F: FnMut(u8, bool) -> SyntaxResult<()>,
[src]
fn scan_phrase_bytes<F>(&mut self, f: F) -> ScanResult<()> where
F: FnMut(u8, bool) -> SyntaxResult<()>,
Scans a phrase, processing the content characters separatedly. Read more
fn scan_newline(&mut self) -> ScanResult<()>
[src]
fn scan_newline(&mut self) -> ScanResult<()>
Scans a newline. Read more
fn scan_space(&mut self) -> ScanResult<()>
[src]
fn scan_space(&mut self) -> ScanResult<()>
Scans a non-empty sequence of space. Read more
fn scan_opt_space(&mut self) -> ScanResult<()>
[src]
fn scan_opt_space(&mut self) -> ScanResult<()>
Scans a possibly empty sequence of space.
fn skip_entry(&mut self) -> ScanResult<()>
[src]
fn skip_entry(&mut self) -> ScanResult<()>
Skips over an entry. Read more
fn scan_word_bytes<F>(&mut self, f: F) -> ScanResult<()> where
F: FnMut(u8, bool) -> SyntaxResult<()>,
[src]
fn scan_word_bytes<F>(&mut self, f: F) -> ScanResult<()> where
F: FnMut(u8, bool) -> SyntaxResult<()>,
Scans a word, processing each character of its content separatedly. Read more
fn scan_str_phrase<T, F>(&mut self, f: F) -> ScanResult<T> where
F: FnOnce(&str) -> SyntaxResult<T>,
[src]
fn scan_str_phrase<T, F>(&mut self, f: F) -> ScanResult<T> where
F: FnOnce(&str) -> SyntaxResult<T>,
Scans a phrase and converts it into a string slice. Read more
fn scan_phrase_copy(&mut self) -> ScanResult<Vec<u8>>
[src]
fn scan_phrase_copy(&mut self) -> ScanResult<Vec<u8>>
Scans a phrase and returns a copy of it. Read more
fn scan_u16(&mut self) -> ScanResult<u16>
[src]
fn scan_u16(&mut self) -> ScanResult<u16>
Helper Methods Read more
fn scan_u32(&mut self) -> ScanResult<u32>
[src]
fn scan_u32(&mut self) -> ScanResult<u32>
Scans a phrase containing a 32 bit integer in decimal representation.
fn scan_hex_word<F>(&mut self, f: F) -> ScanResult<()> where
F: FnMut(u8) -> SyntaxResult<()>,
[src]
fn scan_hex_word<F>(&mut self, f: F) -> ScanResult<()> where
F: FnMut(u8) -> SyntaxResult<()>,
Scans a word containing a sequence of pairs of hex digits. Read more
fn skip_literal(&mut self, literal: &[u8]) -> ScanResult<()>
[src]
fn skip_literal(&mut self, literal: &[u8]) -> ScanResult<()>
Skips over the word with the content literal
. Read more
fn scan_dname(&mut self, origin: Option<&DNameSlice>) -> ScanResult<DNameBuf>
[src]
fn scan_dname(&mut self, origin: Option<&DNameSlice>) -> ScanResult<DNameBuf>
Scans a domain name and returns an owned domain name. Read more
fn scan_dname_into(
&mut self,
origin: Option<&DNameSlice>,
target: &mut Vec<u8>
) -> ScanResult<()>
[src]
fn scan_dname_into(
&mut self,
origin: Option<&DNameSlice>,
target: &mut Vec<u8>
) -> ScanResult<()>
Scans a domain name into a bytes vec. Read more
fn scan_charstr(&mut self) -> ScanResult<CharStrBuf>
[src]
fn scan_charstr(&mut self) -> ScanResult<CharStrBuf>
Scans a character string and returns it as an owned value.
fn scan_charstr_into(&mut self, target: &mut Vec<u8>) -> ScanResult<()>
[src]
fn scan_charstr_into(&mut self, target: &mut Vec<u8>) -> ScanResult<()>
Scans a character string into a bytes vec. Read more
Auto Trait Implementations
impl<R> Send for BufScanner<R> where
R: Send,
impl<R> Send for BufScanner<R> where
R: Send,
impl<R> Sync for BufScanner<R> where
R: Sync,
impl<R> Sync for BufScanner<R> where
R: Sync,