Crate yar_client [] [src]

yar_client is a crate what can transport info to Yar Server, About Yar see: https://github.com/laruence/yar

Examples

 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, 30).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()]);
 println!("{:?}",ret);

Builder

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:

  • [x] YAR_OPT_PACKAGER :JSON 、MsgPack、PHP , the msg body encoding method. current version only can use JSON
  • [ ] YAR_OPT_PERSISTENT , curl lib support keep-alive
  • [x] YAR_OPT_TIMEOUT unit second , transport timeout
  • [x] YAR_OPT_CONNECT_TIMEOUT unit second ,TCP connect timeout

Modules

error

Structs

Builder
YarClient

Constants

YAR_OPT_CONNECT_TIMEOUT
YAR_OPT_PACKAGER
YAR_OPT_PERSISTENT
YAR_OPT_TIMEOUT

Type Definitions

Result