pub struct CoapServer<Handler, Endpoint> { /* private fields */ }Expand description
Primary server API to configure, bind, and ultimately run the CoAP server.
Implementations§
Source§impl<Handler, Endpoint: Debug + Send + Clone + 'static> CoapServer<Handler, Endpoint>where
Handler: PacketHandler<Endpoint> + Send + 'static,
impl<Handler, Endpoint: Debug + Send + Clone + 'static> CoapServer<Handler, Endpoint>where
Handler: PacketHandler<Endpoint> + Send + 'static,
Sourcepub async fn bind<T: Transport<Endpoint = Endpoint>>(
transport: T,
) -> Result<Self, TransportError>
pub async fn bind<T: Transport<Endpoint = Endpoint>>( transport: T, ) -> Result<Self, TransportError>
Bind the server to a specific source of incoming packets in a transport-agnostic way. Most
customers will wish to use crate::udp::UdpTransport.
Sourcepub async fn serve(
self,
handler: impl IntoHandler<Handler, Endpoint>,
) -> Result<(), FatalServerError>
pub async fn serve( self, handler: impl IntoHandler<Handler, Endpoint>, ) -> Result<(), FatalServerError>
Run the server “forever”. Note that the function may return a fatal error if the server encounters unrecoverable issues, typically due to programmer error in this crate itself or transport errors not related to a specific peer. The intention is that this crate should be highly reliable and run indefinitely for properly configured use cases.
Auto Trait Implementations§
impl<Handler, Endpoint> Freeze for CoapServer<Handler, Endpoint>where
Handler: Freeze,
impl<Handler, Endpoint> !RefUnwindSafe for CoapServer<Handler, Endpoint>
impl<Handler, Endpoint> Send for CoapServer<Handler, Endpoint>
impl<Handler, Endpoint> !Sync for CoapServer<Handler, Endpoint>
impl<Handler, Endpoint> Unpin for CoapServer<Handler, Endpoint>where
Handler: Unpin,
impl<Handler, Endpoint> !UnwindSafe for CoapServer<Handler, Endpoint>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more