Skip to main content

ResponseWriter

Trait ResponseWriter 

Source
pub trait ResponseWriter {
    // Required methods
    fn write(&mut self, content: &str) -> Result<()>;
    fn end(&mut self) -> Result<()>;

    // Provided methods
    fn write_escaped(&mut self, content: &str) -> Result<()> { ... }
    fn write_escaped_attribute(&mut self, name: &str, value: &str) -> Result<()> { ... }
}
Expand description

Interface for writing rendered output

Required Methods§

Source

fn write(&mut self, content: &str) -> Result<()>

Write content to the output

Source

fn end(&mut self) -> Result<()>

Finalize the output

Provided Methods§

Source

fn write_escaped(&mut self, content: &str) -> Result<()>

Write untrusted text with the same HTML escaping as encode_safe.

Buffered writers may override this to append encoded text directly without allocating an intermediate string.

Source

fn write_escaped_attribute(&mut self, name: &str, value: &str) -> Result<()>

Write a quoted HTML attribute, escaping its untrusted value.

The name must already be a valid, trusted attribute name. Implementations must preserve the six entity replacements used by encode_safe.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§