pub struct PrintItems<'a> { /* private fields */ }Expand description
A list of print items allocated in an Arena.
Implementations§
Source§impl<'a> PrintItems<'a>
impl<'a> PrintItems<'a>
pub fn new(arena: &'a Arena) -> Self
pub fn into_rc_path(self) -> Option<PrintItemPath<'a>>
pub fn push_item(&mut self, item: PrintItem<'a>)
pub fn extend(&mut self, items: PrintItems<'a>)
Sourcepub fn push_str_runtime_width_computed(&mut self, item: &'a str)
pub fn push_str_runtime_width_computed(&mut self, item: &'a str)
Pushes a string that will have its width computed at runtime.
The string isn’t copied, so this can be used for text that lives at least as long as the arena, such as the text of the file being formatted.
Instead of using this, prefer to use push_sc where possible
with the sc! macro from the dprint-core-macros crate.
pub fn push_force_current_line_indentation(&mut self)
pub fn push_space(&mut self)
Sourcepub fn push_sc(&mut self, item: &'a StringContainer<'a>)
pub fn push_sc(&mut self, item: &'a StringContainer<'a>)
Pushes a string that’s had its width computed at compile time.
Sourcepub fn push_string(&mut self, item: String)
pub fn push_string(&mut self, item: String)
Pushes a string, copying it into the arena.
Sourcepub fn push_str(&mut self, item: &str)
pub fn push_str(&mut self, item: &str)
Pushes a borrowed string, copying it into the arena, and computes its width at runtime.
Prefer push_sc with the sc! macro for text known at compile time, and
push_str_runtime_width_computed for text that lives as long as the arena, since
neither copies. Use this for other text the caller doesn’t own: it avoids building
a String only for it to be copied and thrown away.