pub enum ComponentProvenance {
Authored,
ToolAuthored,
Derived,
Runtime,
}Expand description
Who is allowed to write a component — the axis orthogonal to
SemanticDomain.
SemanticDomain answers which subsystem consumes this data and drives
change epochs, page grouping and Flow gating. It deliberately says nothing
about authorship: Transform and GlobalTransform are both Spatial,
yet one is written by a human and the other is recomputed every frame by
transform_propagation. Collider and PhysicsDebugData are both
Physics, yet one is an input and the other is debug output.
Without this axis the same intent gets re-encoded ad hoc at every site that needs it — which component to offer in “Add Component”, which to copy when duplicating an entity, which to write to a scene file. Each such list is hand-maintained, so none of them covers components defined outside this crate.
The four variants encode two independent bits:
| variant | offered to the author | copied on duplicate |
|---|---|---|
Authored | yes | yes |
ToolAuthored | no | yes |
Derived | no | no |
Runtime | no | no |
Persistence stays a separate question, governed by
#[component(no_serializable)] and #[component(skip)] — a ToolAuthored
component such as Prefab must persist even though nobody adds it by hand.
Variants§
Authored
Written by a human through the editor or by game code. Belongs in a scene file, survives duplication, and is offered in “Add Component”. This is the default for any component that does not say otherwise.
ToolAuthored
Written by a tool action rather than by hand — Prefab, whose source
is set by “instantiate prefab”. It persists and must survive
duplication, but adding an empty one by hand is meaningless, so it is
not offered in the menu.
Derived
Recomputed by the engine from Authored state — GlobalTransform from
Transform + Parent, or the HandleComponent<Gpu*> projections from
their asset handles. A duplicate must not carry a copy: the engine
regenerates it, and a stale copy would be wrong until it did.
Runtime
Per-run transient state that no one authors and nothing recomputes from
authored data — PhysicsDebugData. Never offered, never copied.
Implementations§
Source§impl ComponentProvenance
impl ComponentProvenance
Whether the editor should offer this component in “+ Add Component”.
Only Authored qualifies: everything else is written
by the engine or by a tool action.
Sourcepub const fn is_copied_on_duplicate(self) -> bool
pub const fn is_copied_on_duplicate(self) -> bool
Whether duplicating an entity should copy this component verbatim.
Derived and Runtime are excluded because the engine produces them:
copying would install a stale value that the next tick overwrites at
best, and that reads as corrupt state at worst.
Trait Implementations§
Source§impl Clone for ComponentProvenance
impl Clone for ComponentProvenance
Source§fn clone(&self) -> ComponentProvenance
fn clone(&self) -> ComponentProvenance
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ComponentProvenance
impl Debug for ComponentProvenance
Source§impl Default for ComponentProvenance
impl Default for ComponentProvenance
Source§fn default() -> ComponentProvenance
fn default() -> ComponentProvenance
Source§impl Hash for ComponentProvenance
impl Hash for ComponentProvenance
Source§impl PartialEq for ComponentProvenance
impl PartialEq for ComponentProvenance
Source§fn eq(&self, other: &ComponentProvenance) -> bool
fn eq(&self, other: &ComponentProvenance) -> bool
self and other values to be equal, and is used by ==.impl Copy for ComponentProvenance
impl Eq for ComponentProvenance
impl StructuralPartialEq for ComponentProvenance
Auto Trait Implementations§
impl Freeze for ComponentProvenance
impl RefUnwindSafe for ComponentProvenance
impl Send for ComponentProvenance
impl Sync for ComponentProvenance
impl Unpin for ComponentProvenance
impl UnsafeUnpin for ComponentProvenance
impl UnwindSafe for ComponentProvenance
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.