pub struct RpcServer { /* private fields */ }Expand description
JSON-RPC server over stdio
Implementations§
Source§impl RpcServer
impl RpcServer
Sourcepub fn register_method<F>(&mut self, name: &str, handler: F)
pub fn register_method<F>(&mut self, name: &str, handler: F)
Register a method handler
Sourcepub fn event_sender(&self) -> Sender<(String, Value)>
pub fn event_sender(&self) -> Sender<(String, Value)>
Get event sender for emitting events
Sourcepub fn send_notification(&self, method: &str, params: Value) -> Result<()>
pub fn send_notification(&self, method: &str, params: Value) -> Result<()>
Send a notification event - will send to all subscribers of this event type
Sourcepub fn register_subscription_handlers(&mut self)
pub fn register_subscription_handlers(&mut self)
Register subscription method handlers
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the server is running
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RpcServer
impl RefUnwindSafe for RpcServer
impl Send for RpcServer
impl Sync for RpcServer
impl Unpin for RpcServer
impl UnwindSafe for RpcServer
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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