salsa/tests/incremental/log.rs

17 lines
346 B
Rust
Raw Normal View History

use std::cell::RefCell;
#[derive(Default)]
2018-10-09 19:34:30 +00:00
pub(crate) struct Log {
data: RefCell<Vec<String>>,
}
impl Log {
2018-10-09 19:34:30 +00:00
pub(crate) fn add(&self, text: impl Into<String>) {
self.data.borrow_mut().push(text.into());
}
2018-10-09 19:34:30 +00:00
pub(crate) fn take(&self) -> Vec<String> {
std::mem::replace(&mut *self.data.borrow_mut(), vec![])
}
}