You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let sbg1 = SidebarGroup::new("Group1").child(
SomeComponent::new()
);
let sbg2 = SidebarGroup::new("Group2").child(
SidebarMenu::new().child(SidebarMenuItem::new("haha".to_string())),
);
let left_pane = Sidebar::new(Side::Left).child(sbg1).child(sbg2);
// ^^^^
but I get an error in the marked spot:
mismatched types
expected struct SidebarGroup<SomeComponent>
found struct SidebarGroup<SidebarMenu>
they should be compatible because in SomeComponent I have this Render implementation:
impl RenderOnce for SomeComponent {
fn render(self, _window: &mut Window, _cx: &mut App) -> impl IntoElement {
let mut menu = SidebarMenu::new();
// I attach several items in a loop here like this
// menu = menu.child(menu_item);
// where menu_item is a SidebarMenuItem
menu
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I want a sidebar with two different sections:
but I get an error in the marked spot:
they should be compatible because in SomeComponent I have this Render implementation:
so it's really just another SidebarMenu
How do I achieve this?
Beta Was this translation helpful? Give feedback.
All reactions