Struct matterdb::Patch[][src]

pub struct Patch { /* fields omitted */ }

A set of changes that can be atomically applied to a Database.

This set can contain changes from multiple indexes. Changes can be read from the Patch using its RawAccess implementation.

Examples

let db = TemporaryDB::new();
let fork = db.fork();
fork.get_list("list").extend(vec![1_i32, 2, 3]);
let patch: Patch = fork.into_patch();
// The patch contains changes recorded in the fork.
let list = patch.get_list::<_, i32>("list");
assert_eq!(list.len(), 3);

Trait Implementations

impl AsReadonly for &Patch[src]

type Readonly = Self

Readonly version of the access.

fn as_readonly(&self) -> Self::Readonly[src]

Performs the conversion.

impl Debug for Patch[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl From<Patch> for Fork[src]

fn from(patch: Patch) -> Self[src]

Creates a fork based on the provided patch and snapshot.

Note: using created fork to modify data already present in patch may lead to an inconsistent database state. Hence, this method is useful only if you are sure that the fork and patch interacted with different indexes.

impl RawAccess for &Patch[src]

type Changes = ()

Type of the changes() that will be applied to the database.

fn snapshot(&self) -> &dyn Snapshot[src]

Reference to a Snapshot. This is the base relative to which the changes are defined.

fn changes(&self, _address: &ResolvedAddress) -> Self::Changes[src]

Returns changes related to specific address compared to the snapshot().

impl Snapshot for Patch[src]

fn get(&self, name: &ResolvedAddress, key: &[u8]) -> Option<Vec<u8>>[src]

Returns a value corresponding to the specified address and key as a raw vector of bytes, or None if it does not exist. Read more

fn contains(&self, name: &ResolvedAddress, key: &[u8]) -> bool[src]

Returns true if the snapshot contains a value for the specified address and key. Read more

fn iter(&self, name: &ResolvedAddress, from: &[u8]) -> Iter<'_>[src]

Returns an iterator over the entries of the snapshot in ascending order starting from the specified key. The iterator element type is (&[u8], &[u8]). Read more

Auto Trait Implementations

impl !RefUnwindSafe for Patch

impl Send for Patch

impl Sync for Patch

impl Unpin for Patch

impl !UnwindSafe for Patch

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.