[−][src]Struct unsegen_pager::Pager
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]
L: PagerLine,
D: LineDecorator<Line = L>,
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]
&mut self,
line: I
) -> Result<(), PagerError>
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]
&mut self,
predicate: F
) -> Result<(), PagerError>
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]
L: PagerLine,
D: LineDecorator<Line = L>,
impl<L, D> Widget for Pager<L, D> where
L: PagerLine,
D: LineDecorator<Line = L>,
[src]
L: PagerLine,
D: LineDecorator<Line = L>,
fn space_demand(&self) -> Demand2D
[src]
fn draw(&self, window: Window, _: RenderingHints)
[src]
impl<L, D> Scrollable for Pager<L, D> where
L: PagerLine,
D: LineDecorator<Line = L>,
[src]
L: PagerLine,
D: LineDecorator<Line = L>,
fn scroll_backwards(&mut self) -> OperationResult
[src]
fn scroll_forwards(&mut self) -> OperationResult
[src]
fn scroll_to_beginning(&mut self) -> OperationResult
[src]
fn scroll_to_end(&mut self) -> OperationResult
[src]
Auto Trait Implementations
impl<L, D> Send for Pager<L, D> where
D: Send,
L: Send,
D: Send,
L: Send,
impl<L, D> Sync for Pager<L, D> where
D: Sync,
L: Sync,
D: Sync,
L: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,