Struct parse_zoneinfo::line::LineParser
source · pub struct LineParser { /* private fields */ }
Implementations§
source§impl LineParser
impl LineParser
pub fn new() -> Self
👎Deprecated
sourcepub fn parse_str<'a>(&self, input: &'a str) -> Result<Line<'a>, Error>
pub fn parse_str<'a>(&self, input: &'a str) -> Result<Line<'a>, Error>
Attempt to parse this line, returning a Line
depending on what
type of line it was, or an Error
if it couldn’t be parsed.
Examples found in repository?
examples/benchmark.rs (line 13)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
fn main() {
let asia = std::fs::read_to_string("examples/asia").unwrap();
for _ in 0..100 {
let parser = LineParser::default();
let mut builder = TableBuilder::new();
for line in asia.lines() {
match parser.parse_str(line).unwrap() {
Line::Zone(zone) => builder.add_zone_line(zone).unwrap(),
Line::Continuation(cont) => builder.add_continuation_line(cont).unwrap(),
Line::Rule(rule) => builder.add_rule_line(rule).unwrap(),
Line::Link(link) => builder.add_link_line(link).unwrap(),
Line::Space => {}
}
}
let _table = builder.build();
}
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LineParser
impl RefUnwindSafe for LineParser
impl Send for LineParser
impl Sync for LineParser
impl Unpin for LineParser
impl UnwindSafe for LineParser
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