Fix missed renames in #22632 (#23688)

Fix a bug where a GPUI macro still used `ModelContext`
Rename `AsyncAppContext` -> `AsyncApp`
Rename update_model, read_model, insert_model, and reserve_model to
update_entity, read_entity, insert_entity, and reserve_entity

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki 2025-01-26 15:37:34 -08:00 committed by GitHub
parent 83141d07e9
commit a6b1514246
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
118 changed files with 708 additions and 757 deletions

View file

@ -24,7 +24,7 @@ Provides access to the global application state. All other kinds of contexts ult
Provides access to the state of an application window, and also derefs to an `AppContext`, so you can pass a window context reference to any method taking an app context. Obtain this context by calling `WindowHandle::update`.
## `ModelContext<T>`
## `Context<T>`
Available when you create or update a `Model<T>`. It derefs to an `AppContext`, but also contains methods specific to the particular model, such as the ability to notify change observers or emit events.
@ -32,7 +32,7 @@ Available when you create or update a `Model<T>`. It derefs to an `AppContext`,
Available when you create or update a `View<V>`. It derefs to a `WindowContext`, but also contains methods specific to the particular view, such as the ability to notify change observers or emit events.
## `AsyncAppContext` and `AsyncWindowContext`
## `AsyncApp` and `AsyncWindowContext`
Whereas the above contexts are always passed to your code as references, you can call `to_async` on the reference to create an async context, which has a static lifetime and can be held across `await` points in async code. When you interact with `Model`s or `View`s with an async context, the calls become fallible, because the context may outlive the window or even the app itself.

View file

@ -42,9 +42,9 @@ To bind actions, chain `on_action` on to your element:
```rust
impl Render for Menu {
fn render(&mut self, window: &mut Window, cx: &mut ModelContext<Self>) -> impl Component {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl Component {
div()
.on_action(|this: &mut Menu, move: &MoveUp, window: &mut Window, cx: &mut ModelContext<Menu>| {
.on_action(|this: &mut Menu, move: &MoveUp, window: &mut Window, cx: &mut Context<Menu>| {
// ...
})
.on_action(|this, move: &MoveDown, cx| {
@ -59,10 +59,10 @@ In order to bind keys to actions, you need to declare a _key context_ for part o
```rust
impl Render for Menu {
fn render(&mut self, window: &mut Window, cx: &mut ModelContext<Self>) -> impl Component {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl Component {
div()
.key_context("menu")
.on_action(|this: &mut Menu, move: &MoveUp, window: &mut Window, cx: &mut ModelContext<Menu>| {
.on_action(|this: &mut Menu, move: &MoveUp, window: &mut Window, cx: &mut Context<Menu>| {
// ...
})
.on_action(|this, move: &MoveDown, cx| {