pub enum RegisteredType {
Show 99 variants
Window,
GraphicsConfig,
Shader,
Camera3D,
FrameInput,
Prop,
RigidBody,
PropBody,
Room,
DirectionalLight,
PointLight,
SpotLight,
RectAreaLight,
ProceduralMesh,
Model,
Scene,
TextLabel,
HitRegion,
File,
BlockType,
VoxelChunk,
InstancedProp,
PostProcessConfig,
Animation,
SkeletonPose,
StreamingConfig,
VoxelWorld,
AudioEmitter,
Sprite,
KeyBinding,
Screen,
Decal,
VolumetricFog,
PhysicsJoint,
ParticleEmitter,
WaterSurface,
SdfVolume,
GlassPanel,
LayoutContainer,
PhysicsConfig,
FpsCounter,
StatHud,
ScrollPanel,
ReflectionProbe,
Transform,
PropInstance,
MeshRenderer,
ModelRenderer,
Collider,
BodyDynamics,
Interactable,
Pickup,
Parent,
Children,
SceneMember,
GlobalTransform,
RenderHandle,
Held,
Lifetime,
Spawner,
DebugHud,
AudioCue,
Story,
AppConfig,
AnimationGraph,
AnimationParams,
CharacterRig,
GroundProbes,
CameraProbe,
TextInput,
Behavior,
Variables,
TriggerVolume,
Hidden,
LoadingOverlay,
AudioOcclusionProbe,
CharacterShape,
LightRig,
MaterialPalette,
CameraShot,
Prefab,
SceneImport,
MainMenu,
OptionSelect,
Slider,
EngineDefaults,
StoryImport,
Panel,
CharacterSchema,
CharacterModel,
AudioClip,
Texture,
CubemapTexture,
EnvironmentMap,
ColorLut,
Font,
Material,
Mesh,
SkinnedMesh,
}Variants§
Window
GraphicsConfig
Shader
Camera3D
FrameInput
Prop
RigidBody
PropBody
Room
DirectionalLight
PointLight
SpotLight
RectAreaLight
ProceduralMesh
Model
Scene
TextLabel
HitRegion
File
BlockType
VoxelChunk
InstancedProp
PostProcessConfig
Animation
SkeletonPose
StreamingConfig
VoxelWorld
AudioEmitter
Sprite
KeyBinding
Screen
Decal
VolumetricFog
PhysicsJoint
ParticleEmitter
WaterSurface
SdfVolume
GlassPanel
LayoutContainer
PhysicsConfig
FpsCounter
StatHud
ScrollPanel
ReflectionProbe
Transform
PropInstance
MeshRenderer
ModelRenderer
Collider
BodyDynamics
Interactable
Pickup
Parent
Children
SceneMember
GlobalTransform
RenderHandle
Held
Lifetime
Spawner
DebugHud
AudioCue
Story
AppConfig
AnimationGraph
AnimationParams
CharacterRig
GroundProbes
CameraProbe
TextInput
Behavior
Variables
TriggerVolume
Hidden
LoadingOverlay
AudioOcclusionProbe
CharacterShape
LightRig
MaterialPalette
CameraShot
Prefab
SceneImport
MainMenu
OptionSelect
Slider
EngineDefaults
StoryImport
Panel
CharacterSchema
CharacterModel
AudioClip
Texture
CubemapTexture
EnvironmentMap
ColorLut
Font
Material
Mesh
SkinnedMesh
Implementations§
Source§impl RegisteredType
impl RegisteredType
Sourcepub fn discriminant(self) -> Option<u8>
pub fn discriminant(self) -> Option<u8>
The on-disk blob tag / in-memory ComponentId, derived from the
shared ComponentTag enum (list position) so it matches the
runtime loader exactly.
None for a build-only type: the cook expands it into the
components it stands for, so no record of it is ever written and
it has no tag to carry.
Sourcepub fn from_discriminant(val: u8) -> Option<Self>
pub fn from_discriminant(val: u8) -> Option<Self>
The type carrying a blob discriminant, or None if unknown. Only
a stored type has one.
Sourcepub fn scope_resolution(self) -> ScopeResolution
pub fn scope_resolution(self) -> ScopeResolution
What this type denotes at tick time: the column a behavior can scope or query against, or why there is none.
Resolves through the substitute where a load-time pass leaves a
runtime marker behind, so Prop answers
Column(RegisteredType::PropInstance).
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
A name either matches a known type or it does not; callers that
want a message supply their own via ok_or/ok_or_else.
Sourcepub fn args_struct_name(self) -> &'static str
pub fn args_struct_name(self) -> &'static str
The name of this type’s authored args schema struct: the
component itself for pass-through types, the args: override
for the divergent ones. The docs pipeline renders that struct’s
fields as the asset’s parameters.
Sourcepub fn registration(self) -> Registration
pub fn registration(self) -> Registration
This type’s static authoring metadata.
Sourcepub fn reserialize_args(self, args: &Value) -> Result<Vec<u8>, CnResult>
pub fn reserialize_args(self, args: &Value) -> Result<Vec<u8>, CnResult>
Bake a JSON args value into the blob record’s component bytes:
deserialize through the typed args schema (interning name-string
cross-references), apply the type’s bake-time validator, and
serialize the runtime component as postcard. For a pass-through
type the args ARE the component; a divergent type (args:
metadata) routes through its bake translation in
bake_divergent.
Sourcepub fn normalized_args(self, args: &Value) -> Result<Value, CnResult>
pub fn normalized_args(self, args: &Value) -> Result<Value, CnResult>
Normalize a JSON args value through the typed args schema: the
same deserialize + validate as reserialize_args, but back to
JSON with defaults filled and references resolved. Authoring
tools (cn add, the editor form) write this into world.jsonl;
the baked postcard bytes cannot round-trip to JSON.
Sourcepub fn field_enum_variants(self, field: &str) -> Option<Vec<String>>
pub fn field_enum_variants(self, field: &str) -> Option<Vec<String>>
The allowed values of a string-enum args field (in declaration
order), or None if field is a free-form string / absent / not a
string-enum. Probes the typed args by deserializing the defaults
with field set to a sentinel: a string-enum yields serde’s
“unknown variant …, expected …” which parse_expected_variants
reads; a free string accepts the sentinel and yields None. Used by
authoring tools to offer a picker instead of a free text box; it
degrades to None (free text) if serde’s phrasing ever changes.
Sourcepub fn resource_kind(self) -> Option<ResourceKind>
pub fn resource_kind(self) -> Option<ResourceKind>
The dense per-kind handle space this asset is assigned into, or
None if it is not a resource asset. Cook assigns the handle;
the runtime addresses the resource by it.
Sourcepub fn is_resource(self) -> bool
pub fn is_resource(self) -> bool
Whether this type is a resource asset: compiled into the blob’s resource stream and reached by a handle, rather than stored in a component column.
Sourcepub fn is_data(self) -> bool
pub fn is_data(self) -> bool
Whether this resource’s compiled bytes ride inline in its record rather than in a payload section the record points at. False for everything that is not a resource asset.
Sourcepub fn ref_fields(self) -> &'static [(&'static str, &'static str)]
pub fn ref_fields(self) -> &'static [(&'static str, &'static str)]
The asset-reference fields of this type, as (field, target_type),
from the entry’s refs: metadata.
Sourcepub fn singleton(self) -> bool
pub fn singleton(self) -> bool
The structural flags, from the entry’s metadata: singleton
(at most one instance belongs to a world; authoring tools use an
edit-or-add flow), useful_blank (meaningful when declared with
only default args, so authoring tools offer a plain add), and
renders (presence implies the world renders; drives the
GraphicsConfig companion injection at build time).
Sourcepub fn useful_blank(self) -> bool
pub fn useful_blank(self) -> bool
Whether declaring the type with no args still does something useful.
Sourcepub fn live(self) -> bool
pub fn live(self) -> bool
Whether the running world re-reads this type’s column every frame. An editing tool holding a live world can overwrite such a component in place and see the change on the next draw, instead of reloading the world to apply it.
Flagging a type asserts two things: its column still holds entities at tick time and some system reads them afresh, AND no build-time expansion reads its args – an in-place write never runs the expansion, so a type another asset is generated from would leave that generated asset standing on the old values.
An expansion is not the only thing that reads args at build time; the reference graph that decides how payloads pack and the cross-asset validator do too. A type carrying one of those can still be flagged, so long as the writer declines the edits that would move it.
Sourcepub fn all() -> &'static [RegisteredType]
pub fn all() -> &'static [RegisteredType]
Every registered component type, in list order.
Sourcepub fn addable_types() -> impl Iterator<Item = (RegisteredType, Registration)>
pub fn addable_types() -> impl Iterator<Item = (RegisteredType, Registration)>
Every type a world may declare, with its registration metadata.
Trait Implementations§
Source§impl Clone for RegisteredType
impl Clone for RegisteredType
Source§fn clone(&self) -> RegisteredType
fn clone(&self) -> RegisteredType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RegisteredType
Source§impl Debug for RegisteredType
impl Debug for RegisteredType
impl Eq for RegisteredType
Source§impl Hash for RegisteredType
impl Hash for RegisteredType
Source§impl PartialEq for RegisteredType
impl PartialEq for RegisteredType
impl StructuralPartialEq for RegisteredType
Auto Trait Implementations§
impl Freeze for RegisteredType
impl RefUnwindSafe for RegisteredType
impl Send for RegisteredType
impl Sync for RegisteredType
impl Unpin for RegisteredType
impl UnsafeUnpin for RegisteredType
impl UnwindSafe for RegisteredType
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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