pub struct ProtocolBuilder { /* private fields */ }
Expand description
Builder for creating configured protocols.
The ProtocolBuilder
provides a fluent API for configuring and creating
protocols with specific request and notification handlers.
Implementations§
Source§impl ProtocolBuilder
impl ProtocolBuilder
Sourcepub fn request_handler<Req, Resp>(
self,
method: &str,
handler: impl Fn(Req) -> Pin<Box<dyn Future<Output = Result<Resp>> + Send>> + Send + Sync + 'static,
) -> Self
pub fn request_handler<Req, Resp>( self, method: &str, handler: impl Fn(Req) -> Pin<Box<dyn Future<Output = Result<Resp>> + Send>> + Send + Sync + 'static, ) -> Self
Sourcepub fn has_request_handler(&self, method: &str) -> bool
pub fn has_request_handler(&self, method: &str) -> bool
Sourcepub fn notification_handler<N>(
self,
method: &str,
handler: impl Fn(N) -> Pin<Box<dyn Future<Output = Result<()>> + Send>> + Send + Sync + 'static,
) -> Self
pub fn notification_handler<N>( self, method: &str, handler: impl Fn(N) -> Pin<Box<dyn Future<Output = Result<()>> + Send>> + Send + Sync + 'static, ) -> Self
Sourcepub fn has_notification_handler(&self, method: &str) -> bool
pub fn has_notification_handler(&self, method: &str) -> bool
Trait Implementations§
Source§impl Clone for ProtocolBuilder
impl Clone for ProtocolBuilder
Source§fn clone(&self) -> ProtocolBuilder
fn clone(&self) -> ProtocolBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ProtocolBuilder
impl !RefUnwindSafe for ProtocolBuilder
impl Send for ProtocolBuilder
impl Sync for ProtocolBuilder
impl Unpin for ProtocolBuilder
impl !UnwindSafe for ProtocolBuilder
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