pub struct App { /* private fields */ }Implementations§
Source§impl App
impl App
pub fn create( repo: Rc<Repository>, size: (u16, u16), args: &Args, config: Arc<Config>, enable_async_cmds: bool, piped: Option<Paged>, ) -> Res<Self>
pub fn run(&mut self, term: &mut Term, max_tick_delay: Duration) -> Res<()>
pub fn update(&mut self, term: &mut Term, event: Option<Event>) -> Res<()>
pub fn update_screens(&mut self) -> Res<()>
Sourcepub fn rerender_screens(&mut self) -> Res<()>
pub fn rerender_screens(&mut self) -> Res<()>
Rebuild every screen, leaving each cursor where it was in the diff rather than on the line number it happened to occupy. For a re-render of the same content (a renderer feature turned on or off), the rows move but the place in the patch does not.
pub fn handle_event(&mut self, term: &mut Term, event: Event) -> Res<()>
pub fn redraw_now(&mut self, term: &mut Term) -> Res<()>
Sourcepub fn print_if_one_screen(&mut self, term: &mut Term) -> Res<bool>
pub fn print_if_one_screen(&mut self, term: &mut Term) -> Res<bool>
Prints the screen, and says so, if it fits on the terminal with a row
to spare for the shell’s prompt: less’s --quit-if-one-screen. Waits
for the rest of a screen still being drawn while what there is fits.
pub fn stage_redraw(&mut self)
Sourcepub fn display_info<S: Into<Cow<'static, str>>>(&mut self, message: S)
pub fn display_info<S: Into<Cow<'static, str>>>(&mut self, message: S)
Displays an Info message to the CmdLog.
Sourcepub fn display_error<S: Into<Cow<'static, str>>>(&mut self, message: S)
pub fn display_error<S: Into<Cow<'static, str>>>(&mut self, message: S)
Displays an Error message to the CmdLog.
Sourcepub fn run_cmd(
&mut self,
term: &mut Term,
input: &[u8],
cmd: Command,
) -> Res<()>
pub fn run_cmd( &mut self, term: &mut Term, input: &[u8], cmd: Command, ) -> Res<()>
Runs a Command and handles its output.
Will block awaiting its completion.
Sourcepub fn run_cmd_async(
&mut self,
term: &mut Term,
input: &[u8],
cmd: Command,
) -> Res<()>
pub fn run_cmd_async( &mut self, term: &mut Term, input: &[u8], cmd: Command, ) -> Res<()>
Runs a Command and handles its output asynchronously (if async commands are enabled).
Will return Ok(()) if one is already running.
pub fn run_cmd_interactive(&mut self, term: &mut Term, cmd: Command) -> Res<()>
pub fn confirm(&mut self, term: &mut Term, prompt: &'static str) -> Res<()>
Sourcepub fn pick(
&mut self,
term: &mut Term,
picker_state: PickerState,
) -> Res<Option<PickerData>>
pub fn pick( &mut self, term: &mut Term, picker_state: PickerState, ) -> Res<Option<PickerData>>
Show a picker and wait for user to select an item or cancel.
Returns:
Ok(Some(data))- User selected an itemOk(None)- User cancelled (Esc or Ctrl-C)Err(e)- An error occurred
§Example
let items = vec![
PickerItem::new("main", PickerData::Item("main".to_string())),
PickerItem::new("develop", PickerData::Item("develop".to_string())),
];
let picker = PickerState::new("Select branch", items, false);
match app.pick(term, picker)? {
Some(PickerData::Item(name)) => {
// User selected a branch
println!("Selected: {}", name);
}
Some(PickerData::CustomInput(_)) => {
// Should not happen when allow_custom_input is false
}
None => {
// User cancelled
println!("Cancelled");
}
}Auto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl !Send for App
impl !Sync for App
impl !UnwindSafe for App
impl Forget for App
impl Move for App
impl Unpin for App
impl UnsafeUnpin for App
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.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