pub struct ProtocolMap(/* private fields */);Expand description
A typed map of protocol handlers, mapping them from ALPNs.
Implementations§
Source§impl ProtocolMap
impl ProtocolMap
Sourcepub fn get_typed<P: ProtocolHandler>(&self, alpn: &[u8]) -> Option<Arc<P>>
pub fn get_typed<P: ProtocolHandler>(&self, alpn: &[u8]) -> Option<Arc<P>>
Returns the registered protocol handler for an ALPN as a concrete type.
Sourcepub fn get(&self, alpn: &[u8]) -> Option<Arc<dyn ProtocolHandler>>
pub fn get(&self, alpn: &[u8]) -> Option<Arc<dyn ProtocolHandler>>
Returns the registered protocol handler for an ALPN as a Arc<dyn ProtocolHandler>.
Sourcepub fn insert(&mut self, alpn: Vec<u8>, handler: Arc<dyn ProtocolHandler>)
pub fn insert(&mut self, alpn: Vec<u8>, handler: Arc<dyn ProtocolHandler>)
Inserts a protocol handler.
Sourcepub fn alpns(&self) -> impl Iterator<Item = &Vec<u8>>
pub fn alpns(&self) -> impl Iterator<Item = &Vec<u8>>
Returns an iterator of all registered ALPN protocol identifiers.
Sourcepub async fn shutdown(&self)
pub async fn shutdown(&self)
Shuts down all protocol handlers.
Calls and awaits ProtocolHandler::shutdown for all registered handlers concurrently.
Trait Implementations§
Source§impl Clone for ProtocolMap
impl Clone for ProtocolMap
Source§fn clone(&self) -> ProtocolMap
fn clone(&self) -> ProtocolMap
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 ProtocolMap
impl Debug for ProtocolMap
Source§impl Default for ProtocolMap
impl Default for ProtocolMap
Source§fn default() -> ProtocolMap
fn default() -> ProtocolMap
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ProtocolMap
impl !RefUnwindSafe for ProtocolMap
impl Send for ProtocolMap
impl Sync for ProtocolMap
impl Unpin for ProtocolMap
impl !UnwindSafe for ProtocolMap
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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