give salsa_runtime a default implementation

This commit is contained in:
XFFXFF 2022-08-24 20:11:48 +08:00
parent f5b0ff59d3
commit 6776919f39
22 changed files with 16 additions and 184 deletions

View file

@ -47,14 +47,6 @@ impl Default for Database {
// ANCHOR: db_impl
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
fn salsa_event(&self, event: salsa::Event) {
// Log interesting events, if logging is enabled
if let Some(logs) = &self.logs {

View file

@ -11,9 +11,9 @@ pub trait Database: HasJarsDyn + AsSalsaDatabase {
log::debug!("salsa_event: {:?}", event.debug(self));
}
fn salsa_runtime(&self) -> &Runtime;
fn salsa_runtime_mut(&mut self) -> &mut Runtime;
fn salsa_runtime(&self) -> &Runtime {
self.runtime()
}
}
/// Indicates a database that also supports parallel query

View file

@ -51,14 +51,6 @@ struct Database {
impl salsa::Database for Database {
fn salsa_event(&self, _event: salsa::Event) {}
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl Db for Database {}

View file

@ -55,14 +55,6 @@ struct Database {
impl salsa::Database for Database {
fn salsa_event(&self, _event: salsa::Event) {}
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl Db for Database {}

View file

@ -50,14 +50,6 @@ struct Database {
impl salsa::Database for Database {
fn salsa_event(&self, _event: salsa::Event) {}
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl Db for Database {}

View file

@ -70,14 +70,6 @@ struct Database {
impl salsa::Database for Database {
fn salsa_event(&self, _event: salsa::Event) {}
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl Db for Database {}

View file

@ -78,18 +78,10 @@ struct Database {
storage: salsa::Storage<Self>,
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl Db for Database {}
impl salsa::Database for Database {}
impl RefUnwindSafe for Database {}
#[salsa::input(jar = Jar)]

View file

@ -30,15 +30,7 @@ struct Database {
storage: salsa::Storage<Self>,
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl salsa::Database for Database {}
impl Db for Database {}

View file

@ -76,14 +76,6 @@ impl salsa::Database for Database {
_ => {}
}
}
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl Db for Database {}

View file

@ -69,14 +69,6 @@ impl salsa::Database for Database {
_ => {}
}
}
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl Db for Database {}

View file

@ -53,15 +53,7 @@ struct Database {
logger: Logger,
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl salsa::Database for Database {}
impl Db for Database {}

View file

@ -37,15 +37,7 @@ struct Database {
logger: Logger,
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl salsa::Database for Database {}
impl Db for Database {}

View file

@ -40,15 +40,7 @@ struct Database {
logger: Logger,
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl salsa::Database for Database {}
impl Db for Database {}

View file

@ -66,15 +66,7 @@ struct Database {
logger: Logger,
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl salsa::Database for Database {}
impl Db for Database {}

View file

@ -22,15 +22,7 @@ struct Database {
logger: Logger,
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl salsa::Database for Database {}
impl Db for Database {}

View file

@ -72,15 +72,7 @@ fn execute() {
storage: salsa::Storage<Self>,
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl salsa::Database for Database {}
impl Db for Database {}

View file

@ -38,19 +38,11 @@ pub(crate) struct Database {
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_event(&self, event: salsa::Event) {
if let salsa::EventKind::WillBlockOn { .. } = event.kind {
self.signal(self.knobs().signal_on_will_block.get());
}
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl salsa::ParallelDatabase for Database {

View file

@ -72,14 +72,6 @@ struct Database {
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
fn salsa_event(&self, event: salsa::Event) {
self.push_log(format!("{:?}", event.debug(self)));
}

View file

@ -25,15 +25,7 @@ fn execute() {
storage: salsa::Storage<Self>,
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl salsa::Database for Database {}
impl Db for Database {}

View file

@ -27,15 +27,7 @@ struct Database {
storage: salsa::Storage<Self>,
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl salsa::Database for Database {}
impl Db for Database {}

View file

@ -37,15 +37,7 @@ struct Database {
storage: salsa::Storage<Self>,
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl salsa::Database for Database {}
impl Db for Database {}

View file

@ -41,15 +41,7 @@ struct Database {
logger: Logger,
}
impl salsa::Database for Database {
fn salsa_runtime(&self) -> &salsa::Runtime {
self.storage.runtime()
}
fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime {
self.storage.runtime_mut()
}
}
impl salsa::Database for Database {}
impl Db for Database {}