[][src]Struct coap::server::CoAPServer

pub struct CoAPServer { /* fields omitted */ }

Methods

impl CoAPServer[src]

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

Creates a CoAP server listening on the given address.

pub fn handle<H: CoAPHandler + 'static>(
    &mut self,
    handler: H
) -> Result<(), CoAPServerError>
[src]

Starts handling requests with the handler

pub fn stop(&mut self)[src]

Stop the server.

pub fn set_worker_num(&mut self, worker_num: usize)[src]

Set the number of threads for handling requests

pub fn update_resource(
    &mut self,
    path: &str,
    payload: Vec<u8>
) -> Result<(), CoAPServerError>
[src]

Update the resource asynchronously, like PUT method in client

pub fn socket_addr(&self) -> Result<SocketAddr>[src]

Return the local address that the server is listening on. This can be useful when starting a server on a random port as part of unit testing.

Trait Implementations

impl Drop for CoAPServer[src]

Auto Trait Implementations

impl Send for CoAPServer

impl !Sync for CoAPServer

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.