Skip to main content

Rpc

Struct Rpc 

Source
pub struct Rpc { /* private fields */ }

Implementations§

Source§

impl Rpc

Source

pub fn arg_string(&mut self, name: &str, value: &str) -> Result<&mut Self>

Add a string argument to the RPC call

§Arguments
  • name - The argument name
  • value - The string value
§Example
rpc.arg_string("filename", "/path/to/file.txt");
Source

pub fn arg_double(&mut self, name: &str, value: f64) -> Result<&mut Self>

Add a double argument to the RPC call

§Arguments
  • name - The argument name
  • value - The double value
Source

pub fn arg_int32(&mut self, name: &str, value: i32) -> Result<&mut Self>

Add an int32 argument to the RPC call

§Arguments
  • name - The argument name
  • value - The int32 value
Source

pub fn arg_bool(&mut self, name: &str, value: bool) -> Result<&mut Self>

Add a boolean argument to the RPC call

§Arguments
  • name - The argument name
  • value - The boolean value
Source

pub fn execute(self, timeout: f64) -> Result<Value>

Execute the RPC call synchronously

§Arguments
  • timeout - Maximum time to wait in seconds
§Returns

Returns the result value from the server, or an error if the operation failed or timed out.

§Example
let mut rpc = ctx.rpc("calculator:add").unwrap();
rpc.arg_double("a", 10.0);
rpc.arg_double("b", 5.0);
let result = rpc.execute(5.0).unwrap();
let sum = result.get_field_double("result").unwrap();

Auto Trait Implementations§

§

impl Freeze for Rpc

§

impl RefUnwindSafe for Rpc

§

impl !Send for Rpc

§

impl !Sync for Rpc

§

impl Unpin for Rpc

§

impl UnsafeUnpin for Rpc

§

impl UnwindSafe for Rpc

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.