pub trait TextOut {
// Required methods
fn write_str(&mut self, s: &str) -> Result<(), Fail>;
fn flush(&mut self) -> Result<(), Fail>;
// Provided method
fn has_committed(&self) -> bool { ... }
}Expand description
The fragment boundary every renderer writes to, which is one of alchemy’s shared types. A consumer of text fragments.
Fragments arrive in order and are concatenated; where the boundaries
fall carries no meaning. flush pushes everything held so far to the
final destination, and a renderer calls it exactly once, at the end of
the protocol it renders, so that a document that failed half way is not
flushed as if it were whole.
Required Methods§
fn write_str(&mut self, s: &str) -> Result<(), Fail>
fn flush(&mut self) -> Result<(), Fail>
Provided Methods§
Sourcefn has_committed(&self) -> bool
fn has_committed(&self) -> bool
Whether any text has reached the final destination, so that a
failure found now leaves partial output behind. A renderer asks this
when it fails and reports committed_output from the answer, which
is how a host knows to print output: "partial" rather than
"none". The default is the conservative answer for an output that
cannot tell: whatever the renderer handed over may be out. render’s
WriteOut answers exactly, from the bytes its writer received; a
fragment that is still buffered is not committed, and into_inner
drops it rather than sending it after the fact.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".