RE ADD CONTEXT

This commit is contained in:
2025-12-15 21:50:53 -05:00
parent dc2be7f688
commit 0b8a93c5ce
39 changed files with 925 additions and 713 deletions

View File

@@ -2,16 +2,16 @@ use std::any::TypeId;
use crate::{Widget, util::HashSet};
pub struct WidgetData {
pub widget: Box<dyn Widget>,
pub struct WidgetData<State> {
pub widget: Box<dyn Widget<State>>,
pub label: String,
pub event_mgrs: HashSet<TypeId>,
/// dynamic borrow checking
pub borrowed: bool,
}
impl WidgetData {
pub fn new<W: Widget>(widget: W) -> Self {
impl<State> WidgetData<State> {
pub fn new<W: Widget<State>>(widget: W) -> Self {
let mut label = std::any::type_name::<W>().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;