coap_handler_implementations

Trait TypeRenderable

Source
pub trait TypeRenderable {
    type Get;
    type Post;
    type Put;

    // Provided methods
    fn get(&mut self) -> Result<Self::Get, u8> { ... }
    fn post(&mut self, _representation: &Self::Post) -> u8 { ... }
    fn put(&mut self, _representation: &Self::Put) -> u8 { ... }
    fn delete(&mut self) -> u8 { ... }
}
Expand description

A simple Handler trait that supports GET, POST and/or PUT on a data structure that supports serde.

A TypeRenderable implementation can be turned into a Handler by wrapping it in TypeHandler::new.

Required Associated Types§

Source

type Get

Output type of the [get()] method, serialized into the response payload.

Source

type Post

Input type of the [post()] method, deserialized from the request payload.

Note that with TypedRenderable in this version, the response is always empty.

Source

type Put

Input type of the [put()] method, deserialized from the request payload.

Provided Methods§

Source

fn get(&mut self) -> Result<Self::Get, u8>

Source

fn post(&mut self, _representation: &Self::Post) -> u8

Source

fn put(&mut self, _representation: &Self::Put) -> u8

Source

fn delete(&mut self) -> u8

Implementors§