pub struct RpcResponseHandler {
pub req_id: String,
pub command: String,
pub data: Option<Value>,
pub rpc_context: RpcContext,
response_tx: Sender<Vec<u8>>,
finalized: AtomicBool,
}Expand description
Handler for incoming RPC requests (server side).
Fields§
§req_id: String§command: String§data: Option<Value>§rpc_context: RpcContext§response_tx: Sender<Vec<u8>>§finalized: AtomicBoolImplementations§
Source§impl RpcResponseHandler
impl RpcResponseHandler
Sourcepub fn get_command(&self) -> &str
pub fn get_command(&self) -> &str
Get the command name.
Sourcepub fn get_command_raw_data(&self) -> Option<&Value>
pub fn get_command_raw_data(&self) -> Option<&Value>
Get the raw command data.
Sourcepub fn get_rpc_context(&self) -> &RpcContext
pub fn get_rpc_context(&self) -> &RpcContext
Get the RPC context.
Sourcepub fn needs_response(&self) -> bool
pub fn needs_response(&self) -> bool
Check if this request needs a response.
Sourcepub async fn send_response(
&self,
data: Option<Value>,
done: bool,
) -> Result<(), String>
pub async fn send_response( &self, data: Option<Value>, done: bool, ) -> Result<(), String>
Send a response (data + done flag).
Sourcepub async fn send_response_error(&self, err: &str) -> Result<(), String>
pub async fn send_response_error(&self, err: &str) -> Result<(), String>
Send an error response.
Sourcepub fn is_finalized(&self) -> bool
pub fn is_finalized(&self) -> bool
Check if the handler has been finalized.
Auto Trait Implementations§
impl !Freeze for RpcResponseHandler
impl RefUnwindSafe for RpcResponseHandler
impl Send for RpcResponseHandler
impl Sync for RpcResponseHandler
impl Unpin for RpcResponseHandler
impl UnwindSafe for RpcResponseHandler
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.