pub struct Transaction { /* private fields */ }Expand description
A rollbackable transaction that executes a sequence of RollbackableOperations.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new, empty Transaction using the OS temporary directory for backups.
Sourcepub fn with_temp_dir<P: AsRef<Path>>(temp_dir: P) -> Self
pub fn with_temp_dir<P: AsRef<Path>>(temp_dir: P) -> Self
Constructs a new, empty Transaction with a custom backup directory.
Sourcepub fn create_file<S: AsRef<Path>>(self, path: S) -> Self
pub fn create_file<S: AsRef<Path>>(self, path: S) -> Self
Adds a CreateFile operation.
Sourcepub fn create_dir<S: AsRef<Path>>(self, path: S) -> Self
pub fn create_dir<S: AsRef<Path>>(self, path: S) -> Self
Adds a CreateDirectory operation.
Sourcepub fn append_file<S: AsRef<Path>>(self, path: S, data: Vec<u8>) -> Self
pub fn append_file<S: AsRef<Path>>(self, path: S, data: Vec<u8>) -> Self
Adds an AppendFile operation.
Sourcepub fn copy_file<S: AsRef<Path>, T: AsRef<Path>>(
self,
source: S,
dest: T,
) -> Self
pub fn copy_file<S: AsRef<Path>, T: AsRef<Path>>( self, source: S, dest: T, ) -> Self
Adds a CopyFile operation.
Sourcepub fn copy_dir<S: AsRef<Path>, T: AsRef<Path>>(
self,
source: S,
dest: T,
) -> Self
pub fn copy_dir<S: AsRef<Path>, T: AsRef<Path>>( self, source: S, dest: T, ) -> Self
Adds a CopyDirectory operation.
Sourcepub fn delete_file<S: AsRef<Path>>(self, source: S) -> Self
pub fn delete_file<S: AsRef<Path>>(self, source: S) -> Self
Adds a DeleteFile operation.
Sourcepub fn delete_dir<S: AsRef<Path>>(self, source: S) -> Self
pub fn delete_dir<S: AsRef<Path>>(self, source: S) -> Self
Adds a DeleteDirectory operation.
Sourcepub fn move_file<S: AsRef<Path>, T: AsRef<Path>>(
self,
source: S,
dest: T,
) -> Self
pub fn move_file<S: AsRef<Path>, T: AsRef<Path>>( self, source: S, dest: T, ) -> Self
Adds a MoveFile operation.
Sourcepub fn move_dir<S: AsRef<Path>, T: AsRef<Path>>(
self,
source: S,
dest: T,
) -> Self
pub fn move_dir<S: AsRef<Path>, T: AsRef<Path>>( self, source: S, dest: T, ) -> Self
Adds a MoveDirectory operation.
Sourcepub fn write_file<S: AsRef<Path>>(self, path: S, data: Vec<u8>) -> Self
pub fn write_file<S: AsRef<Path>>(self, path: S, data: Vec<u8>) -> Self
Adds a WriteFile operation.
Sourcepub fn touch_file<S: AsRef<Path>>(self, path: S) -> Self
pub fn touch_file<S: AsRef<Path>>(self, path: S) -> Self
Adds a TouchFile operation.
Trait Implementations§
Source§impl Default for Transaction
impl Default for Transaction
Source§impl RollbackableOperation for Transaction
impl RollbackableOperation for Transaction
Auto Trait Implementations§
impl Freeze for Transaction
impl !RefUnwindSafe for Transaction
impl !Send for Transaction
impl !Sync for Transaction
impl Unpin for Transaction
impl UnsafeUnpin for Transaction
impl !UnwindSafe for Transaction
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