pub trait Context {
type Result<T>;
// Required methods
fn build_model<T: 'static>(
&mut self,
build_model: impl FnOnce(&mut ModelContext<'_, T>) -> T
) -> Self::Result<Model<T>>;
fn update_model<T, R>(
&mut self,
handle: &Model<T>,
update: impl FnOnce(&mut T, &mut ModelContext<'_, T>) -> R
) -> Self::Result<R>
where T: 'static;
fn read_model<T, R>(
&self,
handle: &Model<T>,
read: impl FnOnce(&T, &AppContext) -> R
) -> Self::Result<R>
where T: 'static;
fn update_window<T, F>(
&mut self,
window: AnyWindowHandle,
f: F
) -> Result<T>
where F: FnOnce(AnyView, &mut WindowContext<'_>) -> T;
fn read_window<T, R>(
&self,
window: &WindowHandle<T>,
read: impl FnOnce(View<T>, &AppContext) -> R
) -> Result<R>
where T: 'static;
}