Struct nazar::t38::Client
[−]
[src]
pub struct Client<'a> { /* fields omitted */ }
Methods
impl<'a> Client<'a>
[src]
fn new() -> Self
fn from(url: &'static str) -> Self
Constructor with one argument - Rust convention!
fn cmd(&mut self, s: &'a str) -> &Client<'a>
cmd takes and sets a Tile38 command
fn arg<A>(&self, a: A) -> &Client<'a> where
A: Into<Cow<'a, str>>,
A: Into<Cow<'a, str>>,
Use arg to construct a Tile38 command. Although this does not work for 'Field' yet. Supports only &str and String args only
Example
n.arg("POINT").arg("23").arg("321");
fn ping(url: &'a str) -> bool
Pings the Tile38 server running at the given url. It should be used to check if the server is alive or dead!
Arguments
url
- URL at which a Tile38 server instance is running
Example
use nazar::t38::{Client} let is_live = Client::ping("redis://127.0.0.1:9851");
fn execute_with_args(&self) -> RedisResult<String>
execute_with_args executes Tile38 query
fn execute(self, command: &str, args: Vec<Types>) -> RedisResult<String>
low level API
fn open_fence<F>(
self,
url: &str,
fleet: &str,
lat: &str,
lng: &str,
radius: &str,
work: F
) where
F: Fn(String),
self,
url: &str,
fleet: &str,
lat: &str,
lng: &str,
radius: &str,
work: F
) where
F: Fn(String),
Open a static geofence!
where work
is closure
fn open_fence_within<F>(
self,
url: &str,
fleet: &str,
id: &str,
coordinates: Vec<Vec<f64>>,
work: F
) where
F: Fn(String),
self,
url: &str,
fleet: &str,
id: &str,
coordinates: Vec<Vec<f64>>,
work: F
) where
F: Fn(String),
open fence using GeoJSON
Uses T38's WITHIN command
where work
is closure
fn open_fence2(
self,
url: &str,
fleet: &str,
lat: &str,
lng: &str,
radius: &str,
action: fn(_: &NazarSender, _: String)
)
self,
url: &str,
fleet: &str,
lat: &str,
lng: &str,
radius: &str,
action: fn(_: &NazarSender, _: String)
)
Open a static geofence!
takes a function of type fn(&NazarSender, String)
NazarSender
represents a WebSocket connection and String
is the message from server.
fn open_fence_within2(
self,
url: &str,
fleet: &str,
id: &str,
coordinates: Vec<Vec<f64>>,
action: fn(_: &NazarSender, _: String)
)
self,
url: &str,
fleet: &str,
id: &str,
coordinates: Vec<Vec<f64>>,
action: fn(_: &NazarSender, _: String)
)
open fence using GeoJSON
Uses T38's WITHIN command
Takes a function of type fn(&NazarSender, String)
NazarSender
represents a WebSocket connection and String
is the message from server.
fn open_fence_and_send(
self,
url: &str,
fleet: &str,
lat: &str,
lng: &str,
radius: &str,
client: &NazarSender
)
self,
url: &str,
fleet: &str,
lat: &str,
lng: &str,
radius: &str,
client: &NazarSender
)
open a circular geofence and send the fence updates on the provided client - a WebSocket Connection
fn open_fence_within_and_send(
self,
url: &str,
fleet: &str,
id: &str,
coordinates: Vec<Vec<f64>>,
client: &NazarSender
)
self,
url: &str,
fleet: &str,
id: &str,
coordinates: Vec<Vec<f64>>,
client: &NazarSender
)
open a polygonal geofence using and send the fence updates on the provided client - a WebSocket Connection