multi_buffer.rs

 1use ui::prelude::*;
 2use ui::{hello_world_rust_buffer_example, MultiBuffer};
 3
 4use crate::story::Story;
 5
 6#[derive(Element, Default)]
 7pub struct MultiBufferStory {}
 8
 9impl MultiBufferStory {
10    fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
11        let theme = theme(cx);
12
13        Story::container(cx)
14            .child(Story::title_for::<_, MultiBuffer<V>>(cx))
15            .child(Story::label(cx, "Default"))
16            .child(MultiBuffer::new(vec![
17                hello_world_rust_buffer_example(&theme),
18                hello_world_rust_buffer_example(&theme),
19                hello_world_rust_buffer_example(&theme),
20                hello_world_rust_buffer_example(&theme),
21                hello_world_rust_buffer_example(&theme),
22            ]))
23    }
24}