Skip to main content

Body

Struct Body 

Source
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: usize

How 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§

Source§

impl Debug for Body<'_>

Source§

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

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

impl<'a> Default for Body<'a>

Source§

fn default() -> Body<'a>

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

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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.