Struct parse_zoneinfo::line::LineParser

source ·
pub struct LineParser { /* private fields */ }

Implementations§

source§

impl LineParser

source

pub fn new() -> Self

👎Deprecated
source

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§

source§

impl Default for LineParser

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.