pub struct RpcSession<T> { /* private fields */ }Implementations§
Source§impl<T: RpcServer> RpcSession<T>
impl<T: RpcServer> RpcSession<T>
pub fn create(server: T) -> (Self, Receiver<Message>)
pub fn new(client: RpcClient, server: T) -> Self
pub fn into_sink(self) -> RpcSessionSink<T>
Sourcepub async fn process_incoming(&self, input: &str) -> Option<Message>
pub async fn process_incoming(&self, input: &str) -> Option<Message>
Processes incoming JSON-RPC message.
Handles incoming requests and notifications, returns a response if any.
See also [process_incoming_parsed].
Sourcepub async fn process_incoming_parsed(&self, message: Message) -> Option<Message>
pub async fn process_incoming_parsed(&self, message: Message) -> Option<Message>
Same as [process_incoming], but accepts a parsed Message
instead of a string.
Sourcepub async fn handle_incoming(&self, input: &str)
pub async fn handle_incoming(&self, input: &str)
Handles incoming JSON-RPC request.
Sends response to the client. Blocks until request handler finishes. Spawn a task if you want to run the request handler concurrently.
See also [handle_incoming_parsed].
Sourcepub async fn handle_incoming_parsed(&self, message: Message)
pub async fn handle_incoming_parsed(&self, message: Message)
Same as [handle_incoming], but accepts a parsed Message
instead of a string.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for RpcSession<T>where
T: Freeze,
impl<T> !RefUnwindSafe for RpcSession<T>
impl<T> Send for RpcSession<T>where
T: Send,
impl<T> Sync for RpcSession<T>where
T: Sync,
impl<T> Unpin for RpcSession<T>where
T: Unpin,
impl<T> !UnwindSafe for RpcSession<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