pub struct InfiniteSelectState<T, D = Vec<InfiniteSelectItem<T>>>where
T: InfiniteSelectValue,
D: SelectDelegate<Item = InfiniteSelectItem<T>> + From<Vec<InfiniteSelectItem<T>>> + 'static,{ /* private fields */ }Expand description
Runtime state for a cascading infinite-select field.
Implementations§
Source§impl<T, D> InfiniteSelectState<T, D>where
T: InfiniteSelectValue,
D: SelectDelegate<Item = InfiniteSelectItem<T>> + From<Vec<InfiniteSelectItem<T>>> + 'static,
impl<T, D> InfiniteSelectState<T, D>where
T: InfiniteSelectValue,
D: SelectDelegate<Item = InfiniteSelectItem<T>> + From<Vec<InfiniteSelectItem<T>>> + 'static,
Sourcepub fn new_default(window: &mut Window, cx: &mut Context<'_, Self>) -> Self
pub fn new_default(window: &mut Window, cx: &mut Context<'_, Self>) -> Self
Creates a new state from T::default().
Sourcepub fn new(
initial_value: T,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Self
pub fn new( initial_value: T, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
Creates a new state from the given initial value.
Sourcepub fn new_with_options(
initial_value: T,
options: InfiniteSelectOptions,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Self
pub fn new_with_options( initial_value: T, options: InfiniteSelectOptions, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
Creates a new state with explicit options.
Sourcepub fn path(&self) -> &InfiniteSelectPath
pub fn path(&self) -> &InfiniteSelectPath
Returns the current index-based selection path.
Sourcepub fn key_path(&self) -> &InfiniteSelectKeyPath
pub fn key_path(&self) -> &InfiniteSelectKeyPath
Returns the current key-based selection path.
Sourcepub fn selected_index_at_depth(&self, depth: usize) -> Option<usize>
pub fn selected_index_at_depth(&self, depth: usize) -> Option<usize>
Returns the selected index at the given depth.
Sourcepub fn selected_key_at_depth(&self, depth: usize) -> Option<&str>
pub fn selected_key_at_depth(&self, depth: usize) -> Option<&str>
Returns the selected key at the given depth.
Sourcepub fn levels(&self, cx: &impl Borrow<App>) -> Vec<InfiniteSelectLevel<D>>
pub fn levels(&self, cx: &impl Borrow<App>) -> Vec<InfiniteSelectLevel<D>>
Returns the current rendered select levels in root-to-leaf order.
Sourcepub fn snapshot(&self, cx: &impl Borrow<App>) -> InfiniteSelectSnapshot<T, D>
pub fn snapshot(&self, cx: &impl Borrow<App>) -> InfiniteSelectSnapshot<T, D>
Returns an owned snapshot of the value, paths, and rendered levels.
Sourcepub fn form_fields(&self, cx: &impl Borrow<App>) -> Vec<Field>
pub fn form_fields(&self, cx: &impl Borrow<App>) -> Vec<Field>
Returns render-ready GPUI form fields for each visible select level.
Sourcepub fn master_select(&self) -> Entity<SelectState<D>>
pub fn master_select(&self) -> Entity<SelectState<D>>
Returns the root select entity.
Sourcepub fn child_selects(&self) -> Vec<Entity<SelectState<D>>>
pub fn child_selects(&self) -> Vec<Entity<SelectState<D>>>
Returns the currently visible child selects.
Sourcepub fn set_value(
&mut self,
value: T,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn set_value( &mut self, value: T, window: &mut Window, cx: &mut Context<'_, Self>, )
Programmatically sets the current selection.
Sourcepub fn set_path(
&mut self,
path: &InfiniteSelectPath,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Result<(), InfiniteSelectPathError>
pub fn set_path( &mut self, path: &InfiniteSelectPath, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Result<(), InfiniteSelectPathError>
Programmatically sets the current selection from an index path.
Sourcepub fn set_key_path(
&mut self,
key_path: &InfiniteSelectKeyPath,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Result<(), InfiniteSelectPathError>
pub fn set_key_path( &mut self, key_path: &InfiniteSelectKeyPath, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Result<(), InfiniteSelectPathError>
Programmatically sets the current selection from a key path.
Sourcepub fn set_selected_index_at_depth(
&mut self,
depth: usize,
index: usize,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Result<(), InfiniteSelectPathError>
pub fn set_selected_index_at_depth( &mut self, depth: usize, index: usize, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Result<(), InfiniteSelectPathError>
Programmatically changes one selection index and resets deeper levels to defaults.
Sourcepub fn set_selected_key_at_depth(
&mut self,
depth: usize,
key: impl Into<String>,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Result<(), InfiniteSelectPathError>
pub fn set_selected_key_at_depth( &mut self, depth: usize, key: impl Into<String>, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Result<(), InfiniteSelectPathError>
Programmatically changes one selection key and resets deeper levels to defaults.
Trait Implementations§
impl<T, D> EventEmitter<InfiniteSelectEvent<T>> for InfiniteSelectState<T, D>where
T: InfiniteSelectValue,
D: SelectDelegate<Item = InfiniteSelectItem<T>> + From<Vec<InfiniteSelectItem<T>>> + 'static,
Source§impl<T, D> Focusable for InfiniteSelectState<T, D>where
T: InfiniteSelectValue,
D: SelectDelegate<Item = InfiniteSelectItem<T>> + From<Vec<InfiniteSelectItem<T>>> + 'static,
impl<T, D> Focusable for InfiniteSelectState<T, D>where
T: InfiniteSelectValue,
D: SelectDelegate<Item = InfiniteSelectItem<T>> + From<Vec<InfiniteSelectItem<T>>> + 'static,
Source§fn focus_handle(&self, cx: &App) -> FocusHandle
fn focus_handle(&self, cx: &App) -> FocusHandle
Source§impl<T, D> Render for InfiniteSelectState<T, D>where
T: InfiniteSelectValue,
D: SelectDelegate<Item = InfiniteSelectItem<T>> + From<Vec<InfiniteSelectItem<T>>> + 'static,
impl<T, D> Render for InfiniteSelectState<T, D>where
T: InfiniteSelectValue,
D: SelectDelegate<Item = InfiniteSelectItem<T>> + From<Vec<InfiniteSelectItem<T>>> + 'static,
Auto Trait Implementations§
impl<T, D = Vec<InfiniteSelectItem<T>>> !RefUnwindSafe for InfiniteSelectState<T, D>
impl<T, D = Vec<InfiniteSelectItem<T>>> !Send for InfiniteSelectState<T, D>
impl<T, D = Vec<InfiniteSelectItem<T>>> !Sync for InfiniteSelectState<T, D>
impl<T, D = Vec<InfiniteSelectItem<T>>> !UnwindSafe for InfiniteSelectState<T, D>
impl<T, D> Forget for InfiniteSelectState<T, D>
impl<T, D> Freeze for InfiniteSelectState<T, D>
impl<T, D> Move for InfiniteSelectState<T, D>
impl<T, D> Unpin for InfiniteSelectState<T, D>
impl<T, D> UnsafeUnpin for InfiniteSelectState<T, D>where
T: UnsafeUnpin,
Entity<SelectState<D>>: UnsafeUnpin,
Vec<Entity<SelectState<D>>>: UnsafeUnpin,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
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