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