pub fn newline() -> Box<Layout>Expand description
Creates a simple line break.
This is a convenience function that creates a line break without any content
on either side. It’s equivalent to line(null(), null()) and provides a
clean way to insert line breaks in layouts.
§Returns
A boxed [Layout::Line] with empty content on both sides.
§Examples
use typeset::*;
// Simple line break between content
let separated = comp(
text_str("First line"),
comp(newline(), text_str("Second line"), false, false),
false, false
);
assert_eq!(format_layout(separated, 2, 80), "First line\nSecond line");use typeset::*;
// Multiple line breaks
let spaced = comp(
text_str("Content"),
comp(
newline(),
comp(newline(), text_str("More content"), false, false),
false, false
),
false, false
);
// Creates a blank line between content§See Also
blank_line- For double line breaksline()- For line breaks with content on both sides- [
join_with_lines] - For joining multiple layouts with line breaks