Skip to main content

RegisteredType

Enum RegisteredType 

Source
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

Source

pub fn as_str(self) -> &'static str

The type’s registry name.

Source

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.

Source

pub fn from_discriminant(val: u8) -> Option<Self>

The type carrying a blob discriminant, or None if unknown. Only a stored type has one.

Source

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).

Source

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.

Source

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.

Source

pub fn registration(self) -> Registration

This type’s static authoring metadata.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

pub fn useful_blank(self) -> bool

Whether declaring the type with no args still does something useful.

Source

pub fn renders(self) -> bool

Whether declaring the type implies the world renders.

Source

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.

Source

pub fn addable(self) -> bool

Whether a world may declare this type directly.

Source

pub fn all() -> &'static [RegisteredType]

Every registered component type, in list order.

Source

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

Source§

fn clone(&self) -> RegisteredType

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 Copy for RegisteredType

Source§

impl Debug for RegisteredType

Source§

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

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

impl Eq for RegisteredType

Source§

impl Hash for RegisteredType

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 RegisteredType

Source§

fn eq(&self, other: &RegisteredType) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RegisteredType

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

Compare self to key and return true if they are equal.
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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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, <T as TryFrom<U>>::Error>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more