pub struct TextParser;Expand description
Text parser for extracting structured data from text
Implementations§
Source§impl TextParser
impl TextParser
Sourcepub fn tokenize(text: &str, delimiters: &[char]) -> Vec<String>
pub fn tokenize(text: &str, delimiters: &[char]) -> Vec<String>
Split text into tokens using various delimiters
Sourcepub fn extract_numbers(text: &str) -> Vec<f64>
pub fn extract_numbers(text: &str) -> Vec<f64>
Extract numbers from text
Sourcepub fn extract_key_value_pairs(
text: &str,
pair_delimiter: char,
kv_delimiter: char,
) -> HashMap<String, String>
pub fn extract_key_value_pairs( text: &str, pair_delimiter: char, kv_delimiter: char, ) -> HashMap<String, String>
Extract key-value pairs from text
Sourcepub fn parse_structured_lines<F, T>(
lines: &[String],
parser: F,
) -> UtilsResult<Vec<T>>
pub fn parse_structured_lines<F, T>( lines: &[String], parser: F, ) -> UtilsResult<Vec<T>>
Parse structured text lines (e.g., log files)
Auto Trait Implementations§
impl Freeze for TextParser
impl RefUnwindSafe for TextParser
impl Send for TextParser
impl Sync for TextParser
impl Unpin for TextParser
impl UnwindSafe for TextParser
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more