pub struct Transaction { /* private fields */ }Expand description
Edits against one version, in order, none overlapping another.
Transaction::new is the one construction point, so edits out of
order are refused once rather than read two ways.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn new(baseline: B3Hash, edits: Vec<Edit>) -> Result<Transaction, AxError>
pub fn new(baseline: B3Hash, edits: Vec<Edit>) -> Result<Transaction, AxError>
Edits made on the version baseline.
Two insertions at one offset are kept in the order given; any other pair must not share a byte.
§Errors
E_INVALID_ARGS naming the first edit that starts before the one
ahead of it ends.
pub fn edits(&self) -> &[Edit]
Sourcepub fn apply(&self, source: &[u8]) -> Result<Applied, AxError>
pub fn apply(&self, source: &[u8]) -> Result<Applied, AxError>
Applies the edits to source, which must be the baseline version.
§Errors
E_VERSION_CONFLICT when source is not the baseline: somebody
saved since these edits were made, and their change stands.
E_INVALID_ARGS when an edit reaches past the end of source.
Either way nothing was applied.
Trait Implementations§
Source§impl Clone for Transaction
impl Clone for Transaction
Source§impl Debug for Transaction
impl Debug for Transaction
impl Eq for Transaction
Source§impl PartialEq for Transaction
impl PartialEq for Transaction
impl StructuralPartialEq 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