Trait RecurseQuery

Source
pub trait RecurseQuery<C, V> {
    // Required methods
    fn program(&self) -> &Program;
    fn execute_with_context(
        &self,
        document: &mut Documents,
        context: &DynamicContext<'_>,
        recurse: &Recurse<'_, V>,
    ) -> Result<C>;

    // Provided methods
    fn static_context(&self) -> &StaticContext { ... }
    fn dynamic_context_builder(
        &self,
        document: &Documents,
    ) -> DynamicContextBuilder<'_> { ... }
    fn execute(
        &self,
        document: &mut Documents,
        item: &Item,
        recurse: &Recurse<'_, V>,
    ) -> Result<C> { ... }
    fn execute_build_context(
        &self,
        document: &mut Documents,
        recurse: &Recurse<'_, V>,
        build: impl FnOnce(&mut DynamicContextBuilder<'_>),
    ) -> Result<C> { ... }
}
Expand description

A recursive query that can be executed against an Itemable

It gives back a result of type V

Required Methods§

Source

fn program(&self) -> &Program

Get the program for the query

Source

fn execute_with_context( &self, document: &mut Documents, context: &DynamicContext<'_>, recurse: &Recurse<'_, V>, ) -> Result<C>

Execute the query against an itemable, with context.

To do the conversion pass in a Recurse object. This allows you to use a convert function recursively.

Provided Methods§

Source

fn static_context(&self) -> &StaticContext

Get the static context for the query.

Source

fn dynamic_context_builder( &self, document: &Documents, ) -> DynamicContextBuilder<'_>

Get a dynamic context builder for the query, configured with the query’s static context and the document’s documents.

You can use this if you want to construct your own dynamic context to use with execute_with_context.

Source

fn execute( &self, document: &mut Documents, item: &Item, recurse: &Recurse<'_, V>, ) -> Result<C>

Execute the query against an itemable.

To do the conversion pass in a Recurse object. This allows you to use a convert function recursively.

Source

fn execute_build_context( &self, document: &mut Documents, recurse: &Recurse<'_, V>, build: impl FnOnce(&mut DynamicContextBuilder<'_>), ) -> Result<C>

Execute a query against an itemable, building the context.

This is useful if you want to build a dynamic context with specific settings (such as variables), and then execute a query against it.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§