pub struct AdapterRegistry<A>where
A: Adapter,{ /* private fields */ }Expand description
Registry for managing multiple named adapters.
Allows switching between different adapters at runtime.
Note: Adapter composition (combining multiple adapters) is planned for a future release.
Implementations§
Source§impl<A> AdapterRegistry<A>where
A: Adapter,
impl<A> AdapterRegistry<A>where
A: Adapter,
Sourcepub fn new() -> AdapterRegistry<A>
pub fn new() -> AdapterRegistry<A>
Create a new empty adapter registry.
Sourcepub fn register_adapter(
&mut self,
name: impl Into<String>,
adapter: A,
) -> Result<(), PeftError>
pub fn register_adapter( &mut self, name: impl Into<String>, adapter: A, ) -> Result<(), PeftError>
Sourcepub fn get_active_adapter(&self) -> Result<&A, PeftError>
pub fn get_active_adapter(&self) -> Result<&A, PeftError>
Sourcepub fn get_active_adapter_mut(&mut self) -> Result<&mut A, PeftError>
pub fn get_active_adapter_mut(&mut self) -> Result<&mut A, PeftError>
Get a mutable reference to the active adapter.
§Errors
Returns an error if no adapter is currently active
Sourcepub fn contains_adapter(&self, name: &str) -> bool
pub fn contains_adapter(&self, name: &str) -> bool
Check if an adapter with the given name exists.
Sourcepub fn active_adapter_name(&self) -> Option<&str>
pub fn active_adapter_name(&self) -> Option<&str>
Get the name of the currently active adapter.
Sourcepub fn adapter_names(&self) -> Vec<&str>
pub fn adapter_names(&self) -> Vec<&str>
Get a list of all registered adapter names.
Trait Implementations§
Source§impl<A> Default for AdapterRegistry<A>where
A: Adapter,
impl<A> Default for AdapterRegistry<A>where
A: Adapter,
Source§fn default() -> AdapterRegistry<A>
fn default() -> AdapterRegistry<A>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<A> Freeze for AdapterRegistry<A>
impl<A> RefUnwindSafe for AdapterRegistry<A>where
A: RefUnwindSafe,
impl<A> Send for AdapterRegistry<A>
impl<A> Sync for AdapterRegistry<A>
impl<A> Unpin for AdapterRegistry<A>where
A: Unpin,
impl<A> UnwindSafe for AdapterRegistry<A>where
A: UnwindSafe,
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
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>
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