Skip to main content

Brackets

Struct Brackets 

Source
pub struct Brackets<F, I> { /* private fields */ }
Expand description

A Stream that matches nested brackets.

Note that this is not a Parse implementation, because it is recursive.

Implementations§

Source§

impl<F: Fn(Vec<Token>) -> Box<dyn Tree>, I: Stream> Brackets<F, I>

Source

pub fn new(open: char, close: char, new_bracket: F, input: I) -> Self

Construct a Brackets.

  • open - the char used to open a bracket.
  • close - the char used to close a bracket.
  • new_bracket - turns bracket contents into a bracket value. The bracket contents are read from Self.
  • input - a Stream that contains chars.

Trait Implementations§

Source§

impl<F: Fn(Vec<Token>) -> Box<dyn Tree>, I: Stream> Stream for Brackets<F, I>

Source§

fn read(&mut self) -> Token

Read a single Token.
Source§

fn read_all(self) -> Vec<Token>
where Self: Sized,

Read and return all Tokens upto EndOfFile, which is discarded.

Auto Trait Implementations§

§

impl<F, I> Freeze for Brackets<F, I>
where F: Freeze, I: Freeze,

§

impl<F, I> RefUnwindSafe for Brackets<F, I>

§

impl<F, I> Send for Brackets<F, I>
where F: Send, I: Send,

§

impl<F, I> Sync for Brackets<F, I>
where F: Sync, I: Sync,

§

impl<F, I> Unpin for Brackets<F, I>
where F: Unpin, I: Unpin,

§

impl<F, I> UnsafeUnpin for Brackets<F, I>
where F: UnsafeUnpin, I: UnsafeUnpin,

§

impl<F, I> UnwindSafe for Brackets<F, I>
where F: UnwindSafe, I: UnwindSafe,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.