Skip to main content

AnyLayer

Struct AnyLayer 

Source
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

Source

pub fn id(self) -> HandleId

Source

pub fn as_container_layer(self) -> Option<AnyContainerLayer>

Dart’s layer as ContainerLayer, as an Option.

Source

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.

Source

pub fn supports_rasterization(self, app: &App) -> bool

Source

pub fn describe_clip_bounds(self, app: &App) -> Option<Rect>

Source

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.

Source

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.

Source

pub fn debug_handle_count(self, app: &App) -> u32

Returns the number of objects holding a LayerHandle to this layer.

Source

pub fn dispose(self, app: &mut App)

Source

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.

Source

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.

Source

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.

Source

pub fn attach(self, app: &mut App, owner: HandleId)

Source

pub fn detach(self, app: &mut App)

Source

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.

Source

pub fn redepth_children(self, app: &mut App)

Source

pub fn next_sibling(self, app: &App) -> Option<AnyLayer>

This layer’s next sibling in the parent layer’s child list.

Source

pub fn previous_sibling(self, app: &App) -> Option<AnyLayer>

This layer’s previous sibling in the parent layer’s child list.

Source

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.

Source

pub fn find_annotations( self, app: &App, result: &mut AnnotationSearch, local_position: Offset, only_first: bool, ) -> bool

Source

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.
Source

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.
Source

pub fn add_to_scene(self, app: &mut App, builder: &mut SceneBuilder)

Source

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.

Source

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.

Source

pub fn always_needs_add_to_scene(self, app: &App) -> bool

Source

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.

Source

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.

Source

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:

Dart’s ContainerLayer override recurses into the children; here the erased handle knows whether it is a container.

Source

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§

Source§

impl Clone for AnyLayer

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for AnyLayer

Source§

impl Debug for AnyLayer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for AnyLayer

Source§

impl ErasedLayer for AnyLayer

Source§

fn as_layer(self) -> AnyLayer

Dart’s implicit upcast to Layer.
Source§

impl From<AnyLayer> for HandleId

Source§

fn from(layer: AnyLayer) -> HandleId

Converts to this type from the input type.
Source§

impl Hash for AnyLayer

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for AnyLayer

Source§

fn eq(&self, other: &AnyLayer) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,