mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-12 16:35:21 +00:00
16 lines
331 B
Rust
16 lines
331 B
Rust
use std::cell::RefCell;
|
|
|
|
#[derive(Default)]
|
|
crate struct Log {
|
|
data: RefCell<Vec<String>>,
|
|
}
|
|
|
|
impl Log {
|
|
crate fn add(&self, text: impl Into<String>) {
|
|
self.data.borrow_mut().push(text.into());
|
|
}
|
|
|
|
crate fn take(&self) -> Vec<String> {
|
|
std::mem::replace(&mut *self.data.borrow_mut(), vec![])
|
|
}
|
|
}
|