Struct Parser

Source
pub struct Parser<T: Clone> { /* private fields */ }

Implementations§

Source§

impl<T: Clone> Parser<T>

Source

pub fn new(f: Rc<HandleLine<T>>) -> Self

Source

pub fn parse<'a>(&mut self, data: &'a str) -> Lines<'a>

Source

pub fn iter<'a>(&mut self, data: &'a str) -> TydIterator<'a, T>

Examples found in repository?
examples/parse.rs (line 199)
184fn main() -> io::Result<()> {
185    //let s = ",}},}}},}";
186
187    //.inspect
188    //.find
189
190    //let count = rcount_ends_with(s, &["}", ",}", "},"]);
191    //println!("{:?} {}", count, s);
192
193    let raw = std::fs::read("examples/components")?;
194    let data = String::from_utf8_lossy(&raw);
195
196    let default_uses = String::new();
197
198    let mut parser = tyd::parser(&parse_line);
199    for (state, line) in parser.iter(&data) {
200        println!("{:?}", state)
201    }
202
203    Ok(())
204}

Auto Trait Implementations§

§

impl<T> Freeze for Parser<T>

§

impl<T> !RefUnwindSafe for Parser<T>

§

impl<T> !Send for Parser<T>

§

impl<T> !Sync for Parser<T>

§

impl<T> Unpin for Parser<T>

§

impl<T> !UnwindSafe for Parser<T>

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>,

Source§

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>,

Source§

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.