Skip to main content

Combobox

Struct Combobox 

Source
pub struct Combobox<T: Searchable + Send + Sync + 'static> { /* private fields */ }

Implementations§

Source§

impl<T: Searchable + Send + Sync + 'static> Combobox<T>

Source

pub fn new(items: Vec<T>) -> Self

Source

pub fn from_matches(matches: Vec<T>) -> Self

Source

pub fn query(&self) -> &str

Source

pub fn matches(&self) -> &[T]

Source

pub fn selected_index(&self) -> usize

Source

pub fn set_max_visible(&mut self, max: usize)

Source

pub fn set_match_sort(&mut self, sort: fn(&T, &T) -> Ordering)

Source

pub fn is_empty(&self) -> bool

Source

pub fn selected(&self) -> Option<&T>

Source

pub fn push_query_char(&mut self, c: char)

Source

pub fn pop_query_char(&mut self)

Source

pub fn set_selected_index(&mut self, index: usize)

Source

pub fn move_up(&mut self)

Source

pub fn move_down(&mut self)

Source

pub fn move_up_where(&mut self, predicate: impl Fn(&T) -> bool)

Source

pub fn move_down_where(&mut self, predicate: impl Fn(&T) -> bool)

Source

pub fn select_first_where(&mut self, predicate: impl Fn(&T) -> bool)

Source

pub fn render_items( &self, context: &ViewContext, render_item: impl Fn(&T, bool, &ViewContext) -> Line, ) -> Vec<Line>

Source

pub fn visible_matches_with_selection(&self) -> Vec<(&T, bool)>

Source

pub fn handle_picker_event( &mut self, event: &Event, ) -> Option<Vec<PickerMessage<T>>>

Standard event dispatch for picker-style components.

Handles Escape, Up/Down, Enter (confirm), Char (query + whitespace-close), Backspace, and BackspaceOnEmpty. Returns PickerMessage<T> for each action.

Auto Trait Implementations§

§

impl<T> Freeze for Combobox<T>

§

impl<T> !RefUnwindSafe for Combobox<T>

§

impl<T> Send for Combobox<T>

§

impl<T> Sync for Combobox<T>

§

impl<T> Unpin for Combobox<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Combobox<T>

§

impl<T> !UnwindSafe for Combobox<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more