Crate zenoh[−][src]
The crate of the zenoh API.
See the Zenoh struct for details.
Quick start examples
Put a key/value into zenoh
use zenoh::*; use std::convert::TryInto; #[async_std::main] async fn main() { let zenoh = Zenoh::new(net::config::default()).await.unwrap(); let workspace = zenoh.workspace(None).await.unwrap(); workspace.put( &"/demo/example/hello".try_into().unwrap(), "Hello World!".into() ).await.unwrap(); zenoh.close().await.unwrap(); }
Subscribe for keys/values changes from zenoh
use zenoh::*; use futures::prelude::*; use std::convert::TryInto; #[async_std::main] async fn main() { let zenoh = Zenoh::new(net::config::default()).await.unwrap(); let workspace = zenoh.workspace(None).await.unwrap(); let mut change_stream = workspace.subscribe(&"/demo/example/**".try_into().unwrap()).await.unwrap(); while let Some(change) = change_stream.next().await { println!(">> {:?} for {} : {:?} at {}", change.kind, change.path, change.value, change.timestamp ) } change_stream.close().await.unwrap(); zenoh.close().await.unwrap(); }
Get keys/values from zenoh
use zenoh::*; use futures::prelude::*; use std::convert::TryInto; #[async_std::main] async fn main() { let zenoh = Zenoh::new(net::config::default()).await.unwrap(); let workspace = zenoh.workspace(None).await.unwrap(); let mut data_stream = workspace.get(&"/demo/example/**".try_into().unwrap()).await.unwrap(); while let Some(data) = data_stream.next().await { println!(">> {} : {:?} at {}", data.path, data.value, data.timestamp ) } zenoh.close().await.unwrap(); }
Modules
net | The network level zenoh API. |
utils | Some useful operations for the zenoh API. |
Structs
Change | The notification of a change occured on a path/value and reported to a subscription. |
ChangeStream | A |
Data | A Data returned as a result of a |
DataStream | A |
GetRequest | A |
GetRequestStream | A |
Path | A zenoh Path is a set of strings separated by |
PathExpr | A zenoh Path Expression used to express a selection of |
Properties | A map of key/value (String,String) properties. |
Selector | A zenoh Selector is the conjunction of a path expression identifying a set of paths and some optional parts allowing to refine the set of paths and associated values. |
SubscriberHandle | A handle returned as result of |
Timestamp | A timestamp made of a |
Workspace | A Workspace to operate on zenoh. |
ZError | |
Zenoh | The zenoh client API. |
Enums
ChangeKind | The kind of a |
Value | A user value that is associated with a Path in zenoh. |
ZErrorKind |
Type Definitions
TimestampID | |
ZResult |