learn how workspaces + proc macros work & restructure everything
This commit is contained in:
17
core/src/layout/view.rs
Normal file
17
core/src/layout/view.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use crate::layout::{Widget, WidgetLike, WidgetRef};
|
||||
use std::marker::Unsize;
|
||||
|
||||
pub trait WidgetView {
|
||||
type Widget: Widget + ?Sized + Unsize<dyn Widget> = dyn Widget;
|
||||
fn view(&self) -> &WidgetRef<Self::Widget>;
|
||||
}
|
||||
|
||||
pub struct ViewTag;
|
||||
|
||||
impl<WV: WidgetView> WidgetLike<ViewTag> for WV {
|
||||
type Widget = WV::Widget;
|
||||
|
||||
fn add(self, _ui: &mut super::Ui) -> WidgetRef<Self::Widget> {
|
||||
self.view().clone()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user