struct AnchorAligner<'a> {
merged_lines: Vec<AAMergedLine>,
anchor_def_to_merged_line_idx: IndexMap<&'a str, usize, BuildHasherDefault<FxHasher>>,
original_columns: SmallVec<[AAColumn<'a>; 4]>,
}
Expand description
Tool for adjusting pretty-printed columns, so that their anchors line up (by adding empty lines to whichever side “is behind”).
Fields§
§merged_lines: Vec<AAMergedLine>
§anchor_def_to_merged_line_idx: IndexMap<&'a str, usize, BuildHasherDefault<FxHasher>>
Current (“rightmost”) column’s anchor definitions (with indices pointing
into merged_lines
), which the next column will align to.
original_columns: SmallVec<[AAColumn<'a>; 4]>
Implementations§
source§impl<'a> AnchorAligner<'a>
impl<'a> AnchorAligner<'a>
sourcefn merged_columns(&self) -> impl Iterator<Item = AAMergedColumn<'a, '_>>
fn merged_columns(&self) -> impl Iterator<Item = AAMergedColumn<'a, '_>>
Flatten all columns to TextOp
s (including line separators).
sourcefn add_column_and_align_anchors(&mut self, new_column: AAColumn<'a>)
fn add_column_and_align_anchors(&mut self, new_column: AAColumn<'a>)
Merge new_column
into the current set of columns, aligning as many
anchors as possible, between it, and the most recent column.
Trait Implementations§
source§impl<'a> Default for AnchorAligner<'a>
impl<'a> Default for AnchorAligner<'a>
source§fn default() -> AnchorAligner<'a>
fn default() -> AnchorAligner<'a>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> Freeze for AnchorAligner<'a>
impl<'a> RefUnwindSafe for AnchorAligner<'a>
impl<'a> Send for AnchorAligner<'a>
impl<'a> Sync for AnchorAligner<'a>
impl<'a> Unpin for AnchorAligner<'a>
impl<'a> UnwindSafe for AnchorAligner<'a>
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more