pub struct AnyLayer { /* private fields */ }Expand description
Erased Layer: one identity and a static vtable, the fat pointer rustc cannot build for an
arena id. No lease.
Equality is Dart’s == on an object reference.
Implementations§
Source§impl AnyLayer
impl AnyLayer
pub fn id(self) -> HandleId
Sourcepub fn as_container_layer(self) -> Option<AnyContainerLayer>
pub fn as_container_layer(self) -> Option<AnyContainerLayer>
Dart’s layer as ContainerLayer, as an Option.
Sourcepub fn subtree_has_composition_callbacks(self, app: &App) -> bool
pub fn subtree_has_composition_callbacks(self, app: &App) -> bool
Whether the subtree rooted at this layer has any composition callback observers.
This only evaluates to true if the subtree rooted at this node has observers. For example, it may evaluate to true on a parent node but false on a child if the parent has observers but the child does not.
Sourcepub fn supports_rasterization(self, app: &App) -> bool
pub fn supports_rasterization(self, app: &App) -> bool
Sourcepub fn describe_clip_bounds(self, app: &App) -> Option<Rect>
pub fn describe_clip_bounds(self, app: &App) -> Option<Rect>
Sourcepub fn add_composition_callback(
self,
app: &mut App,
callback: CompositionCallback,
) -> Box<dyn FnOnce(&mut App)>
pub fn add_composition_callback( self, app: &mut App, callback: CompositionCallback, ) -> Box<dyn FnOnce(&mut App)>
Adds a callback for when the layer tree that this layer is part of gets composited, or when it is detached and will not be rendered again.
The callback receives a reference to this layer. The recipient must not mutate the layer during the scope of the callback, but may traverse the tree to find information about the current transform or clip. The layer may not be attached anymore in this state, but even if it is detached it may still have an also detached parent it can visit.
If new callbacks are added or removed within the callback, the new callbacks will fire (or stop firing) on the next compositing event.
Composition callbacks are useful in place of pushing a layer that would otherwise try to observe the layer tree without actually affecting compositing. For example, a composition callback may be used to observe the total transform and clip of the current container layer to determine whether a render object drawn into it is visible or not.
Calling the returned callback will remove callback from the composition callbacks.
Sourcepub fn debug_disposed(self, app: &App) -> bool
pub fn debug_disposed(self, app: &App) -> bool
If asserts are enabled, returns whether dispose has been called since the last time any
retained resources were created.
A disposed layer’s arena entry is gone, so a stale handle answers true as well.
Sourcepub fn debug_handle_count(self, app: &App) -> u32
pub fn debug_handle_count(self, app: &App) -> u32
Returns the number of objects holding a LayerHandle to this layer.
Sourcepub fn dispose(self, app: &mut App)
pub fn dispose(self, app: &mut App)
See Layer::dispose.
Sourcepub fn parent(self, app: &App) -> Option<AnyContainerLayer>
pub fn parent(self, app: &App) -> Option<AnyContainerLayer>
This layer’s parent in the layer tree.
The parent of the root node in the layer tree is None.
Only subclasses of ContainerLayer can have children in the layer tree. All other
layer classes are used for leaves in the layer tree.
Sourcepub fn owner(self, app: &App) -> Option<HandleId>
pub fn owner(self, app: &App) -> Option<HandleId>
The owner for this layer (None if unattached).
The entire layer tree that this layer belongs to will have the same owner.
Typically the owner is a RenderView.
Sourcepub fn attached(self, app: &App) -> bool
pub fn attached(self, app: &App) -> bool
Whether the layer tree containing this layer is attached to an owner.
This becomes true during the call to attach.
This becomes false during the call to detach.
Sourcepub fn attach(self, app: &mut App, owner: HandleId)
pub fn attach(self, app: &mut App, owner: HandleId)
See Layer::attach.
Sourcepub fn detach(self, app: &mut App)
pub fn detach(self, app: &mut App)
See Layer::detach.
Sourcepub fn depth(self, app: &App) -> i32
pub fn depth(self, app: &App) -> i32
The depth of this layer in the layer tree.
The depth of nodes in a tree monotonically increases as you traverse down the tree. There’s no guarantee regarding depth between siblings.
The depth is used to ensure that nodes are processed in depth order.
Sourcepub fn redepth_children(self, app: &mut App)
pub fn redepth_children(self, app: &mut App)
Sourcepub fn next_sibling(self, app: &App) -> Option<AnyLayer>
pub fn next_sibling(self, app: &App) -> Option<AnyLayer>
This layer’s next sibling in the parent layer’s child list.
Sourcepub fn previous_sibling(self, app: &App) -> Option<AnyLayer>
pub fn previous_sibling(self, app: &App) -> Option<AnyLayer>
This layer’s previous sibling in the parent layer’s child list.
Sourcepub fn remove(self, app: &mut App)
pub fn remove(self, app: &mut App)
Removes this layer from its parent layer’s child list.
This has no effect if the layer’s parent is already None.
Sourcepub fn find_annotations(
self,
app: &App,
result: &mut AnnotationSearch,
local_position: Offset,
only_first: bool,
) -> bool
pub fn find_annotations( self, app: &App, result: &mut AnnotationSearch, local_position: Offset, only_first: bool, ) -> bool
Sourcepub fn find<S: 'static>(
self,
app: &App,
local_position: Offset,
) -> Option<Rc<S>>
pub fn find<S: 'static>( self, app: &App, local_position: Offset, ) -> Option<Rc<S>>
Search this layer and its subtree for the first annotation of type S under the point
described by local_position.
Returns None if no matching annotations are found.
By default this method calls find_annotations with
only_first: true and returns the annotation of the first result. Prefer overriding
Layer::find_annotations instead of this method, because during an annotation search,
only find_annotations is recursively called, while custom behavior in this method is
ignored.
See also:
find_all_annotations, which is similar but returns all annotations found at the given position.AnnotatedRegionLayer, for placing values in the layer tree.
Sourcepub fn find_all_annotations<S: 'static>(
self,
app: &App,
local_position: Offset,
) -> AnnotationResult<S>
pub fn find_all_annotations<S: 'static>( self, app: &App, local_position: Offset, ) -> AnnotationResult<S>
Search this layer and its subtree for all annotations of type S under the point
described by local_position.
Returns a result with empty entries if no matching annotations are found.
By default this method calls find_annotations with
only_first: false and returns the annotations of its result. Prefer overriding
Layer::find_annotations instead of this method, because during an annotation search,
only find_annotations is recursively called, while custom behavior in this method is
ignored.
See also:
find, which is similar but returns the first annotation found at the given position.AnnotatedRegionLayer, for placing values in the layer tree.
Sourcepub fn add_to_scene(self, app: &mut App, builder: &mut SceneBuilder)
pub fn add_to_scene(self, app: &mut App, builder: &mut SceneBuilder)
See Layer::add_to_scene.
Sourcepub fn needs_add_to_scene(self, app: &App) -> bool
pub fn needs_add_to_scene(self, app: &App) -> bool
Whether add_to_scene must run for this layer when a scene is next built: it changed
since it was last added, or never was, or a descendant did as far as
update_subtree_needs_add_to_scene has
found out.
Sourcepub fn mark_needs_add_to_scene(self, app: &mut App)
pub fn mark_needs_add_to_scene(self, app: &mut App)
Mark that this layer has changed and add_to_scene needs to be called.
Sourcepub fn always_needs_add_to_scene(self, app: &App) -> bool
pub fn always_needs_add_to_scene(self, app: &App) -> bool
Sourcepub fn engine_layer(self, app: &App) -> Option<EngineLayer>
pub fn engine_layer(self, app: &App) -> Option<EngineLayer>
The engine layer used to render this layer: the node of the scene’s tree its subtree made
when it was last added to a scene, which SceneBuilder::add_retained adds again while
nothing in the subtree changed.
Sourcepub fn set_engine_layer(self, app: &mut App, value: Option<EngineLayer>)
pub fn set_engine_layer(self, app: &mut App, value: Option<EngineLayer>)
Sets the engine layer used to render this layer.
Typically this is set to the value SceneBuilder::pop returned in add_to_scene.
Sourcepub fn update_subtree_needs_add_to_scene(self, app: &mut App)
pub fn update_subtree_needs_add_to_scene(self, app: &mut App)
Traverses the layer subtree starting from this layer and determines whether it needs
add_to_scene.
A layer needs add_to_scene if any of the following is true:
always_needs_add_to_sceneis true.mark_needs_add_to_scenehas been called.- Any of its descendants need
add_to_scene.
Dart’s ContainerLayer override recurses into the children; here the erased handle
knows whether it is a container.
Sourcepub fn add_to_scene_with_retained_rendering(
self,
app: &mut App,
builder: &mut SceneBuilder,
)
pub fn add_to_scene_with_retained_rendering( self, app: &mut App, builder: &mut SceneBuilder, )
Dart’s _addToSceneWithRetainedRendering: the retained engine layer where the subtree
has not changed, add_to_scene otherwise.
Trait Implementations§
impl Copy for AnyLayer
impl Eq for AnyLayer
Source§impl ErasedLayer for AnyLayer
impl ErasedLayer for AnyLayer
Auto Trait Implementations§
impl Freeze for AnyLayer
impl RefUnwindSafe for AnyLayer
impl Send for AnyLayer
impl Sync for AnyLayer
impl Unpin for AnyLayer
impl UnsafeUnpin for AnyLayer
impl UnwindSafe for AnyLayer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.