[][src]Struct coap::client::CoAPClient

pub struct CoAPClient { /* fields omitted */ }

Methods

impl CoAPClient[src]

pub fn new_with_specific_source<A: ToSocketAddrs, B: ToSocketAddrs>(
    bind_addr: A,
    peer_addr: B
) -> Result<CoAPClient>
[src]

Create a CoAP client with the specific source and peer address.

pub fn new<A: ToSocketAddrs>(addr: A) -> Result<CoAPClient>[src]

Create a CoAP client with the peer address.

pub fn get(url: &str) -> Result<CoAPResponse>[src]

Execute a get request

pub fn get_with_timeout(url: &str, timeout: Duration) -> Result<CoAPResponse>[src]

Execute a get request with the coap url and a specific timeout.

pub fn observe<H: FnMut(Packet) + Send + 'static>(
    &mut self,
    resource_path: &str,
    handler: H
) -> Result<()>
[src]

Observe a resource with the handler

pub fn unobserve(&mut self)[src]

Stop observing

pub fn request_with_timeout(
    url: &str,
    timeout: Option<Duration>
) -> Result<CoAPResponse>
[src]

Deprecated since 0.6.0:

please use get_with_timeout instead

Execute a request with the coap url and a specific timeout. Default timeout is 5s.

pub fn request(url: &str) -> Result<CoAPResponse>[src]

Deprecated since 0.6.0:

please use get instead

Execute a request with the coap url.

pub fn send(&self, request: &CoAPRequest) -> Result<()>[src]

Execute a request.

pub fn receive(&self) -> Result<CoAPResponse>[src]

Receive a response.

pub fn set_receive_timeout(&self, dur: Option<Duration>) -> Result<()>[src]

Set the receive timeout.

Trait Implementations

impl Drop for CoAPClient[src]

Auto Trait Implementations

impl Send for CoAPClient

impl !Sync for CoAPClient

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.