Context

The Window, App, Context and Entity are most important things in GPUI, it appears everywhere.

  • Window - The current window instance, which for handle the Window Level things.
  • App - The current application instance, which for handle the Application Level things.
  • Context - The Entity Context instance, which for handle the Context Level things.
  • Entity - The Entity instance, which for handle the Entity Level things.

For example:

fn new(window: &mut Window, cx: &mut App) {}

impl RenderOnce for MyElement {
    fn render(self, window: &mut Window, cx: &mut App) {}
}

impl Render for MyView {
    fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) {}
}

CC BY 4.0 · Documentation prose and original illustrations GPUI Kit has rights to license may be copied or adapted with attribution. License. Credit GPUI Kit, link to this source page and the CC BY 4.0 license, and indicate any changes. Code examples and software source remain under Apache-2.0. Existing Apache permissions remain; third-party material retains its own terms.