pub struct ProtocolRegistry { /* private fields */ }Expand description
A registry of named protocol adapters.
Thread-safe: uses Arc internally so it can be cloned across Tokio tasks.
Implementations§
Source§impl ProtocolRegistry
impl ProtocolRegistry
Sourcepub fn register(
&mut self,
protocol_name: impl Into<String>,
adapter: Arc<dyn ProtocolAdapter>,
url_prefixes: impl IntoIterator<Item = impl Into<String>>,
)
pub fn register( &mut self, protocol_name: impl Into<String>, adapter: Arc<dyn ProtocolAdapter>, url_prefixes: impl IntoIterator<Item = impl Into<String>>, )
Register an adapter under protocol_name.
Optionally bind one or more URL prefixes to this adapter for automatic
dispatch via Self::adapter_for_url.
Sourcepub fn adapter(&self, protocol_name: &str) -> Option<Arc<dyn ProtocolAdapter>>
pub fn adapter(&self, protocol_name: &str) -> Option<Arc<dyn ProtocolAdapter>>
Look up an adapter by protocol name.
Sourcepub fn adapter_for_url(&self, url: &str) -> Option<Arc<dyn ProtocolAdapter>>
pub fn adapter_for_url(&self, url: &str) -> Option<Arc<dyn ProtocolAdapter>>
Look up an adapter by URL — matches on registered URL prefixes.
Returns the adapter for the first matching prefix, or None if no
prefix matches.
Trait Implementations§
Source§impl Clone for ProtocolRegistry
impl Clone for ProtocolRegistry
Source§fn clone(&self) -> ProtocolRegistry
fn clone(&self) -> ProtocolRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProtocolRegistry
impl Debug for ProtocolRegistry
Source§impl Default for ProtocolRegistry
impl Default for ProtocolRegistry
Source§fn default() -> ProtocolRegistry
fn default() -> ProtocolRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ProtocolRegistry
impl !RefUnwindSafe for ProtocolRegistry
impl Send for ProtocolRegistry
impl Sync for ProtocolRegistry
impl Unpin for ProtocolRegistry
impl UnsafeUnpin for ProtocolRegistry
impl !UnwindSafe for ProtocolRegistry
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