Function zenoh::scout

source ·
pub fn scout<I: Into<WhatAmIMatcher>, TryIntoConfig>(
    what: I,
    config: TryIntoConfig
) -> ScoutBuilder<DefaultHandler>
where TryIntoConfig: TryInto<Config> + Send + 'static, <TryIntoConfig as TryInto<Config>>::Error: Into<Error>,
Expand description

Scout for routers and/or peers.

scout spawns a task that periodically sends scout messages and waits for Hello replies.

Drop the returned Scout to stop the scouting task.

§Arguments

  • what - The kind of zenoh process to scout for
  • config - The configuration Config to use for scouting

§Examples

use zenoh::prelude::r#async::*;
use zenoh::scouting::WhatAmI;

let receiver = zenoh::scout(WhatAmI::Peer | WhatAmI::Router, config::default())
    .res()
    .await
    .unwrap();
while let Ok(hello) = receiver.recv_async().await {
    println!("{}", hello);
}