pub struct InfiniteSelectItem<T: InfiniteSelectValue> { /* private fields */ }Expand description
A wrapper for infinite-select enum variants that implements SelectItem.
This allows infinite-select enum variants to be displayed in a select dropdown while preserving access to the nested value.
Implementations§
Source§impl<T: InfiniteSelectValue> InfiniteSelectItem<T>
impl<T: InfiniteSelectValue> InfiniteSelectItem<T>
Sourcepub fn new(value: T, title: impl Into<SharedString>) -> Self
pub fn new(value: T, title: impl Into<SharedString>) -> Self
Creates a new item with a custom title.
Sourcepub fn from_variant(value: T, cx: &impl Borrow<App>) -> Self
pub fn from_variant(value: T, cx: &impl Borrow<App>) -> Self
Creates an item using variant_label(cx) as the title.
Sourcepub fn into_value(self) -> T
pub fn into_value(self) -> T
Consumes the item and returns the wrapped value.
Sourcepub fn child_variant_names(&self) -> Vec<&'static str>
pub fn child_variant_names(&self) -> Vec<&'static str>
Returns the child variant names if the wrapped value has children.
Sourcepub fn child_variant_keys(&self) -> Vec<&'static str>
pub fn child_variant_keys(&self) -> Vec<&'static str>
Returns the child variant keys if the wrapped value has children.
Sourcepub fn child_variant_labels(&self, cx: &impl Borrow<App>) -> Vec<SharedString>
pub fn child_variant_labels(&self, cx: &impl Borrow<App>) -> Vec<SharedString>
Returns the child variant labels if the wrapped value has children.
Trait Implementations§
Source§impl<T: Clone + InfiniteSelectValue> Clone for InfiniteSelectItem<T>
impl<T: Clone + InfiniteSelectValue> Clone for InfiniteSelectItem<T>
Source§impl<T: InfiniteSelectValue> SearchableListItem for InfiniteSelectItem<T>
impl<T: InfiniteSelectValue> SearchableListItem for InfiniteSelectItem<T>
type Value = T
Source§fn title(&self) -> SharedString
fn title(&self) -> SharedString
Short display label shown in the dropdown row and in the trigger by default. Read more
Source§fn display_title(&self) -> Option<AnyElement>
fn display_title(&self) -> Option<AnyElement>
Override the trigger display element (e.g. “Country (US)” instead of just “United States”). Read more
Source§fn render(&self, _: &mut Window, _: &mut App) -> impl IntoElement
fn render(&self, _: &mut Window, _: &mut App) -> impl IntoElement
Render this item’s row content inside the dropdown. Read more
Source§fn render_highlighted(
&self,
query: &str,
_: &mut Window,
cx: &mut App,
) -> impl IntoElement
fn render_highlighted( &self, query: &str, _: &mut Window, cx: &mut App, ) -> impl IntoElement
Render this item’s row content with the text matching
query
highlighted. Used instead of Self::render when the component
enables highlight_matches. Read moreAuto Trait Implementations§
impl<T> Forget for InfiniteSelectItem<T>
impl<T> Freeze for InfiniteSelectItem<T>where
T: Freeze,
impl<T> Move for InfiniteSelectItem<T>
impl<T> RefUnwindSafe for InfiniteSelectItem<T>where
T: RefUnwindSafe,
impl<T> Send for InfiniteSelectItem<T>where
T: Send,
impl<T> Sync for InfiniteSelectItem<T>where
T: Sync,
impl<T> Unpin for InfiniteSelectItem<T>where
T: Unpin,
impl<T> UnsafeUnpin for InfiniteSelectItem<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for InfiniteSelectItem<T>where
T: 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
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,
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>
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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> ⓘ
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