pub struct SelectState {
pub items: Vec<String>,
pub selected: usize,
pub open: bool,
pub placeholder: String,
/* private fields */
}Expand description
State for a dropdown select widget.
Renders as a single-line button showing the selected option. When activated, expands into a vertical list overlay for picking an option.
Fields§
§items: Vec<String>Selectable option labels.
selected: usizeSelected option index.
open: boolWhether the dropdown list is currently open.
placeholder: StringPlaceholder text shown when items is empty.
Implementations§
Source§impl SelectState
impl SelectState
Sourcepub fn new(items: Vec<impl Into<String>>) -> Self
pub fn new(items: Vec<impl Into<String>>) -> Self
Create select state with the provided options.
Sourcepub fn placeholder(self, p: impl Into<String>) -> Self
pub fn placeholder(self, p: impl Into<String>) -> Self
Set placeholder text shown when no item can be displayed.
Sourcepub fn selected_item(&self) -> Option<&str>
pub fn selected_item(&self) -> Option<&str>
Returns the currently selected item label, or None if empty.
Trait Implementations§
Source§impl Clone for SelectState
impl Clone for SelectState
Source§fn clone(&self) -> SelectState
fn clone(&self) -> SelectState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SelectState
impl Debug for SelectState
Source§impl Default for SelectState
impl Default for SelectState
Source§fn default() -> SelectState
fn default() -> SelectState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SelectState
impl RefUnwindSafe for SelectState
impl Send for SelectState
impl Sync for SelectState
impl Unpin for SelectState
impl UnsafeUnpin for SelectState
impl UnwindSafe for SelectState
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