Return impl IntoElement from Render::render trait

This commit is contained in:
Nathan Sobo
2024-01-02 10:09:05 -07:00
parent 0f33775a91
commit 1b5c8b2b4a
84 changed files with 550 additions and 110 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
use crate::{
div, Action, AnyView, AnyWindowHandle, AppCell, AppContext, AsyncAppContext,
BackgroundExecutor, Bounds, ClipboardItem, Context, Element, Entity, EventEmitter,
ForegroundExecutor, InputEvent, KeyDownEvent, Keystroke, Model, ModelContext, Pixels, Platform,
BackgroundExecutor, Bounds, ClipboardItem, Context, Entity, EventEmitter, ForegroundExecutor,
InputEvent, IntoElement, KeyDownEvent, Keystroke, Model, ModelContext, Pixels, Platform,
PlatformWindow, Point, Render, Result, Size, Task, TestDispatcher, TestPlatform, TestWindow,
TestWindowHandlers, TextSystem, View, ViewContext, VisualContext, WindowBounds, WindowContext,
WindowHandle, WindowOptions,
@@ -731,7 +731,7 @@ impl AnyWindowHandle {
pub struct EmptyView {}
impl Render for EmptyView {
fn render(&mut self, _cx: &mut crate::ViewContext<Self>) -> impl Element {
fn render(&mut self, _cx: &mut crate::ViewContext<Self>) -> impl IntoElement {
div()
}
}
+1 -1
View File
@@ -107,7 +107,7 @@ pub trait IntoElement: Sized {
}
pub trait Render: 'static + Sized {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element;
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement;
}
/// You can derive [IntoElement] on any type that implements this trait.
+1 -1
View File
@@ -205,7 +205,7 @@ impl ExternalPaths {
}
impl Render for ExternalPaths {
fn render(&mut self, _: &mut ViewContext<Self>) -> impl Element {
fn render(&mut self, _: &mut ViewContext<Self>) -> impl IntoElement {
div() // Intentionally left empty because the platform will render icons for the dragged files
}
}