[][src]Struct coap::server::Server

pub struct Server<'a, HandlerRet> where
    HandlerRet: Future<Output = Option<CoapResponse>>, 
{ /* fields omitted */ }

Implementations

impl<'a, HandlerRet> Server<'a, HandlerRet> where
    HandlerRet: Future<Output = Option<CoapResponse>>, 
[src]

pub fn new<A: ToSocketAddrs>(addr: A) -> Result<Server<'a, HandlerRet>, Error>[src]

Creates a CoAP server listening on the given address.

pub async fn run<F: FnMut(CoapRequest<SocketAddr>) -> HandlerRet + Send + 'a, '_>(
    &'_ mut self,
    handler: F
) -> Result<(), Error>
[src]

run the server.

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.

Auto Trait Implementations

impl<'a, HandlerRet> !RefUnwindSafe for Server<'a, HandlerRet>

impl<'a, HandlerRet> Send for Server<'a, HandlerRet>

impl<'a, HandlerRet> !Sync for Server<'a, HandlerRet>

impl<'a, HandlerRet> Unpin for Server<'a, HandlerRet>

impl<'a, HandlerRet> !UnwindSafe for Server<'a, HandlerRet>

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.