pub struct LinesScroller<'a> { /* private fields */ }Expand description
Simple wrapper for rendering pre-rendered lines in a ScrollView
§Example
ⓘ
let lines: Vec<Line> = content.iter().map(|s| Line::raw(s)).collect();
let scroller = LinesScroller::new(&lines);
let mut scroll_view = ScrollView::new();
scroll_view.render(frame, area, ScrollViewProps {
content_height: scroller.content_height(),
scroll_offset,
is_focused: true,
style: ScrollViewStyle::default(),
behavior: ScrollViewBehavior::default(),
on_scroll: Action::Scroll,
render_content: &mut scroller.renderer(),
});Implementations§
Source§impl<'a> LinesScroller<'a>
impl<'a> LinesScroller<'a>
Sourcepub fn with_style(self, style: Style) -> Self
pub fn with_style(self, style: Style) -> Self
Set the base text style
Sourcepub fn content_height(&self) -> usize
pub fn content_height(&self) -> usize
Get the total content height
Auto Trait Implementations§
impl<'a> Freeze for LinesScroller<'a>
impl<'a> RefUnwindSafe for LinesScroller<'a>
impl<'a> Send for LinesScroller<'a>
impl<'a> Sync for LinesScroller<'a>
impl<'a> Unpin for LinesScroller<'a>
impl<'a> UnsafeUnpin for LinesScroller<'a>
impl<'a> UnwindSafe for LinesScroller<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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