Skip to main content

App

Struct App 

Source
pub struct App {
Show 20 fields pub files: Vec<FileReview>, pub layers: Layers, pub selected: usize, pub cursor: usize, pub scroll: usize, pub focus: Focus, pub store: ReviewStore, pub notes: NoteStore, pub input: Option<Input>, pub search: Option<String>, pub show_help: bool, pub message: Option<String>, pub clipboard: Clipboard, pub collapse_moves: bool, pub root: PathBuf, pub open_request: Option<(PathBuf, usize)>, pub title: String, pub palette: Palette, pub syntax: bool, pub quit: bool, /* private fields */
}

Fields§

§files: Vec<FileReview>§layers: Layers§selected: usize

Position in the visible list.

§cursor: usize

Line of the diff pane the cursor is on.

§scroll: usize§focus: Focus§store: ReviewStore§notes: NoteStore§input: Option<Input>

The prompt being typed, if one is open.

§search: Option<String>

The last search, highlighted in the diff until cleared with Esc.

§show_help: bool§message: Option<String>

A one-off message for the status bar, cleared by the next key.

§clipboard: Clipboard§collapse_moves: bool

Show each moved block as its one-line marker only.

§root: PathBuf

The working tree’s top-level directory; changed paths are relative to it.

§open_request: Option<(PathBuf, usize)>

A file and line to open in the editor, for the run loop to carry out.

§title: String

What is being reviewed, shown over the file list: “origin/main…feature”, “PR 7”.

§palette: Palette§syntax: bool

Colour code by syntax; off leaves only the diff’s own colouring.

§quit: bool

Implementations§

Source§

impl App

Source

pub fn new(files: Vec<FileReview>, layers: Layers) -> App

Source

pub fn with_stores( files: Vec<FileReview>, layers: Layers, store: ReviewStore, notes: NoteStore, ) -> App

Source

pub fn current(&self) -> Option<&FileReview>

The file under the cursor, if any file is listed.

Source

pub fn moved_blocks(&self) -> usize

Number of moved blocks among the listed files.

Source

pub fn handle_key(&mut self, key: KeyEvent)

Source

pub fn review_progress(&self) -> (usize, usize)

Reviewed and total counts over the listed files.

Auto Trait Implementations§

§

impl !RefUnwindSafe for App

§

impl !Send for App

§

impl !Sync for App

§

impl Freeze 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.