coap_handler_implementations

Trait SimpleRenderable

Source
pub trait SimpleRenderable {
    // Required method
    fn render<W: Write + Write>(&mut self, writer: &mut W);

    // Provided method
    fn content_format(&self) -> Option<u16> { ... }
}
Expand description

A simplified Handler trait that can react to GET requests and will render to a fmt::Write object with blockwise backing.

Anything that implements it (which includes plain &str, for example) can be packed into a SimpleRendered to form a Handler.

Required Methods§

Source

fn render<W: Write + Write>(&mut self, writer: &mut W)

Provided Methods§

Source

fn content_format(&self) -> Option<u16>

If something is returned, GETs with differing Accept options will be rejecected, and the value will be set in responses.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a> SimpleRenderable for &'a str

Source§

fn render<W>(&mut self, writer: &mut W)
where W: Write,

Source§

fn content_format(&self) -> Option<u16>

Implementors§