Crates.io | yar_client |
lib.rs | yar_client |
version | 0.1.3 |
source | src |
created_at | 2018-04-10 18:48:50.193909 |
updated_at | 2018-04-12 17:26:04.218561 |
description | yar client json support only |
homepage | https://github.com/hanskorg/yar-client-rust.git |
repository | https://github.com/hanskorg/yar-client-rust.git |
max_upload_size | |
id | 59932 |
size | 23,774 |
`yar_client` is a crate what can transport info to Yar Server what PHP protocol tool,
More about Yar see: <https://github.com/laruence/yar>
Add this to your Cargo.toml
:
[dependencies]
yar_client = "0.1.0"
use yar_client::*;
let mut client = Builder::default()
.set_url("http://10limi.com/rpc.php").unwrap()
.set_opt(YAR_OPT_PACKAGER, "JSON").unwrap()
.set_opt(YAR_OPT_CONNECT_TIMEOUT, 10).unwrap()
.set_opt(YAR_OPT_TIMEOUT, 30).unwrap()
.set_token("token")
.set_provider("org.hansk.net.yarclient")
.build().unwrap();
let ret = client.call("test", vec!["1".to_string(), "2".to_string()]).unwrap();
Set up Yar server address
let client = Builder::default().set_url("http://10limi.com/rpc.php")?
use yar_client::Build
build a new client,need call *yar_client::Builder::set_url()*
,
and can call *set_opt()*
set up some options, this is the list of options:
let client = Builder::default().set_opt(..., ...)?
More About token see php yar manual, default value is `yar_client_rust`
let client = Builder::default().set_token("...")
More About token see php yar manual, default value is `yar_client_rust`
let client = Builder::default().set_provider("...")?