mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-08-04 11:00:05 +00:00
make event generation lazy
Creating events if nobody is listening has always bugged me.
This commit is contained in:
parent
1842b1dfbb
commit
64556e9d28
21 changed files with 37 additions and 24 deletions
|
@ -124,8 +124,9 @@ impl Db for Database {
|
|||
|
||||
#[salsa::db]
|
||||
impl salsa::Database for Database {
|
||||
fn salsa_event(&self, event: salsa::Event) {
|
||||
fn salsa_event(&self, event: &dyn Fn() -> salsa::Event) {
|
||||
// don't log boring events
|
||||
let event = event();
|
||||
if let salsa::EventKind::WillExecute { .. } = event.kind {
|
||||
self.logs.lock().unwrap().push(format!("{:?}", event));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue