Trait Update

Source
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§

Source

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 for Self
  • 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.
§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

Source§

unsafe fn maybe_update(_old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for bool

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for f32

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for f64

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for i8

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for i16

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for i32

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for i64

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for isize

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for u8

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for u16

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for u32

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for u64

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for ()

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for usize

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for String

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl Update for PathBuf

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl<A> Update for (A,)
where A: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl<A> Update for SmallVec<A>
where A: Array, A::Item: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_vec: Self) -> bool

Source§

impl<A, B> Update for (A, B)
where A: Update, B: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl<A, B, C> Update for (A, B, C)
where A: Update, B: Update, C: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl<A, B, C, D> Update for (A, B, C, D)
where A: Update, B: Update, C: Update, D: Update,

Source§

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)
where A: Update, B: Update, C: Update, D: Update, E: Update,

Source§

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)
where A: Update, B: Update, C: Update, D: Update, E: Update, F: Update,

Source§

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)
where A: Update, B: Update, C: Update, D: Update, E: Update, F: Update, G: Update,

Source§

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)
where A: Update, B: Update, C: Update, D: Update, E: Update, F: Update, G: Update, H: Update,

Source§

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)
where A: Update, B: Update, C: Update, D: Update, E: Update, F: Update, G: Update, H: Update, I: Update,

Source§

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)
where A: Update, B: Update, C: Update, D: Update, E: Update, F: Update, G: Update, H: Update, I: Update, J: Update,

Source§

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)
where A: Update, B: Update, C: Update, D: Update, E: Update, F: Update, G: Update, H: Update, I: Update, J: Update, K: Update,

Source§

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)
where A: Update, B: Update, C: Update, D: Update, E: Update, F: Update, G: Update, H: Update, I: Update, J: Update, K: Update, L: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl<K> Update for BTreeSet<K>
where K: Update + Eq + Ord,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_set: Self) -> bool

Source§

impl<K, S> Update for HashSet<K, S>
where K: Update + Eq + Hash, S: BuildHasher,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_set: Self) -> bool

Source§

impl<K, S> Update for HashSet<K, S>
where K: Update + Eq + Hash, S: BuildHasher,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_set: Self) -> bool

Source§

impl<K, S> Update for IndexSet<K, S>
where K: Update + Eq + Hash, S: BuildHasher,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_set: Self) -> bool

Source§

impl<K, V> Update for BTreeMap<K, V>
where K: Update + Eq + Ord, V: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_map: Self) -> bool

Source§

impl<K, V, S> Update for HashMap<K, V, S>
where K: Update + Eq + Hash, V: Update, S: BuildHasher,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_map: Self) -> bool

Source§

impl<K, V, S> Update for HashMap<K, V, S>
where K: Update + Eq + Hash, V: Update, S: BuildHasher,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_map: Self) -> bool

Source§

impl<K, V, S> Update for IndexMap<K, V, S>
where K: Update + Eq + Hash, V: Update, S: BuildHasher,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_map: Self) -> bool

Source§

impl<L, R> Update for Either<L, R>
where L: Update, R: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl<T> Update for Option<T>
where T: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl<T> Update for Box<[T]>
where T: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_box: Self) -> bool

Source§

impl<T> Update for Box<T>
where T: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_box: Self) -> bool

Source§

impl<T> Update for Arc<T>
where T: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_arc: Self) -> bool

Source§

impl<T> Update for Vec<T>
where T: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_vec: Self) -> bool

Source§

impl<T> Update for PhantomData<T>

Source§

unsafe fn maybe_update(_old_pointer: *mut Self, _new_value: Self) -> bool

Source§

impl<T> Update for ThinVec<T>
where T: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_vec: Self) -> bool

Source§

impl<T, E> Update for Result<T, E>
where T: Update, E: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool

Source§

impl<T, const N: usize> Update for [T; N]
where T: Update,

Source§

unsafe fn maybe_update(old_pointer: *mut Self, new_vec: Self) -> bool

Implementors§