Struct piston_meta_search::Search[][src]

pub struct Search<'a> {
    pub range: Option<Range>,
    pub data: &'a [Range<MetaData>],
}

Used to search through meta data.

Fields

range: Option<Range>

The previous range of search. Used in errors if there is no meta data left.

data: &'a [Range<MetaData>]

The data to search.

Implementations

impl<'a> Search<'a>[src]

pub fn new(data: &'a [Range<MetaData>]) -> Search<'a>[src]

Creates a new search.

pub fn for_string<T, F>(
    &'a self,
    name: &str,
    val: &str,
    f: F
) -> Result<T, Range<ParseError>> where
    F: FnOnce(Search<'a>) -> Result<T, Range<ParseError>>, 
[src]

Searches anywhere in meta data for a string. Calls closure on the first match.

pub fn for_f64<T, F>(
    &'a self,
    name: &str,
    val: f64,
    f: F
) -> Result<T, Range<ParseError>> where
    F: FnOnce(Search<'a>) -> Result<T, Range<ParseError>>, 
[src]

Searches anywhere in meta data for a f64. Calls closure on the first match.

pub fn for_bool<T, F>(
    &'a self,
    name: &str,
    val: bool,
    f: F
) -> Result<T, Range<ParseError>> where
    F: FnOnce(Search<'a>) -> Result<T, Range<ParseError>>, 
[src]

Searches anywhere in meta data for a bool. Calls closure on the first match.

pub fn for_node<T, F>(
    &'a self,
    name: &str,
    f: F
) -> Result<T, Range<ParseError>> where
    F: FnOnce(Search<'a>) -> Result<T, Range<ParseError>>, 
[src]

Searches anywhere in meta data for a node. Calls closure on the first match.

pub fn for_end_node<T, F>(
    &'a self,
    name: &str,
    f: F
) -> Result<T, Range<ParseError>> where
    F: FnOnce(Search<'a>) -> Result<T, Range<ParseError>>, 
[src]

Searches anywhere in meta data for an end node. Calls closure on the first match.

pub fn bool(&mut self, name: &str) -> Result<bool, Range<ParseError>>[src]

Reads next as bool value.

pub fn f64(&mut self, name: &str) -> Result<f64, Range<ParseError>>[src]

Reads next as f64 value.

pub fn string(&mut self, name: &str) -> Result<Arc<String>, Range<ParseError>>[src]

Reads next as string value.

pub fn node(&mut self, name: &str) -> Result<(), Range<ParseError>>[src]

Reads next as node.

pub fn end_node(&mut self, name: &str) -> Result<(), Range<ParseError>>[src]

Reads next as end node.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Search<'a>

impl<'a> Send for Search<'a>

impl<'a> Sync for Search<'a>

impl<'a> Unpin for Search<'a>

impl<'a> UnwindSafe for Search<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.