QueryRuntimeBuilder

Struct QueryRuntimeBuilder 

Source
pub struct QueryRuntimeBuilder { /* private fields */ }
Expand description

Builder for QueryRuntime with customizable settings.

§Example

let runtime = QueryRuntime::builder()
    .error_comparator(|a, b| {
        // Treat all errors of the same type as equal
        a.downcast_ref::<std::io::Error>().is_some()
            == b.downcast_ref::<std::io::Error>().is_some()
    })
    .build();

Implementations§

Source§

impl QueryRuntimeBuilder

Source

pub fn new() -> Self

Create a new builder with default settings.

Source

pub fn error_comparator(self, f: ErrorComparator) -> Self

Set the error comparator function for early cutoff optimization.

When a query returns QueryError::UserError, this function is used to compare it with the previously cached error. If they are equal, downstream queries can skip recomputation (early cutoff).

The default comparator returns false for all errors, meaning errors are always considered different (conservative, always recomputes).

§Example
// Treat errors as equal if they have the same display message
let runtime = QueryRuntime::builder()
    .error_comparator(|a, b| a.to_string() == b.to_string())
    .build();
Source

pub fn build(self) -> QueryRuntime

Build the runtime with the configured settings.

Trait Implementations§

Source§

impl Default for QueryRuntimeBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.