element_ext.rs
1use crate::theme::{Theme, Themed};
2use gpui2::Element;
3use std::marker::PhantomData;
4
5pub trait ElementExt<V: 'static>: Element<V> {
6 fn themed(self, theme: Theme) -> Themed<V, Self>
7 where
8 Self: Sized;
9}
10
11impl<V: 'static, E: Element<V>> ElementExt<V> for E {
12 fn themed(self, theme: Theme) -> Themed<V, Self>
13 where
14 Self: Sized,
15 {
16 Themed {
17 child: self,
18 theme,
19 view_type: PhantomData,
20 }
21 }
22}