Skip to main content

AppContext

Derive Macro AppContext 

Source
#[derive(AppContext)]
{
    // Attributes available to this derive:
    #[app]
}
Expand description

Derives gpui::AppContext for a struct that holds a &mut gpui::App.

Mark the field that holds the &mut App with #[app]. The derived methods forward to that field, so the struct can be used wherever an AppContext is accepted. The attribute is required.

Without the attribute the derive fails to compile:

ⓘ
#[derive(AppContext)]
struct MyContext<'a> {
    app: &'a mut gpui::App
}