pub trait BlockingServer<S>: Sized + Platform<S>where
S: Step<Self::Types, PollReq = Addrd<Req<Self::Types>>, PollResp = Addrd<Resp<Self::Types>>>,{
// Provided method
fn run<I, R>(
&self,
init: Init<I>,
handle_request: R
) -> Result<(), Error<Self::Error>>
where I: FnMut(),
R: FnMut(Run<Self::Types, Self::Error>) -> Run<Self::Types, Self::Error> { ... }
}
Expand description
Use a CoAP Platform
as a server
This trait provides a function .run()
that
allows you to provide some work to do when the server initializes (Init
)
and a closure that handles incoming requests.
Servers are thread-safe, meaning that run
may
be invoked concurrently by multiple worker threads.