pub struct Registry {
pub components: Vec<ComponentInfo>,
}Expand description
Ordered built-in component reflection/serialization table.
This is distinct from ECS registration: use Self::register for host extensions.
Fields§
§components: Vec<ComponentInfo>Component metadata in Inspector/serialization order.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn register_world(&self, world: &mut World)
pub fn register_world(&self, world: &mut World)
Registers every metadata type in a fresh world through host-owned callbacks. Needed when loading scenes containing permanent host extension components.
Sourcepub fn get(&self, name: &str) -> Option<&ComponentInfo>
pub fn get(&self, name: &str) -> Option<&ComponentInfo>
Finds metadata by exact component name.
Sourcepub fn register<T: Component>(&mut self, world: &mut World)
pub fn register<T: Component>(&mut self, world: &mut World)
Registers an editor-visible component in this table and a host world. Re-registering the same type is idempotent. Call only in permanent host code, because native library unloading would invalidate storage/callback vtables.
Sourcepub fn of_entity<'a>(
&'a self,
world: &World,
entity: Entity,
) -> Vec<&'a ComponentInfo>
pub fn of_entity<'a>( &'a self, world: &World, entity: Entity, ) -> Vec<&'a ComponentInfo>
Metadata for components present on this entity, preserving registry order.
Sourcepub fn validate_entity(&self, world: &World, entity: Entity) -> Vec<String>
pub fn validate_entity(&self, world: &World, entity: Entity) -> Vec<String>
Reports registered component values that cannot round-trip through JSON. Unknown/runtime-only storages are ignored; stale handles return one diagnostic.
Sourcepub fn add_named(
&self,
world: &mut World,
entity: Entity,
name: &str,
) -> Result<bool, String>
pub fn add_named( &self, world: &mut World, entity: Entity, name: &str, ) -> Result<bool, String>
Inserts a default named component only when it is absent. Returns whether insertion occurred; errors report unknown types or stale handles.
Sourcepub fn remove_named(
&self,
world: &mut World,
entity: Entity,
name: &str,
) -> Result<bool, String>
pub fn remove_named( &self, world: &mut World, entity: Entity, name: &str, ) -> Result<bool, String>
Removes a named component, enforcing its Inspector removal policy. Returns whether a value existed. Unknown/stale/non-removable requests fail.
Sourcepub fn copy_entity(&self, world: &mut World, from: Entity, to: Entity)
pub fn copy_entity(&self, world: &mut World, from: Entity, to: Entity)
Copies every registered component from one entity to another (used for duplicate).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Registry
impl RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
impl UnwindSafe for Registry
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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 moreimpl<T> MaybeSync for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.