mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-12 16:35:21 +00:00
drive-by change: use salsa::
in place of ::salsa::
This is less precise, but it permits people to "re-export" salsa without forcing a Cargo.toml dependency.
This commit is contained in:
parent
9b5c7eeb5e
commit
1382495d9f
2 changed files with 20 additions and 20 deletions
|
@ -62,9 +62,9 @@ pub(crate) fn database(args: TokenStream, input: TokenStream) -> TokenStream {
|
||||||
#group_name_snake: #group_storage,
|
#group_name_snake: #group_storage,
|
||||||
});
|
});
|
||||||
has_group_impls.extend(quote! {
|
has_group_impls.extend(quote! {
|
||||||
impl ::salsa::plumbing::HasQueryGroup<#group_path> for #database_name {
|
impl salsa::plumbing::HasQueryGroup<#group_path> for #database_name {
|
||||||
fn group_storage(db: &Self) -> &#group_storage {
|
fn group_storage(db: &Self) -> &#group_storage {
|
||||||
let runtime = ::salsa::Database::salsa_runtime(db);
|
let runtime = salsa::Database::salsa_runtime(db);
|
||||||
&runtime.storage().#group_name_snake
|
&runtime.storage().#group_name_snake
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ pub(crate) fn database(args: TokenStream, input: TokenStream) -> TokenStream {
|
||||||
// For each query `fn foo() for FooType` create
|
// For each query `fn foo() for FooType` create
|
||||||
//
|
//
|
||||||
// ```
|
// ```
|
||||||
// foo(<FooType as ::salsa::Query<#database_name>>::Key),
|
// foo(<FooType as salsa::Query<#database_name>>::Key),
|
||||||
// ```
|
// ```
|
||||||
let mut variants = proc_macro2::TokenStream::new();
|
let mut variants = proc_macro2::TokenStream::new();
|
||||||
for (query_group, group_key) in query_groups.iter().zip(&query_group_key_names) {
|
for (query_group, group_key) in query_groups.iter().zip(&query_group_key_names) {
|
||||||
|
@ -116,7 +116,7 @@ pub(crate) fn database(args: TokenStream, input: TokenStream) -> TokenStream {
|
||||||
|
|
||||||
//
|
//
|
||||||
output.extend(quote! {
|
output.extend(quote! {
|
||||||
impl ::salsa::plumbing::DatabaseStorageTypes for #database_name {
|
impl salsa::plumbing::DatabaseStorageTypes for #database_name {
|
||||||
type DatabaseKey = __SalsaDatabaseKey;
|
type DatabaseKey = __SalsaDatabaseKey;
|
||||||
type DatabaseStorage = __SalsaDatabaseStorage;
|
type DatabaseStorage = __SalsaDatabaseStorage;
|
||||||
}
|
}
|
||||||
|
@ -134,10 +134,10 @@ pub(crate) fn database(args: TokenStream, input: TokenStream) -> TokenStream {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
output.extend(quote! {
|
output.extend(quote! {
|
||||||
impl ::salsa::plumbing::DatabaseOps for #database_name {
|
impl salsa::plumbing::DatabaseOps for #database_name {
|
||||||
fn for_each_query(
|
fn for_each_query(
|
||||||
&self,
|
&self,
|
||||||
mut op: impl FnMut(&dyn ::salsa::plumbing::QueryStorageMassOps<Self>),
|
mut op: impl FnMut(&dyn salsa::plumbing::QueryStorageMassOps<Self>),
|
||||||
) {
|
) {
|
||||||
#for_each_ops
|
#for_each_ops
|
||||||
}
|
}
|
||||||
|
@ -157,11 +157,11 @@ pub(crate) fn database(args: TokenStream, input: TokenStream) -> TokenStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
output.extend(quote! {
|
output.extend(quote! {
|
||||||
impl ::salsa::plumbing::DatabaseKey<#database_name> for __SalsaDatabaseKey {
|
impl salsa::plumbing::DatabaseKey<#database_name> for __SalsaDatabaseKey {
|
||||||
fn maybe_changed_since(
|
fn maybe_changed_since(
|
||||||
&self,
|
&self,
|
||||||
db: &#database_name,
|
db: &#database_name,
|
||||||
revision: ::salsa::plumbing::Revision,
|
revision: salsa::plumbing::Revision,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
match &self.kind {
|
match &self.kind {
|
||||||
#for_each_query_desc
|
#for_each_query_desc
|
||||||
|
|
|
@ -152,7 +152,7 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
||||||
|
|
||||||
query_fn_definitions.extend(quote! {
|
query_fn_definitions.extend(quote! {
|
||||||
fn #fn_name(&self, #(#key_names: #keys),*) -> #value {
|
fn #fn_name(&self, #(#key_names: #keys),*) -> #value {
|
||||||
<Self as ::salsa::plumbing::GetQueryTable<#qt>>::get_query_table(self).get((#(#key_names),*))
|
<Self as salsa::plumbing::GetQueryTable<#qt>>::get_query_table(self).get((#(#key_names),*))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -185,11 +185,11 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
||||||
|
|
||||||
query_fn_definitions.extend(quote! {
|
query_fn_definitions.extend(quote! {
|
||||||
fn #set_fn_name(&mut self, #(#key_names: #keys,)* value__: #value) {
|
fn #set_fn_name(&mut self, #(#key_names: #keys,)* value__: #value) {
|
||||||
<Self as ::salsa::plumbing::GetQueryTable<#qt>>::get_query_table_mut(self).set((#(#key_names),*), value__)
|
<Self as salsa::plumbing::GetQueryTable<#qt>>::get_query_table_mut(self).set((#(#key_names),*), value__)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn #set_constant_fn_name(&mut self, #(#key_names: #keys,)* value__: #value) {
|
fn #set_constant_fn_name(&mut self, #(#key_names: #keys,)* value__: #value) {
|
||||||
<Self as ::salsa::plumbing::GetQueryTable<#qt>>::get_query_table_mut(self).set_constant((#(#key_names),*), value__)
|
<Self as salsa::plumbing::GetQueryTable<#qt>>::get_query_table_mut(self).set_constant((#(#key_names),*), value__)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -202,10 +202,10 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
||||||
// A variant for the group descriptor below
|
// A variant for the group descriptor below
|
||||||
query_descriptor_maybe_change.extend(quote! {
|
query_descriptor_maybe_change.extend(quote! {
|
||||||
#group_key::#fn_name(key) => {
|
#group_key::#fn_name(key) => {
|
||||||
let group_storage: &#group_storage<DB__> = ::salsa::plumbing::HasQueryGroup::group_storage(db);
|
let group_storage: &#group_storage<DB__> = salsa::plumbing::HasQueryGroup::group_storage(db);
|
||||||
let storage = &group_storage.#fn_name;
|
let storage = &group_storage.#fn_name;
|
||||||
|
|
||||||
<_ as ::salsa::plumbing::QueryStorageOps<DB__, #qt>>::maybe_changed_since(
|
<_ as salsa::plumbing::QueryStorageOps<DB__, #qt>>::maybe_changed_since(
|
||||||
storage,
|
storage,
|
||||||
db,
|
db,
|
||||||
revision,
|
revision,
|
||||||
|
@ -219,7 +219,7 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
||||||
//
|
//
|
||||||
// FIXME(#120): the pub should not be necessary once we complete the transition
|
// FIXME(#120): the pub should not be necessary once we complete the transition
|
||||||
storage_fields.extend(quote! {
|
storage_fields.extend(quote! {
|
||||||
pub #fn_name: <#qt as ::salsa::Query<DB__>>::Storage,
|
pub #fn_name: <#qt as salsa::Query<DB__>>::Storage,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
||||||
impl<T> #trait_name for T
|
impl<T> #trait_name for T
|
||||||
where
|
where
|
||||||
T: #bounds,
|
T: #bounds,
|
||||||
T: ::salsa::plumbing::HasQueryGroup<#group_struct>
|
T: salsa::plumbing::HasQueryGroup<#group_struct>
|
||||||
{
|
{
|
||||||
#query_fn_definitions
|
#query_fn_definitions
|
||||||
}
|
}
|
||||||
|
@ -344,12 +344,12 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
||||||
#trait_vis fn maybe_changed_since<DB__>(
|
#trait_vis fn maybe_changed_since<DB__>(
|
||||||
&self,
|
&self,
|
||||||
db: &DB__,
|
db: &DB__,
|
||||||
db_descriptor: &<DB__ as ::salsa::plumbing::DatabaseStorageTypes>::DatabaseKey,
|
db_descriptor: &<DB__ as salsa::plumbing::DatabaseStorageTypes>::DatabaseKey,
|
||||||
revision: ::salsa::plumbing::Revision,
|
revision: salsa::plumbing::Revision,
|
||||||
) -> bool
|
) -> bool
|
||||||
where
|
where
|
||||||
DB__: #trait_name,
|
DB__: #trait_name,
|
||||||
DB__: ::salsa::plumbing::HasQueryGroup<#group_struct>,
|
DB__: salsa::plumbing::HasQueryGroup<#group_struct>,
|
||||||
{
|
{
|
||||||
match self {
|
match self {
|
||||||
#query_descriptor_maybe_change
|
#query_descriptor_maybe_change
|
||||||
|
@ -375,12 +375,12 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
||||||
impl<DB__> #group_storage<DB__>
|
impl<DB__> #group_storage<DB__>
|
||||||
where
|
where
|
||||||
DB__: #trait_name,
|
DB__: #trait_name,
|
||||||
DB__: ::salsa::plumbing::HasQueryGroup<#group_struct>,
|
DB__: salsa::plumbing::HasQueryGroup<#group_struct>,
|
||||||
{
|
{
|
||||||
#trait_vis fn for_each_query(
|
#trait_vis fn for_each_query(
|
||||||
&self,
|
&self,
|
||||||
db: &DB__,
|
db: &DB__,
|
||||||
mut op: &mut dyn FnMut(&dyn ::salsa::plumbing::QueryStorageMassOps<DB__>),
|
mut op: &mut dyn FnMut(&dyn salsa::plumbing::QueryStorageMassOps<DB__>),
|
||||||
) {
|
) {
|
||||||
#for_each_ops
|
#for_each_ops
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue