Skip to main content

Affected

Struct Affected 

Source
#[non_exhaustive]
pub struct Affected<'a> { pub roots: IndexSet<&'a str>, pub shaders: IndexSet<&'a str>, pub outputs: bool, pub everything: bool, }
Expand description

What a Changes batch may have moved.

Candidates, not a minimal set. An entry means “resolve this again”, not “this definitely differs”: ɴsɪ’s precedence rules can make an edit invisible – a re-armed surfaceshader at a lower priority than a nearer one changes nothing – and deciding that here would mean remembering every previous answer this crate ever gave, which is the consumer’s own record to keep.

Keyed by handle, not by placement path. One geometry under two parents is several objects to a renderer, and editing one parent moves only one of them; a handle-level answer makes the consumer re-resolve both. Correct, and coarse for a crowd – path-precision is an optimisation to ask for with a measurement.

§Why it borrows

Every handle in here already lives in the Scene or in the Changes it was computed from, so owning them meant a String clone per named node on a path an interactive host walks every frame. Measured, one transform with n children, debug build, best of ten: 1000 nodes 2.08 ms, 10 000 27.3 ms, 50 000 88.9 ms – about 2 us a node, four to five allocations of it. Borrowing costs a lifetime on the type and nothing else.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§roots: IndexSet<&'a str>

The roots of what may have moved: these nodes and everything below them on the objects chain.

Roots rather than an enumeration, because enumerating is O(scene) for the edit that matters least – moving one transform near the top of a production scene names every geometry under it, and a set-dressing scene has millions. The consumer walks its own objects anyway; Scene::descendants expands a root when it wants the list.

§shaders: IndexSet<&'a str>

Shader nodes whose own attributes or network changed.

Kept apart because they map one-to-one onto a renderer’s material parameters and cost no geometry work: only the root shader’s identity reaches geometry, and that is a surfaceshader edge, which lands in nodes.

§outputs: bool

Whether the camera/screen/layer/driver chain changed, so the outputs need re-reading.

§everything: bool

Whether something global changed – an attribute on .root or .global – and the whole scene is a candidate.

When this is set, nodes is not filled: the answer is everything, and listing it would be a copy of the scene.

Trait Implementations§

Source§

impl<'a> Clone for Affected<'a>

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<'a> Debug for Affected<'a>

Source§

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

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

impl<'a> Default for Affected<'a>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a> Eq for Affected<'a>

Source§

impl<'a> PartialEq for Affected<'a>

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

impl<'a> StructuralPartialEq for Affected<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Affected<'a>

§

impl<'a> RefUnwindSafe for Affected<'a>

§

impl<'a> Send for Affected<'a>

§

impl<'a> Sync for Affected<'a>

§

impl<'a> Unpin for Affected<'a>

§

impl<'a> UnsafeUnpin for Affected<'a>

§

impl<'a> UnwindSafe for Affected<'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<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<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.