pub struct Segment {
pub span: Span,
pub padding: u8,
}Expand description
One logical line of a leaf block:
the source line with container prefixes (>, list indents) already stripped.
padding is the number of virtual spaces in front of span left over
when prefix consumption stopped inside a tab
(tabs advance to 4-column stops, so a prefix can end mid-tab).
Consumers render padding spaces, then the slice.
Fields§
§span: Span§padding: u8Implementations§
Source§impl Segment
impl Segment
pub fn new(span: Span, padding: u8) -> Self
Sourcepub fn join<'s>(source: &'s str, pieces: &[Segment]) -> Cow<'s, str>
pub fn join<'s>(source: &'s str, pieces: &[Segment]) -> Cow<'s, str>
The logical text of a multi-line construct:
pieces joined with \n, padding rendered as spaces.
Borrows for the common single-line case.
This is what labels are normalized from and what a multi-line title decodes from;
a raw source slice across the pieces would include the container prefixes between them.
Trait Implementations§
impl Copy for Segment
impl Eq for Segment
impl StructuralPartialEq for Segment
Auto Trait Implementations§
impl Freeze for Segment
impl RefUnwindSafe for Segment
impl Send for Segment
impl Sync for Segment
impl Unpin for Segment
impl UnsafeUnpin for Segment
impl UnwindSafe for Segment
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