#[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
Reorder
Move the commit at from to sit at index to within the line,
reassigning it to whichever branch’s run it lands in.
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.
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.
Reword
Rewrite the message of the commit at index, preserving its
Stable-Commit-Id.
Delete
Delete the commit at index.
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).
RemoveBoundary
Remove the boundary at boundary, dissolving that branch into its
neighbour.
MoveBoundary
Shift the boundary at boundary by delta commits, moving commits
between the two adjacent branches.
RenameBranch
Rename the branch at boundary.
Undo
Undo the last applied operation.
Redo
Redo the last undone operation.
Trait Implementations§
impl Eq for Operation
impl StructuralPartialEq for Operation
Auto Trait Implementations§
impl Freeze for Operation
impl RefUnwindSafe for Operation
impl Send for Operation
impl Sync for Operation
impl Unpin for Operation
impl UnsafeUnpin for Operation
impl UnwindSafe for Operation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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