pub struct Block(pub Vec<Line>);
Expand description
A Block
is one or many lines of text. More blocks can be embedded within a
line, in which case the indentation of the previous line will be preserved when
outputting new lines.
Tuple Fields§
§0: Vec<Line>
Implementations§
Source§impl Block
impl Block
pub fn empty() -> Self
pub fn write_to(&self, f: &mut Formatter<'_>, prefix: &str) -> Result
pub fn set<T: Into<Block>>(self, placeholder_name: &str, content: T) -> Self
Sourcepub fn join_map<T, U, F>(iter: T, mapper: F) -> Self
pub fn join_map<T, U, F>(iter: T, mapper: F) -> Self
Run a function that maps over each item in an iterator, then join the results.
Provides an IteratorLocation
for checking whether the current item is the
first/last/only/nth item in the list.
Sourcepub fn for_each<T, U, F>(self, iter: T, mapper: F) -> Self
👎Deprecated
pub fn for_each<T, U, F>(self, iter: T, mapper: F) -> Self
Repeat a template for each element of some iterable value.
Deprecated in favor of join_map
.
Sourcepub fn join<T>(blocks: T) -> Blockwhere
T: IntoIterator<Item = Block>,
pub fn join<T>(blocks: T) -> Blockwhere
T: IntoIterator<Item = Block>,
Join multiple blocks into a single block
Trait Implementations§
impl StructuralPartialEq for Block
Auto Trait Implementations§
impl Freeze for Block
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more