pub struct Body<'a> {
pub rows: usize,
pub selected: Option<&'a dyn Fn(usize) -> bool>,
pub scroll_to: Option<usize>,
}Expand description
The body’s own facts for this frame: how many rows, which are selected, and which one to bring into view.
Held apart from TableStyle because none of it is style and none of it
survives the frame: a row count changes when a folder does, a selection when
the user clicks, and a scroll request exists for exactly one frame. Held
apart from the Column slice because none of it is description either.
The description says what a table is, and this says what it holds right
now.
Both of the optional fields are here rather than left to the app because
egui_extras answers them on a handle the app never sees: set_selected is a
method on the row, and scroll_to_row a method on the builder, and this
crate owns both. That is the same reason cell exists.
Fields§
§rows: usizeHow many rows to draw.
selected: Option<&'a dyn Fn(usize) -> bool>Whether a row is selected, by index.
A predicate rather than a set, so an app whose selection is a range, a
bitmap or a single index does not have to build a collection to be asked.
None is a table no row of which is selected, which is not the same
claim as a predicate that always answers false and costs nothing to make.
scroll_to: Option<usize>A row to bring into view this frame.
Set it from a request the app then clears, the way a keyboard cursor moving off-screen raises one: held rather than taken, it would fight every scroll the user makes with the mouse.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Body<'a>
impl<'a> !Send for Body<'a>
impl<'a> !Sync for Body<'a>
impl<'a> !UnwindSafe for Body<'a>
impl<'a> Freeze for Body<'a>
impl<'a> Unpin for Body<'a>
impl<'a> UnsafeUnpin for Body<'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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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