Skip to main content

TestApplierGuard

Struct TestApplierGuard 

Source
pub struct TestApplierGuard<'a> { /* private fields */ }

Methods from Deref<Target = MemoryApplier>§

Source

pub fn slots(&mut self) -> &mut SlotTable

Source

pub fn scene_node_attached_to( &mut self, node_id: usize, root: usize, ) -> Option<usize>

Drains the parents recorded via Applier::record_structural_change, keeping only nodes still attached to root (a parent that was itself removed is covered by its own surviving ancestor’s record). A virtual parent — a subcompose slot wrapper the render graph never contains — is reported as its nearest non-virtual ancestor: that is the node whose graph child set the change altered, and an id the graph cannot resolve would force the scoped scene update to give up and rebuild. Resolves a scene-scope candidate the way structural records are resolved: to its nearest non-virtual ancestor, and only while still attached to root. A node detached after recording must not reach the scoped scene update — an id the graph cannot resolve forces it to give up and rebuild the whole scene.

Source

pub fn scene_nodes_attached_to( &mut self, nodes: impl IntoIterator<Item = usize>, root: usize, ) -> Vec<Option<usize>>

Self::scene_node_attached_to for each of nodes, in order, with every ancestor looked up at most once: a batch costs the distinct ancestors of its nodes, not each node’s depth.

Source

pub fn scene_nodes_attached_to_into( &mut self, nodes: impl IntoIterator<Item = usize>, root: usize, output: &mut Vec<Option<usize>>, scratch: &mut SceneNodeAttachmentScratch, )

Fills output with Self::scene_nodes_attached_to results, reusing its storage and the ancestry cache in scratch across batches.

Each distinct ancestor is inspected at most once per call. The cache is cleared for each call, so graph mutations are observed by the next batch.

use cranpose_core::{MemoryApplier, NodeId, SceneNodeAttachmentScratch};

let mut applier = MemoryApplier::new();
let mut scratch = SceneNodeAttachmentScratch::default();
let mut attached: Vec<Option<NodeId>> = Vec::new();
let root = NodeId::default();
applier.scene_nodes_attached_to_into([], root, &mut attached, &mut scratch);
assert!(attached.is_empty());
Source

pub fn take_structural_change_parents_attached_to( &mut self, root: usize, ) -> Vec<usize>

Source

pub fn take_structural_change_parents_into(&mut self, output: &mut Vec<usize>)

Takes the recorded structural-change candidates into reusable storage. Candidates are not resolved or attachment-filtered; callers that route them into scenes should use Self::scene_nodes_attached_to_into.

use cranpose_core::MemoryApplier;

let mut applier = MemoryApplier::new();
let mut nodes = Vec::new();
applier.take_structural_change_parents_into(&mut nodes);
assert!(nodes.is_empty());
Source

pub fn with_node<N, R>( &mut self, id: usize, f: impl FnOnce(&mut N) -> R, ) -> Result<R, NodeError>
where N: Node + 'static,

Source

pub fn len(&self) -> usize

Source

pub fn capacity(&self) -> usize

Source

pub fn tombstone_count(&self) -> usize

Source

pub fn freelist_len(&self) -> usize

Source

pub fn debug_recycled_node_count(&self) -> usize

Source

pub fn debug_recycled_node_count_for<N>(&self) -> usize
where N: Node + 'static,

Source

pub fn debug_stats(&self) -> MemoryApplierDebugStats

Source

pub fn is_empty(&self) -> bool

Source

pub fn for_each_node_mut( &mut self, visit: impl FnMut(&mut (dyn Node + 'static)), )

Calls visit with every live node, dense and high-id alike.

Source

pub fn debug_live_node_heap_bytes(&self) -> usize

Source

pub fn debug_recycled_node_heap_bytes(&self) -> usize

Source

pub fn set_runtime_handle(&mut self, handle: RuntimeHandle)

Source

pub fn clear_runtime_handle(&mut self)

Source

pub fn runtime_handle(&self) -> Option<RuntimeHandle>

Source

pub fn dump_tree(&self, root: Option<usize>) -> String

Source

pub fn get_ref(&self, id: usize) -> Result<&(dyn Node + 'static), NodeError>

Borrows a live node without requiring exclusive access to the tree. Returns NodeError::Missing when id does not name a live node.

Trait Implementations§

Source§

impl Deref for TestApplierGuard<'_>

Source§

type Target = MemoryApplier

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for TestApplierGuard<'_>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for TestApplierGuard<'a>

§

impl<'a> !Send for TestApplierGuard<'a>

§

impl<'a> !Sync for TestApplierGuard<'a>

§

impl<'a> !UnwindSafe for TestApplierGuard<'a>

§

impl<'a> Freeze for TestApplierGuard<'a>

§

impl<'a> Unpin for TestApplierGuard<'a>

§

impl<'a> UnsafeUnpin for TestApplierGuard<'a>

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<T> ErasedDestructor for T
where T: 'static,

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.