Rename other references from "handle" to "model"

Co-Authored-By: Max <max@zed.dev>
Co-Authored-By: Mikayla <mikayla@zed.dev>
This commit is contained in:
Antonio Scandurra 2023-10-30 19:53:48 +01:00
parent ba789fc0c4
commit bc4f8fbf4e
13 changed files with 128 additions and 128 deletions

View file

@ -711,7 +711,7 @@ impl Context for AppContext {
type Result<T> = T;
/// Build an entity that is owned by the application. The given function will be invoked with
/// a `ModelContext` and must return an object representing the entity. A `Handle` will be returned
/// a `ModelContext` and must return an object representing the entity. A `Model` will be returned
/// which can be used to access the entity in a context.
fn build_model<T: 'static + Send>(
&mut self,
@ -724,18 +724,18 @@ impl Context for AppContext {
})
}
/// Update the entity referenced by the given handle. The function is passed a mutable reference to the
/// Update the entity referenced by the given model. The function is passed a mutable reference to the
/// entity along with a `ModelContext` for the entity.
fn update_entity<T: 'static, R>(
&mut self,
handle: &Model<T>,
model: &Model<T>,
update: impl FnOnce(&mut T, &mut Self::ModelContext<'_, T>) -> R,
) -> R {
self.update(|cx| {
let mut entity = cx.entities.lease(handle);
let mut entity = cx.entities.lease(model);
let result = update(
&mut entity,
&mut ModelContext::mutable(cx, handle.downgrade()),
&mut ModelContext::mutable(cx, model.downgrade()),
);
cx.entities.end_lease(entity);
result