Trait Backend

Source
pub trait Backend<E>: Send {
    type Observe: Observer<E>;

    // Required methods
    fn request<'life0, 'async_trait>(
        &'life0 mut self,
        req: Packet,
        opts: RequestOptions,
    ) -> Pin<Box<dyn Future<Output = Result<Packet, E>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn observe<'life0, 'async_trait>(
        &'life0 mut self,
        resource: String,
        opts: RequestOptions,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Observe, E>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn unobserve<'life0, 'async_trait>(
        &'life0 mut self,
        o: Self::Observe,
    ) -> Pin<Box<dyn Future<Output = Result<(), E>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generic transport trait for implementing CoAP client backends

Required Associated Types§

Required Methods§

Source

fn request<'life0, 'async_trait>( &'life0 mut self, req: Packet, opts: RequestOptions, ) -> Pin<Box<dyn Future<Output = Result<Packet, E>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn observe<'life0, 'async_trait>( &'life0 mut self, resource: String, opts: RequestOptions, ) -> Pin<Box<dyn Future<Output = Result<Self::Observe, E>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn unobserve<'life0, 'async_trait>( &'life0 mut self, o: Self::Observe, ) -> Pin<Box<dyn Future<Output = Result<(), E>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§