Skip to main content

RecomposeScope

Struct RecomposeScope 

Source
pub struct RecomposeScope { /* private fields */ }
Expand description

The unit of recomposition. State read inside a scope invalidates it, and a recomposition runs only the content of the invalid scopes. Clones refer to the same scope.

Implementations§

Source§

impl RecomposeScope

Source

pub fn id(&self) -> usize

Returns an id that is unique among the live scopes.

Source

pub fn is_invalid(&self) -> bool

Returns true if state that the scope read has changed since it last recomposed.

Source

pub fn is_active(&self) -> bool

Returns false between deactivate and reactivate.

Source

pub fn owner_chain_deactivation_epoch(&self) -> u64

Total deactivations along this scope’s owner chain. A retained slot composition records this at compose time; a later mismatch means some enclosing composition was deactivated (its owned effects cancelled) since the slot last composed, so the retained content must recompose once to restart them — no flag on the slot’s own scopes carries that trace, because deactivation walks stop at slot-host boundaries.

Source

pub fn deactivate(&self)

Marks the scope inactive, as when its content is retained or held for reuse. An inactive scope is not queued for recomposition until it is reactivated.

Source

pub fn reactivate(&self)

Marks the scope active again and queues it for recomposition if it was invalidated while inactive.

Source

pub fn force_reuse(&self)

Makes the next should_recompose return false even if the scope is invalid. Cancels a pending force_recompose.

Source

pub fn force_recompose(&self)

Makes the next should_recompose return true even if the scope is not invalid. Cancels a pending force_reuse.

Source

pub fn should_recompose(&self) -> bool

Returns whether the scope’s content has to run now: true after force_recompose or when the scope is invalid, and false after force_reuse. A forced answer is used up by the call.

Source

pub fn has_composed_once(&self) -> bool

Returns true once the scope has composed its content at least once.

Trait Implementations§

Source§

impl Clone for RecomposeScope

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 Eq for RecomposeScope

Source§

impl Hash for RecomposeScope

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 RecomposeScope

Source§

fn eq(&self, other: &Self) -> 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<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<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<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> 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.