pub struct Client<Cfg: Platform> { /* private fields */ }
Expand description

A blocking CoAP request client

Implementations

Create a new Client secured by DTLS

use kwap::blocking::Client;
use kwap::req::ReqBuilder;
use kwap::ContentFormat;

let mut client = Client::try_new_secure(1234).unwrap();
let req = ReqBuilder::get("127.0.0.1:5683".parse().unwrap(), "hello").accept(ContentFormat::Text)
                                                                     .build()
                                                                     .unwrap();

let rep = client.send(req).unwrap();

println!("Hello, {}!", rep.payload_string().unwrap());

Create a new std client with a specific runtime config

Create a new Client for a platform supporting Rust’s standard library.

use kwap::blocking::Client;
use kwap::req::ReqBuilder;
use kwap::ContentFormat;

let mut client = Client::new_std();
let req = ReqBuilder::get("127.0.0.1:5683".parse().unwrap(), "hello").accept(ContentFormat::Text)
                                                                     .build()
                                                                     .unwrap();

let rep = client.send(req).unwrap();

println!("Hello, {}!", rep.payload_string().unwrap());

Create a new std client with a specific runtime config

Create a new request client

Create a new request client with a specific runtime config

Ping an endpoint

Note: this will eventually not require Client to be borrowed mutably.

Send a request

Note: this will eventually not require Client to be borrowed mutably.

Listen on a multicast address for a broadcast from a Server

This will time out if nothing has been received after 1 second.

Send a GET request

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.