Context
Context dereferences to App so it has all the functionality available to App and it also has additional functionality for controlling the Entity it belongs to.
Notify
The notify function alerts GPUI that the Entity has been updated and that observers of it should be notified. If the T type of Context<T> implements Render then the view will be re-rendered.
use gpui::{AppContext, Application};
pub struct SomeState {
some_value: bool,
}
fn main() {
Application::new().run(|app| {
let entity = app.new(|_cx| SomeState { some_value: true });
entity.update(app, |this, cx| {
this.some_value = false;
cx.notify();
});
});
}