pub struct SearchField<'a> { /* private fields */ }Expand description
The search field.
Implementations§
Source§impl<'a> SearchField<'a>
impl<'a> SearchField<'a>
Sourcepub fn new(library: impl Into<String>) -> Self
pub fn new(library: impl Into<String>) -> Self
The search field of library library (its name in the
library.filter step and in commands).
Sourcepub fn suggestions(self, suggestions: &'a [Suggestion]) -> Self
pub fn suggestions(self, suggestions: &'a [Suggestion]) -> Self
The application’s suggestions for the text typed, given each pass
(meant with Self::whole_text). They show in a list under the
field once something is typed, or on Down: Up and Down move the
highlight, Enter or a click takes the highlighted one (the text
becomes its Suggestion::insert, SearchEvent::Picked).
Escape closes the list, then clears the text, then leaves the
field, each reported (SearchState::take_events); the field
keeps the keyboard until the last step, the focus plugin installed
(an application’s window) or not.
Sourcepub fn chips(self, chips: &'a [AppChip]) -> Self
pub fn chips(self, chips: &'a [AppChip]) -> Self
The application’s chips, drawn in the field after the field’s own
(meant with Self::whole_text: the application’s reading of the
text, in words). Each has its remove button; in the empty field,
Backspace selects the last one and removes it at a second press,
Ctrl+Backspace removes it at once. A removal is reported
(SearchEvent::ChipRemoved): the application drops the chip
from its text.
Sourcepub fn whole_text(self, whole: bool) -> Self
pub fn whole_text(self, whole: bool) -> Self
The application reads the text typed with its own grammar: the
text is never split into this field’s criteria (Filter::parse),
Enter makes no chip of it, and the filter’s text is the text as
typed (trimmed). The chips are only those picked from the “+” menu
or set by the application. Off by default.
Sourcepub fn app(self, app: &'a AppHandle) -> Self
pub fn app(self, app: &'a AppHandle) -> Self
Runs its changes as steps of this application, and takes the
library.filter command.
Sourcepub fn label(self, label: impl Into<String>) -> Self
pub fn label(self, label: impl Into<String>) -> Self
Its accessible name and hint (“Search” by default).
pub fn show(self, ui: &mut Ui, state: &mut SearchState) -> SearchOutput
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for SearchField<'a>
impl<'a> !RefUnwindSafe for SearchField<'a>
impl<'a> !Send for SearchField<'a>
impl<'a> !Sync for SearchField<'a>
impl<'a> Unpin for SearchField<'a>
impl<'a> UnsafeUnpin for SearchField<'a>
impl<'a> !UnwindSafe for SearchField<'a>
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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