pub struct ProtocolManager { /* private fields */ }Expand description
Protocol Manager
Manages protocol handlers and facilitates protocol-based interactions.
Implementations§
Source§impl ProtocolManager
impl ProtocolManager
Sourcepub fn register_protocol(
&mut self,
handler: Box<dyn ProtocolHandler>,
) -> Web5Result<()>
pub fn register_protocol( &mut self, handler: Box<dyn ProtocolHandler>, ) -> Web5Result<()>
Register a protocol handler
Sourcepub fn get_protocol(&self, protocol_id: &str) -> Web5Result<&ProtocolDefinition>
pub fn get_protocol(&self, protocol_id: &str) -> Web5Result<&ProtocolDefinition>
Get a protocol definition by ID
Sourcepub fn handle_message(
&self,
protocol_id: &str,
message: &[u8],
) -> Web5Result<Vec<u8>>
pub fn handle_message( &self, protocol_id: &str, message: &[u8], ) -> Web5Result<Vec<u8>>
Handle a message for a specific protocol
Sourcepub fn has_protocol(&self, protocol_id: &str) -> bool
pub fn has_protocol(&self, protocol_id: &str) -> bool
Check if a protocol is registered
Sourcepub fn get_all_protocols(&self) -> Vec<&ProtocolDefinition>
pub fn get_all_protocols(&self) -> Vec<&ProtocolDefinition>
Get all registered protocol definitions
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProtocolManager
impl !RefUnwindSafe for ProtocolManager
impl Send for ProtocolManager
impl Sync for ProtocolManager
impl Unpin for ProtocolManager
impl !UnwindSafe for ProtocolManager
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