diff --git a/crates/gpui3/src/element.rs b/crates/gpui3/src/element.rs index dd8b3cb3b1..0a9273fb23 100644 --- a/crates/gpui3/src/element.rs +++ b/crates/gpui3/src/element.rs @@ -1,4 +1,4 @@ -use crate::{BorrowWindow, Bounds, ElementId, Identified, LayoutId, Pixels, Point, ViewContext}; +use crate::{BorrowWindow, Bounds, ElementId, LayoutId, Pixels, Point, ViewContext}; use derive_more::{Deref, DerefMut}; pub(crate) use smallvec::SmallVec; @@ -6,9 +6,7 @@ pub trait Element: 'static + Send + Sync { type ViewState: 'static + Send + Sync; type ElementState: 'static + Send + Sync; - fn element_id(&self) -> Option { - None - } + fn element_id(&self) -> Option; fn layout( &mut self, @@ -24,16 +22,6 @@ pub trait Element: 'static + Send + Sync { element_state: &mut Self::ElementState, cx: &mut ViewContext, ); - - fn id(self, id: impl Into) -> Identified - where - Self: Sized, - { - Identified { - element: self, - id: id.into(), - } - } } pub trait StatefulElement: Element { diff --git a/crates/gpui3/src/elements/div.rs b/crates/gpui3/src/elements/div.rs index db25370c30..2cb3e47f9f 100644 --- a/crates/gpui3/src/elements/div.rs +++ b/crates/gpui3/src/elements/div.rs @@ -1,30 +1,41 @@ use crate::{ - AnyElement, Bounds, Element, Interactive, LayoutId, MouseEventListeners, Overflow, - ParentElement, Pixels, Point, Refineable, RefinementCascade, Style, Styled, ViewContext, + AnyElement, Bounds, Element, ElementId, Interactive, LayoutId, MouseEventListeners, Overflow, + ParentElement, Pixels, Point, Refineable, RefinementCascade, StatefulElement, Style, Styled, + ViewContext, }; use parking_lot::Mutex; use smallvec::SmallVec; -use std::sync::Arc; +use std::{marker::PhantomData, sync::Arc}; -pub struct Div { +pub enum HasId {} + +pub struct Div { styles: RefinementCascade