pub struct ExtensionRegistry<B>where
B: TensorBackend + 'static,{ /* private fields */ }Expand description
Registry of backend-specific extension runtime executors.
Implementations§
Source§impl<B> ExtensionRegistry<B>where
B: TensorBackend + 'static,
impl<B> ExtensionRegistry<B>where
B: TensorBackend + 'static,
Sourcepub fn new() -> ExtensionRegistry<B>
pub fn new() -> ExtensionRegistry<B>
Create an empty extension runtime registry.
§Examples
use tenferro_runtime::ExtensionRegistry;
use tenferro_cpu::CpuBackend;
let registry = ExtensionRegistry::<CpuBackend>::new();
assert!(!registry.contains("example.identity.v1"));Sourcepub fn register(
&mut self,
executor: Arc<dyn ExtensionRuntime<B>>,
) -> Result<(), ExtensionRuntimeRegistryError>
pub fn register( &mut self, executor: Arc<dyn ExtensionRuntime<B>>, ) -> Result<(), ExtensionRuntimeRegistryError>
Register one runtime executor.
Registration is idempotent by family id: registering the same extension family more than once succeeds and keeps the first runtime. This lets extension crates register their own dependency extensions defensively.
Sourcepub fn get(&self, family_id: &str) -> Option<Arc<dyn ExtensionRuntime<B>>>
pub fn get(&self, family_id: &str) -> Option<Arc<dyn ExtensionRuntime<B>>>
Look up an executor by extension family id.
Trait Implementations§
Source§impl<B> Debug for ExtensionRegistry<B>where
B: TensorBackend + 'static,
impl<B> Debug for ExtensionRegistry<B>where
B: TensorBackend + 'static,
Source§impl<B> Default for ExtensionRegistry<B>where
B: TensorBackend + 'static,
impl<B> Default for ExtensionRegistry<B>where
B: TensorBackend + 'static,
Source§fn default() -> ExtensionRegistry<B>
fn default() -> ExtensionRegistry<B>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<B> Freeze for ExtensionRegistry<B>
impl<B> !RefUnwindSafe for ExtensionRegistry<B>
impl<B> Send for ExtensionRegistry<B>
impl<B> Sync for ExtensionRegistry<B>
impl<B> Unpin for ExtensionRegistry<B>
impl<B> UnsafeUnpin for ExtensionRegistry<B>
impl<B> !UnwindSafe for ExtensionRegistry<B>
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
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
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>
Converts
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>
Converts
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