Return impl IntoElement from RenderOnce::render
This makes it a bit more approachable to implement. This required converting the state of Component to AnyElement, which costs an allocation. I'm hoping this will be ok performance-wise now that AnyElements use bump allocation, but I need to benchmark still.
This commit is contained in:
parent
1b5c8b2b4a
commit
68e7d99219
35 changed files with 74 additions and 183 deletions
|
@ -1,4 +1,4 @@
|
|||
use gpui::{div, prelude::*, Div, Element, ElementId, IntoElement, Styled, WindowContext};
|
||||
use gpui::{div, prelude::*, Element, ElementId, IntoElement, Styled, WindowContext};
|
||||
|
||||
use crate::prelude::*;
|
||||
use crate::{Color, Icon, IconElement, Selection};
|
||||
|
@ -19,9 +19,7 @@ pub struct Checkbox {
|
|||
}
|
||||
|
||||
impl RenderOnce for Checkbox {
|
||||
type Output = gpui::Stateful<Div>;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
fn render(self, cx: &mut WindowContext) -> impl IntoElement {
|
||||
let group_id = format!("checkbox_group_{:?}", self.id);
|
||||
|
||||
let icon = match self.checked {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue