Closed brandon-reinhart closed 2 weeks ago
It seems possible to avoid this overly restrictive trait bound. In my case, I have a template type that I want to DefaultTheme. A template parameter is of a type that is unused in the type and cannot be Clone for reasons.
#[derive(Component, Reflect)] pub(crate) struct ManifestEditor<M> where M: Manifest + EditableManifest, { manifest: String, handle: Handle<M::RawManifest>, loaded: bool, items: Entity, props: Entity, } impl<M> DefaultTheme for ManifestEditor<M> where M: Manifest + EditableManifest, { fn default_theme() -> Option<Theme<ManifestEditor<M>>> { ManifestEditor::<M>::theme().into() } } impl<M> ManifestEditor<M> where M: Manifest + EditableManifest, { pub const ITEMS: &'static str = "Items"; pub const PROPS: &'static str = "Props"; pub fn theme() -> Theme<ManifestEditor<M>> { let base_theme = PseudoTheme::deferred(None, ManifestEditor::<M>::primary_style); Theme::new(vec![base_theme]) } fn primary_style(style_builder: &mut StyleBuilder, theme_data: &ThemeData) {} }
It seems reasonable for this to be Sized. I tested this locally and the examples all work fine with this change.
It seems possible to avoid this overly restrictive trait bound. In my case, I have a template type that I want to DefaultTheme. A template parameter is of a type that is unused in the type and cannot be Clone for reasons.
It seems reasonable for this to be Sized. I tested this locally and the examples all work fine with this change.