pub struct ProtocolBuilder { /* private fields */ }
Implementations§
Source§impl ProtocolBuilder
impl ProtocolBuilder
pub fn new() -> Self
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
Register a typed request handler
pub fn has_request_handler(&self, method: &str) -> bool
pub fn notification_handler<N>( self, method: &str, handler: impl Fn(N) -> Pin<Box<dyn Future<Output = Result<()>> + Send>> + Send + Sync + 'static, ) -> Self
pub fn has_notification_handler(&self, method: &str) -> bool
pub fn build(self) -> Protocol
Trait Implementations§
Source§impl Clone for ProtocolBuilder
impl Clone for ProtocolBuilder
Source§fn clone(&self) -> ProtocolBuilder
fn clone(&self) -> ProtocolBuilder
Returns a copy 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 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