Checkpoint

This commit is contained in:
Nathan Sobo
2023-10-10 12:42:44 -06:00
parent d70b4f04f6
commit e714653478
3 changed files with 10 additions and 10 deletions
+6
View File
@@ -33,6 +33,12 @@ pub trait Element: 'static {
}
}
pub trait StatefulElement: Element {
fn element_id(&self) -> ElementId {
Element::element_id(self).unwrap()
}
}
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct ElementId(ArcCow<'static, [u8]>);
+2 -2
View File
@@ -1,6 +1,6 @@
use crate::{
AnyElement, Bounds, DispatchPhase, Element, ElementId, Interactive, MouseEventListeners,
MouseMoveEvent, ParentElement, Pixels, Stateful, Styled, ViewContext,
MouseMoveEvent, ParentElement, Pixels, StatefulElement, Styled, ViewContext,
};
use anyhow::Result;
use refineable::{CascadeSlot, Refineable, RefinementCascade};
@@ -100,4 +100,4 @@ impl<E: ParentElement + Styled> ParentElement for Hoverable<E> {
}
}
impl<E: Stateful + Styled> Stateful for Hoverable<E> {}
impl<E: StatefulElement + Styled> StatefulElement for Hoverable<E> {}
+2 -8
View File
@@ -1,12 +1,6 @@
use crate::{BorrowWindow, Bounds, Element, ElementId, LayoutId, ViewContext};
use crate::{BorrowWindow, Bounds, Element, ElementId, LayoutId, StatefulElement, ViewContext};
use anyhow::Result;
pub trait Stateful: Element {
fn element_id(&self) -> ElementId {
Element::element_id(self).unwrap()
}
}
pub struct Identified<E> {
pub(crate) element: E,
pub(crate) id: ElementId,
@@ -41,4 +35,4 @@ impl<E: Element> Element for Identified<E> {
}
}
impl<E: Element> Stateful for Identified<E> {}
impl<E: Element> StatefulElement for Identified<E> {}