pub struct TestComposition { /* private fields */ }Expand description
In-memory composition helper used by tests.
Implementations§
Source§impl TestComposition
impl TestComposition
Sourcepub fn root(&self) -> Option<NodeId>
pub fn root(&self) -> Option<NodeId>
Returns the id of the root node, or None when the composition has no root node.
Sourcepub fn runtime_handle(&self) -> RuntimeHandle
pub fn runtime_handle(&self) -> RuntimeHandle
Returns the runtime handle of the composition.
Sourcepub fn should_render(&self) -> bool
pub fn should_render(&self) -> bool
Returns true when state changes or animation callbacks have work pending.
Sourcepub fn take_root_render_request(&mut self) -> bool
pub fn take_root_render_request(&mut self) -> bool
Returns true once if a root render was requested since the last call, then resets the request.
Sourcepub fn flush_pending_node_updates(&mut self) -> Result<(), NodeError>
pub fn flush_pending_node_updates(&mut self) -> Result<(), NodeError>
Applies the node updates that state changes queued.
Sourcepub fn process_invalid_scopes(&mut self) -> Result<bool, NodeError>
pub fn process_invalid_scopes(&mut self) -> Result<bool, NodeError>
Recomposes the scopes that state changes invalidated. Returns true when any scope recomposed.
Sourcepub fn render(
&mut self,
root_key: Key,
content: impl FnMut(),
) -> Result<(), NodeError>
pub fn render( &mut self, root_key: Key, content: impl FnMut(), ) -> Result<(), NodeError>
Renders content as the root composition under root_key, then recomposes invalidated
scopes.
Sourcepub fn applier_mut(&mut self) -> TestApplierGuard<'_>
pub fn applier_mut(&mut self) -> TestApplierGuard<'_>
Borrows the applier that holds the node tree. The guard keeps this composition’s app context active.
Sourcepub fn with_app_context<R>(&self, block: impl FnOnce() -> R) -> R
pub fn with_app_context<R>(&self, block: impl FnOnce() -> R) -> R
Runs block with this composition’s app context active.
Auto Trait Implementations§
impl !RefUnwindSafe for TestComposition
impl !Send for TestComposition
impl !Sync for TestComposition
impl !UnwindSafe for TestComposition
impl Freeze for TestComposition
impl Unpin for TestComposition
impl UnsafeUnpin for TestComposition
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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