Struct Transaction

Source
pub struct Transaction { /* private fields */ }
Expand description

A rollbackable Transaction

Implementations§

Source§

impl Transaction

Source

pub fn new() -> Self

Constructs a new, empty Transaction

Source

pub fn create_file<S: AsRef<Path>>(self, path: S) -> Transaction

Adds a CreateFile operation to the transaction

Source

pub fn create_dir<S: AsRef<Path>>(self, path: S) -> Transaction

Adds a CreateDirectory operation to the transaction

Source

pub fn append_file<S: AsRef<Path>>( self, source: S, temp_dir: S, data: Vec<u8>, ) -> Transaction

Adds a AppendFile operation to the transaction

Source

pub fn copy_file<S: AsRef<Path>>(self, source: S, dest: S) -> Transaction

Adds a CopyFile operation to the transaction

Source

pub fn copy_dir<S: AsRef<Path>>( self, source: S, dest: S, temp_dir: S, ) -> Transaction

Adds a CopyDirectory operation to the transaction

Source

pub fn delete_file<S: AsRef<Path>>(self, source: S, temp_dir: S) -> Transaction

Adds a DeleteFile operation to the transaction

Source

pub fn delete_dir<S: AsRef<Path>>(self, source: S, temp_dir: S) -> Transaction

Adds a DeleteDirectory operation to the transaction

Source

pub fn move_file<S: AsRef<Path>>(self, source: S, dest: S) -> Transaction

Adds a MoveFile operation to the transaction

Source

pub fn move_dir<S: AsRef<Path>>(self, source: S, dest: S) -> Transaction

Adds a MoveDirectory operation to the transaction

Source

pub fn write_file<S: AsRef<Path>>( self, source: S, temp_dir: S, data: Vec<u8>, ) -> Transaction

Adds a WriteFile operation to the transaction

Trait Implementations§

Source§

impl RollbackableOperation for Transaction

Source§

fn execute(&mut self) -> Result<()>

Executes the transaction

Source§

fn rollback(&self) -> Result<()>

Performs rollback on the transaction

Only the operations that were executed will be rollbacked

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.