pub trait ResponseWriter {
// Required methods
fn write(&mut self, content: &str) -> Result<(), HandlerError>;
fn end(&mut self) -> Result<(), HandlerError>;
// Provided methods
fn write_escaped(&mut self, content: &str) -> Result<(), HandlerError> { ... }
fn write_escaped_attribute(
&mut self,
name: &str,
value: &str,
) -> Result<(), HandlerError> { ... }
}Expand description
Interface for writing rendered output
Required Methods§
Sourcefn end(&mut self) -> Result<(), HandlerError>
fn end(&mut self) -> Result<(), HandlerError>
Finalize the output
Provided Methods§
Sourcefn write_escaped(&mut self, content: &str) -> Result<(), HandlerError>
fn write_escaped(&mut self, content: &str) -> Result<(), HandlerError>
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.
Sourcefn write_escaped_attribute(
&mut self,
name: &str,
value: &str,
) -> Result<(), HandlerError>
fn write_escaped_attribute( &mut self, name: &str, value: &str, ) -> Result<(), HandlerError>
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".