Skip to main content

Query

Trait Query 

Source
pub trait Query:
    Send
    + Sync
    + 'static {
    type Key: QueryKey;
    type Value: QueryValue;

    // Required methods
    fn compute(&self, db: &dyn QueryDatabase, key: &Self::Key) -> Self::Value;
    fn name(&self) -> &'static str;
}
Expand description

A query definition with its computation function.

Required Associated Types§

Source

type Key: QueryKey

The key type for this query.

Source

type Value: QueryValue

The value type for this query.

Required Methods§

Source

fn compute(&self, db: &dyn QueryDatabase, key: &Self::Key) -> Self::Value

Compute the query result for the given key.

Source

fn name(&self) -> &'static str

Get a human-readable name for this query.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§