Return impl IntoElement from Render::render trait
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user