pub struct View<S: Hash + Clone> {
pub layer: Arc<RwLock<Option<Layer>>>,
/* private fields */
}
Expand description
A View<S> is a struct to support the creation of complex hierarchies of layers that can be rendered by the engine.
Fields§
§layer: Arc<RwLock<Option<Layer>>>
Implementations§
source§impl<S: Hash + Clone> View<S>
impl<S: Hash + Clone> View<S>
pub fn new( key: impl Into<String>, initial_state: S, render_function: impl ViewRenderFunction<S>, ) -> Self
sourcepub fn set_layer(&self, layer: Layer)
pub fn set_layer(&self, layer: Layer)
Assigns a layer to the view, this will render the view into the layer
sourcepub fn update_state(&self, state: &S) -> bool
pub fn update_state(&self, state: &S) -> bool
Update the state of the view and render the layer if the state has changed
pub fn contains_point(&self, point: Point) -> bool
pub fn get_internal_state<T: Clone + 'static>( &self, name: impl AsRef<str>, ) -> Option<T>
pub fn set_internal_state<T: Clone + Send + Sync + 'static>( &self, name: impl AsRef<str>, val: &T, )
pub fn layer_by_key(&self, id: &str) -> Option<Layer>
pub fn hover_layer(&self, id: &str, location: &Point) -> bool
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for View<S>
impl<S> !RefUnwindSafe for View<S>
impl<S> Send for View<S>
impl<S> Sync for View<S>
impl<S> Unpin for View<S>
impl<S> !UnwindSafe for View<S>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more