Struct salsa_2022::durability::Durability
source · [−]pub struct Durability(_);
Expand description
Describes how likely a value is to change – how “durable” it is.
By default, inputs have Durability::LOW
and interned values have
Durability::HIGH
. But inputs can be explicitly set with other
durabilities.
We use durabilities to optimize the work of “revalidating” a query after some input has changed. Ordinarily, in a new revision, queries have to trace all their inputs back to the base inputs to determine if any of those inputs have changed. But if we know that the only changes were to inputs of low durability (the common case), and we know that the query only used inputs of medium durability or higher, then we can skip that enumeration.
Typically, one assigns low durabilites to inputs that the user is frequently editing. Medium or high durabilities are used for configuration, the source from library crates, or other things that are unlikely to be edited.
Implementations
sourceimpl Durability
impl Durability
sourcepub const LOW: Durability = _
pub const LOW: Durability = _
Low durability: things that change frequently.
Example: part of the crate being edited
sourcepub const MEDIUM: Durability = _
pub const MEDIUM: Durability = _
Medium durability: things that change sometimes, but rarely.
Example: a Cargo.toml file
sourcepub const HIGH: Durability = _
pub const HIGH: Durability = _
High durability: things that are not expected to change under common usage.
Example: the standard library or something from crates.io
Trait Implementations
sourceimpl Clone for Durability
impl Clone for Durability
sourcefn clone(&self) -> Durability
fn clone(&self) -> Durability
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for Durability
impl Debug for Durability
sourceimpl Ord for Durability
impl Ord for Durability
sourcefn cmp(&self, other: &Durability) -> Ordering
fn cmp(&self, other: &Durability) -> Ordering
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialEq<Durability> for Durability
impl PartialEq<Durability> for Durability
sourcefn eq(&self, other: &Durability) -> bool
fn eq(&self, other: &Durability) -> bool
sourceimpl PartialOrd<Durability> for Durability
impl PartialOrd<Durability> for Durability
sourcefn partial_cmp(&self, other: &Durability) -> Option<Ordering>
fn partial_cmp(&self, other: &Durability) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Durability
impl Eq for Durability
impl StructuralEq for Durability
impl StructuralPartialEq for Durability
Auto Trait Implementations
impl RefUnwindSafe for Durability
impl Send for Durability
impl Sync for Durability
impl Unpin for Durability
impl UnwindSafe for Durability
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.