pub struct ProviderRegistry { /* private fields */ }Expand description
Registry of available hash providers, keyed by algorithm prefix.
The registry allows multiple algorithms to coexist. New providers can be
registered at startup or at runtime. The active algorithm (used for new
content) is determined by HashConfig.active_algorithm.
Implementations§
Source§impl ProviderRegistry
impl ProviderRegistry
Sourcepub fn register(&mut self, provider: Box<dyn HashProvider>)
pub fn register(&mut self, provider: Box<dyn HashProvider>)
Register a new hash provider under its algorithm prefix.
Sourcepub fn get(&self, prefix: &str) -> Option<&dyn HashProvider>
pub fn get(&self, prefix: &str) -> Option<&dyn HashProvider>
Look up a provider by algorithm prefix.
Sourcepub fn active(&self, active_prefix: &str) -> &dyn HashProvider
pub fn active(&self, active_prefix: &str) -> &dyn HashProvider
Get the active provider (determined by HashConfig).
Sourcepub fn algorithms(&self) -> Vec<&'static str>
pub fn algorithms(&self) -> Vec<&'static str>
List all registered algorithm prefixes.
Auto Trait Implementations§
impl !RefUnwindSafe for ProviderRegistry
impl !UnwindSafe for ProviderRegistry
impl Forget for ProviderRegistry
impl Freeze for ProviderRegistry
impl Send for ProviderRegistry
impl Sync for ProviderRegistry
impl Unpin for ProviderRegistry
impl UnsafeUnpin for ProviderRegistry
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