Module queryable

Module queryable 

Source
Expand description

Queryable — register a prefix and respond to incoming queries (Interests).

Like Producer but returns a stream of Query objects that the application responds to explicitly, matching Zenoh’s queryable pattern.

§Example

use ndn_app::Queryable;
use ndn_packet::encode::DataBuilder;

let mut q = Queryable::connect("/run/nfd/nfd.sock", "/sensors/temp").await?;

while let Some(query) = q.recv().await {
    let data = DataBuilder::new((*query.interest.name).clone(), b"22.5").build();
    query.reply(data).await.ok();
}

Structs§

Query
A query received by a Queryable — the application replies via Query::reply.
Queryable
A queryable endpoint — receives Interests and lets the application reply.