pub trait Db {
// Required methods
fn query<Q: Query>(&self, query: Q) -> Result<Arc<Q::Output>, QueryError>;
fn asset<K: AssetKey>(
&self,
key: K,
) -> Result<AssetLoadingState<K>, QueryError>;
fn list_queries<Q: Query>(&self) -> Vec<Q>;
fn list_asset_keys<K: AssetKey>(&self) -> Vec<K>;
}Expand description
Database trait that provides query execution and asset access.
This trait is implemented by both QueryRuntime and
QueryContext, allowing queries to work with either.
QueryRuntime::query()/QueryRuntime::asset(): No dependency trackingQueryContext::query()/QueryContext::asset(): With dependency tracking
Required Methods§
Sourcefn query<Q: Query>(&self, query: Q) -> Result<Arc<Q::Output>, QueryError>
fn query<Q: Query>(&self, query: Q) -> Result<Arc<Q::Output>, QueryError>
Execute a query, returning the cached result if available.
Sourcefn asset<K: AssetKey>(&self, key: K) -> Result<AssetLoadingState<K>, QueryError>
fn asset<K: AssetKey>(&self, key: K) -> Result<AssetLoadingState<K>, QueryError>
Access an asset by key.
Sourcefn list_queries<Q: Query>(&self) -> Vec<Q>
fn list_queries<Q: Query>(&self) -> Vec<Q>
List all executed queries of a specific type.
Sourcefn list_asset_keys<K: AssetKey>(&self) -> Vec<K>
fn list_asset_keys<K: AssetKey>(&self) -> Vec<K>
List all resolved asset keys of a specific type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.