Skip to main content

Review

Struct Review 

Source
pub struct Review {
    pub repo_root: PathBuf,
    pub vcs: Box<dyn Vcs>,
    pub status: StatusModel,
    pub session: Session,
    /* private fields */
}

Fields§

§repo_root: PathBuf§vcs: Box<dyn Vcs>§status: StatusModel§session: Session

The working-tree review session.

Implementations§

Source§

impl Review

Source

pub fn open(repo_root: &Path) -> Result<Self, ReviewError>

Source

pub fn open_with_settings( repo_root: &Path, settings: &DiffSettings, ) -> Result<Self, ReviewError>

Source

pub fn set_diff_algorithm( &self, algorithm: DiffAlgorithm, indent_heuristic: bool, )

Source

pub fn model(&self) -> &DiffModel

The working-tree diff, cached on first access. A backend error caches an empty diff until the next Review::refresh.

Source

pub fn model_mut(&mut self) -> &mut DiffModel

Source

pub fn refresh(&mut self) -> Result<(), ReviewError>

Recompute status and diff, and drop viewed marks for files that changed or left the diff.

Source

pub fn compute_refresh( repo_root: &Path, settings: &DiffSettings, against: Option<&str>, pinned: Option<(&ReviewSource, Option<(&str, &str)>)>, limits: CommitLimits, ) -> Result<Refreshed, ReviewError>

A refresh on its own repo handle, for a worker thread; apply it with Review::install_refresh. against and pinned re-diff the open three-dot or pinned source in the same pass.

Source

pub fn compute_declared( repo_root: &Path, paths: &[String], ) -> Result<HashMap<String, Kind>, ReviewError>

What the repo’s git attributes declare about each of paths, leaving out paths they say nothing about. Each lookup is real IO, so we run this on a worker.

Source

pub fn compute_walkthrough_files( repo_root: &Path, rev: Option<&str>, read_first: ReadFirst, files: &[String], ) -> WalkthroughFiles

Every requested file’s content from the copy read_first names, else the other. A path neither copy has is left out. Runs on a worker.

Source

pub fn compute_binary_sides( repo_root: &Path, path: &str, blobs: &BlobIds, deleted: bool, ) -> BinarySides

Both sides of a binary file, each from its blob, the new side from the worktree when the store has no blob for it. We check the size first so a side over MAX_PREVIEW_BYTES never loads into memory.

Source

pub fn compute_file( repo_root: &Path, rel: &str, ) -> Result<FileSnapshot, ReviewError>

One file’s worktree text and blame, for a worker. A file git cannot blame comes back with no spans.

Source

pub fn install_refresh(&mut self, status: StatusModel, model: DiffModel)

Source

pub fn save(&self) -> Result<(), ReviewError>

Source

pub fn ensure_source( &mut self, source: &ReviewSource, ) -> Result<(), ReviewError>

Load a source’s session into the cache. Call before Review::session_for.

Source

pub fn session_for(&self, source: &ReviewSource) -> &Session

Empty for a source not yet Review::ensure_sourced.

Source

pub fn session_for_mut(&mut self, source: &ReviewSource) -> &mut Session

Source

pub fn save_for(&self, source: &ReviewSource) -> Result<(), ReviewError>

Source

pub fn forget_source(&mut self, source: &ReviewSource)

Drop a source’s cached session once its file is deleted, so a later access reloads it.

Source

pub fn all_reviews(&self) -> Result<Vec<(ReviewSource, Session)>, ReviewError>

Every review across all sources, in-memory state overriding disk, sorted by source key. A review file that fails to parse is skipped.

Source

pub fn all_reviews_and_corrupt(&self) -> Result<LoadedReviews, ReviewError>

Review::all_reviews plus the path of every review file skipped.

Source

pub fn restore_model(&mut self, model: DiffModel)

Swap a previous model back in after a no-op refresh, since it carries render-time emphasis the rebuilt one lacks.

Auto Trait Implementations§

§

impl !Freeze for Review

§

impl !RefUnwindSafe for Review

§

impl !Sync for Review

§

impl !UnwindSafe for Review

§

impl Send for Review

§

impl Unpin for Review

§

impl UnsafeUnpin for Review

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, 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.