pub struct Registry { /* private fields */ }Expand description
Process-wide registry of registered backends.
Backends are registered by their canonical short name (the same
string the Python BACKEND_REGISTRY uses — verified by the
Fase 24.j drift gate). Lookup is O(1) HashMap.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Empty registry — useful for tests that want to register only stub backends.
Sourcepub fn production() -> Self
pub fn production() -> Self
Production registry — populated with all 7 native backends.
Every backend is constructed via its from_env() factory — i.e.
API keys are read at registry-construction time from the
per-provider env vars (ANTHROPIC_API_KEY, OPENAI_API_KEY,
GEMINI_API_KEY, KIMI_API_KEY, GLM_API_KEY, OPENROUTER_API_KEY,
plus OLLAMA_HOST / OLLAMA_API_KEY for the local daemon).
Backends whose env var is missing still construct successfully;
the auth check fires on the first complete() call instead.
The registry’s provider_names() returns the sorted list of all
7 keys: ["anthropic", "gemini", "glm", "kimi", "ollama", "openai", "openrouter"]. The Fase 24.j drift gate
(tests/test_fase24_backend_parity.py) asserts this set
matches Python’s BACKEND_REGISTRY keys exactly.
Sourcepub fn production_with_stub() -> Self
pub fn production_with_stub() -> Self
§Fase 33.x.b — Production registry PLUS the stub backend.
Used by the server streaming path so dispatch through the
uniform Registry surface includes the stub. The 7 canonical
production backends are unchanged; stub is added as an 8th
entry. The Fase 24.j cross-stack drift gate continues to pin
the 7 canonical entries exactly via filesystem enumeration of
axon-rs/src/backends/*.rs minus the SHARED_INFRA_MODULES
set (which includes stub).
Adopters who call Registry::production() directly do not
see the stub — it surfaces only on the streaming-path
dispatcher, where its content matches the legacy synchronous
stub-mode output byte-for-byte (D4 wire byte-compat).
Source§impl Registry
impl Registry
Sourcepub fn register(&mut self, backend: Box<dyn Backend>)
pub fn register(&mut self, backend: Box<dyn Backend>)
Register backend under the key backend.name(). Replaces any
existing entry with the same name (last-write-wins).
Sourcepub fn get(&self, name: &str) -> Option<&dyn Backend>
pub fn get(&self, name: &str) -> Option<&dyn Backend>
Look up a backend by name. Returns None if not registered.
Sourcepub fn provider_names(&self) -> Vec<String>
pub fn provider_names(&self) -> Vec<String>
All registered provider names, sorted alphabetically. Used by
the cross-stack drift gate (Fase 24.j) to verify the Rust set
equals the Python BACKEND_REGISTRY set.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Registry
impl !UnwindSafe for Registry
impl Freeze for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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