ZIm/crates/storybook/src/element_ext.rs
2023-08-30 16:12:14 -06:00

22 lines
479 B
Rust

use crate::theme::{Theme, Themed};
use gpui2::Element;
use std::marker::PhantomData;
pub trait ElementExt<V: 'static>: Element<V> {
fn themed(self, theme: Theme) -> Themed<V, Self>
where
Self: Sized;
}
impl<V: 'static, E: Element<V>> ElementExt<V> for E {
fn themed(self, theme: Theme) -> Themed<V, Self>
where
Self: Sized,
{
Themed {
child: self,
theme,
view_type: PhantomData,
}
}
}