pub struct AdapterRegistry { /* private fields */ }Expand description
Registry of named adapter factories, one map per AdapterStage.
Built-in adapter type ids match the adapter_type field of schema-v2
model entries (e.g. "powerset-v1", "silero", "wespeaker-resnet34",
"ahc", "vbx", "plda", "cosine"). Version aliases such as "latest"
resolve to a pinned id and are logged for DER reproducibility.
Implementations§
Source§impl AdapterRegistry
impl AdapterRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Empty registry — no built-ins. Prefer Self::with_builtins for the
production set of known type names.
Sourcepub fn with_builtins() -> Self
pub fn with_builtins() -> Self
Registry pre-loaded with the shipped adapter type ids.
Factories are name markers only: they return a BuiltinAdapter
handle recording the type id. Concrete ONNX construction stays in the
existing stage modules / pipeline builder so this registry never pulls
model files or changes DER behaviour.
Sourcepub fn register(
&mut self,
stage: AdapterStage,
adapter_type: impl Into<String>,
factory: AdapterFactory,
) -> Result<(), AdapterError>
pub fn register( &mut self, stage: AdapterStage, adapter_type: impl Into<String>, factory: AdapterFactory, ) -> Result<(), AdapterError>
Register an external adapter factory under adapter_type for stage.
Returns AdapterError::AlreadyRegistered if the id is taken — use a
distinct name or call Self::register_or_replace.
Sourcepub fn register_or_replace(
&mut self,
stage: AdapterStage,
adapter_type: impl Into<String>,
factory: AdapterFactory,
)
pub fn register_or_replace( &mut self, stage: AdapterStage, adapter_type: impl Into<String>, factory: AdapterFactory, )
Like Self::register but overwrites an existing entry.
Sourcepub fn register_alias(
&mut self,
stage: AdapterStage,
alias: impl Into<String>,
target: impl Into<String>,
) -> Result<(), AdapterError>
pub fn register_alias( &mut self, stage: AdapterStage, alias: impl Into<String>, target: impl Into<String>, ) -> Result<(), AdapterError>
Pin a version alias ("latest", "v1", …) to a registered adapter type.
Sourcepub fn resolve(
&self,
stage: AdapterStage,
id_or_alias: &str,
) -> Result<String, AdapterError>
pub fn resolve( &self, stage: AdapterStage, id_or_alias: &str, ) -> Result<String, AdapterError>
Resolve id_or_alias to a concrete registered adapter type id.
Alias resolution is logged at info so DER reports can record which
pin was actually used. Returns an owned String so both direct ids and
alias targets share a single return type without lifetime coupling.
Sourcepub fn create(
&self,
stage: AdapterStage,
id_or_alias: &str,
) -> Result<Box<dyn Any + Send + Sync>, AdapterError>
pub fn create( &self, stage: AdapterStage, id_or_alias: &str, ) -> Result<Box<dyn Any + Send + Sync>, AdapterError>
Create an adapter instance for id_or_alias (alias-resolved).
Sourcepub fn contains(&self, stage: AdapterStage, adapter_type: &str) -> bool
pub fn contains(&self, stage: AdapterStage, adapter_type: &str) -> bool
True if adapter_type is registered (aliases do not count).
Sourcepub fn registered(&self) -> impl Iterator<Item = (AdapterStage, &str)> + '_
pub fn registered(&self) -> impl Iterator<Item = (AdapterStage, &str)> + '_
Iterate registered (stage, adapter_type) pairs.
Trait Implementations§
Source§impl Clone for AdapterRegistry
impl Clone for AdapterRegistry
Source§fn clone(&self) -> AdapterRegistry
fn clone(&self) -> AdapterRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for AdapterRegistry
impl Default for AdapterRegistry
Source§fn default() -> AdapterRegistry
fn default() -> AdapterRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for AdapterRegistry
impl !UnwindSafe for AdapterRegistry
impl Freeze for AdapterRegistry
impl Send for AdapterRegistry
impl Sync for AdapterRegistry
impl Unpin for AdapterRegistry
impl UnsafeUnpin for AdapterRegistry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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