pub struct Worktree { /* private fields */ }Expand description
Capability-rooted facade for deterministic multi-file edit transactions.
Implementations§
Source§impl Worktree
impl Worktree
Sourcepub fn open(root: impl AsRef<Path>) -> Result<Self, WorktreeError>
pub fn open(root: impl AsRef<Path>) -> Result<Self, WorktreeError>
Opens a worktree with bounded default limits and automatic parallelism.
Sourcepub fn open_with(
root: impl AsRef<Path>,
options: WorktreeOptions,
) -> Result<Self, WorktreeError>
pub fn open_with( root: impl AsRef<Path>, options: WorktreeOptions, ) -> Result<Self, WorktreeError>
Opens a worktree with explicit limits and preparation parallelism.
pub const fn options(&self) -> WorktreeOptions
Sourcepub fn dry_run(&self, plan: &EditPlan) -> Result<DryRunReport, WorktreeError>
pub fn dry_run(&self, plan: &EditPlan) -> Result<DryRunReport, WorktreeError>
Validates, reads, hashes, and projects a plan without creating state.
Sourcepub fn prepare(
&self,
plan: &EditPlan,
) -> Result<PreparedTransaction, WorktreeError>
pub fn prepare( &self, plan: &EditPlan, ) -> Result<PreparedTransaction, WorktreeError>
Locks, validates, backs up, stages, and journals the complete plan.
Sourcepub fn apply(&self, plan: &EditPlan) -> Result<ApplyReport, WorktreeError>
pub fn apply(&self, plan: &EditPlan) -> Result<ApplyReport, WorktreeError>
Prepares and commits a complete plan.
Sourcepub fn dry_run_plan(
&self,
plan: &WorktreePlan,
) -> Result<WorktreeDryRunReport, WorktreeError>
pub fn dry_run_plan( &self, plan: &WorktreePlan, ) -> Result<WorktreeDryRunReport, WorktreeError>
Validates and projects create/delete/modify/rename operations without writing state.
Sourcepub fn prepare_plan(
&self,
plan: &WorktreePlan,
) -> Result<PreparedWorktreeTransaction, WorktreeError>
pub fn prepare_plan( &self, plan: &WorktreePlan, ) -> Result<PreparedWorktreeTransaction, WorktreeError>
Validates, locks, stages, and journals every submitted refactor operation.
Sourcepub fn apply_plan(
&self,
plan: &WorktreePlan,
) -> Result<WorktreeApplyReport, WorktreeError>
pub fn apply_plan( &self, plan: &WorktreePlan, ) -> Result<WorktreeApplyReport, WorktreeError>
Prepares and durably commits every submitted filesystem operation.
Sourcepub fn apply_plan_retained(
&self,
plan: &WorktreePlan,
retention: UndoRetention,
) -> Result<RetainedApplyReport, WorktreeError>
pub fn apply_plan_retained( &self, plan: &WorktreePlan, retention: UndoRetention, ) -> Result<RetainedApplyReport, WorktreeError>
Commits a plan while retaining exact rollback evidence and a receipt.
Sourcepub fn undo_receipts(&self) -> Result<Vec<UndoReceipt>, WorktreeError>
pub fn undo_receipts(&self) -> Result<Vec<UndoReceipt>, WorktreeError>
Lists every retained undo receipt in deterministic identifier order.
Sourcepub fn undo_usage(&self) -> Result<UndoStoreUsage, WorktreeError>
pub fn undo_usage(&self) -> Result<UndoStoreUsage, WorktreeError>
Reports the bounded usage of the retained undo store.
Sourcepub fn rollback_undo(
&self,
id: &UndoId,
) -> Result<UndoRollbackReport, WorktreeError>
pub fn rollback_undo( &self, id: &UndoId, ) -> Result<UndoRollbackReport, WorktreeError>
Exactly restores the state captured by one retained commit.
Sourcepub fn discard_undo(&self, id: &UndoId) -> Result<usize, WorktreeError>
pub fn discard_undo(&self, id: &UndoId) -> Result<usize, WorktreeError>
Verifies and removes one retained receipt without changing any target.
Sourcepub fn recover(&self) -> Result<RecoveryReport, WorktreeError>
pub fn recover(&self) -> Result<RecoveryReport, WorktreeError>
Replays and safely resolves an interrupted transaction journal.