pub struct View<S: Hash + Clone> {
pub layer: Arc<RwLock<Option<Layer>>>,
/* private fields */
}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
pub fn get_layer(&self) -> Option<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 layer_by_key(&self, id: &str) -> Option<Layer>
pub fn viewlayer_node_map_insert(&self, key: impl Into<String>, node: NodeRef)
sourcepub fn set_viewlayer_node_map(&self, cache: HashMap<String, VecDeque<NodeRef>>)
pub fn set_viewlayer_node_map(&self, cache: HashMap<String, VecDeque<NodeRef>>)
Set the entire viewlayer_node_map cache from a pre-built HashMap Used to inject warm caches created during surface pre-population
pub fn hover_layer(&self, id: &str, location: &Point) -> bool
sourcepub fn add_pre_render_hook<F>(&self, hook: F)
pub fn add_pre_render_hook<F>(&self, hook: F)
Add a pre-render hook that will be called before each render Hook receives: (state, view)
sourcepub fn add_post_render_hook<F>(&self, hook: F)
pub fn add_post_render_hook<F>(&self, hook: F)
Add a post-render hook that will be called after each render Hook receives: (state, view, layer)
sourcepub fn clear_pre_render_hooks(&self)
pub fn clear_pre_render_hooks(&self)
Clear all pre-render hooks
sourcepub fn clear_post_render_hooks(&self)
pub fn clear_post_render_hooks(&self)
Clear all post-render hooks
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)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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