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.

Methods

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

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

Creates a new search.

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

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

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

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

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

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

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

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

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

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

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

Reads next as bool value.

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

Reads next as f64 value.

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

Reads next as string value.

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

Reads next as node.

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

Reads next as end node.