element_ext.rs

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