[][src]Struct unsegen_pager::PagerContent

pub struct PagerContent<L: PagerLine, D: LineDecorator> { /* fields omitted */ }

A collection of PagerLines including information about the highlighting state and (if present) a LineDecorator.

Use from_lines or from_file to build an initial content and add highlighter and decorator using with_highlighter and with_decorator.

Methods

impl<L: PagerLine> PagerContent<L, NoDecorator<L>>[src]

pub fn from_lines(storage: Vec<L>) -> Self[src]

Create a simple PagerContent from a ordered collection of lines. The lines the Vec will be displayed top to bottom from beginning to end.

impl PagerContent<String, NoDecorator<String>>[src]

pub fn from_file<F: AsRef<Path>>(file_path: F) -> Result<Self>[src]

Try to load lines (as strings) from the given file as the lines of PagerContent.

impl<L, D> PagerContent<L, D> where
    L: PagerLine,
    D: LineDecorator<Line = L>, 
[src]

pub fn with_highlighter<HN: Highlighter>(
    self,
    highlighter: &HN
) -> PagerContent<L, D>
[src]

Add a Highlighter to PagerContent that previously did not have one.

impl<L> PagerContent<L, NoDecorator<L>> where
    L: PagerLine
[src]

pub fn with_decorator<DN: LineDecorator<Line = L>>(
    self,
    decorator: DN
) -> PagerContent<L, DN>
[src]

Add a Decorator to PagerContent that previously did not have one.

impl<L, D> PagerContent<L, D> where
    L: PagerLine,
    D: LineDecorator<Line = L>, 
[src]

pub fn view<'a, I: Into<LineIndex> + Clone, R: RangeBounds<I>>(
    &'a self,
    range: R
) -> impl DoubleEndedIterator<Item = (LineIndex, &'a L)> + 'a where
    Self: Sized
[src]

Iterate over a specified range of lines stored.

The specified range can be larger than what the PagerContent currently holds. In that case the additional indices are simply not part of the returned iterator.

pub fn view_line<I: Into<LineIndex>>(&self, line: I) -> Option<&L>[src]

Try to view a specific line with the given index.

pub fn set_decorator(&mut self, decorator: D)[src]

Overwrite the current decorator with a compatible one.

Auto Trait Implementations

impl<L, D> Unpin for PagerContent<L, D> where
    D: Unpin,
    L: Unpin

impl<L, D> Sync for PagerContent<L, D> where
    D: Sync,
    L: Sync

impl<L, D> Send for PagerContent<L, D> where
    D: Send,
    L: Send

impl<L, D> RefUnwindSafe for PagerContent<L, D> where
    D: RefUnwindSafe,
    L: RefUnwindSafe

impl<L, D> UnwindSafe for PagerContent<L, D> where
    D: UnwindSafe,
    L: UnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]