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