Skip to main content

Operation

Enum Operation 

Source
#[non_exhaustive]
pub enum Operation { Reorder { from: usize, to: usize, }, Squash { index: usize, message: Option<String>, }, Split { index: usize, selected: HashSet<usize>, message: String, }, Reword { index: usize, message: String, }, Delete { index: usize, }, AddBoundary { index: usize, name: String, }, RemoveBoundary { boundary: usize, }, MoveBoundary { boundary: usize, delta: isize, }, RenameBranch { boundary: usize, name: String, }, Undo, Redo, }
Expand description

An edit expressed as data. The view produces these from user input; the engine applies them. Every variant the TUI will ever perform is named here so undo becomes a snapshot↔operation pair and the engine stays directly testable — but this scaffolding ticket does not yet apply any of them (see Engine::apply). Later tickets fill the variants in, roughly in the spine order: boundary edits (ref-only) → reorder/reword/delete → squash → split → undo/redo.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Reorder

Move the commit at from to sit at index to within the line, reassigning it to whichever branch’s run it lands in.

Fields

§from: usize
§

Squash

Squash the commit at index into its adjacent, older (front-ward) neighbour. message is the combined description when the caller prompted for one (both were non-empty); None lets the engine pick the non-empty side or concatenate.

Fields

§index: usize
§message: Option<String>
§

Split

Split the commit at index into two: the selected diff-line change_indexes are peeled into a new, newer commit with message and a fresh id, while the older piece keeps the original id and message. Repeatable on the remainder for N pieces.

Fields

§index: usize
§selected: HashSet<usize>
§message: String
§

Reword

Rewrite the message of the commit at index, preserving its Stable-Commit-Id.

Fields

§index: usize
§message: String
§

Delete

Delete the commit at index.

Fields

§index: usize
§

AddBoundary

Start a new branch name at the commit at index: that commit becomes the new branch’s front, and the new branch takes the tip-ward remainder of its current branch (matching git queue edit).

Fields

§index: usize
§name: String
§

RemoveBoundary

Remove the boundary at boundary, dissolving that branch into its neighbour.

Fields

§boundary: usize
§

MoveBoundary

Shift the boundary at boundary by delta commits, moving commits between the two adjacent branches.

Fields

§boundary: usize
§delta: isize
§

RenameBranch

Rename the branch at boundary.

Fields

§boundary: usize
§name: String
§

Undo

Undo the last applied operation.

§

Redo

Redo the last undone operation.

Trait Implementations§

Source§

impl Clone for Operation

Source§

fn clone(&self) -> Operation

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Operation

Source§

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

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

impl Eq for Operation

Source§

impl PartialEq for Operation

Source§

fn eq(&self, other: &Operation) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Operation

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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.