Remove IntoAnyElement bound from Element trait

This commit is contained in:
Nathan Sobo 2023-10-26 11:49:36 +02:00
parent db15db45ce
commit 927278e20d
48 changed files with 106 additions and 224 deletions

View file

@ -25,7 +25,7 @@ impl<S: 'static + Send + Sync> Avatar<S> {
self
}
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
let theme = theme(cx);
let mut img = img();
@ -63,11 +63,7 @@ mod stories {
}
}
fn render(
&mut self,
_view: &mut S,
cx: &mut ViewContext<S>,
) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
Story::container(cx)
.child(Story::title_for::<_, Avatar<S>>(cx))
.child(Story::label(cx, "Default"))

View file

@ -150,11 +150,7 @@ impl<S: 'static + Send + Sync> Button<S> {
self.icon.map(|i| IconElement::new(i).color(icon_color))
}
pub fn render(
&mut self,
_view: &mut S,
cx: &mut ViewContext<S>,
) -> impl Element<S> {
pub fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
let icon_color = self.icon_color();
let mut button = h_stack()
@ -211,7 +207,7 @@ impl<S: 'static + Send + Sync> ButtonGroup<S> {
}
}
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
let mut el = h_stack().text_size(ui_size(cx, 1.));
for button in &mut self.buttons {
@ -246,11 +242,7 @@ mod stories {
}
}
fn render(
&mut self,
_view: &mut S,
cx: &mut ViewContext<S>,
) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
let states = InteractionState::iter();
Story::container(cx)

View file

@ -30,7 +30,7 @@ impl<S: 'static + Send + Sync> Details<S> {
self
}
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
let theme = theme(cx);
v_stack()
@ -66,11 +66,7 @@ mod stories {
}
}
fn render(
&mut self,
_view: &mut S,
cx: &mut ViewContext<S>,
) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
Story::container(cx)
.child(Story::title_for::<_, Details<S>>(cx))
.child(Story::label(cx, "Default"))

View file

@ -176,7 +176,7 @@ impl<S: 'static + Send + Sync> IconElement<S> {
self
}
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
let fill = self.color.color(cx);
let svg_size = match self.size {
IconSize::Small => ui_size(cx, 12. / 14.),
@ -214,11 +214,7 @@ mod stories {
}
}
fn render(
&mut self,
_view: &mut S,
cx: &mut ViewContext<S>,
) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
let icons = Icon::iter();
Story::container(cx)

View file

@ -60,7 +60,7 @@ impl<S: 'static + Send + Sync> Input<S> {
self
}
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
let theme = theme(cx);
let (input_bg, input_hover_bg, input_active_bg) = match self.variant {
@ -132,11 +132,7 @@ mod stories {
}
}
fn render(
&mut self,
_view: &mut S,
cx: &mut ViewContext<S>,
) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
Story::container(cx)
.child(Story::title_for::<_, Input<S>>(cx))
.child(Story::label(cx, "Default"))

View file

@ -83,7 +83,7 @@ impl<S: 'static + Send + Sync> Label<S> {
self
}
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
div()
.when(self.strikethrough, |this| {
this.relative().child(
@ -135,7 +135,7 @@ impl<S: 'static + Send + Sync> HighlightedLabel<S> {
self
}
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
let theme = theme(cx);
let highlight_color = theme.text_accent;
@ -223,11 +223,7 @@ mod stories {
}
}
fn render(
&mut self,
_view: &mut S,
cx: &mut ViewContext<S>,
) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
Story::container(cx)
.child(Story::title_for::<_, Label<S>>(cx))
.child(Story::label(cx, "Default"))

View file

@ -14,7 +14,7 @@ impl<S: 'static + Send + Sync> ToolDivider<S> {
}
}
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
let theme = theme(cx);
div().w_px().h_3().bg(theme.border)