CoapServer

Struct CoapServer 

Source
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,

Source

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.

Source

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>
where Handler: Send, Endpoint: Send,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V