pub struct ProtocolBuilder<T: Transport> { /* private fields */ }
Implementations§
Source§impl<T: Transport> ProtocolBuilder<T>
impl<T: Transport> ProtocolBuilder<T>
pub fn new(transport: T) -> 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 build(self) -> Protocol<T>
Auto Trait Implementations§
impl<T> Freeze for ProtocolBuilder<T>where
T: Freeze,
impl<T> !RefUnwindSafe for ProtocolBuilder<T>
impl<T> Send for ProtocolBuilder<T>
impl<T> Sync for ProtocolBuilder<T>
impl<T> Unpin for ProtocolBuilder<T>where
T: Unpin,
impl<T> !UnwindSafe for ProtocolBuilder<T>
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