pub struct ResolverRegistry { /* private fields */ }Expand description
A registry of named async resolvers, bound to a ConversationSpec’s
declared resolver slots at load time via
Conversation::from_spec_with_resolvers.
This is what makes a JSON spec a complete deployable unit: the spec carries the declarations (slot, resolver name, args, ttl) and the registry supplies the implementations.
let registry = ResolverRegistry::new()
.with("availability", |args| async move {
let _ = args;
Ok(serde_json::json!({ "open": true }))
});
let convo = Conversation::from_spec_with_resolvers(spec, ®istry)?;Implementations§
Source§impl ResolverRegistry
impl ResolverRegistry
Sourcepub fn with<F, Fut>(self, name: impl Into<String>, fetch: F) -> Self
pub fn with<F, Fut>(self, name: impl Into<String>, fetch: F) -> Self
Register an async resolver under name (builder style).
Sourcepub fn add<F, Fut>(&mut self, name: impl Into<String>, fetch: F)
pub fn add<F, Fut>(&mut self, name: impl Into<String>, fetch: F)
Register an async resolver under name.
Sourcepub fn stubbing(spec: &ConversationSpec) -> Self
pub fn stubbing(spec: &ConversationSpec) -> Self
A registry that stubs every resolver declared anywhere in spec (stages
and overlays) with a no-op returning JSON null.
For structural validation and deterministic simulation, the resolver
implementations are irrelevant — a resolver is an external fetch, so in
a model-free test its output is supplied via a scenario set step (like
a tool result via tool_ok), and the stub is never actually invoked when
the slot is pre-set. Real implementations bind at deploy time via
Conversation::from_spec_with_resolvers.
Trait Implementations§
Source§impl Clone for ResolverRegistry
impl Clone for ResolverRegistry
Source§fn clone(&self) -> ResolverRegistry
fn clone(&self) -> ResolverRegistry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for ResolverRegistry
impl Default for ResolverRegistry
Source§fn default() -> ResolverRegistry
fn default() -> ResolverRegistry
Auto Trait Implementations§
impl Freeze for ResolverRegistry
impl !RefUnwindSafe for ResolverRegistry
impl Send for ResolverRegistry
impl Sync for ResolverRegistry
impl Unpin for ResolverRegistry
impl !UnwindSafe for ResolverRegistry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].