pub struct HashMapWriteTxn<'a, K, V> where
    K: Hash + Eq + Clone + Debug + Sync + Send + 'static,
    V: Clone + Sync + Send + 'static, 
{ /* private fields */ }
Expand description

An active write transaction for a HashMap. The data in this tree may be modified exclusively through this transaction without affecting readers. The write may be rolledback/aborted by dropping this guard without calling commit(). Once commit() is called, readers will be able to access and percieve changes in new transactions.

Implementations

Retrieve a value from the map. If the value exists, a reference is returned as Some(&V), otherwise if not present None is returned.

Assert if a key exists in the map.

returns the current number of k:v pairs in the tree

Determine if the set is currently empty

Iterator over (&K, &V) of the set

Iterator over &K

Iterator over &V

Reset this map to an empty state. As this is within the transaction this change only takes effect once commited. Once cleared, you can begin adding new writes and changes, again, that will only be visible once commited.

Insert or update a value by key. If the value previously existed it is returned as Some(V). If the value did not previously exist this returns None.

Remove a key if it exists in the tree. If the value exists, we return it as Some(V), and if it did not exist, we return None

Get a mutable reference to a value in the tree. This is correctly, and safely cloned before you attempt to mutate the value, isolating it from other transactions.

Create a read-snapshot of the current map. This does NOT guarantee the map may not be mutated during the read, so you MUST guarantee that no functions of the write txn are called while this snapshot is active.

Commit the changes from this write transaction. Readers after this point will be able to percieve these changes.

To abort (unstage changes), just do not call this function.

Trait Implementations

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.