Struct mprober::scanner_rust::ScannerAscii [−]
pub struct ScannerAscii<R, N = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read, { /* fields omitted */ }
Expand description
A simple text scanner which can parse primitive types and strings using ASCII.
Implementations
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
pub fn new2(reader: R) -> ScannerAscii<R, N>
pub fn new2(reader: R) -> ScannerAscii<R, N>
Create a scanner from a reader and set the buffer size via generics.
extern crate scanner_rust; use std::io; use scanner_rust::generic_array::typenum::U1024; use scanner_rust::ScannerAscii; let mut sc: ScannerAscii<_, U1024> = ScannerAscii::new2(io::stdin());
Create a scanner to read data from a file by its path.
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::scan_path("Cargo.toml").unwrap();
impl<N> ScannerAscii<File, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
impl<N> ScannerAscii<File, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
pub fn scan_path2<P>(path: P) -> Result<ScannerAscii<File, N>, ScannerError> where
P: AsRef<Path>,
pub fn scan_path2<P>(path: P) -> Result<ScannerAscii<File, N>, ScannerError> where
P: AsRef<Path>,
Create a scanner to read data from a file by its path and set the buffer size via generics.
extern crate scanner_rust; use scanner_rust::generic_array::typenum::U1024; use scanner_rust::ScannerAscii; let mut sc: ScannerAscii<_, U1024> = ScannerAscii::scan_path2("Cargo.toml").unwrap();
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
pub unsafe fn remove_heading_bytes_from_buffer(
&mut self,
number_of_bytes: usize
)
pub unsafe fn remove_heading_bytes_from_buffer(
&mut self,
number_of_bytes: usize
)
Left shift (if necessary) the buffer to remove bytes from the start of the buffer. Typically, you should use this after peeking the buffer.
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
pub fn next_char(&mut self) -> Result<Option<char>, ScannerError>
pub fn next_char(&mut self) -> Result<Option<char>, ScannerError>
Read the next char. If the data is not a correct char, it will return a Ok(Some(REPLACEMENT_CHARACTER)) which is �. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("5 c ab".as_bytes()); assert_eq!(Some('5'), sc.next_char().unwrap()); assert_eq!(Some(' '), sc.next_char().unwrap()); assert_eq!(Some('c'), sc.next_char().unwrap()); assert_eq!(Some(' '), sc.next_char().unwrap()); assert_eq!(Some('a'), sc.next_char().unwrap()); assert_eq!(Some('b'), sc.next_char().unwrap()); assert_eq!(None, sc.next_char().unwrap());
pub fn next_line(&mut self) -> Result<Option<String>, ScannerError>
pub fn next_line(&mut self) -> Result<Option<String>, ScannerError>
Read the next line but not include the tailing line character (or line chracters like CrLf(\r\n)). If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("123 456\r\n789 \n\n ab ".as_bytes()); assert_eq!(Some("123 456".into()), sc.next_line().unwrap()); assert_eq!(Some("789 ".into()), sc.next_line().unwrap()); assert_eq!(Some("".into()), sc.next_line().unwrap()); assert_eq!(Some(" ab ".into()), sc.next_line().unwrap());
pub fn next_line_raw(&mut self) -> Result<Option<Vec<u8, Global>>, ScannerError>
pub fn next_line_raw(&mut self) -> Result<Option<Vec<u8, Global>>, ScannerError>
Read the next line include the tailing line character (or line chracters like CrLf(\r\n)) without validating ASCII. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("123 456\r\n789 \n\n ab ".as_bytes()); assert_eq!(Some("123 456".into()), sc.next_line_raw().unwrap()); assert_eq!(Some("789 ".into()), sc.next_line_raw().unwrap()); assert_eq!(Some("".into()), sc.next_line_raw().unwrap()); assert_eq!(Some(" ab ".into()), sc.next_line_raw().unwrap());
pub fn drop_next_line(&mut self) -> Result<Option<usize>, ScannerError>
pub fn drop_next_line(&mut self) -> Result<Option<usize>, ScannerError>
Drop the next line but not include the tailing line character (or line chracters like CrLf(\r\n)). If there is nothing to read, it will return Ok(None). If there are something to read, it will return Ok(Some(i)). The i is the length of the dropped line.
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("123 456\r\n789 \n\n ab ".as_bytes()); assert_eq!(Some(7), sc.drop_next_line().unwrap()); assert_eq!(Some("789 ".into()), sc.next_line().unwrap()); assert_eq!(Some(0), sc.drop_next_line().unwrap()); assert_eq!(Some(" ab ".into()), sc.next_line().unwrap()); assert_eq!(None, sc.drop_next_line().unwrap());
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
pub fn skip_whitespaces(&mut self) -> Result<bool, ScannerError>
pub fn skip_whitespaces(&mut self) -> Result<bool, ScannerError>
Skip the next whitespaces (javaWhitespace). If there is nothing to read, it will return Ok(false).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2 c".as_bytes()); assert_eq!(Some('1'), sc.next_char().unwrap()); assert_eq!(Some(' '), sc.next_char().unwrap()); assert_eq!(Some('2'), sc.next_char().unwrap()); assert_eq!(true, sc.skip_whitespaces().unwrap()); assert_eq!(Some('c'), sc.next_char().unwrap()); assert_eq!(false, sc.skip_whitespaces().unwrap());
pub fn next(&mut self) -> Result<Option<String>, ScannerError>
pub fn next(&mut self) -> Result<Option<String>, ScannerError>
Read the next token separated by whitespaces. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("123 456\r\n789 \n\n ab ".as_bytes()); assert_eq!(Some("123".into()), sc.next().unwrap()); assert_eq!(Some("456".into()), sc.next().unwrap()); assert_eq!(Some("789".into()), sc.next().unwrap()); assert_eq!(Some("ab".into()), sc.next().unwrap()); assert_eq!(None, sc.next().unwrap());
Read the next token separated by whitespaces without validating ASCII. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("123 456\r\n789 \n\n ab ".as_bytes()); assert_eq!(Some("123".into()), sc.next_raw().unwrap()); assert_eq!(Some("456".into()), sc.next_raw().unwrap()); assert_eq!(Some("789".into()), sc.next_raw().unwrap()); assert_eq!(Some("ab".into()), sc.next_raw().unwrap()); assert_eq!(None, sc.next_raw().unwrap());
pub fn drop_next(&mut self) -> Result<Option<usize>, ScannerError>
pub fn drop_next(&mut self) -> Result<Option<usize>, ScannerError>
Drop the next token separated by whitespaces. If there is nothing to read, it will return Ok(None). If there are something to read, it will return Ok(Some(i)). The i is the length of the dropped line.
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("123 456\r\n789 \n\n ab ".as_bytes()); assert_eq!(Some(3), sc.drop_next().unwrap()); assert_eq!(Some("456".into()), sc.next().unwrap()); assert_eq!(Some(3), sc.drop_next().unwrap()); assert_eq!(Some("ab".into()), sc.next().unwrap()); assert_eq!(None, sc.drop_next().unwrap());
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
pub fn next_bytes(
&mut self,
max_number_of_bytes: usize
) -> Result<Option<Vec<u8, Global>>, ScannerError>
pub fn next_bytes(
&mut self,
max_number_of_bytes: usize
) -> Result<Option<Vec<u8, Global>>, ScannerError>
Read the next bytes. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("123 456\r\n789 \n\n ab ".as_bytes()); assert_eq!(Some("123".into()), sc.next_bytes(3).unwrap()); assert_eq!(Some(" 456".into()), sc.next_bytes(4).unwrap()); assert_eq!(Some("\r\n789 ".into()), sc.next_bytes(6).unwrap()); assert_eq!(Some("ab".into()), sc.next_raw().unwrap()); assert_eq!(Some(" ".into()), sc.next_bytes(2).unwrap()); assert_eq!(None, sc.next_bytes(2).unwrap());
pub fn drop_next_bytes(
&mut self,
max_number_of_bytes: usize
) -> Result<Option<usize>, ScannerError>
pub fn drop_next_bytes(
&mut self,
max_number_of_bytes: usize
) -> Result<Option<usize>, ScannerError>
Drop the next N bytes. If there is nothing to read, it will return Ok(None). If there are something to read, it will return Ok(Some(i)). The i is the length of the actually dropped bytes.
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("123 456\r\n789 \n\n ab ".as_bytes()); assert_eq!(Some(7), sc.drop_next_bytes(7).unwrap()); assert_eq!(Some("".into()), sc.next_line().unwrap()); assert_eq!(Some("789 ".into()), sc.next_line().unwrap()); assert_eq!(Some(1), sc.drop_next_bytes(1).unwrap()); assert_eq!(Some(" ab ".into()), sc.next_line().unwrap()); assert_eq!(None, sc.drop_next_bytes(1).unwrap());
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
pub fn next_until<S>(
&mut self,
boundary: S
) -> Result<Option<String>, ScannerError> where
S: AsRef<str>,
pub fn next_until<S>(
&mut self,
boundary: S
) -> Result<Option<String>, ScannerError> where
S: AsRef<str>,
Read the next text until it reaches a specific boundary. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("123 456\r\n789 \n\n ab ".as_bytes()); assert_eq!(Some("123".into()), sc.next_until(" ").unwrap()); assert_eq!(Some("456\r".into()), sc.next_until("\n").unwrap()); assert_eq!(Some("78".into()), sc.next_until("9 ").unwrap()); assert_eq!(Some("\n\n ab ".into()), sc.next_until("kk").unwrap()); assert_eq!(None, sc.next().unwrap());
Read the next data until it reaches a specific boundary without fully validating UTF-8. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("123 456\r\n789 \n\n ab ".as_bytes()); assert_eq!(Some("123".into()), sc.next_until_raw(" ").unwrap()); assert_eq!(Some("456\r".into()), sc.next_until_raw("\n").unwrap()); assert_eq!(Some("78".into()), sc.next_until_raw("9 ").unwrap()); assert_eq!(Some("\n\n ab ".into()), sc.next_until_raw("kk").unwrap()); assert_eq!(None, sc.next().unwrap());
Drop the next data until it reaches a specific boundary. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("123 456\r\n789 \n\n ab ".as_bytes()); assert_eq!(Some(7), sc.drop_next_until("\r\n").unwrap()); assert_eq!(Some("789 ".into()), sc.next_line().unwrap()); assert_eq!(Some(0), sc.drop_next_until("\n").unwrap()); assert_eq!(Some(" ab ".into()), sc.next_line().unwrap()); assert_eq!(None, sc.drop_next_until("").unwrap());
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
Try to fill up the buffer and return the immutable byte slice of the valid buffered data.
If the shift parameter is set to false, the guaranteed minimum data length of the result is 32 (if the unread data is long enough), otherwise it is BUFFER_SIZE.
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("123 456\r\n789 \n\n ab ".as_bytes()); assert_eq!("123 456\r\n789 \n\n ab ".as_bytes(), sc.peek(false).unwrap());
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
pub fn next_u8(&mut self) -> Result<Option<u8>, ScannerError>
pub fn next_u8(&mut self) -> Result<Option<u8>, ScannerError>
Read the next token separated by whitespaces and parse it to a u8 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_u8().unwrap()); assert_eq!(Some(2), sc.next_u8().unwrap());
pub fn next_u16(&mut self) -> Result<Option<u16>, ScannerError>
pub fn next_u16(&mut self) -> Result<Option<u16>, ScannerError>
Read the next token separated by whitespaces and parse it to a u16 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_u16().unwrap()); assert_eq!(Some(2), sc.next_u16().unwrap());
pub fn next_u32(&mut self) -> Result<Option<u32>, ScannerError>
pub fn next_u32(&mut self) -> Result<Option<u32>, ScannerError>
Read the next token separated by whitespaces and parse it to a u32 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_u32().unwrap()); assert_eq!(Some(2), sc.next_u32().unwrap());
pub fn next_u64(&mut self) -> Result<Option<u64>, ScannerError>
pub fn next_u64(&mut self) -> Result<Option<u64>, ScannerError>
Read the next token separated by whitespaces and parse it to a u64 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_u64().unwrap()); assert_eq!(Some(2), sc.next_u64().unwrap());
pub fn next_u128(&mut self) -> Result<Option<u128>, ScannerError>
pub fn next_u128(&mut self) -> Result<Option<u128>, ScannerError>
Read the next token separated by whitespaces and parse it to a u128 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_u128().unwrap()); assert_eq!(Some(2), sc.next_u128().unwrap());
pub fn next_usize(&mut self) -> Result<Option<usize>, ScannerError>
pub fn next_usize(&mut self) -> Result<Option<usize>, ScannerError>
Read the next token separated by whitespaces and parse it to a usize value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_usize().unwrap()); assert_eq!(Some(2), sc.next_usize().unwrap());
pub fn next_i8(&mut self) -> Result<Option<i8>, ScannerError>
pub fn next_i8(&mut self) -> Result<Option<i8>, ScannerError>
Read the next token separated by whitespaces and parse it to a i8 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_i8().unwrap()); assert_eq!(Some(2), sc.next_i8().unwrap());
pub fn next_i16(&mut self) -> Result<Option<i16>, ScannerError>
pub fn next_i16(&mut self) -> Result<Option<i16>, ScannerError>
Read the next token separated by whitespaces and parse it to a i16 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_i16().unwrap()); assert_eq!(Some(2), sc.next_i16().unwrap());
pub fn next_i32(&mut self) -> Result<Option<i32>, ScannerError>
pub fn next_i32(&mut self) -> Result<Option<i32>, ScannerError>
Read the next token separated by whitespaces and parse it to a i32 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_i32().unwrap()); assert_eq!(Some(2), sc.next_i32().unwrap());
pub fn next_i64(&mut self) -> Result<Option<i64>, ScannerError>
pub fn next_i64(&mut self) -> Result<Option<i64>, ScannerError>
Read the next token separated by whitespaces and parse it to a i64 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_i64().unwrap()); assert_eq!(Some(2), sc.next_i64().unwrap());
pub fn next_i128(&mut self) -> Result<Option<i128>, ScannerError>
pub fn next_i128(&mut self) -> Result<Option<i128>, ScannerError>
Read the next token separated by whitespaces and parse it to a i128 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_i128().unwrap()); assert_eq!(Some(2), sc.next_i128().unwrap());
pub fn next_isize(&mut self) -> Result<Option<isize>, ScannerError>
pub fn next_isize(&mut self) -> Result<Option<isize>, ScannerError>
Read the next token separated by whitespaces and parse it to a isize value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_isize().unwrap()); assert_eq!(Some(2), sc.next_isize().unwrap());
pub fn next_f32(&mut self) -> Result<Option<f32>, ScannerError>
pub fn next_f32(&mut self) -> Result<Option<f32>, ScannerError>
Read the next token separated by whitespaces and parse it to a f32 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2.5".as_bytes()); assert_eq!(Some(1.0), sc.next_f32().unwrap()); assert_eq!(Some(2.5), sc.next_f32().unwrap());
pub fn next_f64(&mut self) -> Result<Option<f64>, ScannerError>
pub fn next_f64(&mut self) -> Result<Option<f64>, ScannerError>
Read the next token separated by whitespaces and parse it to a f64 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::new("1 2.5".as_bytes()); assert_eq!(Some(1.0), sc.next_f64().unwrap()); assert_eq!(Some(2.5), sc.next_f64().unwrap());
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
impl<R, N> ScannerAscii<R, N> where
N: ArrayLength<u8> + IsGreaterOrEqual<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, Output = B1>,
R: Read,
Read the next text until it reaches a specific boundary and parse it to a u8 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_u8_until(" ").unwrap()); assert_eq!(Some(2), sc.next_u8_until(" ").unwrap());
Read the next text until it reaches a specific boundary and parse it to a u16 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_u16_until(" ").unwrap()); assert_eq!(Some(2), sc.next_u16_until(" ").unwrap());
Read the next text until it reaches a specific boundary and parse it to a u32 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_u32_until(" ").unwrap()); assert_eq!(Some(2), sc.next_u32_until(" ").unwrap());
Read the next text until it reaches a specific boundary and parse it to a u64 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_u64_until(" ").unwrap()); assert_eq!(Some(2), sc.next_u64_until(" ").unwrap());
Read the next text until it reaches a specific boundary and parse it to a u128 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_u128_until(" ").unwrap()); assert_eq!(Some(2), sc.next_u128_until(" ").unwrap());
Read the next text until it reaches a specific boundary and parse it to a usize value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_usize_until(" ").unwrap()); assert_eq!(Some(2), sc.next_usize_until(" ").unwrap());
Read the next text until it reaches a specific boundary and parse it to a i8 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_usize_until(" ").unwrap()); assert_eq!(Some(2), sc.next_usize_until(" ").unwrap());
Read the next text until it reaches a specific boundary and parse it to a i16 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_i16_until(" ").unwrap()); assert_eq!(Some(2), sc.next_i16_until(" ").unwrap());
Read the next text until it reaches a specific boundary and parse it to a i32 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_i32_until(" ").unwrap()); assert_eq!(Some(2), sc.next_i32_until(" ").unwrap());
Read the next text until it reaches a specific boundary and parse it to a i64 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_i64_until(" ").unwrap()); assert_eq!(Some(2), sc.next_i64_until(" ").unwrap());
Read the next text until it reaches a specific boundary and parse it to a i128 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_i128_until(" ").unwrap()); assert_eq!(Some(2), sc.next_i128_until(" ").unwrap());
Read the next text until it reaches a specific boundary and parse it to a isize value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2".as_bytes()); assert_eq!(Some(1), sc.next_isize_until(" ").unwrap()); assert_eq!(Some(2), sc.next_isize_until(" ").unwrap());
Read the next text until it reaches a specific boundary and parse it to a f32 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2.5".as_bytes()); assert_eq!(Some(1.0), sc.next_f32_until(" ").unwrap()); assert_eq!(Some(2.5), sc.next_f32_until(" ").unwrap());
Read the next text until it reaches a specific boundary and parse it to a f64 value. If there is nothing to read, it will return Ok(None).
extern crate scanner_rust; use scanner_rust::ScannerAscii; let mut sc = ScannerAscii::new("1 2.5".as_bytes()); assert_eq!(Some(1.0), sc.next_f64_until(" ").unwrap()); assert_eq!(Some(2.5), sc.next_f64_until(" ").unwrap());
Trait Implementations
Auto Trait Implementations
impl<R, N> RefUnwindSafe for ScannerAscii<R, N> where
R: RefUnwindSafe,
<N as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
impl<R, N> Send for ScannerAscii<R, N> where
R: Send,
impl<R, N> Sync for ScannerAscii<R, N> where
R: Sync,
impl<R, N> Unpin for ScannerAscii<R, N> where
R: Unpin,
<N as ArrayLength<u8>>::ArrayType: Unpin,
impl<R, N> UnwindSafe for ScannerAscii<R, N> where
R: UnwindSafe,
<N as ArrayLength<u8>>::ArrayType: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self into a collection.