Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Clean up Element API and start on docs

Nathan Sobo83923fd6d574
diff --git a/crates/activity_indicator2/src/activity_indicator.rs b/crates/activity_indicator2/src/activity_indicator.rs
index 2b7846cd8d9..1332aa8018d 100644
--- a/crates/activity_indicator2/src/activity_indicator.rs
+++ b/crates/activity_indicator2/src/activity_indicator.rs
@@ -304,9 +304,9 @@ impl ActivityIndicator {
impl EventEmitter<Event> for ActivityIndicator {}
impl Render for ActivityIndicator {
- type Element = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let content = self.content_to_render(cx);
let mut result = h_stack()
diff --git a/crates/assistant2/src/assistant_panel.rs b/crates/assistant2/src/assistant_panel.rs
index bcfb5f0fbc9..b04d99842c6 100644
--- a/crates/assistant2/src/assistant_panel.rs
+++ b/crates/assistant2/src/assistant_panel.rs
@@ -1101,9 +1101,9 @@ fn build_api_key_editor(cx: &mut ViewContext<AssistantPanel>) -> View<Editor> {
}
impl Render for AssistantPanel {
- type Element = Focusable<Div>;
+ type Output = Focusable<Div>;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
if let Some(api_key_editor) = self.api_key_editor.clone() {
v_stack()
.on_action(cx.listener(AssistantPanel::save_credentials))
@@ -2513,9 +2513,9 @@ impl ConversationEditor {
impl EventEmitter<ConversationEditorEvent> for ConversationEditor {}
impl Render for ConversationEditor {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
div()
.key_context("ConversationEditor")
.capture_action(cx.listener(ConversationEditor::cancel_last_assist))
@@ -2618,9 +2618,9 @@ struct InlineAssistant {
impl EventEmitter<InlineAssistantEvent> for InlineAssistant {}
impl Render for InlineAssistant {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let measurements = self.measurements.get();
h_stack()
.w_full()
diff --git a/crates/auto_update2/src/update_notification.rs b/crates/auto_update2/src/update_notification.rs
index 8bb08912b01..7bbbcab0feb 100644
--- a/crates/auto_update2/src/update_notification.rs
+++ b/crates/auto_update2/src/update_notification.rs
@@ -13,9 +13,9 @@ pub struct UpdateNotification {
impl EventEmitter<DismissEvent> for UpdateNotification {}
impl Render for UpdateNotification {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Output {
let app_name = cx.global::<ReleaseChannel>().display_name();
v_stack()
diff --git a/crates/breadcrumbs2/src/breadcrumbs.rs b/crates/breadcrumbs2/src/breadcrumbs.rs
index da7182ec2c7..77ee22493f4 100644
--- a/crates/breadcrumbs2/src/breadcrumbs.rs
+++ b/crates/breadcrumbs2/src/breadcrumbs.rs
@@ -30,9 +30,9 @@ impl Breadcrumbs {
impl EventEmitter<ToolbarItemEvent> for Breadcrumbs {}
impl Render for Breadcrumbs {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let element = h_stack().text_ui();
let Some(active_item) = self.active_item.as_ref() else {
return element;
diff --git a/crates/collab_ui2/src/channel_view.rs b/crates/collab_ui2/src/channel_view.rs
index 0fbe625fe02..9ba8d506c9d 100644
--- a/crates/collab_ui2/src/channel_view.rs
+++ b/crates/collab_ui2/src/channel_view.rs
@@ -222,9 +222,9 @@ impl ChannelView {
impl EventEmitter<EditorEvent> for ChannelView {}
impl Render for ChannelView {
- type Element = AnyView;
+ type Output = AnyView;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
self.editor.clone().into()
}
}
diff --git a/crates/collab_ui2/src/chat_panel.rs b/crates/collab_ui2/src/chat_panel.rs
index 03e9cfbb4ad..17046587a17 100644
--- a/crates/collab_ui2/src/chat_panel.rs
+++ b/crates/collab_ui2/src/chat_panel.rs
@@ -549,9 +549,9 @@ impl ChatPanel {
impl EventEmitter<Event> for ChatPanel {}
impl Render for ChatPanel {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
div()
.full()
.child(if self.client.user_id().is_some() {
diff --git a/crates/collab_ui2/src/chat_panel/message_editor.rs b/crates/collab_ui2/src/chat_panel/message_editor.rs
index 0b9d0be0b40..908f57f2d66 100644
--- a/crates/collab_ui2/src/chat_panel/message_editor.rs
+++ b/crates/collab_ui2/src/chat_panel/message_editor.rs
@@ -196,9 +196,9 @@ impl MessageEditor {
}
impl Render for MessageEditor {
- type Element = AnyView;
+ type Output = AnyView;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
self.editor.to_any()
}
}
diff --git a/crates/collab_ui2/src/collab_panel.rs b/crates/collab_ui2/src/collab_panel.rs
index 8fd90af45b4..24057f096dd 100644
--- a/crates/collab_ui2/src/collab_panel.rs
+++ b/crates/collab_ui2/src/collab_panel.rs
@@ -2263,9 +2263,9 @@ fn render_tree_branch(is_last: bool, cx: &mut WindowContext) -> impl IntoElement
}
impl Render for CollabPanel {
- type Element = Focusable<Div>;
+ type Output = Focusable<Div>;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
v_stack()
.key_context("CollabPanel")
.on_action(cx.listener(CollabPanel::cancel))
@@ -2453,9 +2453,9 @@ struct DraggedChannelView {
}
impl Render for DraggedChannelView {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone();
h_stack()
.font(ui_font)
diff --git a/crates/collab_ui2/src/collab_panel/channel_modal.rs b/crates/collab_ui2/src/collab_panel/channel_modal.rs
index d68aa32e9b3..47d142f01e7 100644
--- a/crates/collab_ui2/src/collab_panel/channel_modal.rs
+++ b/crates/collab_ui2/src/collab_panel/channel_modal.rs
@@ -142,9 +142,9 @@ impl FocusableView for ChannelModal {
}
impl Render for ChannelModal {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let channel_store = self.channel_store.read(cx);
let Some(channel) = channel_store.channel_for_id(self.channel_id) else {
return div();
diff --git a/crates/collab_ui2/src/collab_panel/contact_finder.rs b/crates/collab_ui2/src/collab_panel/contact_finder.rs
index a38d22c096b..8368e176b32 100644
--- a/crates/collab_ui2/src/collab_panel/contact_finder.rs
+++ b/crates/collab_ui2/src/collab_panel/contact_finder.rs
@@ -35,7 +35,7 @@ impl ContactFinder {
}
impl Render for ContactFinder {
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
v_stack()
.elevation_3(cx)
.child(
@@ -52,7 +52,7 @@ impl Render for ContactFinder {
.w(rems(34.))
}
- type Element = Div;
+ type Output = Div;
}
pub struct ContactFinderDelegate {
diff --git a/crates/collab_ui2/src/collab_titlebar_item.rs b/crates/collab_ui2/src/collab_titlebar_item.rs
index 6255e2b833d..2ab2e3f3e22 100644
--- a/crates/collab_ui2/src/collab_titlebar_item.rs
+++ b/crates/collab_ui2/src/collab_titlebar_item.rs
@@ -56,9 +56,9 @@ pub struct CollabTitlebarItem {
}
impl Render for CollabTitlebarItem {
- type Element = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let room = ActiveCall::global(cx).read(cx).room().cloned();
let current_user = self.user_store.read(cx).current_user();
let client = self.client.clone();
diff --git a/crates/collab_ui2/src/face_pile.rs b/crates/collab_ui2/src/face_pile.rs
index fd675127e4a..1c0d8100d85 100644
--- a/crates/collab_ui2/src/face_pile.rs
+++ b/crates/collab_ui2/src/face_pile.rs
@@ -9,9 +9,9 @@ pub struct FacePile {
}
impl RenderOnce for FacePile {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, _: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _: &mut WindowContext) -> Self::Output {
let player_count = self.faces.len();
let player_list = self.faces.into_iter().enumerate().map(|(ix, player)| {
let isnt_last = ix < player_count - 1;
diff --git a/crates/collab_ui2/src/notification_panel.rs b/crates/collab_ui2/src/notification_panel.rs
index 4b2f38de9b8..11e88d8b593 100644
--- a/crates/collab_ui2/src/notification_panel.rs
+++ b/crates/collab_ui2/src/notification_panel.rs
@@ -540,7 +540,7 @@ impl NotificationPanel {
}
impl Render for NotificationPanel {
- type Element = Div;
+ type Output = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Div {
v_stack()
@@ -706,9 +706,9 @@ impl NotificationToast {
}
impl Render for NotificationToast {
- type Element = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let user = self.actor.clone();
h_stack()
diff --git a/crates/collab_ui2/src/notifications/incoming_call_notification.rs b/crates/collab_ui2/src/notifications/incoming_call_notification.rs
index d5bdf4ff446..dea6fc93595 100644
--- a/crates/collab_ui2/src/notifications/incoming_call_notification.rs
+++ b/crates/collab_ui2/src/notifications/incoming_call_notification.rs
@@ -117,9 +117,9 @@ impl IncomingCallNotification {
}
impl Render for IncomingCallNotification {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
// TODO: Is there a better place for us to initialize the font?
let (ui_font, ui_font_size) = {
let theme_settings = ThemeSettings::get_global(cx);
diff --git a/crates/collab_ui2/src/notifications/project_shared_notification.rs b/crates/collab_ui2/src/notifications/project_shared_notification.rs
index 707e9614234..fc7cc2b2d0b 100644
--- a/crates/collab_ui2/src/notifications/project_shared_notification.rs
+++ b/crates/collab_ui2/src/notifications/project_shared_notification.rs
@@ -120,9 +120,9 @@ impl ProjectSharedNotification {
}
impl Render for ProjectSharedNotification {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
// TODO: Is there a better place for us to initialize the font?
let (ui_font, ui_font_size) = {
let theme_settings = ThemeSettings::get_global(cx);
diff --git a/crates/command_palette2/src/command_palette.rs b/crates/command_palette2/src/command_palette.rs
index 05891bc0f19..ae23c0b966f 100644
--- a/crates/command_palette2/src/command_palette.rs
+++ b/crates/command_palette2/src/command_palette.rs
@@ -83,9 +83,9 @@ impl FocusableView for CommandPalette {
}
impl Render for CommandPalette {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
v_stack().w(rems(34.)).child(self.picker.clone())
}
}
diff --git a/crates/copilot2/src/sign_in.rs b/crates/copilot2/src/sign_in.rs
index 4fa93ffcf89..22e10fbdc31 100644
--- a/crates/copilot2/src/sign_in.rs
+++ b/crates/copilot2/src/sign_in.rs
@@ -181,9 +181,9 @@ impl CopilotCodeVerification {
}
impl Render for CopilotCodeVerification {
- type Element = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let prompt = match &self.status {
Status::SigningIn {
prompt: Some(prompt),
diff --git a/crates/copilot_button2/src/copilot_button.rs b/crates/copilot_button2/src/copilot_button.rs
index 2c8427732e7..0c62a3c4891 100644
--- a/crates/copilot_button2/src/copilot_button.rs
+++ b/crates/copilot_button2/src/copilot_button.rs
@@ -34,9 +34,9 @@ pub struct CopilotButton {
}
impl Render for CopilotButton {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let all_language_settings = all_language_settings(None, cx);
if !all_language_settings.copilot.feature_enabled {
return div();
diff --git a/crates/diagnostics2/src/diagnostics.rs b/crates/diagnostics2/src/diagnostics.rs
index 8103231ede6..dfecdfed515 100644
--- a/crates/diagnostics2/src/diagnostics.rs
+++ b/crates/diagnostics2/src/diagnostics.rs
@@ -91,9 +91,9 @@ struct DiagnosticGroupState {
impl EventEmitter<EditorEvent> for ProjectDiagnosticsEditor {}
impl Render for ProjectDiagnosticsEditor {
- type Element = Focusable<Div>;
+ type Output = Focusable<Div>;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let child = if self.path_states.is_empty() {
div()
.bg(cx.theme().colors().editor_background)
diff --git a/crates/diagnostics2/src/items.rs b/crates/diagnostics2/src/items.rs
index cc598ba90ca..5901b6803dc 100644
--- a/crates/diagnostics2/src/items.rs
+++ b/crates/diagnostics2/src/items.rs
@@ -21,9 +21,9 @@ pub struct DiagnosticIndicator {
}
impl Render for DiagnosticIndicator {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let diagnostic_indicator = match (self.summary.error_count, self.summary.warning_count) {
(0, 0) => h_stack().child(
IconElement::new(Icon::Check)
diff --git a/crates/diagnostics2/src/toolbar_controls.rs b/crates/diagnostics2/src/toolbar_controls.rs
index 1a604b76c86..14460291947 100644
--- a/crates/diagnostics2/src/toolbar_controls.rs
+++ b/crates/diagnostics2/src/toolbar_controls.rs
@@ -9,9 +9,9 @@ pub struct ToolbarControls {
}
impl Render for ToolbarControls {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let include_warnings = self
.editor
.as_ref()
diff --git a/crates/editor2/src/editor.rs b/crates/editor2/src/editor.rs
index c9fb2fa181f..817744a47f2 100644
--- a/crates/editor2/src/editor.rs
+++ b/crates/editor2/src/editor.rs
@@ -9291,9 +9291,9 @@ impl FocusableView for Editor {
}
impl Render for Editor {
- type Element = EditorElement;
+ type Output = EditorElement;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let settings = ThemeSettings::get_global(cx);
let text_style = match self.mode {
EditorMode::SingleLine | EditorMode::AutoHeight { .. } => TextStyle {
diff --git a/crates/editor2/src/element.rs b/crates/editor2/src/element.rs
index eb9f4106ea4..da7428a8e04 100644
--- a/crates/editor2/src/element.rs
+++ b/crates/editor2/src/element.rs
@@ -2757,7 +2757,7 @@ enum Invisible {
impl Element for EditorElement {
type State = ();
- fn layout(
+ fn request_layout(
&mut self,
_element_state: Option<Self::State>,
cx: &mut gpui::WindowContext,
diff --git a/crates/editor2/src/items.rs b/crates/editor2/src/items.rs
index b10b891d0db..349b3140fe8 100644
--- a/crates/editor2/src/items.rs
+++ b/crates/editor2/src/items.rs
@@ -1193,9 +1193,9 @@ impl CursorPosition {
}
impl Render for CursorPosition {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Output {
div().when_some(self.position, |el, position| {
let mut text = format!(
"{}{FILE_ROW_COLUMN_DELIMITER}{}",
diff --git a/crates/feedback2/src/deploy_feedback_button.rs b/crates/feedback2/src/deploy_feedback_button.rs
index 926a5d791e0..9a112c25db7 100644
--- a/crates/feedback2/src/deploy_feedback_button.rs
+++ b/crates/feedback2/src/deploy_feedback_button.rs
@@ -17,9 +17,9 @@ impl DeployFeedbackButton {
}
impl Render for DeployFeedbackButton {
- type Element = AnyElement;
+ type Output = AnyElement;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let is_open = self
.workspace
.upgrade()
diff --git a/crates/feedback2/src/feedback_modal.rs b/crates/feedback2/src/feedback_modal.rs
index d22d5d908b1..94e051f2474 100644
--- a/crates/feedback2/src/feedback_modal.rs
+++ b/crates/feedback2/src/feedback_modal.rs
@@ -396,9 +396,9 @@ impl FeedbackModal {
}
impl Render for FeedbackModal {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
self.update_submission_state(cx);
let submit_button_text = if self.awaiting_submission() {
diff --git a/crates/file_finder2/src/file_finder.rs b/crates/file_finder2/src/file_finder.rs
index 69deba6d2c0..4676d91f723 100644
--- a/crates/file_finder2/src/file_finder.rs
+++ b/crates/file_finder2/src/file_finder.rs
@@ -118,9 +118,9 @@ impl FocusableView for FileFinder {
}
}
impl Render for FileFinder {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
v_stack().w(rems(34.)).child(self.picker.clone())
}
}
diff --git a/crates/go_to_line2/src/go_to_line.rs b/crates/go_to_line2/src/go_to_line.rs
index 02fcd477162..97118dad66f 100644
--- a/crates/go_to_line2/src/go_to_line.rs
+++ b/crates/go_to_line2/src/go_to_line.rs
@@ -153,9 +153,9 @@ impl GoToLine {
}
impl Render for GoToLine {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
div()
.elevation_2(cx)
.key_context("GoToLine")
diff --git a/crates/gpui2/src/app/test_context.rs b/crates/gpui2/src/app/test_context.rs
index c77ec29bdf2..3aa09d2189c 100644
--- a/crates/gpui2/src/app/test_context.rs
+++ b/crates/gpui2/src/app/test_context.rs
@@ -733,9 +733,9 @@ impl AnyWindowHandle {
pub struct EmptyView {}
impl Render for EmptyView {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut crate::ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut crate::ViewContext<Self>) -> Self::Output {
div()
}
}
diff --git a/crates/gpui2/src/element.rs b/crates/gpui2/src/element.rs
index 4201123a101..442b5b3ac56 100644
--- a/crates/gpui2/src/element.rs
+++ b/crates/gpui2/src/element.rs
@@ -6,23 +6,61 @@ use derive_more::{Deref, DerefMut};
pub(crate) use smallvec::SmallVec;
use std::{any::Any, fmt::Debug};
-pub trait Render: 'static + Sized {
- type Element: Element + 'static;
+/// Elements describe the contents of a window for a given frame.
+/// Like HTML elements, elements form a tree and participate in layout.
+/// In GPUI, elements are single-use objects that do not outlive a single frame.
+/// Elements are associated with state.
+/// If the element has an identifier, the element's state persists across frames in which the element appears.
+/// If the element is anonymous, the state only persists across from layout request to paint in is referred to as "frame state".
+/// A potential improvement would be to separate this temporary frame state from persistent element state at the type level, and request element state from the context with an id. /cc @as-cii\
+/// To render the contents of a window, we first walk over the tree of elements recursively via [request_layout], giving each an opportunity to register with the layout engine.
+/// Then we compute the requested layout and use the computed bounds to paint the element tree recursively with [paint].
+/// You can implement this trait yourself for performance or other special situations, but you'll typically compose existing elements such as `Div`, `Img`, etc.
+pub trait Element: 'static + IntoElement {
+ /// State that is carried from [request_layout] to [paint] for anonymous elements, and between frames for elements that have an id.
+ type State: 'static;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element;
+ /// Recursively register this element and all its descendants with the layout engine.
+ /// If this element has an id, you'll receive the [State] from the previous frame if an element with this id existed in that frame.
+ /// Return the [LayoutId] you requested from the engine and whatever state you want to carry over to [paint], and also the next frame if this element has an id.
+ fn request_layout(
+ &mut self,
+ state: Option<Self::State>,
+ cx: &mut WindowContext,
+ ) -> (LayoutId, Self::State);
+
+ /// Recursively paint this element by populating the current frame's [Scene] with geometric primitives such as quads, sprites, paths, etc.
+ /// Receives the state from layout, and potentially the previous frame if this element has an id.
+ fn paint(&mut self, bounds: Bounds<Pixels>, state: &mut Self::State, cx: &mut WindowContext);
+
+ /// Convert into a dynamically-typed [AnyElement].
+ /// Before an element can be painted, it must be converted into an [AnyElement].
+ /// It's also useful in situations where you need to own an element, but don't care about its specific type.
+ fn into_any(self) -> AnyElement {
+ AnyElement::new(self)
+ }
}
+/// Implemented by any type that can be converted into an element.
pub trait IntoElement: Sized {
- type Element: Element + 'static;
+ /// The specific type of element into which the implementing type is converted.
+ type Element: Element;
+ /// The [ElementId] of self once converted into an [Element].
+ /// If present, the resulting element's state will be carried across frames.
fn element_id(&self) -> Option<ElementId>;
+ /// Convert self into a type that implements [Element].
fn into_element(self) -> Self::Element;
+ /// Convert self into a dynamically-typed [AnyElement].
fn into_any_element(self) -> AnyElement {
self.into_element().into_any()
}
+ /// Convert into an element, then draw in the current window at the given origin.
+ /// The provided available space is provided to the layout engine to determine the size of the root element.
+ /// Once the element is drawn, its associated element staet is yielded to the given callback.
fn draw_and_update_state<T, R>(
self,
origin: Point<Pixels>,
@@ -54,6 +92,7 @@ pub trait IntoElement: Sized {
}
}
+ /// Convert self to another type by calling the given closure. Useful in rendering code.
fn map<U>(self, f: impl FnOnce(Self) -> U) -> U
where
Self: Sized,
@@ -62,6 +101,7 @@ pub trait IntoElement: Sized {
f(self)
}
+ /// Conditionally chain onto self with the given closure. Useful in rendering code.
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
where
Self: Sized,
@@ -69,6 +109,8 @@ pub trait IntoElement: Sized {
self.map(|this| if condition { then(this) } else { this })
}
+ /// Conditionally chain onto self with the given closure if the given option is Some.
+ /// The contents of the option are provided to the closure.
fn when_some<T>(self, option: Option<T>, then: impl FnOnce(Self, T) -> Self) -> Self
where
Self: Sized,
@@ -83,35 +125,46 @@ pub trait IntoElement: Sized {
}
}
-pub trait Element: 'static + IntoElement {
- type State: 'static;
+pub trait Render: 'static + Sized {
+ type Output: IntoElement;
- fn layout(
- &mut self,
- state: Option<Self::State>,
- cx: &mut WindowContext,
- ) -> (LayoutId, Self::State);
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output;
+}
- fn paint(&mut self, bounds: Bounds<Pixels>, state: &mut Self::State, cx: &mut WindowContext);
+pub trait RenderOnce: 'static {
+ type Output: IntoElement;
- fn into_any(self) -> AnyElement {
- AnyElement::new(self)
- }
+ fn render(self, cx: &mut WindowContext) -> Self::Output;
}
-pub trait RenderOnce: 'static {
- type Rendered: IntoElement;
+pub trait ParentElement {
+ fn children_mut(&mut self) -> &mut SmallVec<[AnyElement; 2]>;
+
+ fn child(mut self, child: impl IntoElement) -> Self
+ where
+ Self: Sized,
+ {
+ self.children_mut().push(child.into_element().into_any());
+ self
+ }
- fn render(self, cx: &mut WindowContext) -> Self::Rendered;
+ fn children(mut self, children: impl IntoIterator<Item = impl IntoElement>) -> Self
+ where
+ Self: Sized,
+ {
+ self.children_mut()
+ .extend(children.into_iter().map(|child| child.into_any_element()));
+ self
+ }
}
pub struct Component<C> {
component: Option<C>,
}
-pub struct CompositeElementState<C: RenderOnce> {
- rendered_element: Option<<C::Rendered as IntoElement>::Element>,
- rendered_element_state: Option<<<C::Rendered as IntoElement>::Element as Element>::State>,
+pub struct ComponentState<C: RenderOnce> {
+ rendered_element: Option<<C::Output as IntoElement>::Element>,
+ rendered_element_state: Option<<<C::Output as IntoElement>::Element as Element>::State>,
}
impl<C> Component<C> {
@@ -123,9 +176,9 @@ impl<C> Component<C> {
}
impl<C: RenderOnce> Element for Component<C> {
- type State = CompositeElementState<C>;
+ type State = ComponentState<C>;
- fn layout(
+ fn request_layout(
&mut self,
state: Option<Self::State>,
cx: &mut WindowContext,
@@ -133,16 +186,16 @@ impl<C: RenderOnce> Element for Component<C> {
let mut element = self.component.take().unwrap().render(cx).into_element();
if let Some(element_id) = element.element_id() {
let layout_id =
- cx.with_element_state(element_id, |state, cx| element.layout(state, cx));
- let state = CompositeElementState {
+ cx.with_element_state(element_id, |state, cx| element.request_layout(state, cx));
+ let state = ComponentState {
rendered_element: Some(element),
rendered_element_state: None,
};
(layout_id, state)
} else {
let (layout_id, state) =
- element.layout(state.and_then(|s| s.rendered_element_state), cx);
- let state = CompositeElementState {
+ element.request_layout(state.and_then(|s| s.rendered_element_state), cx);
+ let state = ComponentState {
rendered_element: Some(element),
rendered_element_state: Some(state),
};
@@ -183,27 +236,6 @@ impl<C: RenderOnce> IntoElement for Component<C> {
#[derive(Deref, DerefMut, Default, Clone, Debug, Eq, PartialEq, Hash)]
pub struct GlobalElementId(SmallVec<[ElementId; 32]>);
-pub trait ParentElement {
- fn children_mut(&mut self) -> &mut SmallVec<[AnyElement; 2]>;
-
- fn child(mut self, child: impl IntoElement) -> Self
- where
- Self: Sized,
- {
- self.children_mut().push(child.into_element().into_any());
- self
- }
-
- fn children(mut self, children: impl IntoIterator<Item = impl IntoElement>) -> Self
- where
- Self: Sized,
- {
- self.children_mut()
- .extend(children.into_iter().map(|child| child.into_any_element()));
- self
- }
-}
-
trait ElementObject {
fn element_id(&self) -> Option<ElementId>;
@@ -262,11 +294,14 @@ impl<E: Element> DrawableElement<E> {
let (layout_id, frame_state) = if let Some(id) = self.element.as_ref().unwrap().element_id()
{
let layout_id = cx.with_element_state(id, |element_state, cx| {
- self.element.as_mut().unwrap().layout(element_state, cx)
+ self.element
+ .as_mut()
+ .unwrap()
+ .request_layout(element_state, cx)
});
(layout_id, None)
} else {
- let (layout_id, frame_state) = self.element.as_mut().unwrap().layout(None, cx);
+ let (layout_id, frame_state) = self.element.as_mut().unwrap().request_layout(None, cx);
(layout_id, Some(frame_state))
};
@@ -454,7 +489,7 @@ impl AnyElement {
impl Element for AnyElement {
type State = ();
- fn layout(
+ fn request_layout(
&mut self,
_: Option<Self::State>,
cx: &mut WindowContext,
@@ -502,7 +537,7 @@ impl IntoElement for () {
impl Element for () {
type State = ();
- fn layout(
+ fn request_layout(
&mut self,
_state: Option<Self::State>,
cx: &mut WindowContext,
diff --git a/crates/gpui2/src/elements/canvas.rs b/crates/gpui2/src/elements/canvas.rs
index d04c65811ff..767417ae401 100644
--- a/crates/gpui2/src/elements/canvas.rs
+++ b/crates/gpui2/src/elements/canvas.rs
@@ -29,7 +29,7 @@ impl IntoElement for Canvas {
impl Element for Canvas {
type State = Style;
- fn layout(
+ fn request_layout(
&mut self,
_: Option<Self::State>,
cx: &mut WindowContext,
diff --git a/crates/gpui2/src/elements/div.rs b/crates/gpui2/src/elements/div.rs
index fc129b4f1df..512cc56bb20 100644
--- a/crates/gpui2/src/elements/div.rs
+++ b/crates/gpui2/src/elements/div.rs
@@ -768,7 +768,7 @@ impl ParentElement for Div {
impl Element for Div {
type State = DivState;
- fn layout(
+ fn request_layout(
&mut self,
element_state: Option<Self::State>,
cx: &mut WindowContext,
@@ -1818,12 +1818,12 @@ where
{
type State = E::State;
- fn layout(
+ fn request_layout(
&mut self,
state: Option<Self::State>,
cx: &mut WindowContext,
) -> (LayoutId, Self::State) {
- self.element.layout(state, cx)
+ self.element.request_layout(state, cx)
}
fn paint(&mut self, bounds: Bounds<Pixels>, state: &mut Self::State, cx: &mut WindowContext) {
@@ -1892,12 +1892,12 @@ where
{
type State = E::State;
- fn layout(
+ fn request_layout(
&mut self,
state: Option<Self::State>,
cx: &mut WindowContext,
) -> (LayoutId, Self::State) {
- self.element.layout(state, cx)
+ self.element.request_layout(state, cx)
}
fn paint(&mut self, bounds: Bounds<Pixels>, state: &mut Self::State, cx: &mut WindowContext) {
diff --git a/crates/gpui2/src/elements/img.rs b/crates/gpui2/src/elements/img.rs
index ab7b8d91409..650b5b666bc 100644
--- a/crates/gpui2/src/elements/img.rs
+++ b/crates/gpui2/src/elements/img.rs
@@ -71,7 +71,7 @@ impl Img {
impl Element for Img {
type State = InteractiveElementState;
- fn layout(
+ fn request_layout(
&mut self,
element_state: Option<Self::State>,
cx: &mut WindowContext,
diff --git a/crates/gpui2/src/elements/list.rs b/crates/gpui2/src/elements/list.rs
index a0467aaaa3c..364b610eee7 100644
--- a/crates/gpui2/src/elements/list.rs
+++ b/crates/gpui2/src/elements/list.rs
@@ -302,7 +302,7 @@ pub struct ListOffset {
impl Element for List {
type State = ();
- fn layout(
+ fn request_layout(
&mut self,
_state: Option<Self::State>,
cx: &mut crate::WindowContext,
diff --git a/crates/gpui2/src/elements/overlay.rs b/crates/gpui2/src/elements/overlay.rs
index 5b72019f177..b5d8b53c7f6 100644
--- a/crates/gpui2/src/elements/overlay.rs
+++ b/crates/gpui2/src/elements/overlay.rs
@@ -60,7 +60,7 @@ impl ParentElement for Overlay {
impl Element for Overlay {
type State = OverlayState;
- fn layout(
+ fn request_layout(
&mut self,
_: Option<Self::State>,
cx: &mut WindowContext,
diff --git a/crates/gpui2/src/elements/svg.rs b/crates/gpui2/src/elements/svg.rs
index 9ca9baf470e..5ea7f9bd782 100644
--- a/crates/gpui2/src/elements/svg.rs
+++ b/crates/gpui2/src/elements/svg.rs
@@ -26,7 +26,7 @@ impl Svg {
impl Element for Svg {
type State = InteractiveElementState;
- fn layout(
+ fn request_layout(
&mut self,
element_state: Option<Self::State>,
cx: &mut WindowContext,
diff --git a/crates/gpui2/src/elements/text.rs b/crates/gpui2/src/elements/text.rs
index 7716d815361..91ec8045ad1 100644
--- a/crates/gpui2/src/elements/text.rs
+++ b/crates/gpui2/src/elements/text.rs
@@ -12,7 +12,7 @@ use util::ResultExt;
impl Element for &'static str {
type State = TextState;
- fn layout(
+ fn request_layout(
&mut self,
_: Option<Self::State>,
cx: &mut WindowContext,
@@ -42,7 +42,7 @@ impl IntoElement for &'static str {
impl Element for SharedString {
type State = TextState;
- fn layout(
+ fn request_layout(
&mut self,
_: Option<Self::State>,
cx: &mut WindowContext,
@@ -118,7 +118,7 @@ impl StyledText {
impl Element for StyledText {
type State = TextState;
- fn layout(
+ fn request_layout(
&mut self,
_: Option<Self::State>,
cx: &mut WindowContext,
@@ -331,7 +331,7 @@ impl InteractiveText {
impl Element for InteractiveText {
type State = InteractiveTextState;
- fn layout(
+ fn request_layout(
&mut self,
state: Option<Self::State>,
cx: &mut WindowContext,
@@ -340,14 +340,14 @@ impl Element for InteractiveText {
mouse_down_index, ..
}) = state
{
- let (layout_id, text_state) = self.text.layout(None, cx);
+ let (layout_id, text_state) = self.text.request_layout(None, cx);
let element_state = InteractiveTextState {
text_state,
mouse_down_index,
};
(layout_id, element_state)
} else {
- let (layout_id, text_state) = self.text.layout(None, cx);
+ let (layout_id, text_state) = self.text.request_layout(None, cx);
let element_state = InteractiveTextState {
text_state,
mouse_down_index: Rc::default(),
diff --git a/crates/gpui2/src/elements/uniform_list.rs b/crates/gpui2/src/elements/uniform_list.rs
index e38a37f90d2..390a10021e8 100644
--- a/crates/gpui2/src/elements/uniform_list.rs
+++ b/crates/gpui2/src/elements/uniform_list.rs
@@ -116,7 +116,7 @@ pub struct UniformListState {
impl Element for UniformList {
type State = UniformListState;
- fn layout(
+ fn request_layout(
&mut self,
state: Option<Self::State>,
cx: &mut WindowContext,
diff --git a/crates/gpui2/src/interactive.rs b/crates/gpui2/src/interactive.rs
index 58ee849aad4..7a4c3d013fc 100644
--- a/crates/gpui2/src/interactive.rs
+++ b/crates/gpui2/src/interactive.rs
@@ -205,9 +205,9 @@ impl ExternalPaths {
}
impl Render for ExternalPaths {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Output {
div() // Intentionally left empty because the platform will render icons for the dragged files
}
}
@@ -305,9 +305,9 @@ mod test {
actions!(test, [TestAction]);
impl Render for TestView {
- type Element = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Output {
div().id("testview").child(
div()
.key_context("parent")
diff --git a/crates/gpui2/src/view.rs b/crates/gpui2/src/view.rs
index 1b4c2b6346f..afa08f92135 100644
--- a/crates/gpui2/src/view.rs
+++ b/crates/gpui2/src/view.rs
@@ -81,12 +81,12 @@ impl<V: 'static> View<V> {
impl<V: Render> Element for View<V> {
type State = Option<AnyElement>;
- fn layout(
+ fn request_layout(
&mut self,
_state: Option<Self::State>,
cx: &mut WindowContext,
) -> (LayoutId, Self::State) {
- let mut element = self.update(cx, |view, cx| view.render(cx).into_any());
+ let mut element = self.update(cx, |view, cx| view.render(cx).into_any_element());
let layout_id = element.layout(cx);
(layout_id, Some(element))
}
@@ -229,7 +229,7 @@ impl<V: Render> From<View<V>> for AnyView {
impl Element for AnyView {
type State = Option<AnyElement>;
- fn layout(
+ fn request_layout(
&mut self,
_state: Option<Self::State>,
cx: &mut WindowContext,
@@ -317,22 +317,22 @@ where
T: 'static + FnMut(&mut WindowContext) -> E,
E: 'static + Send + Element,
{
- type Element = E;
+ type Output = E;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
(self)(cx)
}
}
mod any_view {
- use crate::{AnyElement, AnyView, Element, LayoutId, Render, WindowContext};
+ use crate::{AnyElement, AnyView, IntoElement, LayoutId, Render, WindowContext};
pub(crate) fn layout<V: 'static + Render>(
view: &AnyView,
cx: &mut WindowContext,
) -> (LayoutId, AnyElement) {
let view = view.clone().downcast::<V>().unwrap();
- let mut element = view.update(cx, |view, cx| view.render(cx).into_any());
+ let mut element = view.update(cx, |view, cx| view.render(cx).into_any_element());
let layout_id = element.layout(cx);
(layout_id, element)
}
diff --git a/crates/gpui2_macros/src/derive_render.rs b/crates/gpui2_macros/src/derive_render.rs
index 3983a572f06..2695d4a7c56 100644
--- a/crates/gpui2_macros/src/derive_render.rs
+++ b/crates/gpui2_macros/src/derive_render.rs
@@ -11,9 +11,9 @@ pub fn derive_render(input: TokenStream) -> TokenStream {
impl #impl_generics gpui::Render for #type_name #type_generics
#where_clause
{
- type Element = ();
+ type Output = ();
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
()
}
}
diff --git a/crates/language_selector2/src/active_buffer_language.rs b/crates/language_selector2/src/active_buffer_language.rs
index 48224198a2e..21f7bf233d2 100644
--- a/crates/language_selector2/src/active_buffer_language.rs
+++ b/crates/language_selector2/src/active_buffer_language.rs
@@ -38,7 +38,7 @@ impl ActiveBufferLanguage {
}
impl Render for ActiveBufferLanguage {
- type Element = Div;
+ type Output = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Div {
div().when_some(self.active_language.as_ref(), |el, active_language| {
diff --git a/crates/language_selector2/src/language_selector.rs b/crates/language_selector2/src/language_selector.rs
index 3da8649c6e0..16c661b6fb4 100644
--- a/crates/language_selector2/src/language_selector.rs
+++ b/crates/language_selector2/src/language_selector.rs
@@ -67,9 +67,9 @@ impl LanguageSelector {
}
impl Render for LanguageSelector {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
v_stack().w(rems(34.)).child(self.picker.clone())
}
}
diff --git a/crates/language_tools2/src/lsp_log.rs b/crates/language_tools2/src/lsp_log.rs
index 310726e4a52..00f1e86e5f1 100644
--- a/crates/language_tools2/src/lsp_log.rs
+++ b/crates/language_tools2/src/lsp_log.rs
@@ -595,9 +595,9 @@ fn log_contents(lines: &VecDeque<String>) -> String {
}
impl Render for LspLogView {
- type Element = EditorElement;
+ type Output = EditorElement;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
self.editor.update(cx, |editor, cx| editor.render(cx))
}
}
@@ -709,9 +709,9 @@ impl ToolbarItemView for LspLogToolbarItemView {
}
impl Render for LspLogToolbarItemView {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let Some(log_view) = self.log_view.clone() else {
return div();
};
diff --git a/crates/language_tools2/src/syntax_tree_view.rs b/crates/language_tools2/src/syntax_tree_view.rs
index e4ee4b0cfb6..1794b45337a 100644
--- a/crates/language_tools2/src/syntax_tree_view.rs
+++ b/crates/language_tools2/src/syntax_tree_view.rs
@@ -305,9 +305,9 @@ impl SyntaxTreeView {
}
impl Render for SyntaxTreeView {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut gpui::ViewContext<'_, Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut gpui::ViewContext<'_, Self>) -> Self::Output {
let settings = ThemeSettings::get_global(cx);
let line_height = cx
.text_style()
@@ -507,7 +507,7 @@ fn format_node_range(node: Node) -> String {
}
impl Render for SyntaxTreeToolbarItemView {
- type Element = PopoverMenu<ContextMenu>;
+ type Output = PopoverMenu<ContextMenu>;
fn render(&mut self, cx: &mut ViewContext<'_, Self>) -> PopoverMenu<ContextMenu> {
self.render_menu(cx)
diff --git a/crates/outline2/src/outline.rs b/crates/outline2/src/outline.rs
index ba67f33b25d..2f29534b6ed 100644
--- a/crates/outline2/src/outline.rs
+++ b/crates/outline2/src/outline.rs
@@ -57,9 +57,9 @@ impl EventEmitter<DismissEvent> for OutlineView {}
impl ModalView for OutlineView {}
impl Render for OutlineView {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
v_stack().w(rems(34.)).child(self.picker.clone())
}
}
diff --git a/crates/picker2/src/picker2.rs b/crates/picker2/src/picker2.rs
index 3abdf953b34..6632c13ddfc 100644
--- a/crates/picker2/src/picker2.rs
+++ b/crates/picker2/src/picker2.rs
@@ -228,9 +228,9 @@ impl<D: PickerDelegate> EventEmitter<DismissEvent> for Picker<D> {}
impl<D: PickerDelegate> ModalView for Picker<D> {}
impl<D: PickerDelegate> Render for Picker<D> {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let picker_editor = h_stack()
.overflow_hidden()
.flex_none()
diff --git a/crates/project_panel2/src/project_panel.rs b/crates/project_panel2/src/project_panel.rs
index 21a114c43c9..c0dfe995f63 100644
--- a/crates/project_panel2/src/project_panel.rs
+++ b/crates/project_panel2/src/project_panel.rs
@@ -1480,9 +1480,9 @@ impl ProjectPanel {
}
impl Render for ProjectPanel {
- type Element = Focusable<Stateful<Div>>;
+ type Output = Focusable<Stateful<Div>>;
- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Output {
let has_worktree = self.visible_entries.len() != 0;
if has_worktree {
@@ -1548,9 +1548,9 @@ impl Render for ProjectPanel {
}
impl Render for DraggedProjectEntryView {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let settings = ProjectPanelSettings::get_global(cx);
let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone();
h_stack()
diff --git a/crates/quick_action_bar2/src/quick_action_bar.rs b/crates/quick_action_bar2/src/quick_action_bar.rs
index 3eba0e60ec2..686804e9d9b 100644
--- a/crates/quick_action_bar2/src/quick_action_bar.rs
+++ b/crates/quick_action_bar2/src/quick_action_bar.rs
@@ -36,9 +36,9 @@ impl QuickActionBar {
}
impl Render for QuickActionBar {
- type Element = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let Some(editor) = self.active_editor() else {
return div().id("empty quick action bar");
};
@@ -138,9 +138,9 @@ impl QuickActionBarButton {
}
impl RenderOnce for QuickActionBarButton {
- type Rendered = IconButton;
+ type Output = IconButton;
- fn render(self, _: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _: &mut WindowContext) -> Self::Output {
let tooltip = self.tooltip.clone();
let action = self.action.boxed_clone();
diff --git a/crates/recent_projects2/src/highlighted_workspace_location.rs b/crates/recent_projects2/src/highlighted_workspace_location.rs
index a4057d2f4bd..2df4409a5fd 100644
--- a/crates/recent_projects2/src/highlighted_workspace_location.rs
+++ b/crates/recent_projects2/src/highlighted_workspace_location.rs
@@ -43,9 +43,9 @@ impl HighlightedText {
}
impl RenderOnce for HighlightedText {
- type Rendered = HighlightedLabel;
+ type Output = HighlightedLabel;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
HighlightedLabel::new(self.text, self.highlight_positions)
}
}
diff --git a/crates/recent_projects2/src/recent_projects.rs b/crates/recent_projects2/src/recent_projects.rs
index 2d6f4bf0e31..6b62d185ed1 100644
--- a/crates/recent_projects2/src/recent_projects.rs
+++ b/crates/recent_projects2/src/recent_projects.rs
@@ -103,9 +103,9 @@ impl FocusableView for RecentProjects {
}
impl Render for RecentProjects {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
v_stack()
.w(rems(self.rem_width))
.child(self.picker.clone())
diff --git a/crates/search2/src/buffer_search.rs b/crates/search2/src/buffer_search.rs
index 4972908e0d4..a5522cec89c 100644
--- a/crates/search2/src/buffer_search.rs
+++ b/crates/search2/src/buffer_search.rs
@@ -101,9 +101,9 @@ impl BufferSearchBar {
impl EventEmitter<Event> for BufferSearchBar {}
impl EventEmitter<workspace::ToolbarItemEvent> for BufferSearchBar {}
impl Render for BufferSearchBar {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
if self.dismissed {
return div();
}
diff --git a/crates/search2/src/project_search.rs b/crates/search2/src/project_search.rs
index 9a654c9bf4d..167299ba2d7 100644
--- a/crates/search2/src/project_search.rs
+++ b/crates/search2/src/project_search.rs
@@ -279,9 +279,9 @@ pub enum ViewEvent {
impl EventEmitter<ViewEvent> for ProjectSearchView {}
impl Render for ProjectSearchView {
- type Element = AnyElement;
+ type Output = AnyElement;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
if self.has_matches() {
div()
.flex_1()
@@ -1494,9 +1494,9 @@ impl ProjectSearchBar {
}
impl Render for ProjectSearchBar {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let Some(search) = self.active_project_search.clone() else {
return div();
};
diff --git a/crates/story/src/story.rs b/crates/story/src/story.rs
index 3419af95b09..1a3e84c0d91 100644
--- a/crates/story/src/story.rs
+++ b/crates/story/src/story.rs
@@ -74,9 +74,9 @@ impl ParentElement for StoryContainer {
}
impl RenderOnce for StoryContainer {
- type Rendered = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
div()
.size_full()
.flex()
@@ -294,9 +294,9 @@ impl StoryItem {
}
impl RenderOnce for StoryItem {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
div()
.my_2()
.flex()
@@ -358,9 +358,9 @@ impl StorySection {
}
impl RenderOnce for StorySection {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
let children: SmallVec<[AnyElement; 2]> = SmallVec::from_iter(Itertools::intersperse_with(
self.children.into_iter(),
|| Story::divider().into_any_element(),
diff --git a/crates/storybook2/src/stories/auto_height_editor.rs b/crates/storybook2/src/stories/auto_height_editor.rs
index 2f3089a4e6e..d4fda251d73 100644
--- a/crates/storybook2/src/stories/auto_height_editor.rs
+++ b/crates/storybook2/src/stories/auto_height_editor.rs
@@ -22,9 +22,9 @@ impl AutoHeightEditorStory {
}
impl Render for AutoHeightEditorStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
div()
.size_full()
.bg(white())
diff --git a/crates/storybook2/src/stories/cursor.rs b/crates/storybook2/src/stories/cursor.rs
index 7d4cf8145a0..af8d7440a0d 100644
--- a/crates/storybook2/src/stories/cursor.rs
+++ b/crates/storybook2/src/stories/cursor.rs
@@ -5,9 +5,9 @@ use ui::prelude::*;
pub struct CursorStory;
impl Render for CursorStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
let all_cursors: [(&str, Box<dyn Fn(Stateful<Div>) -> Stateful<Div>>); 19] = [
(
"cursor_default",
diff --git a/crates/storybook2/src/stories/focus.rs b/crates/storybook2/src/stories/focus.rs
index a3a8845947d..8ee10b65700 100644
--- a/crates/storybook2/src/stories/focus.rs
+++ b/crates/storybook2/src/stories/focus.rs
@@ -57,9 +57,9 @@ impl FocusStory {
}
impl Render for FocusStory {
- type Element = Focusable<Stateful<Div>>;
+ type Output = Focusable<Stateful<Div>>;
- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Output {
let theme = cx.theme();
let color_1 = theme.status().created;
let color_2 = theme.status().modified;
diff --git a/crates/storybook2/src/stories/kitchen_sink.rs b/crates/storybook2/src/stories/kitchen_sink.rs
index 271285cc2f5..d6598279909 100644
--- a/crates/storybook2/src/stories/kitchen_sink.rs
+++ b/crates/storybook2/src/stories/kitchen_sink.rs
@@ -14,9 +14,9 @@ impl KitchenSinkStory {
}
impl Render for KitchenSinkStory {
- type Element = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let component_stories = ComponentStory::iter()
.map(|selector| selector.story(cx))
.collect::<Vec<_>>();
diff --git a/crates/storybook2/src/stories/overflow_scroll.rs b/crates/storybook2/src/stories/overflow_scroll.rs
index 631b851304c..6adc6576acc 100644
--- a/crates/storybook2/src/stories/overflow_scroll.rs
+++ b/crates/storybook2/src/stories/overflow_scroll.rs
@@ -6,9 +6,9 @@ use ui::prelude::*;
pub struct OverflowScrollStory;
impl Render for OverflowScrollStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
Story::container()
.child(Story::title("Overflow Scroll"))
.child(Story::label("`overflow_x_scroll`"))
diff --git a/crates/storybook2/src/stories/picker.rs b/crates/storybook2/src/stories/picker.rs
index edaaaa70bd1..85985c5ae34 100644
--- a/crates/storybook2/src/stories/picker.rs
+++ b/crates/storybook2/src/stories/picker.rs
@@ -202,9 +202,9 @@ impl PickerStory {
}
impl Render for PickerStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Output {
div()
.bg(cx.theme().styles.colors.background)
.size_full()
diff --git a/crates/storybook2/src/stories/scroll.rs b/crates/storybook2/src/stories/scroll.rs
index 300aae1144b..8d8543304d4 100644
--- a/crates/storybook2/src/stories/scroll.rs
+++ b/crates/storybook2/src/stories/scroll.rs
@@ -11,9 +11,9 @@ impl ScrollStory {
}
impl Render for ScrollStory {
- type Element = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Output {
let theme = cx.theme();
let color_1 = theme.status().created;
let color_2 = theme.status().modified;
diff --git a/crates/storybook2/src/stories/text.rs b/crates/storybook2/src/stories/text.rs
index 99d722988d0..b044f7ce9af 100644
--- a/crates/storybook2/src/stories/text.rs
+++ b/crates/storybook2/src/stories/text.rs
@@ -14,9 +14,9 @@ impl TextStory {
}
impl Render for TextStory {
- type Element = Component<StoryContainer>;
+ type Output = Component<StoryContainer>;
- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Output {
StoryContainer::new("Text Story", "crates/storybook2/src/stories/text.rs")
.children(
vec![
diff --git a/crates/storybook2/src/stories/viewport_units.rs b/crates/storybook2/src/stories/viewport_units.rs
index 8a95a6b66c3..746f385ab5c 100644
--- a/crates/storybook2/src/stories/viewport_units.rs
+++ b/crates/storybook2/src/stories/viewport_units.rs
@@ -6,9 +6,9 @@ use ui::prelude::*;
pub struct ViewportUnitsStory;
impl Render for ViewportUnitsStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
Story::container().child(
div()
.flex()
diff --git a/crates/storybook2/src/stories/z_index.rs b/crates/storybook2/src/stories/z_index.rs
index 9579b8c7fcf..1f7141fbfd5 100644
--- a/crates/storybook2/src/stories/z_index.rs
+++ b/crates/storybook2/src/stories/z_index.rs
@@ -7,9 +7,9 @@ use ui::prelude::*;
pub struct ZIndexStory;
impl Render for ZIndexStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
Story::container().child(Story::title("z-index")).child(
div()
.flex()
@@ -82,9 +82,9 @@ struct ZIndexExample {
}
impl RenderOnce for ZIndexExample {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
div()
.relative()
.size_full()
diff --git a/crates/storybook2/src/storybook2.rs b/crates/storybook2/src/storybook2.rs
index 523e93cf526..4fdf65f6730 100644
--- a/crates/storybook2/src/storybook2.rs
+++ b/crates/storybook2/src/storybook2.rs
@@ -113,9 +113,9 @@ impl StoryWrapper {
}
impl Render for StoryWrapper {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
div()
.flex()
.flex_col()
diff --git a/crates/terminal_view2/src/terminal_element.rs b/crates/terminal_view2/src/terminal_element.rs
index cb46f742f66..8be10f9469f 100644
--- a/crates/terminal_view2/src/terminal_element.rs
+++ b/crates/terminal_view2/src/terminal_element.rs
@@ -750,7 +750,7 @@ impl TerminalElement {
impl Element for TerminalElement {
type State = InteractiveElementState;
- fn layout(
+ fn request_layout(
&mut self,
element_state: Option<Self::State>,
cx: &mut WindowContext<'_>,
diff --git a/crates/terminal_view2/src/terminal_panel.rs b/crates/terminal_view2/src/terminal_panel.rs
index dd0c7d39995..746c2480c03 100644
--- a/crates/terminal_view2/src/terminal_panel.rs
+++ b/crates/terminal_view2/src/terminal_panel.rs
@@ -329,9 +329,9 @@ impl TerminalPanel {
impl EventEmitter<PanelEvent> for TerminalPanel {}
impl Render for TerminalPanel {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
div().size_full().child(self.pane.clone())
}
}
diff --git a/crates/terminal_view2/src/terminal_view.rs b/crates/terminal_view2/src/terminal_view.rs
index 6d18d6f8f95..231de1444a7 100644
--- a/crates/terminal_view2/src/terminal_view.rs
+++ b/crates/terminal_view2/src/terminal_view.rs
@@ -617,9 +617,9 @@ impl TerminalView {
}
impl Render for TerminalView {
- type Element = Focusable<Div>;
+ type Output = Focusable<Div>;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let terminal_handle = self.terminal.clone();
let focused = self.focus_handle.is_focused(cx);
diff --git a/crates/theme_selector2/src/theme_selector.rs b/crates/theme_selector2/src/theme_selector.rs
index ae067ce87cf..240742025ea 100644
--- a/crates/theme_selector2/src/theme_selector.rs
+++ b/crates/theme_selector2/src/theme_selector.rs
@@ -67,9 +67,9 @@ impl FocusableView for ThemeSelector {
}
impl Render for ThemeSelector {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
v_stack().w(rems(34.)).child(self.picker.clone())
}
}
diff --git a/crates/ui2/src/components/avatar.rs b/crates/ui2/src/components/avatar.rs
index 793872cd8ab..257e46989b6 100644
--- a/crates/ui2/src/components/avatar.rs
+++ b/crates/ui2/src/components/avatar.rs
@@ -16,9 +16,9 @@ pub struct Avatar {
}
impl RenderOnce for Avatar {
- type Rendered = Div;
+ type Output = Div;
- fn render(mut self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(mut self, cx: &mut WindowContext) -> Self::Output {
if self.image.style().corner_radii.top_left.is_none() {
self = self.shape(Shape::Circle);
}
diff --git a/crates/ui2/src/components/button/button.rs b/crates/ui2/src/components/button/button.rs
index bc5d03d639f..2ad12919fba 100644
--- a/crates/ui2/src/components/button/button.rs
+++ b/crates/ui2/src/components/button/button.rs
@@ -136,9 +136,9 @@ impl ButtonCommon for Button {
}
impl RenderOnce for Button {
- type Rendered = ButtonLike;
+ type Output = ButtonLike;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
let is_disabled = self.base.disabled;
let is_selected = self.base.selected;
diff --git a/crates/ui2/src/components/button/button_icon.rs b/crates/ui2/src/components/button/button_icon.rs
index 3b2c703938b..a82aa14e6ed 100644
--- a/crates/ui2/src/components/button/button_icon.rs
+++ b/crates/ui2/src/components/button/button_icon.rs
@@ -63,9 +63,9 @@ impl Selectable for ButtonIcon {
}
impl RenderOnce for ButtonIcon {
- type Rendered = IconElement;
+ type Output = IconElement;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
let icon = self
.selected_icon
.filter(|_| self.selected)
diff --git a/crates/ui2/src/components/button/button_like.rs b/crates/ui2/src/components/button/button_like.rs
index 13d4f360f21..0f304ae15d9 100644
--- a/crates/ui2/src/components/button/button_like.rs
+++ b/crates/ui2/src/components/button/button_like.rs
@@ -363,9 +363,9 @@ impl ParentElement for ButtonLike {
}
impl RenderOnce for ButtonLike {
- type Rendered = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
self.base
.h_flex()
.id(self.id.clone())
diff --git a/crates/ui2/src/components/button/icon_button.rs b/crates/ui2/src/components/button/icon_button.rs
index 3a53bb6cb01..9dcb0c04d49 100644
--- a/crates/ui2/src/components/button/icon_button.rs
+++ b/crates/ui2/src/components/button/icon_button.rs
@@ -106,9 +106,9 @@ impl VisibleOnHover for IconButton {
}
impl RenderOnce for IconButton {
- type Rendered = ButtonLike;
+ type Output = ButtonLike;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
let is_disabled = self.base.disabled;
let is_selected = self.base.selected;
diff --git a/crates/ui2/src/components/button/toggle_button.rs b/crates/ui2/src/components/button/toggle_button.rs
index 4a6ecdeb2fc..7ac642011f9 100644
--- a/crates/ui2/src/components/button/toggle_button.rs
+++ b/crates/ui2/src/components/button/toggle_button.rs
@@ -99,9 +99,9 @@ impl ButtonCommon for ToggleButton {
}
impl RenderOnce for ToggleButton {
- type Rendered = ButtonLike;
+ type Output = ButtonLike;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
let is_disabled = self.base.disabled;
let is_selected = self.base.selected;
diff --git a/crates/ui2/src/components/checkbox.rs b/crates/ui2/src/components/checkbox.rs
index 51e38a38f4f..fd92e969460 100644
--- a/crates/ui2/src/components/checkbox.rs
+++ b/crates/ui2/src/components/checkbox.rs
@@ -19,9 +19,9 @@ pub struct Checkbox {
}
impl RenderOnce for Checkbox {
- type Rendered = gpui::Stateful<Div>;
+ type Output = gpui::Stateful<Div>;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
let group_id = format!("checkbox_group_{:?}", self.id);
let icon = match self.checked {
diff --git a/crates/ui2/src/components/context_menu.rs b/crates/ui2/src/components/context_menu.rs
index 6df6a290964..3ea5e9bc5fd 100644
--- a/crates/ui2/src/components/context_menu.rs
+++ b/crates/ui2/src/components/context_menu.rs
@@ -232,9 +232,9 @@ impl ContextMenuItem {
}
impl Render for ContextMenu {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
div().elevation_2(cx).flex().flex_row().child(
v_stack()
.min_w(px(200.))
diff --git a/crates/ui2/src/components/disclosure.rs b/crates/ui2/src/components/disclosure.rs
index 729023986d2..663fba30ca8 100644
--- a/crates/ui2/src/components/disclosure.rs
+++ b/crates/ui2/src/components/disclosure.rs
@@ -28,9 +28,9 @@ impl Disclosure {
}
impl RenderOnce for Disclosure {
- type Rendered = IconButton;
+ type Output = IconButton;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
IconButton::new(
self.id,
match self.is_open {
diff --git a/crates/ui2/src/components/divider.rs b/crates/ui2/src/components/divider.rs
index 20744d6c48e..dd30ce0ec57 100644
--- a/crates/ui2/src/components/divider.rs
+++ b/crates/ui2/src/components/divider.rs
@@ -31,9 +31,9 @@ pub struct Divider {
}
impl RenderOnce for Divider {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
div()
.map(|this| match self.direction {
DividerDirection::Horizontal => {
diff --git a/crates/ui2/src/components/icon.rs b/crates/ui2/src/components/icon.rs
index a168f97a50f..b0eed862505 100644
--- a/crates/ui2/src/components/icon.rs
+++ b/crates/ui2/src/components/icon.rs
@@ -196,9 +196,9 @@ pub struct IconElement {
}
impl RenderOnce for IconElement {
- type Rendered = Svg;
+ type Output = Svg;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
svg()
.size(self.size.rems())
.flex_none()
diff --git a/crates/ui2/src/components/indicator.rs b/crates/ui2/src/components/indicator.rs
index 4a94650dfc6..f3dc62d20f4 100644
--- a/crates/ui2/src/components/indicator.rs
+++ b/crates/ui2/src/components/indicator.rs
@@ -45,9 +45,9 @@ impl Indicator {
}
impl RenderOnce for Indicator {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
div()
.flex_none()
.map(|this| match self.style {
diff --git a/crates/ui2/src/components/keybinding.rs b/crates/ui2/src/components/keybinding.rs
index 8314f607fef..f0de9891a7f 100644
--- a/crates/ui2/src/components/keybinding.rs
+++ b/crates/ui2/src/components/keybinding.rs
@@ -11,9 +11,9 @@ pub struct KeyBinding {
}
impl RenderOnce for KeyBinding {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
h_stack()
.flex_none()
.gap_2()
@@ -91,9 +91,9 @@ pub struct Key {
}
impl RenderOnce for Key {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
let single_char = self.key.len() == 1;
div()
@@ -125,9 +125,9 @@ pub struct KeyIcon {
}
impl RenderOnce for KeyIcon {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
div()
.w(rems(14. / 16.))
.child(IconElement::new(self.icon).size(IconSize::Small))
diff --git a/crates/ui2/src/components/label/highlighted_label.rs b/crates/ui2/src/components/label/highlighted_label.rs
index a7fbb0d8167..08dfbe2391a 100644
--- a/crates/ui2/src/components/label/highlighted_label.rs
+++ b/crates/ui2/src/components/label/highlighted_label.rs
@@ -46,9 +46,9 @@ impl LabelCommon for HighlightedLabel {
}
impl RenderOnce for HighlightedLabel {
- type Rendered = LabelLike;
+ type Output = LabelLike;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
let highlight_color = cx.theme().colors().text_accent;
let mut highlight_indices = self.highlight_indices.iter().copied().peekable();
diff --git a/crates/ui2/src/components/label/label.rs b/crates/ui2/src/components/label/label.rs
index 82723408888..888cd506d78 100644
--- a/crates/ui2/src/components/label/label.rs
+++ b/crates/ui2/src/components/label/label.rs
@@ -40,9 +40,9 @@ impl LabelCommon for Label {
}
impl RenderOnce for Label {
- type Rendered = LabelLike;
+ type Output = LabelLike;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
self.base.child(self.label)
}
}
diff --git a/crates/ui2/src/components/label/label_like.rs b/crates/ui2/src/components/label/label_like.rs
index ebfbbecceb6..54e383eb487 100644
--- a/crates/ui2/src/components/label/label_like.rs
+++ b/crates/ui2/src/components/label/label_like.rs
@@ -76,9 +76,9 @@ impl ParentElement for LabelLike {
}
impl RenderOnce for LabelLike {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
div()
.when(self.strikethrough, |this| {
this.relative().child(
diff --git a/crates/ui2/src/components/list/list.rs b/crates/ui2/src/components/list/list.rs
index fdfe256bd6b..23ebd8427c5 100644
--- a/crates/ui2/src/components/list/list.rs
+++ b/crates/ui2/src/components/list/list.rs
@@ -46,9 +46,9 @@ impl ParentElement for List {
}
impl RenderOnce for List {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
v_stack().w_full().py_1().children(self.header).map(|this| {
match (self.children.is_empty(), self.toggle) {
(false, _) => this.children(self.children),
diff --git a/crates/ui2/src/components/list/list_header.rs b/crates/ui2/src/components/list/list_header.rs
index 0c07867c6d0..9726ed2c2b5 100644
--- a/crates/ui2/src/components/list/list_header.rs
+++ b/crates/ui2/src/components/list/list_header.rs
@@ -76,9 +76,9 @@ impl Selectable for ListHeader {
}
impl RenderOnce for ListHeader {
- type Rendered = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
h_stack()
.id(self.label.clone())
.w_full()
diff --git a/crates/ui2/src/components/list/list_item.rs b/crates/ui2/src/components/list/list_item.rs
index 6295e2940d3..403c24b8e52 100644
--- a/crates/ui2/src/components/list/list_item.rs
+++ b/crates/ui2/src/components/list/list_item.rs
@@ -147,9 +147,9 @@ impl ParentElement for ListItem {
}
impl RenderOnce for ListItem {
- type Rendered = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
h_stack()
.id(self.id)
.w_full()
diff --git a/crates/ui2/src/components/list/list_separator.rs b/crates/ui2/src/components/list/list_separator.rs
index 346b13ddaa3..d7afb0ed930 100644
--- a/crates/ui2/src/components/list/list_separator.rs
+++ b/crates/ui2/src/components/list/list_separator.rs
@@ -6,9 +6,9 @@ use crate::prelude::*;
pub struct ListSeparator;
impl RenderOnce for ListSeparator {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
div()
.h_px()
.w_full()
diff --git a/crates/ui2/src/components/list/list_sub_header.rs b/crates/ui2/src/components/list/list_sub_header.rs
index 07a99dabe5b..9f49587a458 100644
--- a/crates/ui2/src/components/list/list_sub_header.rs
+++ b/crates/ui2/src/components/list/list_sub_header.rs
@@ -26,9 +26,9 @@ impl ListSubHeader {
}
impl RenderOnce for ListSubHeader {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, _cx: &mut WindowContext) -> Self::Output {
h_stack().flex_1().w_full().relative().py_1().child(
div()
.h_6()
diff --git a/crates/ui2/src/components/popover.rs b/crates/ui2/src/components/popover.rs
index 91713bc3072..7d888ed3aa4 100644
--- a/crates/ui2/src/components/popover.rs
+++ b/crates/ui2/src/components/popover.rs
@@ -41,9 +41,9 @@ pub struct Popover {
}
impl RenderOnce for Popover {
- type Rendered = Div;
+ type Output = Div;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
div()
.flex()
.gap_1()
diff --git a/crates/ui2/src/components/popover_menu.rs b/crates/ui2/src/components/popover_menu.rs
index 1a02dd526e4..3cc925e0b5f 100644
--- a/crates/ui2/src/components/popover_menu.rs
+++ b/crates/ui2/src/components/popover_menu.rs
@@ -130,7 +130,7 @@ pub struct PopoverMenuState<M> {
impl<M: ManagedView> Element for PopoverMenu<M> {
type State = PopoverMenuState<M>;
- fn layout(
+ fn request_layout(
&mut self,
element_state: Option<Self::State>,
cx: &mut WindowContext,
diff --git a/crates/ui2/src/components/right_click_menu.rs b/crates/ui2/src/components/right_click_menu.rs
index a3a454d652f..81f553a6a2c 100644
--- a/crates/ui2/src/components/right_click_menu.rs
+++ b/crates/ui2/src/components/right_click_menu.rs
@@ -60,7 +60,7 @@ pub struct MenuHandleState<M> {
impl<M: ManagedView> Element for RightClickMenu<M> {
type State = MenuHandleState<M>;
- fn layout(
+ fn request_layout(
&mut self,
element_state: Option<Self::State>,
cx: &mut WindowContext,
diff --git a/crates/ui2/src/components/stories/avatar.rs b/crates/ui2/src/components/stories/avatar.rs
index 09adfe480a4..3b40f07c896 100644
--- a/crates/ui2/src/components/stories/avatar.rs
+++ b/crates/ui2/src/components/stories/avatar.rs
@@ -7,9 +7,9 @@ use crate::Avatar;
pub struct AvatarStory;
impl Render for AvatarStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
Story::container()
.child(Story::title_for::<Avatar>())
.child(Story::label("Default"))
diff --git a/crates/ui2/src/components/stories/button.rs b/crates/ui2/src/components/stories/button.rs
index 9fe4f55dcb3..8066f77353f 100644
--- a/crates/ui2/src/components/stories/button.rs
+++ b/crates/ui2/src/components/stories/button.rs
@@ -7,9 +7,9 @@ use crate::{Button, ButtonStyle};
pub struct ButtonStory;
impl Render for ButtonStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
Story::container()
.child(Story::title_for::<Button>())
.child(Story::label("Default"))
diff --git a/crates/ui2/src/components/stories/checkbox.rs b/crates/ui2/src/components/stories/checkbox.rs
index 76601e9ba93..5db543ac04f 100644
--- a/crates/ui2/src/components/stories/checkbox.rs
+++ b/crates/ui2/src/components/stories/checkbox.rs
@@ -7,9 +7,9 @@ use crate::{h_stack, Checkbox};
pub struct CheckboxStory;
impl Render for CheckboxStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
Story::container()
.child(Story::title_for::<Checkbox>())
.child(Story::label("Default"))
diff --git a/crates/ui2/src/components/stories/context_menu.rs b/crates/ui2/src/components/stories/context_menu.rs
index 68d5f7bd33e..b0d3b588d3d 100644
--- a/crates/ui2/src/components/stories/context_menu.rs
+++ b/crates/ui2/src/components/stories/context_menu.rs
@@ -20,9 +20,9 @@ fn build_menu(cx: &mut WindowContext, header: impl Into<SharedString>) -> View<C
pub struct ContextMenuStory;
impl Render for ContextMenuStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
Story::container()
.on_action(|_: &PrintCurrentDate, _| {
println!("printing unix time!");
diff --git a/crates/ui2/src/components/stories/disclosure.rs b/crates/ui2/src/components/stories/disclosure.rs
index cf2491b387c..cc219c05238 100644
--- a/crates/ui2/src/components/stories/disclosure.rs
+++ b/crates/ui2/src/components/stories/disclosure.rs
@@ -7,9 +7,9 @@ use crate::Disclosure;
pub struct DisclosureStory;
impl Render for DisclosureStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
Story::container()
.child(Story::title_for::<Disclosure>())
.child(Story::label("Toggled"))
diff --git a/crates/ui2/src/components/stories/icon.rs b/crates/ui2/src/components/stories/icon.rs
index ee7dfe532cd..3ac68047ea4 100644
--- a/crates/ui2/src/components/stories/icon.rs
+++ b/crates/ui2/src/components/stories/icon.rs
@@ -8,9 +8,9 @@ use crate::{Icon, IconElement};
pub struct IconStory;
impl Render for IconStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
let icons = Icon::iter();
Story::container()
diff --git a/crates/ui2/src/components/stories/icon_button.rs b/crates/ui2/src/components/stories/icon_button.rs
index 0d219efbc2f..7b741d4b5e8 100644
--- a/crates/ui2/src/components/stories/icon_button.rs
+++ b/crates/ui2/src/components/stories/icon_button.rs
@@ -7,9 +7,9 @@ use crate::{Icon, IconButton};
pub struct IconButtonStory;
impl Render for IconButtonStory {
- type Element = Component<StoryContainer>;
+ type Output = Component<StoryContainer>;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
let default_button = StoryItem::new(
"Default",
IconButton::new("default_icon_button", Icon::Hash),
diff --git a/crates/ui2/src/components/stories/keybinding.rs b/crates/ui2/src/components/stories/keybinding.rs
index 520749bc850..620ced3cce9 100644
--- a/crates/ui2/src/components/stories/keybinding.rs
+++ b/crates/ui2/src/components/stories/keybinding.rs
@@ -13,9 +13,9 @@ pub fn binding(key: &str) -> gpui::KeyBinding {
}
impl Render for KeybindingStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
let all_modifier_permutations = ["ctrl", "alt", "cmd", "shift"].into_iter().permutations(2);
Story::container()
diff --git a/crates/ui2/src/components/stories/label.rs b/crates/ui2/src/components/stories/label.rs
index e026d388fde..16b6a642295 100644
--- a/crates/ui2/src/components/stories/label.rs
+++ b/crates/ui2/src/components/stories/label.rs
@@ -7,9 +7,9 @@ use crate::{HighlightedLabel, Label};
pub struct LabelStory;
impl Render for LabelStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
Story::container()
.child(Story::title_for::<Label>())
.child(Story::label("Default"))
diff --git a/crates/ui2/src/components/stories/list.rs b/crates/ui2/src/components/stories/list.rs
index 17956019444..ef10dfdbee7 100644
--- a/crates/ui2/src/components/stories/list.rs
+++ b/crates/ui2/src/components/stories/list.rs
@@ -7,9 +7,9 @@ use crate::{List, ListItem};
pub struct ListStory;
impl Render for ListStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
Story::container()
.child(Story::title_for::<List>())
.child(Story::label("Default"))
diff --git a/crates/ui2/src/components/stories/list_header.rs b/crates/ui2/src/components/stories/list_header.rs
index 3c80afdde38..64fc8c454c4 100644
--- a/crates/ui2/src/components/stories/list_header.rs
+++ b/crates/ui2/src/components/stories/list_header.rs
@@ -7,9 +7,9 @@ use crate::{Icon, ListHeader};
pub struct ListHeaderStory;
impl Render for ListHeaderStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
Story::container()
.child(Story::title_for::<ListHeader>())
.child(Story::label("Default"))
diff --git a/crates/ui2/src/components/stories/list_item.rs b/crates/ui2/src/components/stories/list_item.rs
index b070be663e8..116635cc9ff 100644
--- a/crates/ui2/src/components/stories/list_item.rs
+++ b/crates/ui2/src/components/stories/list_item.rs
@@ -7,9 +7,9 @@ use crate::{Icon, ListItem};
pub struct ListItemStory;
impl Render for ListItemStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
Story::container()
.bg(cx.theme().colors().background)
.child(Story::title_for::<ListItem>())
diff --git a/crates/ui2/src/components/stories/tab.rs b/crates/ui2/src/components/stories/tab.rs
index cd5e920396a..4c613a0d987 100644
--- a/crates/ui2/src/components/stories/tab.rs
+++ b/crates/ui2/src/components/stories/tab.rs
@@ -9,9 +9,9 @@ use crate::{Indicator, Tab};
pub struct TabStory;
impl Render for TabStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
Story::container()
.child(Story::title_for::<Tab>())
.child(Story::label("Default"))
diff --git a/crates/ui2/src/components/stories/tab_bar.rs b/crates/ui2/src/components/stories/tab_bar.rs
index bd2b5a534aa..994f07dead3 100644
--- a/crates/ui2/src/components/stories/tab_bar.rs
+++ b/crates/ui2/src/components/stories/tab_bar.rs
@@ -6,9 +6,9 @@ use crate::{prelude::*, Tab, TabBar, TabPosition};
pub struct TabBarStory;
impl Render for TabBarStory {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
let tab_count = 20;
let selected_tab_index = 3;
diff --git a/crates/ui2/src/components/stories/toggle_button.rs b/crates/ui2/src/components/stories/toggle_button.rs
index 0a4ea5f83eb..ae3b29b6366 100644
--- a/crates/ui2/src/components/stories/toggle_button.rs
+++ b/crates/ui2/src/components/stories/toggle_button.rs
@@ -6,9 +6,9 @@ use crate::{prelude::*, ToggleButton};
pub struct ToggleButtonStory;
impl Render for ToggleButtonStory {
- type Element = Component<StoryContainer>;
+ type Output = Component<StoryContainer>;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
StoryContainer::new(
"Toggle Button",
"crates/ui2/src/components/stories/toggle_button.rs",
diff --git a/crates/ui2/src/components/tab.rs b/crates/ui2/src/components/tab.rs
index eddfab81191..567013ef2bc 100644
--- a/crates/ui2/src/components/tab.rs
+++ b/crates/ui2/src/components/tab.rs
@@ -93,9 +93,9 @@ impl ParentElement for Tab {
}
impl RenderOnce for Tab {
- type Rendered = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
let (text_color, tab_bg, _tab_hover_bg, _tab_active_bg) = match self.selected {
false => (
cx.theme().colors().text_muted,
diff --git a/crates/ui2/src/components/tab_bar.rs b/crates/ui2/src/components/tab_bar.rs
index c0d9953196d..f3a654eb473 100644
--- a/crates/ui2/src/components/tab_bar.rs
+++ b/crates/ui2/src/components/tab_bar.rs
@@ -89,9 +89,9 @@ impl ParentElement for TabBar {
}
impl RenderOnce for TabBar {
- type Rendered = Stateful<Div>;
+ type Output = Stateful<Div>;
- fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Output {
const HEIGHT_IN_REMS: f32 = 30. / 16.;
div()
diff --git a/crates/ui2/src/components/tooltip.rs b/crates/ui2/src/components/tooltip.rs
index 0a8eb8d6be5..800ad61151f 100644
--- a/crates/ui2/src/components/tooltip.rs
+++ b/crates/ui2/src/components/tooltip.rs
@@ -68,9 +68,9 @@ impl Tooltip {
}
impl Render for Tooltip {
- type Element = Overlay;
+ type Output = Overlay;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone();
overlay().child(
// padding to avoid mouse cursor
diff --git a/crates/vcs_menu2/src/lib.rs b/crates/vcs_menu2/src/lib.rs
index 497ea1a0126..b0781b53a9d 100644
--- a/crates/vcs_menu2/src/lib.rs
+++ b/crates/vcs_menu2/src/lib.rs
@@ -65,9 +65,9 @@ impl FocusableView for BranchList {
}
impl Render for BranchList {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
v_stack()
.w(rems(self.rem_width))
.child(self.picker.clone())
diff --git a/crates/vim2/src/mode_indicator.rs b/crates/vim2/src/mode_indicator.rs
index f3b16e68ae0..82dcde9e0e5 100644
--- a/crates/vim2/src/mode_indicator.rs
+++ b/crates/vim2/src/mode_indicator.rs
@@ -47,7 +47,7 @@ impl ModeIndicator {
}
impl Render for ModeIndicator {
- type Element = AnyElement;
+ type Output = AnyElement;
fn render(&mut self, _: &mut ViewContext<Self>) -> AnyElement {
let Some(mode) = self.mode.as_ref() else {
diff --git a/crates/welcome2/src/base_keymap_picker.rs b/crates/welcome2/src/base_keymap_picker.rs
index 9655d7e1351..e70d5950096 100644
--- a/crates/welcome2/src/base_keymap_picker.rs
+++ b/crates/welcome2/src/base_keymap_picker.rs
@@ -64,9 +64,9 @@ impl BaseKeymapSelector {
}
impl Render for BaseKeymapSelector {
- type Element = View<Picker<BaseKeymapSelectorDelegate>>;
+ type Output = View<Picker<BaseKeymapSelectorDelegate>>;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
self.picker.clone()
}
}
diff --git a/crates/welcome2/src/welcome.rs b/crates/welcome2/src/welcome.rs
index 91620595ce5..ed114f16dc5 100644
--- a/crates/welcome2/src/welcome.rs
+++ b/crates/welcome2/src/welcome.rs
@@ -58,9 +58,9 @@ pub struct WelcomePage {
}
impl Render for WelcomePage {
- type Element = Focusable<Div>;
+ type Output = Focusable<Div>;
- fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Output {
h_stack().full().track_focus(&self.focus_handle).child(
v_stack()
.w_96()
diff --git a/crates/workspace2/src/dock.rs b/crates/workspace2/src/dock.rs
index 928e03a692d..ab998e35a8a 100644
--- a/crates/workspace2/src/dock.rs
+++ b/crates/workspace2/src/dock.rs
@@ -505,9 +505,9 @@ impl Dock {
}
impl Render for Dock {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
if let Some(entry) = self.visible_entry() {
let size = entry.panel.size(cx);
@@ -594,9 +594,9 @@ impl PanelButtons {
}
impl Render for PanelButtons {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
// todo!()
let dock = self.dock.read(cx);
let active_index = dock.active_panel_index;
@@ -717,9 +717,9 @@ pub mod test {
}
impl Render for TestPanel {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
div()
}
}
diff --git a/crates/workspace2/src/item.rs b/crates/workspace2/src/item.rs
index 4eadd4e7a3c..e9a11169615 100644
--- a/crates/workspace2/src/item.rs
+++ b/crates/workspace2/src/item.rs
@@ -910,9 +910,9 @@ pub mod test {
}
impl Render for TestItem {
- type Element = Focusable<Div>;
+ type Output = Focusable<Div>;
- fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Output {
gpui::div().track_focus(&self.focus_handle)
}
}
diff --git a/crates/workspace2/src/modal_layer.rs b/crates/workspace2/src/modal_layer.rs
index ff1de6548d7..eef074aef10 100644
--- a/crates/workspace2/src/modal_layer.rs
+++ b/crates/workspace2/src/modal_layer.rs
@@ -104,9 +104,9 @@ impl ModalLayer {
}
impl Render for ModalLayer {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let Some(active_modal) = &self.active_modal else {
return div();
};
diff --git a/crates/workspace2/src/notifications.rs b/crates/workspace2/src/notifications.rs
index a692388a06a..a84283919a9 100644
--- a/crates/workspace2/src/notifications.rs
+++ b/crates/workspace2/src/notifications.rs
@@ -219,9 +219,9 @@ pub mod simple_message_notification {
}
impl Render for MessageNotification {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
v_stack()
.elevation_3(cx)
.p_4()
diff --git a/crates/workspace2/src/pane.rs b/crates/workspace2/src/pane.rs
index bdb95deb564..e68b8f7b9f9 100644
--- a/crates/workspace2/src/pane.rs
+++ b/crates/workspace2/src/pane.rs
@@ -1868,9 +1868,9 @@ impl FocusableView for Pane {
}
impl Render for Pane {
- type Element = Focusable<Div>;
+ type Output = Focusable<Div>;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
v_stack()
.key_context("Pane")
.track_focus(&self.focus_handle)
@@ -2750,9 +2750,9 @@ mod tests {
}
impl Render for DraggedTab {
- type Element = <Tab as RenderOnce>::Rendered;
+ type Output = <Tab as RenderOnce>::Output;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone();
let item = &self.pane.read(cx).items[self.ix];
let label = item.tab_content(Some(self.detail), false, cx);
diff --git a/crates/workspace2/src/pane_group.rs b/crates/workspace2/src/pane_group.rs
index 800d03a50cb..c6eaa71663b 100644
--- a/crates/workspace2/src/pane_group.rs
+++ b/crates/workspace2/src/pane_group.rs
@@ -773,7 +773,7 @@ mod element {
impl Element for PaneAxisElement {
type State = Rc<RefCell<Option<usize>>>;
- fn layout(
+ fn request_layout(
&mut self,
state: Option<Self::State>,
cx: &mut ui::prelude::WindowContext,
diff --git a/crates/workspace2/src/shared_screen.rs b/crates/workspace2/src/shared_screen.rs
index 8f78e7de50a..28f36b623e5 100644
--- a/crates/workspace2/src/shared_screen.rs
+++ b/crates/workspace2/src/shared_screen.rs
@@ -66,9 +66,9 @@ impl FocusableView for SharedScreen {
}
}
impl Render for SharedScreen {
- type Element = Focusable<Div>;
+ type Output = Focusable<Div>;
- fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Output {
div().track_focus(&self.focus).size_full().children(
self.frame
.as_ref()
diff --git a/crates/workspace2/src/status_bar.rs b/crates/workspace2/src/status_bar.rs
index f4e4ac9508d..a76bf11d314 100644
--- a/crates/workspace2/src/status_bar.rs
+++ b/crates/workspace2/src/status_bar.rs
@@ -33,9 +33,9 @@ pub struct StatusBar {
}
impl Render for StatusBar {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
div()
.py_0p5()
.px_1()
diff --git a/crates/workspace2/src/toolbar.rs b/crates/workspace2/src/toolbar.rs
index f8bca157c37..5691a9ad598 100644
--- a/crates/workspace2/src/toolbar.rs
+++ b/crates/workspace2/src/toolbar.rs
@@ -93,9 +93,9 @@ impl Toolbar {
}
impl Render for Toolbar {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
if !self.has_any_visible_items() {
return div();
}
diff --git a/crates/workspace2/src/workspace2.rs b/crates/workspace2/src/workspace2.rs
index 0eb6425287f..455c48573ab 100644
--- a/crates/workspace2/src/workspace2.rs
+++ b/crates/workspace2/src/workspace2.rs
@@ -3489,9 +3489,9 @@ impl FocusableView for Workspace {
struct DraggedDock(DockPosition);
impl Render for Workspace {
- type Element = Div;
+ type Output = Div;
- fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
let mut context = KeyContext::default();
context.add("Workspace");
@@ -4287,7 +4287,7 @@ struct DisconnectedOverlay;
impl Element for DisconnectedOverlay {
type State = AnyElement;
- fn layout(
+ fn request_layout(
&mut self,
_: Option<Self::State>,
cx: &mut WindowContext,