pub struct TextTape<'a> { /* private fields */ }
Expand description
Houses the tape of tokens that is extracted from plaintext data
Implementations§
source§impl<'a> TextTape<'a>
impl<'a> TextTape<'a>
sourcepub fn windows1252_reader(&self) -> ObjectReader<'_, '_, Windows1252Encoding>
pub fn windows1252_reader(&self) -> ObjectReader<'_, '_, Windows1252Encoding>
Creates a windows 1252 object reader from the parsed tape
sourcepub fn utf8_reader(&self) -> ObjectReader<'_, '_, Utf8Encoding>
pub fn utf8_reader(&self) -> ObjectReader<'_, '_, Utf8Encoding>
Creates a utf-8 object reader from the parsed tape
source§impl<'a> TextTape<'a>
impl<'a> TextTape<'a>
sourcepub fn from_slice(data: &[u8]) -> Result<TextTape<'_>, Error>
pub fn from_slice(data: &[u8]) -> Result<TextTape<'_>, Error>
Convenience method for creating a text parser and parsing the given input
Examples found in repository?
src/text/de.rs (line 181)
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
pub fn from_windows1252_slice<'a, T>(data: &'a [u8]) -> Result<T, Error>
where
T: Deserialize<'a>,
{
let tape = TextTape::from_slice(data)?;
TextDeserializer::from_windows1252_tape(&tape)
}
/// Deserialize the given text tape assuming quoted strings are windows1252 encoded.
pub fn from_windows1252_tape<'a, T>(tape: &TextTape<'a>) -> Result<T, Error>
where
T: Deserialize<'a>,
{
Self::from_encoded_tape(tape, Windows1252Encoding::new())
}
/// Convenience method for parsing the given text data and deserializing as utf8 encoded.
pub fn from_utf8_slice<'a, T>(data: &'a [u8]) -> Result<T, Error>
where
T: Deserialize<'a>,
{
let tape = TextTape::from_slice(data)?;
TextDeserializer::from_utf8_tape(&tape)
}
sourcepub fn parser() -> TextTapeParser
pub fn parser() -> TextTapeParser
Returns a parser for text data