pub struct RpcRouter { /* private fields */ }Expand description
Implementations§
Source§impl RpcRouter
impl RpcRouter
Sourcepub fn new(state: Arc<AppStateInner>) -> RpcRouter
pub fn new(state: Arc<AppStateInner>) -> RpcRouter
Create a new router backed by the given application state.
Sourcepub async fn handle_request(&self, raw: &str) -> String
pub async fn handle_request(&self, raw: &str) -> String
Handle a raw JSON string. Parses the request, dispatches it, and returns the serialized JSON response string.
Sourcepub async fn handle_value(&self, value: Value) -> Value
pub async fn handle_value(&self, value: Value) -> Value
Handle a pre-parsed serde_json::Value. Useful for transports that
already do their own parsing (e.g. Tauri IPC, axum JSON extraction).
Sourcepub async fn dispatch(&self, req: JsonRpcRequest) -> JsonRpcResponse
pub async fn dispatch(&self, req: JsonRpcRequest) -> JsonRpcResponse
Dispatch a parsed JSON-RPC request to the correct method handler.
Sourcepub fn method_list(&self) -> Vec<&'static str>
pub fn method_list(&self) -> Vec<&'static str>
Return a list of all supported RPC method names. Useful for introspection / discovery endpoints.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RpcRouter
impl !RefUnwindSafe for RpcRouter
impl Send for RpcRouter
impl Sync for RpcRouter
impl Unpin for RpcRouter
impl UnsafeUnpin for RpcRouter
impl !UnwindSafe for RpcRouter
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