Skip to main content

App

Struct App 

Source
pub struct App {
Show 14 fields pub items: Vec<Item>, pub sel: usize, pub scroll: usize, pub focus: Focus, pub diff: Vec<String>, pub diff_for: Option<(Group, String)>, pub diff_scroll: usize, pub overlay: Overlay, pub status: Option<(String, bool)>, pub prefix: String, pub head: String, pub width: u16, pub height: u16, pub color: bool,
}

Fields§

§items: Vec<Item>§sel: usize§scroll: usize

First visible list row.

§focus: Focus§diff: Vec<String>

Diff lines for diff_for.

§diff_for: Option<(Group, String)>§diff_scroll: usize§overlay: Overlay§status: Option<(String, bool)>

(message, is_error)

§prefix: String

git rev-parse --show-prefix, for cwd-relative display.

§head: String

Branch line shown in the list title.

§width: u16§height: u16§color: bool

False under NO_COLOR.

Implementations§

Source§

impl App

Source

pub fn new(items: Vec<Item>, prefix: String, head: String) -> Self

Source

pub fn resize(&mut self, w: u16, h: u16)

Source

pub fn body_height(&self) -> usize

Lines inside a pane: screen minus status line, hotkey bar and borders.

Source

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

Source

pub fn rows(&self) -> Vec<Row>

Source

pub fn diff_wanted(&self) -> Option<&Item>

The item whose diff should be shown, when it is not loaded yet.

Source

pub fn set_diff(&mut self, item: &Item, lines: Vec<String>)

Source

pub fn replace_items(&mut self, items: Vec<Item>)

New list after a reload: keep the same entry selected (same group and path, else same path in another group, else the nearest position).

Source

pub fn confirm_revert(&mut self, item: Item, files: Vec<String>, total: usize)

Source

pub fn key(&mut self, k: KeyEvent) -> Effect

Source

pub fn hotkeys(&self) -> Vec<(&'static str, &'static str)>

Auto Trait Implementations§

§

impl Forget for App

§

impl Freeze for App

§

impl RefUnwindSafe for App

§

impl Send for App

§

impl Sync for App

§

impl Unpin for App

§

impl UnsafeUnpin for App

§

impl UnwindSafe for App

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.