Rename Handle to Model

This commit is contained in:
Antonio Scandurra 2023-10-30 19:44:01 +01:00
parent 14d24a9ac6
commit 1a54ac0d69
32 changed files with 11195 additions and 482 deletions

View file

@ -1,7 +1,6 @@
use crate::{
AnyBox, AnyElement, AvailableSpace, BorrowWindow, Bounds, Component, Element, ElementId,
EntityId, Handle, LayoutId, Pixels, Size, ViewContext, VisualContext, WeakHandle,
WindowContext,
EntityId, LayoutId, Model, Pixels, Size, ViewContext, VisualContext, WeakHandle, WindowContext,
};
use anyhow::{Context, Result};
use parking_lot::Mutex;
@ -11,13 +10,13 @@ use std::{
};
pub struct View<V> {
pub(crate) state: Handle<V>,
pub(crate) state: Model<V>,
render: Arc<Mutex<dyn Fn(&mut V, &mut ViewContext<V>) -> AnyElement<V> + Send + 'static>>,
}
impl<V: 'static> View<V> {
pub fn for_handle<E>(
state: Handle<V>,
state: Model<V>,
render: impl Fn(&mut V, &mut ViewContext<'_, '_, V>) -> E + Send + 'static,
) -> View<V>
where