#[derive(VisualContext)]
{
// Attributes available to this derive:
#[window]
#[app]
}
Expand description
#[derive(VisualContext)] is used to create a visual context out of anything that holds a &mut Window and
implements AppContext
Note that a #[app] and a #[window] attribute are required to identify the variables holding the &mut App,
and &mut Window respectively.
Failure to add both attributes causes a compile error:
ⓘ
#[derive(VisualContext)]
struct MyContext<'a, 'b> {
#[app]
app: &'a mut gpui::App,
window: &'b mut gpui::Window
}ⓘ
#[derive(VisualContext)]
struct MyContext<'a, 'b> {
app: &'a mut gpui::App,
#[window]
window: &'b mut gpui::Window
}