mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-27 15:07:03 +00:00
Merge pull request #39 from matklad/no-default-key
Remove DefaultKey trait
This commit is contained in:
commit
b2f3d7a70f
1 changed files with 0 additions and 22 deletions
22
src/lib.rs
22
src/lib.rs
|
@ -174,14 +174,6 @@ where
|
|||
})
|
||||
}
|
||||
|
||||
/// Equivalent to `of(DefaultKey::default_key())`
|
||||
pub fn read(&self) -> Q::Value
|
||||
where
|
||||
Q::Key: DefaultKey,
|
||||
{
|
||||
self.get(DefaultKey::default_key())
|
||||
}
|
||||
|
||||
/// Assign a value to an "input queries". Must be used outside of
|
||||
/// an active query computation.
|
||||
pub fn set(&self, key: Q::Key, value: Q::Value)
|
||||
|
@ -218,20 +210,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// A variant of the `Default` trait used for query keys that are
|
||||
/// either singletons (e.g., `()`) or have some overwhelming default.
|
||||
/// In this case, you can write `query.my_query().read()` as a
|
||||
/// convenient shorthand.
|
||||
pub trait DefaultKey {
|
||||
fn default_key() -> Self;
|
||||
}
|
||||
|
||||
impl DefaultKey for () {
|
||||
fn default_key() -> Self {
|
||||
()
|
||||
}
|
||||
}
|
||||
|
||||
/// A macro that helps in defining the "context trait" of a given
|
||||
/// module. This is a trait that defines everything that a block of
|
||||
/// queries need to execute, as well as defining the queries
|
||||
|
|
Loading…
Reference in a new issue