pub struct Select { /* private fields */ }Expand description
A closed list of options with one answer.
The select owns only whether its menu is open. It reports the option that was picked and draws whatever the caller says is current, so a refused choice is visible as the checkmark not moving.
Implementations§
Source§impl Select
impl Select
pub fn new( ident: impl Into<Ident>, _window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
pub fn options(self, options: impl IntoIterator<Item = SelectOption>) -> Self
pub fn selected(self, id: impl Into<SharedString>) -> Self
Sourcepub fn name(self, name: impl Into<SharedString>) -> Self
pub fn name(self, name: impl Into<SharedString>) -> Self
Names the control independently of its current answer or placeholder.
pub fn set_name( &mut self, name: impl Into<SharedString>, cx: &mut Context<'_, Self>, )
pub fn placeholder(self, placeholder: impl Into<SharedString>) -> Self
pub fn invalid(self, invalid: bool) -> Self
Sourcepub fn set_options(
&mut self,
options: Vec<SelectOption>,
cx: &mut Context<'_, Self>,
)
pub fn set_options( &mut self, options: Vec<SelectOption>, cx: &mut Context<'_, Self>, )
Replaces the options from the host side, keeping a selection that is still offered and dropping one that is not.
pub fn set_selected( &mut self, id: Option<SharedString>, cx: &mut Context<'_, Self>, )
pub fn selected_id(&self) -> Option<&SharedString>
pub fn selected_option(&self) -> Option<&SelectOption>
pub fn is_open(&self) -> bool
pub fn set_disabled(&mut self, disabled: bool, cx: &mut Context<'_, Self>)
Trait Implementations§
impl EventEmitter<SelectEvent> for Select
Source§impl Focusable for Select
impl Focusable for Select
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
Returns the focus handle associated with this view.
Auto Trait Implementations§
impl !RefUnwindSafe for Select
impl !Send for Select
impl !Sync for Select
impl !UnwindSafe for Select
impl Freeze for Select
impl Unpin for Select
impl UnsafeUnpin for Select
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> 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