Db

Trait Db 

Source
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 tracking
  • QueryContext::query() / QueryContext::asset(): With dependency tracking

Required Methods§

Source

fn query<Q: Query>(&self, query: Q) -> Result<Arc<Q::Output>, QueryError>

Execute a query, returning the cached result if available.

Source

fn asset<K: AssetKey>(&self, key: K) -> Result<AssetLoadingState<K>, QueryError>

Access an asset by key.

Source

fn list_queries<Q: Query>(&self) -> Vec<Q>

List all executed queries of a specific type.

Source

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.

Implementors§

Source§

impl<'a, T: Tracer> Db for QueryContext<'a, T>

Source§

impl<T: Tracer> Db for QueryRuntime<T>