pub struct RPCServer {
pub handlers: Arc<HashMap<String, Box<dyn RpcHandler>>>,
pub async_handlers: Arc<HashMap<String, Box<dyn AsyncRpcHandler>>>,
}Expand description
RPCServer manages a registry of handlers and dispatches incoming raw Lisp RPC strings
Fields§
§handlers: Arc<HashMap<String, Box<dyn RpcHandler>>>§async_handlers: Arc<HashMap<String, Box<dyn AsyncRpcHandler>>>Implementations§
Source§impl RPCServer
impl RPCServer
pub fn new() -> Self
Sourcepub fn register_async<T, F>(self, func: F) -> Result<Self>
pub fn register_async<T, F>(self, func: F) -> Result<Self>
Register an async handler for a specific command
Sourcepub fn handle(&self, raw_data: &str) -> Result<String>
pub fn handle(&self, raw_data: &str) -> Result<String>
Dispatch a raw Lisp RPC string to the appropriate handler
Sourcepub async fn handle_async(&self, raw_data: &str) -> Result<String>
pub async fn handle_async(&self, raw_data: &str) -> Result<String>
Dispatch a raw Lisp RPC string to the appropriate handler asynchronously
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RPCServer
impl !UnwindSafe for RPCServer
impl Freeze for RPCServer
impl Send for RPCServer
impl Sync for RPCServer
impl Unpin for RPCServer
impl UnsafeUnpin 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