Module zenoh::net[][src]

Expand description

The network level zenoh API.

Examples

Publish

use zenoh::net::*;

#[async_std::main]
async fn main() {
    let session = open(config::default()).await.unwrap();
    session.write(&"/resource/name".into(), "value".as_bytes().into()).await.unwrap();
    session.close().await.unwrap();
}

Subscribe

use zenoh::net::*;
use futures::prelude::*;

#[async_std::main]
async fn main() {
    let session = open(config::default()).await.unwrap();
    let sub_info = SubInfo {
        reliability: Reliability::Reliable,
        mode: SubMode::Push,
        period: None
    };
    let mut subscriber = session.declare_subscriber(&"/resource/name".into(), &sub_info).await.unwrap();
    while let Some(sample) = subscriber.receiver().next().await { println!("Received : {:?}", sample); };
}

Query

use zenoh::net::*;
use futures::prelude::*;

#[async_std::main]
async fn main() {
    let session = open(config::default()).await.unwrap();
    let mut replies = session.query(
        &"/resource/name".into(),
        "predicate",
        QueryTarget::default(),
        QueryConsolidation::default()
    ).await.unwrap();
    while let Some(reply) = replies.next().await {
        println!(">> Received {:?}", reply.data);
    }
}

Modules

Properties to pass to open and scout functions as configuration and associated constants.

Properties returned by the info function and associated constants.

Structs

A subscriber that provides data through a callback.

DataInfo

Hello message

An iterator over the msgs received from a channel.

A publisher.

Structs received b y a Queryable.

An entity able to reply to queries.

Struct used by a Queryable to send replies to queries.

Structs returned by a query.

A zenoh value.

A zenoh-net session.

A subscriber that provides data through a stream.

An non-blocking iterator over the msgs received from a channel.

ZBuf is a buffer that contains one or more ZSlices. It is used to efficiently send and receive data in zenoh. It provides transparent usage for both network and shared memory operations through a simple API.

A zenoh error.

Creates a ZFuture that is immediately ready with a value.

A clonable wrapper to a contiguous slice of bytes.

Enums

An error that may be emitted when attempting to wait for a value on a receiver when all senders are dropped and there are no more messages in the channel.

An error that may be emitted when attempting to wait for a value on a receiver with a timeout when the receive operation times out or all senders are dropped and there are no values left in the channel.

An error that may be emitted when attempting to fetch a value on a receiver when there are no messages in the channel. If there are no messages in the channel and all senders are dropped, then TryRecvError::Disconnected will be returned.

The kind of zenoh error.

Traits

Functions

Open a zenoh-net Session.

Scout for routers and/or peers.

Creates a ZFuture that is immediately ready with a value.

Type Definitions

The callback that will be called on each data for a CallbackSubscriber.

A zenoh result.