VirtualList

Struct VirtualList 

Source
pub struct VirtualList { /* private fields */ }
Expand description

Virtual list widget for egui.

Implementations§

Source§

impl VirtualList

Source

pub fn new() -> Self

Create a new VirtualList

Source

pub fn items_inserted_at_start(&mut self, scroll_top_items: usize)

Call this when you insert items at the start of the list. The list will offset the scroll position by the height of these items, so that for the user, the scroll position stays the same.

Source

pub fn over_scan(&mut self, over_scan: f32)

Set the overscan, or how much the list should render outside of the visible area. The default is 200.0.

Source

pub fn check_for_resize(&mut self, check_for_resize: bool)

Checks if the list was resized and resets the cached sizes if it was. If you are certain that the item heights won’t change on resize, you can disable this. The default is true.

Source

pub fn scroll_position_sync_on_resize( &mut self, scroll_position_sync_on_resize: bool, )

Tries to keep the first visible item at the top of the screen when the window is resized. Depending on the contents, this may cause some flicker. The default is true.

Source

pub fn hide_on_resize(&mut self, hide_on_resize: impl Into<Option<Duration>>)

Prevent flickering while resizing by hiding the list until the resize is done. The default is true.

Source

pub fn ui_custom_layout( &mut self, ui: &mut Ui, length: usize, layout: impl FnMut(&mut Ui, usize) -> usize, ) -> VirtualListResponse

The layout closure gets called for each row with the index of the first item that should be displayed. It should return the number of items that were displayed in the row.

Source

pub fn reset(&mut self)

Resets the list, clearing all cached data. Call this if items changed size, items were replaced, etc. The heights will be recalculated on the next frame.

Trait Implementations§

Source§

impl Debug for VirtualList

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VirtualList

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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