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
impl QueryRuntimeBuilder
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 build(self) -> QueryRuntime
pub fn build(self) -> QueryRuntime
Build the runtime with the configured settings.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QueryRuntimeBuilder
impl RefUnwindSafe for QueryRuntimeBuilder
impl Send for QueryRuntimeBuilder
impl Sync for QueryRuntimeBuilder
impl Unpin for QueryRuntimeBuilder
impl UnwindSafe for QueryRuntimeBuilder
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