pub struct Join<O: TextOut> { /* private fields */ }Expand description
Writes a separator between logical items.
An item is what lies between Join::item_start and
Join::item_end; it may be written in any number of fragments, or in
none, and an empty item is still an item, so ["", ""] joined with ,
is ,. A fragment written outside an item is an item of its own, which
is the common case of one text per element and needs no markers. The
separator goes before every item but the first, never between the
fragments of one item: that distinction is the whole reason this type
exists, because a chunked transport must not change the text.
Implementations§
Source§impl<O: TextOut> Join<O>
impl<O: TextOut> Join<O>
pub fn new(out: O, separator: impl Into<Box<str>>) -> Self
Sourcepub fn item_start(&mut self) -> Result<(), Fail>
pub fn item_start(&mut self) -> Result<(), Fail>
Begin an item: the separator is written now if an item came before.
Starting an item inside an item is PROTOCOL_ORDER_ERROR.
Sourcepub fn item_end(&mut self) -> Result<(), Fail>
pub fn item_end(&mut self) -> Result<(), Fail>
End the current item. Ending when no item is open is
PROTOCOL_ORDER_ERROR.
pub fn into_inner(self) -> O
Trait Implementations§
Source§impl<O: TextOut> TextOut for Join<O>
impl<O: TextOut> TextOut for Join<O>
Source§fn flush(&mut self) -> Result<(), Fail>
fn flush(&mut self) -> Result<(), Fail>
Flushes the output beneath; an open item stays open, since a flush is about transport and an item is about meaning.
fn write_str(&mut self, s: &str) -> Result<(), Fail>
Source§fn has_committed(&self) -> bool
fn has_committed(&self) -> bool
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.