pub struct Selection<K: Clone + PartialEq + 'static> { /* private fields */ }Expand description
Selection state for keys of type K. Cheap to copy.
Implementations§
Source§impl<K: Clone + PartialEq + 'static> Selection<K>
impl<K: Clone + PartialEq + 'static> Selection<K>
Sourcepub fn from_signal(items: Signal<Vec<K>>) -> Self
pub fn from_signal(items: Signal<Vec<K>>) -> Self
Wrap an existing item signal without allocating hook state.
This retains the pre-range-selection constructor contract and is safe
outside component renders. Range operations derive their anchor from
the first selected item; use use_selection_from_signal or
Self::from_signals when the anchor must persist independently.
Sourcepub fn from_signals(items: Signal<Vec<K>>, anchor: Signal<Option<K>>) -> Self
pub fn from_signals(items: Signal<Vec<K>>, anchor: Signal<Option<K>>) -> Self
Wrap existing item and anchor signals.
This is the non-hook constructor for state owned outside the current component. Supplying both signals makes range-anchor lifetime explicit and prevents it from being reset by reconstruction.
Sourcepub fn is_selected(&self, key: &K) -> bool
pub fn is_selected(&self, key: &K) -> bool
Is key currently selected?
Sourcepub fn select_only(&mut self, key: K)
pub fn select_only(&mut self, key: K)
Replace the selection with just key.
Sourcepub fn click(&mut self, key: K, modifiers: Modifiers)
pub fn click(&mut self, key: K, modifiers: Modifiers)
Apply the standard click convention: plain click selects only this key; a click with Ctrl or Cmd held toggles it.
Sourcepub fn select_range(&mut self, ordered: &[K], to: &K, additive: bool) -> bool
pub fn select_range(&mut self, ordered: &[K], to: &K, additive: bool) -> bool
Select the inclusive range from the current anchor to to in the
caller’s stable visual order. Returns false when either endpoint is
absent from ordered.
Sourcepub fn click_in_order(&mut self, key: K, modifiers: Modifiers, ordered: &[K])
pub fn click_in_order(&mut self, key: K, modifiers: Modifiers, ordered: &[K])
Standard click behavior plus Shift-range selection.
Trait Implementations§
impl<K: Clone + PartialEq + 'static> Copy for Selection<K>
Auto Trait Implementations§
impl<K> !RefUnwindSafe for Selection<K>
impl<K> !Send for Selection<K>
impl<K> !Sync for Selection<K>
impl<K> !UnwindSafe for Selection<K>
impl<K> Freeze for Selection<K>
impl<K> Unpin for Selection<K>
impl<K> UnsafeUnpin for Selection<K>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DependencyElement for T
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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