pub enum Arg {
Value(Value),
Callback(Arc<dyn Fn(Vec<Value>) + Send + Sync + 'static>),
}Expand description
Argument type for RPC method calls.
Arguments can be either JSON values or callbacks.
Callbacks are automatically encoded with the __callback__ prefix.
§Example
use kkrpc::Arg;
use serde_json::json;
use std::sync::Arc;
// Value argument
let value_arg = Arg::Value(json!(42));
// Callback argument
let callback_arg = Arg::Callback(Arc::new(|args| {
println!("Callback invoked with: {:?}", args);
}));Variants§
Value(Value)
A JSON value argument
Callback(Arc<dyn Fn(Vec<Value>) + Send + Sync + 'static>)
A callback function argument
Auto Trait Implementations§
impl Freeze for Arg
impl !RefUnwindSafe for Arg
impl Send for Arg
impl Sync for Arg
impl Unpin for Arg
impl !UnwindSafe for Arg
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