[][src]Struct unsegen_pager::Pager

pub struct Pager<L, D = NoDecorator<L>> where
    L: PagerLine,
    D: LineDecorator
{ /* fields omitted */ }

Main Widget, may (or may not) store content, but defines static types for content and decoration.

Use load to actually fill the widget with content.

In addition to the PagerContent, it has a concept of an 'active line' that can be updated via user interaction (using the Scrollable implementation) and is always displayed when drawn to a window.

Methods

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

pub fn new() -> Self[src]

Create an empty pager, with no current content.

pub fn load(&mut self, content: PagerContent<L, D>)[src]

Load (and potentially overwrite previous) content to display in the pager.

If possible, the current line position will be preserved.

pub fn clear_content(&mut self)[src]

Clear the current content.

On subsequent draw calls, nothing will be written to the window.

pub fn content(&self) -> Option<&PagerContent<L, D>>[src]

Get a reference to the current content, if available.

pub fn content_mut(&mut self) -> Option<&mut PagerContent<L, D>>[src]

Get a mutable reference to the current content, if available.

Note that PagerContent does not allow mutable access to the stored lines, so it is required to use load to update the contents. A pager is not a text editor.

pub fn go_to_line<I: Into<LineIndex>>(
    &mut self,
    line: I
) -> Result<(), PagerError>
[src]

Go to the specified line, if present.

If there is no such line, an error is returned.

pub fn go_to_line_if<F: Fn(LineIndex, &L) -> bool>(
    &mut self,
    predicate: F
) -> Result<(), PagerError>
[src]

Go to first line that matches the given predicate.

If there is no such line, an error is returned.

pub fn current_line_index(&self) -> LineIndex[src]

Get the index of the currently active line.

pub fn current_line(&self) -> Option<&L>[src]

Get a reference to the currently active line.

Trait Implementations

impl<L, D> Default for Pager<L, D> where
    L: PagerLine,
    D: LineDecorator<Line = L>, 
[src]

impl<L, D> Widget for Pager<L, D> where
    L: PagerLine,
    D: LineDecorator<Line = L>, 
[src]

impl<L, D> Scrollable for Pager<L, D> where
    L: PagerLine,
    D: LineDecorator<Line = L>, 
[src]

Auto Trait Implementations

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

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

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

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

impl<L, D> UnwindSafe for Pager<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]