Struct scrapmetal::Query [] [src]

pub struct Query<Q, U, D, R> where
    Q: FnMut(&U) -> R,
    D: FnMut() -> R, 
{ /* fields omitted */ }

A query non-destructively creates some value R from references to a U. It can be called on values of any type T, not just on values of type U, so it requires a default R value for when it is called on values which are not a T.

This essentially lifts a FnMut(&U) -> R into a for<T> FnMut(&T) -> R.

Methods

impl<Q, U, R> Query<Q, U, fn() -> R, R> where
    Q: FnMut(&U) -> R,
    R: Default
[src]

Construct a new Query, returning R::default() for the cases where we query a value whose type is not U.

impl<Q, U, D, R> Query<Q, U, D, R> where
    Q: FnMut(&U) -> R,
    D: FnMut() -> R, 
[src]

Construct a new Query, returning make_default() for the cases where we query a value whose type is not U.

Trait Implementations

impl<Q: Debug, U: Debug, D: Debug, R: Debug> Debug for Query<Q, U, D, R> where
    Q: FnMut(&U) -> R,
    D: FnMut() -> R, 
[src]

Formats the value using the given formatter.

impl<Q, U, D, R> GenericQuery<R> for Query<Q, U, D, R> where
    Q: FnMut(&U) -> R,
    D: FnMut() -> R, 
[src]

Call the query function on any T.