1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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> { self.data.take() } }