Replace derive Element with derive IntoAnyElement everywhere

This commit is contained in:
Nathan Sobo 2023-10-26 12:38:23 +02:00
parent 315744ec20
commit 8ecfea55cd
45 changed files with 185 additions and 292 deletions

View file

@ -9,7 +9,7 @@ use crate::{h_stack, HighlightedText};
#[derive(Clone)]
pub struct Symbol(pub Vec<HighlightedText>);
#[derive(Element)]
#[derive(IntoAnyElement)]
pub struct Breadcrumb<S: 'static + Send + Sync> {
state_type: PhantomData<S>,
path: PathBuf,
@ -31,7 +31,7 @@ impl<S: 'static + Send + Sync> Breadcrumb<S> {
div().child(" ").text_color(theme.text_muted)
}
fn render(&mut self, view_state: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
fn render(self, view_state: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
let theme = theme(cx);
let symbols_len = self.symbols.len();
@ -86,7 +86,7 @@ mod stories {
use super::*;
#[derive(Element)]
#[derive(IntoAnyElement)]
pub struct BreadcrumbStory<S: 'static + Send + Sync> {
state_type: PhantomData<S>,
}
@ -98,11 +98,7 @@ mod stories {
}
}
fn render(
&mut self,
view_state: &mut S,
cx: &mut ViewContext<S>,
) -> impl IntoAnyElement<S> {
fn render(self, view_state: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
let theme = theme(cx);
Story::container(cx)