@@ -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]>);
@@ -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> {}
@@ -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> {}