[][src]Struct zenoh::Zenoh

pub struct Zenoh { /* fields omitted */ }

The zenoh client API.

Implementations

impl Zenoh[src]

pub async fn new(config: Config, props: Option<Properties>) -> ZResult<Zenoh>[src]

Creates a zenoh API, establishing a zenoh-net session with discovered peers and/or routers.

Arguments

  • config - The configuration of the zenoh session
  • ps - Optional properties

Examples

use zenoh::*;

let zenoh = Zenoh::new(net::Config::peer(), None).await.unwrap();

pub async fn workspace<'_, '_>(
    &'_ self,
    prefix: Option<Path>
) -> ZResult<Workspace<'_>>
[src]

Creates a Workspace with an optional Path as prefix.
All relative Path or Selector used with this Workspace will be relative to the specified prefix. Not specifying a prefix is equivalent to specifying "/" as prefix, meaning in this case that all relative paths/selectors will be prependend with "/".

Examples

use zenoh::*;
use std::convert::TryInto;

let zenoh = Zenoh::new(net::Config::default(), None).await.unwrap();
let workspace = zenoh.workspace(Some("/demo/example".try_into().unwrap())).await.unwrap();
// The following it equivalent to a PUT on "/demo/example/hello".
workspace.put(
    &"hello".try_into().unwrap(),
    "Hello World!".into()
).await.unwrap();

pub async fn close(self) -> ZResult<()>[src]

Closes the zenoh API and the associated zenoh-net session.

Note that on drop, the zenoh-net session is also automatically closed. But you may want to use this function to handle errors or close the session synchronously.

Examples

use zenoh::*;

let zenoh = Zenoh::new(net::Config::peer(), None).await.unwrap();
zenoh.close();

Auto Trait Implementations

impl !RefUnwindSafe for Zenoh

impl Send for Zenoh

impl Sync for Zenoh

impl Unpin for Zenoh

impl !UnwindSafe for Zenoh

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,