mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-08-04 19:08:32 +00:00
wip
This commit is contained in:
parent
4769e32d44
commit
612cec6703
20 changed files with 227 additions and 330 deletions
|
@ -8,6 +8,7 @@ use notify_debouncer_mini::{
|
|||
notify::{RecommendedWatcher, RecursiveMode},
|
||||
DebounceEventResult, Debouncer,
|
||||
};
|
||||
use salsa::{Accumulator, Setter};
|
||||
|
||||
// ANCHOR: main
|
||||
fn main() -> Result<()> {
|
||||
|
@ -31,7 +32,7 @@ fn main() -> Result<()> {
|
|||
println!("Sum is: {}", sum);
|
||||
} else {
|
||||
for diagnostic in diagnostics {
|
||||
println!("{}", diagnostic);
|
||||
println!("{}", diagnostic.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,21 +133,20 @@ impl salsa::Database for Database {
|
|||
}
|
||||
|
||||
#[salsa::accumulator]
|
||||
#[derive(Clone, Debug)]
|
||||
struct Diagnostic(String);
|
||||
|
||||
impl Diagnostic {
|
||||
fn push_error(db: &dyn Db, file: File, error: Report) {
|
||||
Diagnostic::push(
|
||||
db,
|
||||
format!(
|
||||
"Error in file {}: {:?}\n",
|
||||
file.path(db)
|
||||
.file_name()
|
||||
.unwrap_or_else(|| "<unknown>".as_ref())
|
||||
.to_string_lossy(),
|
||||
error,
|
||||
),
|
||||
)
|
||||
Diagnostic(format!(
|
||||
"Error in file {}: {:?}\n",
|
||||
file.path(db)
|
||||
.file_name()
|
||||
.unwrap_or_else(|| "<unknown>".as_ref())
|
||||
.to_string_lossy(),
|
||||
error,
|
||||
))
|
||||
.accumulate(db);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue