pub struct ProtocolRegistry { /* private fields */ }Expand description
Protocol handler registry
Implementations§
Source§impl ProtocolRegistry
impl ProtocolRegistry
Sourcepub fn register(&self, handler: Box<dyn ProtocolHandler>) -> Result<()>
pub fn register(&self, handler: Box<dyn ProtocolHandler>) -> Result<()>
Register a protocol handler
Sourcepub fn unregister(&self, protocol_id: &ProtocolId) -> Result<()>
pub fn unregister(&self, protocol_id: &ProtocolId) -> Result<()>
Unregister a protocol handler
Sourcepub fn get(
&self,
protocol_id: &ProtocolId,
) -> Option<Arc<RwLock<Box<dyn ProtocolHandler>>>>
pub fn get( &self, protocol_id: &ProtocolId, ) -> Option<Arc<RwLock<Box<dyn ProtocolHandler>>>>
Get a protocol handler
Sourcepub fn find_compatible(
&self,
name: &str,
min_version: &ProtocolVersion,
) -> Option<ProtocolId>
pub fn find_compatible( &self, name: &str, min_version: &ProtocolVersion, ) -> Option<ProtocolId>
Find compatible protocol version
Sourcepub fn list_protocols(&self) -> Vec<ProtocolId>
pub fn list_protocols(&self) -> Vec<ProtocolId>
Get all registered protocol IDs
Sourcepub fn handle_request(
&self,
protocol_id: &ProtocolId,
request: &[u8],
) -> Result<Vec<u8>>
pub fn handle_request( &self, protocol_id: &ProtocolId, request: &[u8], ) -> Result<Vec<u8>>
Handle a request with the appropriate protocol handler
Sourcepub fn get_capabilities(
&self,
protocol_id: &ProtocolId,
) -> Option<ProtocolCapabilities>
pub fn get_capabilities( &self, protocol_id: &ProtocolId, ) -> Option<ProtocolCapabilities>
Get protocol capabilities
Sourcepub fn shutdown_all(&self) -> Result<()>
pub fn shutdown_all(&self) -> Result<()>
Shutdown all handlers
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ProtocolRegistry
impl !RefUnwindSafe for ProtocolRegistry
impl Send for ProtocolRegistry
impl Sync for ProtocolRegistry
impl Unpin for ProtocolRegistry
impl !UnwindSafe for ProtocolRegistry
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
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