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>

source

fn merged_columns(&self) -> impl Iterator<Item = AAMergedColumn<'a, '_>>

Flatten all columns to TextOps (including line separators).

source

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>

source§

fn default() -> AnchorAligner<'a>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.