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:
@@ -99,9 +99,7 @@ impl ButtonCommon for ToggleButton {
|
||||
}
|
||||
|
||||
impl RenderOnce for ToggleButton {
|
||||
type Output = ButtonLike;
|
||||
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Output {
|
||||
fn render(self, _cx: &mut WindowContext) -> impl IntoElement {
|
||||
let is_disabled = self.base.disabled;
|
||||
let is_selected = self.base.selected;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user