pub struct Client { /* private fields */ }Expand description
The Client.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(sender: RpcChannel) -> Self
pub fn new(sender: RpcChannel) -> Self
Creates a new Client.
Sourcepub fn call(
&self,
instance_id: String,
zome: String,
function: String,
args: Value,
) -> impl Future<Item = Value, Error = RpcError>
pub fn call( &self, instance_id: String, zome: String, function: String, args: Value, ) -> impl Future<Item = Value, Error = RpcError>
Examples found in repository?
examples/call_over_ws.rs (lines 11-16)
7fn main() {
8 let client_url = Url::parse("ws://localhost:3401").expect("valid URL");
9 let fut = connect_ws(&client_url)
10 .and_then(|client| { // connect returns a future
11 client.call( // calling a function also returns a future
12 "basic-chat".into(),
13 "chat".into(),
14 "register".into(),
15 json!({"name": "Ferris", "avatar_url": ""}),
16 )
17 }).map(|result| {
18 println!("success: {}", result)
19 }).map_err(|err| {
20 println!("error: {}", err)
21 });
22 tokio::run(fut);
23}Trait Implementations§
Source§impl From<RpcChannel> for Client
impl From<RpcChannel> for Client
Source§fn from(channel: RpcChannel) -> Self
fn from(channel: RpcChannel) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl !UnwindSafe for Client
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