pub struct Selection<K> { /* private fields */ }Expand description
The selected keys, the cursor and the anchor.
Implementations§
Source§impl<K: Key> Selection<K>
impl<K: Key> Selection<K>
pub fn contains(&self, key: &K) -> bool
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub fn set(&mut self, keys: impl IntoIterator<Item = K>, cursor: Option<K>)
pub fn set(&mut self, keys: impl IntoIterator<Item = K>, cursor: Option<K>)
Selects these keys, the cursor on cursor.
Sourcepub fn set_keys(&mut self, keys: impl IntoIterator<Item = K>)
pub fn set_keys(&mut self, keys: impl IntoIterator<Item = K>)
Selects these keys, the cursor and the anchor kept (a selection shared with other widgets, followed).
Sourcepub fn set_cursor(&mut self, cursor: Option<K>)
pub fn set_cursor(&mut self, cursor: Option<K>)
Moves the cursor without changing the selection.
pub fn clear(&mut self)
Sourcepub fn retain(&mut self, keep: impl Fn(&K) -> bool) -> bool
pub fn retain(&mut self, keep: impl Fn(&K) -> bool) -> bool
Keeps the keys keep accepts (rows that are gone are dropped);
the cursor and anchor go too when refused. Returns whether
anything was dropped.
Sourcepub fn click(
&self,
mode: Mode,
len: usize,
key_at: &dyn Fn(usize) -> K,
index: usize,
modifiers: Modifiers,
) -> Proposal<K>
pub fn click( &self, mode: Mode, len: usize, key_at: &dyn Fn(usize) -> K, index: usize, modifiers: Modifiers, ) -> Proposal<K>
The selection a click on row index proposes. key_at gives
the key of a row; len is how many rows there are.
Sourcepub fn move_to(
&self,
mode: Mode,
len: usize,
key_at: &dyn Fn(usize) -> K,
index: usize,
modifiers: Modifiers,
) -> Proposal<K>
pub fn move_to( &self, mode: Mode, len: usize, key_at: &dyn Fn(usize) -> K, index: usize, modifiers: Modifiers, ) -> Proposal<K>
The selection moving the cursor to row index with the keyboard
proposes: Shift extends from the anchor, Ctrl moves the cursor
alone.
Sourcepub fn toggle_cursor(&self, mode: Mode) -> Option<Proposal<K>>
pub fn toggle_cursor(&self, mode: Mode) -> Option<Proposal<K>>
Toggles the cursor’s row (Ctrl+Space).
Trait Implementations§
Auto Trait Implementations§
impl<K> Freeze for Selection<K>where
K: Freeze,
impl<K> RefUnwindSafe for Selection<K>where
K: RefUnwindSafe,
impl<K> Send for Selection<K>where
K: Send,
impl<K> Sync for Selection<K>where
K: Sync,
impl<K> Unpin for Selection<K>where
K: Unpin,
impl<K> UnsafeUnpin for Selection<K>where
K: UnsafeUnpin,
impl<K> UnwindSafe for Selection<K>where
K: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.