1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use tether_agent::{PlugOptionsBuilder, TetherAgentOptionsBuilder};

fn main() {
    let tether_agent = TetherAgentOptionsBuilder::new("example")
        .id_optional(None)
        .host("localhost")
        .port(1883)
        .username("tether")
        .password("sp_ceB0ss!")
        .build()
        .expect("failed to create Tether Agent");

    let output_plug = PlugOptionsBuilder::create_output("anOutput")
        .qos(2)
        .retain(true)
        .build(&tether_agent);
    let input_plug = PlugOptionsBuilder::create_input("everything")
        .topic("#")
        .build(&tether_agent);

    println!("Agent looks like this: {:?}", tether_agent.description());
    let (role, id, _) = tether_agent.description();
    assert_eq!(role, "example");
    assert_eq!(id, "any"); // because we set None

    println!("output plug: {:?}", output_plug);
    println!("input plug: {:?}", input_plug);
}