rename fns to group_foo

This commit is contained in:
Niko Matsakis 2019-01-24 05:50:13 -05:00
parent c0978fede8
commit 6451c820b7
3 changed files with 7 additions and 7 deletions

View file

@ -243,11 +243,11 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
type GroupStorage = #group_storage<DB>; type GroupStorage = #group_storage<DB>;
type GroupDescriptor = #group_descriptor; type GroupDescriptor = #group_descriptor;
fn storage(group_storage: &Self::GroupStorage) -> &Self::Storage { fn group_storage(group_storage: &Self::GroupStorage) -> &Self::Storage {
&group_storage.#fn_name &group_storage.#fn_name
} }
fn descriptor(key: Self::Key) -> Self::GroupDescriptor { fn group_descriptor(key: Self::Key) -> Self::GroupDescriptor {
#group_descriptor::#fn_name(key) #group_descriptor::#fn_name(key)
} }
} }

View file

@ -356,10 +356,10 @@ pub trait Query<DB: Database>: Debug + Default + Sized + 'static {
type GroupDescriptor; type GroupDescriptor;
/// Extact storage for this query from the storage for its group. /// Extact storage for this query from the storage for its group.
fn storage(group_storage: &Self::GroupStorage) -> &Self::Storage; fn group_storage(group_storage: &Self::GroupStorage) -> &Self::Storage;
/// Create group descriptor for this query. /// Create group descriptor for this query.
fn descriptor(key: Self::Key) -> Self::GroupDescriptor; fn group_descriptor(key: Self::Key) -> Self::GroupDescriptor;
} }
/// Return value from [the `query` method] on `Database`. /// Return value from [the `query` method] on `Database`.

View file

@ -90,14 +90,14 @@ where
{ {
fn get_query_table(db: &DB) -> QueryTable<'_, DB, Q> { fn get_query_table(db: &DB) -> QueryTable<'_, DB, Q> {
let group_storage: &Q::GroupStorage = GetQueryGroupStorage::from(db); let group_storage: &Q::GroupStorage = GetQueryGroupStorage::from(db);
let query_storage = Q::storage(group_storage); let query_storage = Q::group_storage(group_storage);
QueryTable::new(db, query_storage) QueryTable::new(db, query_storage)
} }
fn get_query_table_mut(db: &mut DB) -> QueryTableMut<'_, DB, Q> { fn get_query_table_mut(db: &mut DB) -> QueryTableMut<'_, DB, Q> {
let db = &*db; let db = &*db;
let group_storage: &Q::GroupStorage = GetQueryGroupStorage::from(db); let group_storage: &Q::GroupStorage = GetQueryGroupStorage::from(db);
let query_storage = Q::storage(group_storage); let query_storage = Q::group_storage(group_storage);
QueryTableMut::new(db, query_storage) QueryTableMut::new(db, query_storage)
} }
@ -105,7 +105,7 @@ where
_db: &DB, _db: &DB,
key: <Q as Query<DB>>::Key, key: <Q as Query<DB>>::Key,
) -> <DB as DatabaseStorageTypes>::QueryDescriptor { ) -> <DB as DatabaseStorageTypes>::QueryDescriptor {
let group_descriptor = Q::descriptor(key); let group_descriptor = Q::group_descriptor(key);
<DB as GetDatabaseDescriptor<_>>::from(group_descriptor) <DB as GetDatabaseDescriptor<_>>::from(group_descriptor)
} }
} }