[−][src]Struct rustofi::SearchPage
SearchPage
displays a multi column rofi window and is meant to be used as a search page
of sorts for your application. items
should be associated with a data model, while actions
should be either operations you can perform on those items, or actions you can take within the
app (switch pages for example). The search_callback
allows you to refresh the data models
displayed or perform an operation on custom entry
Fields
items: Vec<T>
standard list items, will be displayed in the rofi window using to_string()
item_callback: Box<dyn RustofiCallback<T>>
callback called whenever an item in the items
vector is selected
blank_callback: Box<dyn FnMut() -> RustofiResult>
callback called whenever a blank entry is selected
actions: Vec<String>
additional action entries, meant to be operations on standard items
action_callback: Box<dyn FnMut(&String) -> RustofiResult>
callback called whenever a custom action is selected (NOT on Exit or Cancel)
search_callback: Box<dyn FnMut(&String) -> RustofiResult>
callback to be run when no other entry matches
window: Window<'a>
rofi window instance
Methods
impl<'a, T: Display + Clone> SearchPage<'a, T>
[src]
pub fn new(
items: Vec<T>,
item_callback: Box<dyn RustofiCallback<T>>,
search_callback: Box<dyn FnMut(&String) -> RustofiResult>
) -> Self
[src]
items: Vec<T>,
item_callback: Box<dyn RustofiCallback<T>>,
search_callback: Box<dyn FnMut(&String) -> RustofiResult>
) -> Self
create the initial bare minumum AppPage, without showing the window yet
Trait Implementations
impl<'a, T: Display + Clone> RustofiComponent<'a> for SearchPage<'a, T>
[src]
fn create_window() -> Window<'a>
[src]
create a rofi window with 4 columns
fn action(self, acb: Box<dyn FnMut(&String) -> RustofiResult>) -> Self
[src]
set the callback to be run when an action is selected
fn blank(self, bcb: Box<dyn FnMut() -> RustofiResult>) -> Self
[src]
set the callback to be run when the blank entry is selected
fn actions(self, actions: Vec<String>) -> Self
[src]
set the actions in the AppPage. This should only be called once as it overwrites the previous settings
fn window(self, window: Window<'a>) -> Self
[src]
set a completely custom window
fn display(&mut self, prompt: String) -> RustofiResult
[src]
display the search window and match the entry against the actions, standard items and finally if nothing matches, run the search callback
Auto Trait Implementations
impl<'a, T> !Send for SearchPage<'a, T>
impl<'a, T> !Sync for SearchPage<'a, T>
impl<'a, T> Unpin for SearchPage<'a, T> where
T: Unpin,
T: Unpin,
impl<'a, T> !UnwindSafe for SearchPage<'a, T>
impl<'a, T> !RefUnwindSafe for SearchPage<'a, T>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,