pub trait SimpleRenderable {
// Required method
fn render<W>(&mut self, writer: &mut W)
where W: Write;
// Provided methods
fn render_bytes(&mut self, writer: &mut WindowedInfinityWithETag<'_>) { ... }
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.
For binary data, render_bytes can be implemented instead of render, and utilize the WindowedInfinityWithETag’s write_bytes method (multiple times, if so desired). In that case, the render function can be left unimplemented.
Required Methods§
Provided Methods§
fn render_bytes(&mut self, writer: &mut WindowedInfinityWithETag<'_>)
sourcefn content_format(&self) -> Option<u16>
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.