pub unsafe trait Update {
// Required method
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool;
}
Expand description
§Safety
Implementing this trait requires the implementor to verify:
maybe_update
ensures the properties it is intended to ensure.- If the value implements
Eq
, it is safe to compare an instance of the value from an older revision with one from the newer revision. If the value compares as equal, no update is needed to bring it into the newer revision.
NB: The second point implies that Update
cannot be implemented for any
&'db T
– (i.e., any Rust reference tied to the database).
Such a value could refer to memory that was freed in some
earlier revision. Even if the memory is still valid, it could also
have been part of a tracked struct whose values were mutated,
thus invalidating the 'db
lifetime (from a stacked borrows perspective).
Either way, the Eq
implementation would be invalid.
Required Methods§
Sourceunsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
§Returns
True if the value should be considered to have changed in the new revision.
§Safety
§Requires
Informally, requires that old_value
points to a value in the
database that is potentially from a previous revision and new_value
points to a value produced in this revision.
More formally, requires that
- all parameters meet the validity and safety invariants for their type
old_value
further points to allocated memory that meets the validity invariant forSelf
- all data owned by
old_value
further meets its safety invariant- not that borrowed data in
old_value
only meets its validity invariant and hence cannot be dereferenced; essentially, a&T
may point to memory in the database which has been modified or even freed in the newer revision.
- not that borrowed data in
§Ensures
That old_value
is updated with
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl Update for Infallible
impl Update for Infallible
unsafe fn maybe_update(_old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for bool
impl Update for bool
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for f32
impl Update for f32
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for f64
impl Update for f64
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for i8
impl Update for i8
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for i16
impl Update for i16
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for i32
impl Update for i32
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for i64
impl Update for i64
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for isize
impl Update for isize
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for u8
impl Update for u8
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for u16
impl Update for u16
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for u32
impl Update for u32
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for u64
impl Update for u64
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for ()
impl Update for ()
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for usize
impl Update for usize
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for String
impl Update for String
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl Update for PathBuf
impl Update for PathBuf
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl<A> Update for (A,)where
A: Update,
impl<A> Update for (A,)where
A: Update,
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl<A> Update for SmallVec<A>
impl<A> Update for SmallVec<A>
unsafe fn maybe_update(old_pointer: *mut Self, new_vec: Self) -> bool
Source§impl<A, B> Update for (A, B)
impl<A, B> Update for (A, B)
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl<A, B, C> Update for (A, B, C)
impl<A, B, C> Update for (A, B, C)
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl<A, B, C, D> Update for (A, B, C, D)
impl<A, B, C, D> Update for (A, B, C, D)
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl<A, B, C, D, E> Update for (A, B, C, D, E)
impl<A, B, C, D, E> Update for (A, B, C, D, E)
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl<A, B, C, D, E, F> Update for (A, B, C, D, E, F)
impl<A, B, C, D, E, F> Update for (A, B, C, D, E, F)
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl<A, B, C, D, E, F, G> Update for (A, B, C, D, E, F, G)
impl<A, B, C, D, E, F, G> Update for (A, B, C, D, E, F, G)
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl<A, B, C, D, E, F, G, H> Update for (A, B, C, D, E, F, G, H)
impl<A, B, C, D, E, F, G, H> Update for (A, B, C, D, E, F, G, H)
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl<A, B, C, D, E, F, G, H, I> Update for (A, B, C, D, E, F, G, H, I)
impl<A, B, C, D, E, F, G, H, I> Update for (A, B, C, D, E, F, G, H, I)
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl<A, B, C, D, E, F, G, H, I, J> Update for (A, B, C, D, E, F, G, H, I, J)
impl<A, B, C, D, E, F, G, H, I, J> Update for (A, B, C, D, E, F, G, H, I, J)
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl<A, B, C, D, E, F, G, H, I, J, K> Update for (A, B, C, D, E, F, G, H, I, J, K)
impl<A, B, C, D, E, F, G, H, I, J, K> Update for (A, B, C, D, E, F, G, H, I, J, K)
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl<A, B, C, D, E, F, G, H, I, J, K, L> Update for (A, B, C, D, E, F, G, H, I, J, K, L)
impl<A, B, C, D, E, F, G, H, I, J, K, L> Update for (A, B, C, D, E, F, G, H, I, J, K, L)
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool
Source§impl<K> Update for BTreeSet<K>
impl<K> Update for BTreeSet<K>
unsafe fn maybe_update(old_pointer: *mut Self, new_set: Self) -> bool
Source§impl<K, S> Update for HashSet<K, S>
impl<K, S> Update for HashSet<K, S>
unsafe fn maybe_update(old_pointer: *mut Self, new_set: Self) -> bool
Source§impl<K, S> Update for HashSet<K, S>
impl<K, S> Update for HashSet<K, S>
unsafe fn maybe_update(old_pointer: *mut Self, new_set: Self) -> bool
Source§impl<K, S> Update for IndexSet<K, S>
impl<K, S> Update for IndexSet<K, S>
unsafe fn maybe_update(old_pointer: *mut Self, new_set: Self) -> bool
Source§impl<K, V> Update for BTreeMap<K, V>
impl<K, V> Update for BTreeMap<K, V>
unsafe fn maybe_update(old_pointer: *mut Self, new_map: Self) -> bool
Source§impl<K, V, S> Update for HashMap<K, V, S>
impl<K, V, S> Update for HashMap<K, V, S>
unsafe fn maybe_update(old_pointer: *mut Self, new_map: Self) -> bool
Source§impl<K, V, S> Update for HashMap<K, V, S>
impl<K, V, S> Update for HashMap<K, V, S>
unsafe fn maybe_update(old_pointer: *mut Self, new_map: Self) -> bool
Source§impl<K, V, S> Update for IndexMap<K, V, S>
impl<K, V, S> Update for IndexMap<K, V, S>
unsafe fn maybe_update(old_pointer: *mut Self, new_map: Self) -> bool
Source§impl<L, R> Update for Either<L, R>
Available on crate feature rayon
only.
impl<L, R> Update for Either<L, R>
rayon
only.