pub struct RollbackManager { /* private fields */ }Expand description
Manages rollback data for transformation undo support.
Rollback files are stored as JSON under <project_root>/.codemod-pilot/rollback/.
Implementations§
Source§impl RollbackManager
impl RollbackManager
Sourcepub fn new(project_root: &Path) -> Result<Self>
pub fn new(project_root: &Path) -> Result<Self>
Create a new RollbackManager for the given project root.
The rollback directory is created lazily on the first Self::save_rollback
call.
Sourcepub fn save_rollback(&self, results: &[TransformResult]) -> Result<PathBuf>
pub fn save_rollback(&self, results: &[TransformResult]) -> Result<PathBuf>
Save a rollback entry for the given transformation results.
Returns the path to the saved rollback JSON file.
Sourcepub fn apply_rollback(&self, patch_path: &Path) -> Result<usize>
pub fn apply_rollback(&self, patch_path: &Path) -> Result<usize>
Apply a rollback from a saved JSON file, restoring original file contents.
Returns the number of files restored.
Sourcepub fn list_rollbacks(&self) -> Result<Vec<RollbackEntry>>
pub fn list_rollbacks(&self) -> Result<Vec<RollbackEntry>>
List all available rollback entries, most recent first.
Auto Trait Implementations§
impl Freeze for RollbackManager
impl RefUnwindSafe for RollbackManager
impl Send for RollbackManager
impl Sync for RollbackManager
impl Unpin for RollbackManager
impl UnsafeUnpin for RollbackManager
impl UnwindSafe for RollbackManager
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
Mutably borrows from an owned value. Read more
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>
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 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>
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