Struct rat_ftable::selection::RowSetSelection

source ·
pub struct RowSetSelection {
    pub anchor: Option<usize>,
    pub lead: Option<usize>,
    pub selected: HashSet<usize>,
}
Expand description

Allows selection an active range of rows. The current range can be retired to a set of selected rows.

This one only supports row-selection.

Fields§

§anchor: Option<usize>§lead: Option<usize>§selected: HashSet<usize>

Implementations§

source§

impl RowSetSelection

source

pub fn new() -> RowSetSelection

source

pub fn next(&mut self, n: usize, max: usize, extend: bool)

Select next. Maybe extend the range.

source

pub fn prev(&mut self, n: usize, extend: bool)

Select next. Maybe extend the range.

source

pub fn set_lead(&mut self, lead: Option<usize>, extend: bool)

Set a new lead. Maybe extend the range.

source

pub fn set_lead_clamped(&mut self, lead: usize, max: usize, extend: bool)

Set a new lead, at the same time limit the lead to max.

source

pub fn lead(&self) -> Option<usize>

Current lead.

source

pub fn anchor(&self) -> Option<usize>

Current anchor.

source

pub fn transfer_lead_anchor(&mut self)

Transfers the range anchor to lead to the selection set and reset both.

source

pub fn selected(&self) -> HashSet<usize>

Set of all selected rows. Clones the retired set and adds the current anchor..lead range.

source

pub fn clear(&mut self)

Clear the selection.

source

pub fn add(&mut self, idx: usize)

Add to selection.

source

pub fn remove(&mut self, idx: usize)

Remove from selection. Only works for retired selections, not for the active anchor-lead range.

Trait Implementations§

source§

impl Clone for RowSetSelection

source§

fn clone(&self) -> RowSetSelection

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RowSetSelection

source§

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

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

impl Default for RowSetSelection

source§

fn default() -> RowSetSelection

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

impl TableSelection for RowSetSelection

source§

fn is_selected_row(&self, row: usize) -> bool

Row is selected. This can be separate from is_selected_cell.
source§

fn is_selected_column(&self, _column: usize) -> bool

Column is selected. This can be separate from is_selected_cell.
source§

fn is_selected_cell(&self, _column: usize, _row: usize) -> bool

Specific cell is selected.
source§

fn lead_selection(&self) -> Option<(usize, usize)>

Selection lead.

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> 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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

§

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.