pub struct BinaryServer { /* private fields */ }Expand description
A JSON-RPC server that communicates via stdin/stdout.
Implementations§
Source§impl BinaryServer
impl BinaryServer
Sourcepub fn with_io<R, W>(input: R, output: W) -> Self
pub fn with_io<R, W>(input: R, output: W) -> Self
Creates a server with custom input and output streams.
Sourcepub fn emitter(&self) -> EventEmitter
pub fn emitter(&self) -> EventEmitter
Returns a cloneable event emitter tied to the server stdout stream.
Sourcepub fn register(&mut self, action: &str, handler: Handler)
pub fn register(&mut self, action: &str, handler: Handler)
Registers a handler function for a specific action name.
Sourcepub fn emit_event<T: Serialize>(&self, event: &str, data: T) -> Result<()>
pub fn emit_event<T: Serialize>(&self, event: &str, data: T) -> Result<()>
Emits an event with a JSON-serializable payload.
Sourcepub fn emit_event_empty(&self, event: &str) -> Result<()>
pub fn emit_event_empty(&self, event: &str) -> Result<()>
Emits an event without a payload.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BinaryServer
impl RefUnwindSafe for BinaryServer
impl Send for BinaryServer
impl Sync for BinaryServer
impl Unpin for BinaryServer
impl UnsafeUnpin for BinaryServer
impl UnwindSafe for BinaryServer
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