pub trait Transport {
type Endpoint: Debug + Send + Clone;
// Required method
fn bind<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<BoxedFramedBinding<Self::Endpoint>, TransportError>> + Send + 'async_trait>>
where Self: 'async_trait;
}Expand description
Generalization of the underlying CoAP transport, intended primarily to make it easy to support a wide range of protocols (TCP, DTLS, websockets, BLE, etc) but also to eventually support alternative runtime frameworks such as Embassy for embedded devices.
Required Associated Types§
Required Methods§
Sourcefn bind<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<BoxedFramedBinding<Self::Endpoint>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn bind<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<BoxedFramedBinding<Self::Endpoint>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
Perform the binding, that is, begin accepting new data from this transport even if there isn’t yet a handler serving the data source yet. Note that this is not quite the same as TcpSocket::bind which requires a loop to accept the incoming connections. In our case, we expect a continuous async stream of (Packet, Endpoint) pairs which distinguish each individual socket. The transport impl is expected to spawn new tasks for each accepted source as necessary.