pub struct Engine { /* private fields */ }Expand description
The headless editing engine over the current queue line.
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Load the current queue line into the engine, applying the TUI’s entry
guards. Reuses edit’s scoping: the current queue line (an untracked
branch opens as one provisional section over trunk). Refuses a forked
line, a dirty worktree, and an empty queue.
This is headless — it never checks for a TTY. The non-TTY guard lives
in the command layer (commands::tui) so that tests can drive load
in-process without a terminal.
Sourcepub const fn line(&self) -> &EditableLine
pub const fn line(&self) -> &EditableLine
The loaded queue line: commit sequence and boundaries.
Sourcepub fn launched_from(&self) -> &str
pub fn launched_from(&self) -> &str
The branch the TUI was launched from.
Sourcepub fn landing_branch(&self) -> &str
pub fn landing_branch(&self) -> &str
The branch HEAD is currently on (the exit landing point).
Sourcepub fn queue_name(&self) -> &str
pub fn queue_name(&self) -> &str
The queue name new branches are recorded under.
Sourcepub const fn has_pending(&self) -> bool
pub const fn has_pending(&self) -> bool
Whether any operation is on the undo stack (drives the quit-guard).
Sourcepub fn layout(&self) -> Vec<(String, String)>
pub fn layout(&self) -> Vec<(String, String)>
The final branch chain, front → tip, as (parent, branch) pairs.
Sourcepub fn dissolved_with_prs(&self) -> Vec<(String, u64)>
pub fn dissolved_with_prs(&self) -> Vec<(String, u64)>
Branches that were present at load but have since been dissolved, and that carried a cached PR number — the exit summary warns about these.
Sourcepub fn apply(&mut self, op: Operation) -> Result<Applied>
pub fn apply(&mut self, op: Operation) -> Result<Applied>
Apply an operation. Boundary edits, undo/redo, and reorder are handled here; the remaining history-rewriting variants land in later tickets.
Most operations return Applied::Done; a rewriting operation that
conflicts returns Applied::Conflict with a rebase in progress (see
Engine::undo_conflict / Engine::conflicted).
Sourcepub const fn conflicted(&self) -> bool
pub const fn conflicted(&self) -> bool
Whether a conflicted operation is awaiting resolution.
Sourcepub fn undo_conflict(&mut self) -> Result<()>
pub fn undo_conflict(&mut self) -> Result<()>
Back out a conflicted operation: abort the rebase and restore the pre-operation snapshot exactly.
Sourcepub fn empty_branches(&self) -> Vec<usize>
pub fn empty_branches(&self) -> Vec<usize>
Boundary indices whose branch currently owns no commits (e.g. after a delete emptied it) — the view offers to dissolve these.
Sourcepub fn pr_of(&self, boundary: usize) -> Option<u64>
pub fn pr_of(&self, boundary: usize) -> Option<u64>
The cached PR number of the branch at boundary, if any. O(1) — no
git call — so the view can call it every frame.
Sourcepub fn branch_name(&self, boundary: usize) -> &str
pub fn branch_name(&self, boundary: usize) -> &str
The branch name at boundary.
Sourcepub fn split_lines(&self, index: usize) -> Result<Vec<SplitLine>>
pub fn split_lines(&self, index: usize) -> Result<Vec<SplitLine>>
The split selector’s view of the commit at index: its diff flattened
into displayable lines, the +/- ones carrying a dense change_index.
Sourcepub fn split_change_count(&self, index: usize) -> Result<usize>
pub fn split_change_count(&self, index: usize) -> Result<usize>
The number of selectable (+/-) lines in the commit at index.
Sourcepub fn squash_needs_message(&self, index: usize) -> Result<bool>
pub fn squash_needs_message(&self, index: usize) -> Result<bool>
Whether squashing the commit at index into its older neighbour needs a
combined-message prompt — true only when both descriptions are
non-empty (otherwise the non-empty side is used, or the result is empty).
Sourcepub fn squash_default_message(&self, index: usize) -> Result<String>
pub fn squash_default_message(&self, index: usize) -> Result<String>
The default combined description shown in the squash prompt: the older body then the newer, blank line between (each without its id trailer).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Engine
impl RefUnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
impl UnwindSafe for Engine
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> 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