Crates.io | sonic_client |
lib.rs | sonic_client |
version | 0.1.2 |
source | src |
created_at | 2019-04-09 07:57:24.501283 |
updated_at | 2019-04-09 08:50:39.002309 |
description | a client lib for sonic search |
homepage | |
repository | |
max_upload_size | |
id | 126776 |
size | 28,081 |
Rust client for sonic, a Rust based search platform.
This lib is under development, apis could change very fast.
sonic_client = "0.1.1"
use sonic_client::SearchChan;
let mut s = SearchChan::new("127.0.0.1", 1491, "haha").expect("Connection error");
let handle = s.read();
assert_eq!("CONNECTED <sonic-server v1.1.8>\r\n", s.connect().unwrap());
thread::sleep(time::Duration::from_secs(4));
let r1 = s
.query("helpdesk", "user:0dcde3a6", "gdpr", Some(50), None)
.unwrap();
let r2 = s.ping().unwrap();
let r3 = s.quit().unwrap();
assert_eq!("EVENT", r1[0]);
assert_eq!("PONG\r\n", r2.recv().unwrap());
assert_eq!("ENDED quit\r\n", r3.recv().unwrap());
handle.join().expect("Failed to wait process");