pub struct Transaction<'a> { /* private fields */ }Expand description
Changes staged inside Store::transaction. Reads see staged changes.
Implementations§
Source§impl Transaction<'_>
impl Transaction<'_>
Sourcepub fn set_summary(&mut self, summary: impl Into<String>)
pub fn set_summary(&mut self, summary: impl Into<String>)
Replaces the commit subject (an apply run names its files only once it has run).
Sourcepub fn add_entity(&mut self, entity: impl Into<String>)
pub fn add_entity(&mut self, entity: impl Into<String>)
Adds a Surjection-Entity trailer, once per entity.
Sourcepub fn set_apply(&mut self, apply: ApplyRef)
pub fn set_apply(&mut self, apply: ApplyRef)
Sets the Surjection-Apply: <apply-id> <outcome> trailer.
Sourcepub fn has_changes(&self) -> bool
pub fn has_changes(&self) -> bool
Whether anything is staged.
Sourcepub fn check(&self) -> Result<(), CoreError>
pub fn check(&self) -> Result<(), CoreError>
Validates and leak-scans what is staged so far, as the commit will (SPEC 5, 11.8), without writing anything. For work inside the transaction that has effects outside the store (an instant apply).
Sourcepub fn read_to_string(
&self,
relative: &str,
) -> Result<Option<String>, CoreError>
pub fn read_to_string( &self, relative: &str, ) -> Result<Option<String>, CoreError>
A store file as this transaction sees it; None if absent.
pub fn exists(&self, relative: &str) -> Result<bool, CoreError>
Sourcepub fn write(
&mut self,
relative: &str,
contents: impl Into<Vec<u8>>,
) -> Result<(), CoreError>
pub fn write( &mut self, relative: &str, contents: impl Into<Vec<u8>>, ) -> Result<(), CoreError>
Stages contents for relative.
Sourcepub fn remove(&mut self, relative: &str) -> Result<(), CoreError>
pub fn remove(&mut self, relative: &str) -> Result<(), CoreError>
Stages the removal of relative.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Transaction<'a>
impl<'a> !Send for Transaction<'a>
impl<'a> !Sync for Transaction<'a>
impl<'a> !UnwindSafe for Transaction<'a>
impl<'a> Forget for Transaction<'a>
impl<'a> Freeze for Transaction<'a>
impl<'a> Move for Transaction<'a>
impl<'a> Unpin for Transaction<'a>
impl<'a> UnsafeUnpin for Transaction<'a>where
&'a Store<'a>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
*const LeafNode<String, Option<Vec<u8>>> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Option<Vec<u8>>)>>: UnsafeUnpin,
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