Introduce a Render trait, make views implement it
Don't pass a render function separately from the view. Co-authored-by: Nathan Sobo <nathan@zed.dev> Co-authored-by: Mikayla <mikayla@zed.dev> Co-authored-by: Antonio <as-cii@zed.dev>
This commit is contained in:
co-authored by
Nathan Sobo
Mikayla
Antonio
parent
0128079de0
commit
30dffbb409
@@ -40,15 +40,16 @@ pub use stories::*;
|
||||
|
||||
#[cfg(feature = "stories")]
|
||||
mod stories {
|
||||
use crate::{hello_world_rust_buffer_example, Story};
|
||||
|
||||
use super::*;
|
||||
use crate::{hello_world_rust_buffer_example, Story};
|
||||
use gpui2::{Div, Render};
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct MultiBufferStory;
|
||||
|
||||
impl MultiBufferStory {
|
||||
fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
|
||||
impl Render for MultiBufferStory {
|
||||
type Element = Div<Self>;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
let theme = theme(cx);
|
||||
|
||||
Story::container(cx)
|
||||
|
||||
Reference in New Issue
Block a user