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, the default view.

Implementations§

Source§

impl Review

Source

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

Open the git backend, load the persisted session (if any), and compute the status sections. The working-tree review diff is deferred until first Review::model access. Diffs carry git’s default hunk context.

Source

pub fn open_with_context( repo_root: &Path, context_lines: u32, ) -> Result<Self, ReviewError>

Like Review::open with a custom number of context lines around diff hunks (config key ui.context_lines).

Source

pub fn model(&self) -> &DiffModel

The working-tree review diff, computed and cached on first access. A backend error yields an empty diff rather than panicking; the next Review::refresh gets another chance to compute it.

Source

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

Mutable view of the working-tree review diff, computing it first if needed. The TUI uses this to enrich a file with intra-line emphasis just before rendering it.

Source

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

Recompute status + diff (the watcher calls this on changes) and drop viewed marks for files that changed or left the diff.

Source

pub fn compute_refresh( repo_root: &Path, context_lines: u32, against: Option<&str>, ) -> Result<Refreshed, ReviewError>

Compute a refresh on a separate repo handle, so it can run off the UI thread; the result is applied later with Review::install_refresh. against recomputes the open three-dot review in the same pass, since it tracks edits and cannot be pinned like a commit’s diff.

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, for the kinds sidebar. One attribute lookup walks the directory chain and the global attribute files, so this is real IO per path and belongs on a worker; paths the repo says nothing about are left out.

Source

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

One file’s worktree text and blame, for the file view. Opens its own backend so it runs on a worker thread like Review::compute_refresh. A file git cannot blame (untracked, or newly staged) still loads: it comes back with text and no spans.

Source

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

Swap in freshly computed status + diff and reconcile viewed marks.

Source

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

Source

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

Load a non-working source’s session into the cache if not already there. Call before reading via Review::session_for for that source.

Source

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

The session for a source. The working tree is always present; other sources must be Review::ensure_sourced first, else an empty session is returned.

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 all_reviews(&self) -> Result<Vec<(ReviewSource, Session)>, ReviewError>

Every review across all sources, in-memory state overriding disk, sorted by source key. Powers the agent-facing aggregate feed.

Source

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

Swap a previously computed model back in. Used when a refresh proved a no-op (same fingerprint): the old model 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, <T as TryFrom<U>>::Error>

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.