Trait Database

Source
pub trait Database: DatabaseOps {
    // Provided methods
    fn salsa_event(&self, event_fn: Event) { ... }
    fn unwind_if_cancelled(&self) { ... }
    fn salsa_runtime(&self) -> &Runtime { ... }
    fn salsa_runtime_mut(&mut self) -> &mut Runtime { ... }
}
Expand description

The base trait which your “query context” must implement. Gives access to the salsa runtime, which you must embed into your query context (along with whatever other state you may require).

Provided Methods§

Source

fn salsa_event(&self, event_fn: Event)

This function is invoked at key points in the salsa runtime. It permits the database to be customized and to inject logging or other custom behavior.

Source

fn unwind_if_cancelled(&self)

Starts unwinding the stack if the current revision is cancelled.

This method can be called by query implementations that perform potentially expensive computations, in order to speed up propagation of cancellation.

Cancellation will automatically be triggered by salsa on any query invocation.

This method should not be overridden by Database implementors. A salsa_event is emitted when this method is called, so that should be used instead.

Source

fn salsa_runtime(&self) -> &Runtime

Gives access to the underlying salsa runtime.

This method should not be overridden by Database implementors.

Source

fn salsa_runtime_mut(&mut self) -> &mut Runtime

Gives access to the underlying salsa runtime.

This method should not be overridden by Database implementors.

Implementors§