Skip to main content

StepState

Struct StepState 

Source
pub struct StepState {
Show 13 fields pub current_step: usize, pub total_steps: usize, pub applied_changes: Vec<usize>, pub active_change: Option<usize>, pub cursor_change: Option<usize>, pub animating_hunk: Option<usize>, pub step_direction: StepDirection, pub current_hunk: usize, pub total_hunks: usize, pub last_nav_was_hunk: bool, pub hunk_preview_mode: bool, pub preview_from_backward: bool, pub show_hunk_extent_while_stepping: bool, /* private fields */
}
Expand description

The current state of stepping through a diff

Fields§

§current_step: usize

Current step index (0 = initial state, 1 = after first change applied, etc.)

§total_steps: usize

Total number of steps (number of significant changes + 1 for initial state)

§applied_changes: Vec<usize>

IDs of changes that have been applied up to current step

§active_change: Option<usize>

ID of the change being highlighted/animated at current step

§cursor_change: Option<usize>

Cursor change used for non-stepping navigation (does not imply animation)

§animating_hunk: Option<usize>

Hunk currently being animated (distinct from cursor position in current_hunk)

§step_direction: StepDirection

Direction of the last step action

§current_hunk: usize

Current hunk index (0-based)

§total_hunks: usize

Total number of hunks

§last_nav_was_hunk: bool

True if the last navigation was a hunk navigation (for extent marker display)

§hunk_preview_mode: bool

True after hunkdown (full preview mode), cleared on first step

§preview_from_backward: bool

True if preview was entered via hunkup (backward navigation)

§show_hunk_extent_while_stepping: bool

Show hunk extent markers while stepping (set by UI)

Implementations§

Source§

impl StepState

Source

pub fn new(total_changes: usize, total_hunks: usize) -> Self

Source

pub fn is_at_start(&self) -> bool

Check if we’re at the initial state (no changes applied)

Source

pub fn is_at_end(&self) -> bool

Check if we’re at the final state (all changes applied)

Source

pub fn progress(&self) -> f64

Get progress as a percentage

Source

pub fn is_applied(&self, change_id: usize) -> bool

Trait Implementations§

Source§

impl Clone for StepState

Source§

fn clone(&self) -> StepState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StepState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for StepState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for StepState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,