pub struct QueryRuntimeBuilder<T: Tracer = NoopTracer> { /* 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<T: Tracer> QueryRuntimeBuilder<T>
impl<T: Tracer> QueryRuntimeBuilder<T>
Sourcepub fn error_comparator(self, f: ErrorComparator) -> Self
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();Sourcepub fn tracer<U: Tracer>(self, tracer: U) -> QueryRuntimeBuilder<U>
pub fn tracer<U: Tracer>(self, tracer: U) -> QueryRuntimeBuilder<U>
Set the tracer for observability.
Sourcepub fn build(self) -> QueryRuntime<T>
pub fn build(self) -> QueryRuntime<T>
Build the runtime with the configured settings.
Trait Implementations§
Source§impl Default for QueryRuntimeBuilder<NoopTracer>
impl Default for QueryRuntimeBuilder<NoopTracer>
Auto Trait Implementations§
impl<T> Freeze for QueryRuntimeBuilder<T>where
T: Freeze,
impl<T> RefUnwindSafe for QueryRuntimeBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for QueryRuntimeBuilder<T>
impl<T> Sync for QueryRuntimeBuilder<T>
impl<T> Unpin for QueryRuntimeBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for QueryRuntimeBuilder<T>where
T: UnwindSafe,
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