pub struct Server { /* private fields */ }Expand description
A JSON-RPC 2.0 server with file descriptor passing support.
Implementations§
Source§impl Server
impl Server
Sourcepub fn register_method<F>(&mut self, name: &str, handler: F)
pub fn register_method<F>(&mut self, name: &str, handler: F)
Register a handler for a JSON-RPC method.
Sourcepub fn register_notification<F>(&mut self, name: &str, handler: F)
pub fn register_notification<F>(&mut self, name: &str, handler: F)
Register a handler for a JSON-RPC notification.
Sourcepub async fn listen<P: AsRef<Path>>(self, path: P) -> Result<()>
pub async fn listen<P: AsRef<Path>>(self, path: P) -> Result<()>
Start listening for connections on the given Unix socket path.
Sourcepub async fn process_message(
&self,
message_with_fds: MessageWithFds,
sender: &mut Sender,
) -> Result<()>
pub async fn process_message( &self, message_with_fds: MessageWithFds, sender: &mut Sender, ) -> Result<()>
Process a single JSON-RPC message and send the response.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Server
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnsafeUnpin for Server
impl !UnwindSafe for Server
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