Merge pull request #39 from matklad/no-default-key

Remove DefaultKey trait
This commit is contained in:
Niko Matsakis 2018-10-09 08:20:40 -04:00 committed by GitHub
commit b2f3d7a70f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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