Enum reedline::ReedlineMenu
source · [−]pub enum ReedlineMenu {
EngineCompleter(Box<dyn Menu>),
HistoryMenu(Box<dyn Menu>),
WithCompleter {
menu: Box<dyn Menu>,
completer: Box<dyn Completer>,
},
}
Expand description
Allowed menus in Reedline
Variants
EngineCompleter(Box<dyn Menu>)
Menu that uses Reedline’s completer to update its values
HistoryMenu(Box<dyn Menu>)
Menu that uses the history as its completer
WithCompleter
Menu that has its own Completer
Trait Implementations
sourceimpl Menu for ReedlineMenu
impl Menu for ReedlineMenu
Selects what type of event happened with the menu
sourcefn can_quick_complete(&self) -> bool
fn can_quick_complete(&self) -> bool
A menu may not be allowed to quick complete because it needs to stay active even with one element Read more
sourcefn can_partially_complete(
&mut self,
values_updated: bool,
line_buffer: &mut LineBuffer,
completer: &mut dyn Completer
) -> bool
fn can_partially_complete(
&mut self,
values_updated: bool,
line_buffer: &mut LineBuffer,
completer: &mut dyn Completer
) -> bool
The completion menu can try to find the common string and replace it in the given line buffer Read more
sourcefn update_values(
&mut self,
line_buffer: &mut LineBuffer,
completer: &mut dyn Completer
)
fn update_values(
&mut self,
line_buffer: &mut LineBuffer,
completer: &mut dyn Completer
)
Updates the values presented in the menu
This function needs to be defined in the trait because when the menu is
activated or the quick_completion
option is true, the len of the values
is calculated to know if there is only one value so it can be selected
immediately Read more
sourcefn update_working_details(
&mut self,
line_buffer: &mut LineBuffer,
completer: &mut dyn Completer,
painter: &Painter
)
fn update_working_details(
&mut self,
line_buffer: &mut LineBuffer,
completer: &mut dyn Completer,
painter: &Painter
)
The working details of a menu are values that could change based on the menu conditions before it being printed, such as the number or size of columns, etc. In this function should be defined how the menu event is treated since it is called just before painting the menu Read more
sourcefn replace_in_buffer(&self, line_buffer: &mut LineBuffer)
fn replace_in_buffer(&self, line_buffer: &mut LineBuffer)
Indicates how to replace in the line buffer the selected value from the menu
Calculates the real required lines for the menu considering how many lines wrap the terminal or if entries have multiple lines Read more
Creates the menu representation as a string which will be painted by the painter
sourcefn get_values(&self) -> &[Suggestion]
fn get_values(&self) -> &[Suggestion]
Gets cached values from menu that will be displayed
Auto Trait Implementations
impl !RefUnwindSafe for ReedlineMenu
impl Send for ReedlineMenu
impl !Sync for ReedlineMenu
impl Unpin for ReedlineMenu
impl !UnwindSafe for ReedlineMenu
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more