pub struct TypedRegistryBuilder<T, E> { /* private fields */ }Expand description
Mutable builder for TypedRegistry. Immutable after build().
Implementations§
Source§impl<T, E> TypedRegistryBuilder<T, E>
impl<T, E> TypedRegistryBuilder<T, E>
pub fn new() -> Self
Sourcepub fn register(
self,
type_url: &str,
factory: impl Fn(&Value) -> Result<T, E> + Send + Sync + 'static,
) -> Self
pub fn register( self, type_url: &str, factory: impl Fn(&Value) -> Result<T, E> + Send + Sync + 'static, ) -> Self
Register a factory for a type URL. Last registration wins on duplicate.
Sourcepub fn register_unique(
self,
type_url: &str,
factory: impl Fn(&Value) -> Result<T, E> + Send + Sync + 'static,
) -> Self
pub fn register_unique( self, type_url: &str, factory: impl Fn(&Value) -> Result<T, E> + Send + Sync + 'static, ) -> Self
Register a factory, panicking if the type URL is already registered.
Use this for distributed registration (e.g. inventory::submit!)
where duplicates indicate a configuration error.
Sourcepub fn contains(&self, type_url: &str) -> bool
pub fn contains(&self, type_url: &str) -> bool
Returns true if a factory is registered for this type URL.
Sourcepub fn build(self) -> TypedRegistry<T, E>
pub fn build(self) -> TypedRegistry<T, E>
Freeze the registry. No further registrations possible.
Trait Implementations§
Auto Trait Implementations§
impl<T, E> Freeze for TypedRegistryBuilder<T, E>
impl<T, E> !RefUnwindSafe for TypedRegistryBuilder<T, E>
impl<T, E> Send for TypedRegistryBuilder<T, E>
impl<T, E> Sync for TypedRegistryBuilder<T, E>
impl<T, E> Unpin for TypedRegistryBuilder<T, E>
impl<T, E> UnsafeUnpin for TypedRegistryBuilder<T, E>
impl<T, E> !UnwindSafe for TypedRegistryBuilder<T, E>
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