[][src]Trait unsegen_pager::LineDecorator

pub trait LineDecorator {
    type Line: PagerLine;
    fn horizontal_space_demand<'a, 'b: 'a>(
        &'a self,
        lines: impl DoubleEndedIterator<Item = (LineIndex, &'b Self::Line)> + 'b
    ) -> ColDemand
    where
        Self::Line: 'b
;
fn decorate(
        &self,
        line: &Self::Line,
        line_to_decorate_index: LineIndex,
        active_line_index: LineIndex,
        window: Window
    ); }

Interface for anything that is able to decorate lines, i.e., to draw something next to the left of a pager line, given some information about the line.

Associated Types

type Line: PagerLine

The type of line that can be decorated using this implementation.

Loading content...

Required methods

fn horizontal_space_demand<'a, 'b: 'a>(
    &'a self,
    lines: impl DoubleEndedIterator<Item = (LineIndex, &'b Self::Line)> + 'b
) -> ColDemand where
    Self::Line: 'b, 

Define how much (horizontal) space is required to draw the decoration of the given lines.

As the width of the decorator column is fixed for all lines, the implementer should choose the maximum demand of all lines.

fn decorate(
    &self,
    line: &Self::Line,
    line_to_decorate_index: LineIndex,
    active_line_index: LineIndex,
    window: Window
)

Decorate the given line by drawing to `window.

Information of how to decorate the line can retrieved from the line itself, its index, and/or the index of the currently active line of the pager.

Note that window is at least one row in height and in fact is so in most cases, but an implementer cannot rely on that. It is also not guaranteed that the window is as wide as specified in the last call to horizontal_space_demand.

Loading content...

Implementors

impl<L: PagerLine> LineDecorator for LineNumberDecorator<L>[src]

type Line = L

impl<L: PagerLine> LineDecorator for NoDecorator<L>[src]

type Line = L

Loading content...