Skip to main content

Model

Struct Model 

Source
pub struct Model {
Show 60 fields pub screen: Screen, pub focus: Focus, pub previous_focus: Option<Focus>, pub reviews: Vec<ReviewSummary>, pub current_review: Option<ReviewDetail>, pub threads: Vec<ThreadSummary>, pub current_thread: Option<ThreadDetail>, pub all_comments: HashMap<String, Vec<Comment>>, pub current_diff: Option<ParsedDiff>, pub current_file_content: Option<FileContent>, pub file_cache: HashMap<String, FileCacheEntry>, pub highlighter: Highlighter, pub highlighted_lines: Vec<Vec<HighlightSpan>>, pub list_index: usize, pub list_scroll: usize, pub file_index: usize, pub sidebar_index: usize, pub sidebar_scroll: usize, pub collapsed_files: HashSet<String>, pub diff_scroll: usize, pub diff_cursor: usize, pub expanded_thread: Option<String>, pub filter: ReviewFilter, pub sidebar_visible: bool, pub diff_view_mode: DiffViewMode, pub diff_wrap: bool, pub pending_editor_request: Option<EditorRequest>, pub pending_comment_request: Option<CommentRequest>, pub inline_editor: Option<InlineEditor>, pub pending_comment_submission: Option<PendingCommentSubmission>, pub command_palette_input: String, pub command_palette_selection: usize, pub command_palette_commands: Vec<CommandSpec>, pub command_palette_mode: PaletteMode, pub visual_mode: bool, pub visual_anchor: usize, pub comment_input: String, pub comment_target_line: Option<u32>, pub width: u16, pub height: u16, pub layout_mode: LayoutMode, pub theme: Theme, pub pre_palette_theme: Option<String>, pub config: UiConfig, pub thread_positions: RefCell<HashMap<String, usize>>, pub max_stream_row: Cell<usize>, pub line_map: RefCell<HashMap<usize, i64>>, pub cursor_stops: RefCell<Vec<usize>>, pub search_input: String, pub search_active: bool, pub repo_path: Option<String>, pub editor_name: String, pub flash_message: Option<String>, pub should_quit: bool, pub needs_redraw: bool, pub last_list_scroll: Option<(Instant, i8)>, pub last_sidebar_scroll: Option<(Instant, i8)>, pub pending_review: Option<String>, pub pending_file: Option<String>, pub pending_thread: Option<String>,
}
Expand description

Application state

Fields§

§screen: Screen§focus: Focus§previous_focus: Option<Focus>§reviews: Vec<ReviewSummary>§current_review: Option<ReviewDetail>§threads: Vec<ThreadSummary>§current_thread: Option<ThreadDetail>§all_comments: HashMap<String, Vec<Comment>>§current_diff: Option<ParsedDiff>

Parsed diff for the currently selected file

§current_file_content: Option<FileContent>

File content for context when no diff available

§file_cache: HashMap<String, FileCacheEntry>

Cache for all files in the review stream

§highlighter: Highlighter

Syntax highlighter

§highlighted_lines: Vec<Vec<HighlightSpan>>

Cached highlighted lines for current diff (indexed by display line)

§list_index: usize

Selected index in review list

§list_scroll: usize

Scroll offset in review list

§file_index: usize

Selected file index in sidebar

§sidebar_index: usize

Selected index in the flat sidebar tree

§sidebar_scroll: usize

Scroll offset for sidebar tree

§collapsed_files: HashSet<String>

Files whose thread children are collapsed

§diff_scroll: usize

Scroll offset in diff pane

§diff_cursor: usize

Line cursor position in diff pane (stream row index)

§expanded_thread: Option<String>

Currently expanded thread ID

§filter: ReviewFilter

Review list filter

§sidebar_visible: bool

Show sidebar in overlay mode

§diff_view_mode: DiffViewMode

Diff view mode (unified or side-by-side)

§diff_wrap: bool

Wrap diff lines when enabled

§pending_editor_request: Option<EditorRequest>

Pending editor launch request

§pending_comment_request: Option<CommentRequest>

Pending comment-via-$EDITOR request (Shift+A)

§inline_editor: Option<InlineEditor>

Inline comment editor state (a)

§pending_comment_submission: Option<PendingCommentSubmission>

Comment ready for persistence (from inline editor submit)

§command_palette_input: String§command_palette_selection: usize§command_palette_commands: Vec<CommandSpec>§command_palette_mode: PaletteMode§visual_mode: bool

Whether visual line selection mode is active (Shift+V)

§visual_anchor: usize

Anchor stream row where visual mode was entered

§comment_input: String§comment_target_line: Option<u32>§width: u16§height: u16§layout_mode: LayoutMode§theme: Theme§pre_palette_theme: Option<String>

Theme name before opening the picker (for revert on Esc)

§config: UiConfig§thread_positions: RefCell<HashMap<String, usize>>

Thread positions captured during rendering (thread_idstream_row)

§max_stream_row: Cell<usize>

Total stream rows from the last render pass (for cursor clamping)

§line_map: RefCell<HashMap<usize, i64>>

Diff line mapping captured during rendering: stream_row → new-side line number. Populated for every diff line (including all wrapped rows).

§cursor_stops: RefCell<Vec<usize>>

Sorted list of stream rows that are valid cursor stops (one per logical item). Populated during rendering; used by cursor navigation to skip wrapped/padding rows.

§search_input: String§search_active: bool§repo_path: Option<String>§editor_name: String§flash_message: Option<String>

Shown in the help bar area until the next keypress.

§should_quit: bool§needs_redraw: bool

Flag indicating the view needs a full redraw

§last_list_scroll: Option<(Instant, i8)>§last_sidebar_scroll: Option<(Instant, i8)>§pending_review: Option<String>§pending_file: Option<String>§pending_thread: Option<String>

Implementations§

Source§

impl Model

Source

pub fn new(width: u16, height: u16, config: UiConfig) -> Self

Create a new model

Source

pub fn filtered_reviews(&self) -> Vec<&ReviewSummary>

Get filtered reviews based on current filter and search query

Source

pub fn files_with_threads(&self) -> Vec<FileEntry>

Get unique files from threads and the diff file cache for the sidebar.

Source

pub fn threads_for_current_file(&self) -> Vec<&ThreadSummary>

Get threads for the currently selected file

Source

pub fn visible_threads_for_current_file(&self) -> Vec<&ThreadSummary>

Get threads that are visible in the current diff (all threads for the file)

Source

pub fn sidebar_items(&self) -> Vec<SidebarItem>

Build a flat list of sidebar items: files with their threads as children

Source

pub const fn resize(&mut self, width: u16, height: u16)

Handle terminal resize

Source

pub const fn list_visible_height(&self) -> usize

Get the visible height for the review list (accounting for chrome)

Source

pub fn sync_active_file_cache(&mut self)

Sync current file fields from the file cache

Auto Trait Implementations§

§

impl !Freeze for Model

§

impl !RefUnwindSafe for Model

§

impl Send for Model

§

impl !Sync for Model

§

impl Unpin for Model

§

impl UnsafeUnpin for Model

§

impl UnwindSafe for Model

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Real + Zero + Arithmetics + Clone, Swp: WhitePoint<T>, Dwp: WhitePoint<T>, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<T>,

Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default.
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, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more