pub struct WriteTransaction<'a, W: SpreadsheetWriter> { /* private fields */ }Expand description
Transaction wrapper applying a set of write operations atomically to an underlying writer. Atomicity guarantee is best-effort: either all operations are applied in insertion order or none (if dropped without commit). Durability depends on backend flush/save semantics.
Implementations§
Source§impl<'a, W: SpreadsheetWriter> WriteTransaction<'a, W>
impl<'a, W: SpreadsheetWriter> WriteTransaction<'a, W>
pub fn new(writer: &'a mut W) -> Self
pub fn write_cell( &mut self, sheet: &str, row: u32, col: u32, data: CellData, ) -> &mut Self
pub fn write_range( &mut self, sheet: &str, cells: BTreeMap<(u32, u32), CellData>, ) -> &mut Self
pub fn clear_range( &mut self, sheet: &str, start: (u32, u32), end: (u32, u32), ) -> &mut Self
pub fn create_sheet(&mut self, name: &str) -> &mut Self
pub fn delete_sheet(&mut self, name: &str) -> &mut Self
pub fn rename_sheet(&mut self, old: &str, new: &str) -> &mut Self
Sourcepub fn validate(&mut self) -> Result<(), W::Error>
pub fn validate(&mut self) -> Result<(), W::Error>
Validate operations for basic invariants (order-sensitive checks can be added later).
Sourcepub fn commit(self) -> Result<(), W::Error>
pub fn commit(self) -> Result<(), W::Error>
Apply all operations; calls flush() at end for durability. Consumes self.
Sourcepub fn rollback(self)
pub fn rollback(self)
Explicit rollback just marks as committed (journal dropped without applying).
pub fn operations(&self) -> &[WriteOp]
Trait Implementations§
Source§impl<'a, W: SpreadsheetWriter> Drop for WriteTransaction<'a, W>
impl<'a, W: SpreadsheetWriter> Drop for WriteTransaction<'a, W>
Auto Trait Implementations§
impl<'a, W> Freeze for WriteTransaction<'a, W>
impl<'a, W> RefUnwindSafe for WriteTransaction<'a, W>where
W: RefUnwindSafe,
impl<'a, W> Send for WriteTransaction<'a, W>
impl<'a, W> Sync for WriteTransaction<'a, W>
impl<'a, W> Unpin for WriteTransaction<'a, W>
impl<'a, W> UnsafeUnpin for WriteTransaction<'a, W>
impl<'a, W> !UnwindSafe for WriteTransaction<'a, W>
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