pub struct MapQuery<V, T, Q: Query<V> + Sized, F>{ /* private fields */ }Expand description
A query maps the result of another query to a different type.
Implementations§
Source§impl<V, T, Q, F> MapQuery<V, T, Q, F>where
Q: Query<V> + Sized,
F: Fn(V, &mut Documents, &DynamicContext<'_>) -> SpannedResult<T> + Clone,
impl<V, T, Q, F> MapQuery<V, T, Q, F>where
Q: Query<V> + Sized,
F: Fn(V, &mut Documents, &DynamicContext<'_>) -> SpannedResult<T> + Clone,
Sourcepub fn execute(&self, document: &mut Documents, item: &Item) -> Result<T>
pub fn execute(&self, document: &mut Documents, item: &Item) -> Result<T>
Execute the query against an item.
Sourcepub fn execute_with_context(
&self,
document: &mut Documents,
context: &DynamicContext<'_>,
) -> Result<T>
pub fn execute_with_context( &self, document: &mut Documents, context: &DynamicContext<'_>, ) -> Result<T>
Execute the query against a dynamic context.
Trait Implementations§
Source§impl<V, T, Q: Query<V> + Sized, F> Query<T> for MapQuery<V, T, Q, F>
impl<V, T, Q: Query<V> + Sized, F> Query<T> for MapQuery<V, T, Q, F>
Source§fn execute_with_context(
&self,
document: &mut Documents,
context: &DynamicContext<'_>,
) -> Result<T>
fn execute_with_context( &self, document: &mut Documents, context: &DynamicContext<'_>, ) -> Result<T>
Execute the query against a dynamic context Read more
Source§fn static_context(&self) -> &StaticContext
fn static_context(&self) -> &StaticContext
Get the static context for the query.
Source§fn dynamic_context_builder(
&self,
documents: &Documents,
) -> DynamicContextBuilder<'_>
fn dynamic_context_builder( &self, documents: &Documents, ) -> DynamicContextBuilder<'_>
Get a dynamic context builder for the query, configured with the
query’s static context and the document’s documents. Read more
Source§fn map<T, F>(self, f: F) -> MapQuery<V, T, Self, F>
fn map<T, F>(self, f: F) -> MapQuery<V, T, Self, F>
Map the the result of the query to a different type. Read more
Source§fn execute(&self, documents: &mut Documents, item: impl Itemable) -> Result<V>
fn execute(&self, documents: &mut Documents, item: impl Itemable) -> Result<V>
Excute the query against an itemable
Source§fn execute_build_context(
&self,
documents: &mut Documents,
build: impl FnOnce(&mut DynamicContextBuilder<'_>),
) -> Result<V>
fn execute_build_context( &self, documents: &mut Documents, build: impl FnOnce(&mut DynamicContextBuilder<'_>), ) -> Result<V>
Execute a query with a specific dynamic context. Read more
Auto Trait Implementations§
impl<V, T, Q, F> Freeze for MapQuery<V, T, Q, F>
impl<V, T, Q, F> RefUnwindSafe for MapQuery<V, T, Q, F>
impl<V, T, Q, F> Send for MapQuery<V, T, Q, F>
impl<V, T, Q, F> Sync for MapQuery<V, T, Q, F>
impl<V, T, Q, F> Unpin for MapQuery<V, T, Q, F>
impl<V, T, Q, F> UnwindSafe for MapQuery<V, T, Q, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more