Zed2 entities (#3189)
Adds an `Entity` trait for abstracting over `View`s and `Model`s, and implements it for the `subscribe()` and `observe()` APIs. The last commit also includes a fun experiment I added, using the `Result` type to return the owned model handles back to the caller in the case of downcast failure, inspired by the `binary_search*` methods.
This commit is contained in:
commit
88875fd006
13 changed files with 214 additions and 107 deletions
|
@ -730,7 +730,7 @@ impl Context for AppContext {
|
|||
|
||||
/// 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>(
|
||||
fn update_model<T: 'static, R>(
|
||||
&mut self,
|
||||
model: &Model<T>,
|
||||
update: impl FnOnce(&mut T, &mut Self::ModelContext<'_, T>) -> R,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue