use crate::Widget; pub struct WidgetData { pub widget: Box, pub label: String, /// dynamic borrow checking pub borrowed: bool, } impl WidgetData { pub fn new(widget: W) -> Self { let mut label = std::any::type_name::().to_string(); if let (Some(first), Some(last)) = (label.find(":"), label.rfind(":")) { label = label.split_at(first).0.to_string() + "::" + label.split_at(last + 1).1; } Self { widget: Box::new(widget), label, borrowed: false, } } }