LockView

Struct LockView 

Source
pub struct LockView<'a, T, L, F>
where T: 'static, L: LockValue<T> + 'a, F: Fn(&LockQuery<'a, T, L>) -> LockQuery<'a, T, L>,
{ /* private fields */ }
Expand description

A reusable query pattern (like a SQL VIEW).

Views encapsulate query logic that can be reused across multiple queries.

Implementations§

Source§

impl<'a, T, L, F> LockView<'a, T, L, F>
where T: 'static, L: LockValue<T> + 'a, F: Fn(&LockQuery<'a, T, L>) -> LockQuery<'a, T, L>,

Source

pub fn new(builder: F) -> LockView<'a, T, L, F>

Create a new view with a query builder function.

§Example
let expensive_view = LockView::new(|query| {
    query.where_(Product::price(), |&p| p > 500.0)
});
Source

pub fn apply(&self, base: &LockQuery<'a, T, L>) -> LockQuery<'a, T, L>
where T: Clone, L: Clone,

Apply the view to a base query.

Auto Trait Implementations§

§

impl<'a, T, L, F> Freeze for LockView<'a, T, L, F>
where F: Freeze,

§

impl<'a, T, L, F> RefUnwindSafe for LockView<'a, T, L, F>

§

impl<'a, T, L, F> Send for LockView<'a, T, L, F>
where F: Send, L: Send, T: Sync,

§

impl<'a, T, L, F> Sync for LockView<'a, T, L, F>
where F: Sync, L: Sync, T: Sync,

§

impl<'a, T, L, F> Unpin for LockView<'a, T, L, F>
where F: Unpin, L: Unpin,

§

impl<'a, T, L, F> UnwindSafe for LockView<'a, T, L, F>

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.