Skip to main content

ScrollablePane

Struct ScrollablePane 

Source
pub struct ScrollablePane<'a, T: PaneEntry> {
    pub entries: &'a [T],
    pub scroll_offset: usize,
    pub title: Option<&'a str>,
    pub border_style: Style,
    pub empty_text: &'a str,
}
Expand description

A bordered, scrollable list of PaneEntry items with automatic truncation and a scroll percentage badge.

Fields§

§entries: &'a [T]

Slice of entries to display.

§scroll_offset: usize

Line offset from the top (0 = show from the first entry).

§title: Option<&'a str>

Optional title rendered in the top border.

§border_style: Style

Style applied to the block border.

§empty_text: &'a str

Text shown when entries is empty.

Implementations§

Source§

impl<'a, T: PaneEntry> ScrollablePane<'a, T>

Source

pub fn new(entries: &'a [T], scroll_offset: usize) -> Self

Create a new pane with sensible defaults.

Source

pub fn with_title(self, title: &'a str) -> Self

Set the block title.

Source

pub fn with_border_style(self, style: Style) -> Self

Set the border style.

Source

pub fn with_empty_text(self, text: &'a str) -> Self

Set the placeholder text shown when there are no entries.

Trait Implementations§

Source§

impl<T: PaneEntry> Widget for ScrollablePane<'_, T>

Source§

fn render(self, area: Rect, buf: &mut Buffer)

Draws the current state of the widget in the given buffer. That is the only method required to implement a custom widget.

Auto Trait Implementations§

§

impl<'a, T> Freeze for ScrollablePane<'a, T>

§

impl<'a, T> RefUnwindSafe for ScrollablePane<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for ScrollablePane<'a, T>
where T: Sync,

§

impl<'a, T> Sync for ScrollablePane<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for ScrollablePane<'a, T>

§

impl<'a, T> UnsafeUnpin for ScrollablePane<'a, T>

§

impl<'a, T> UnwindSafe for ScrollablePane<'a, T>
where T: RefUnwindSafe,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

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>,

Source§

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.