remove the pub use for runtime to keep the "main namespace" clean

Not sure which is better.
This commit is contained in:
Niko Matsakis 2018-09-29 06:20:12 -04:00
parent f8bf23bfb5
commit d7b1d194de
3 changed files with 7 additions and 9 deletions

View file

@ -13,7 +13,7 @@ use salsa::query_context_storage;
/// - query storage (declared using the `query_context_storage` macro below)
#[derive(Default)]
pub struct QueryContextImpl {
runtime: salsa::Runtime<QueryContextImpl>,
runtime: salsa::runtime::Runtime<QueryContextImpl>,
storage: QueryContextImplStorage,
interner: Interner,
}

View file

@ -3,7 +3,7 @@ use std::cell::Cell;
#[derive(Default)]
pub struct QueryContextImpl {
runtime: salsa::Runtime<QueryContextImpl>,
runtime: salsa::runtime::Runtime<QueryContextImpl>,
storage: QueryContextImplStorage,
counter: Cell<usize>,
}

View file

@ -23,12 +23,10 @@ pub mod memoized;
pub mod runtime;
pub mod transparent;
pub use self::runtime::Runtime;
/// The base trait which your "query context" must implement. Gives
/// access to the salsa runtime, which you must embed into your query
/// context (along with whatever other state you may require).
pub trait QueryContext: Sized + QueryContextStorageTypes {
pub trait QueryContext: QueryContextStorageTypes {
/// Gives access to the underlying salsa runtime.
fn salsa_runtime(&self) -> &runtime::Runtime<Self>;
@ -40,21 +38,21 @@ pub trait QueryContext: Sized + QueryContextStorageTypes {
/// should be generated for your query-context type automatically by
/// the `query_context_storage` macro, so you shouldn't need to mess
/// with this trait directly.
pub trait QueryContextStorageTypes {
pub trait QueryContextStorageTypes: Sized {
/// A "query descriptor" packages up all the possible queries and a key.
/// It is used to store information about (e.g.) the stack.
///
/// At runtime, it can be implemented in various ways: a monster enum
/// works for a fixed set of queries, but a boxed trait object is good
/// for a more open-ended option.
type QueryDescriptor: QueryDescriptor;
type QueryDescriptor: QueryDescriptor<Self>;
/// Defines the "storage type", where all the query data is kept.
/// This type is defined by the `query_context_storage` macro.
type QueryStorage;
}
pub trait QueryDescriptor: Debug + Eq + Hash {}
pub trait QueryDescriptor<QC>: Debug + Eq + Hash {}
pub trait Query<QC: QueryContext>: Debug + Default + Sized + 'static {
type Key: Clone + Debug + Hash + Eq + Send;
@ -367,7 +365,7 @@ macro_rules! query_context_storage {
type QueryStorage = $Storage;
}
impl $crate::QueryDescriptor for __SalsaQueryDescriptor {
impl $crate::QueryDescriptor<$QueryContext> for __SalsaQueryDescriptor {
}
$(