pub struct EntityBundle {
pub name: Name,
pub tag: Tag,
}Expand description
基础实体 Bundle
包含实体的基本标识信息,适用于大多数实体。
§包含组件
Name: 实体名称Tag: 实体标签
§示例
use anvilkit_ecs::prelude::*;
let mut world = World::new();
// 直接创建
let entity1 = world.spawn(EntityBundle {
name: Name::new("基础实体"),
tag: Tag::new("basic"),
}).id();
// 使用构建器
let entity2 = world.spawn(
EntityBundle::new("另一个实体", "another")
).id();Fields§
§name: Name实体名称
tag: Tag实体标签
Implementations§
Source§impl EntityBundle
impl EntityBundle
Trait Implementations§
Source§impl Bundle for EntityBundle
impl Bundle for EntityBundle
Source§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
Source§impl Clone for EntityBundle
impl Clone for EntityBundle
Source§fn clone(&self) -> EntityBundle
fn clone(&self) -> EntityBundle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EntityBundle
impl Debug for EntityBundle
Source§impl Default for EntityBundle
impl Default for EntityBundle
Source§fn default() -> EntityBundle
fn default() -> EntityBundle
Returns the “default value” for a type. Read more
impl DynamicBundle for EntityBundle
Auto Trait Implementations§
impl Freeze for EntityBundle
impl RefUnwindSafe for EntityBundle
impl Send for EntityBundle
impl Sync for EntityBundle
impl Unpin for EntityBundle
impl UnsafeUnpin for EntityBundle
impl UnwindSafe for EntityBundle
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates
Self using data from the given World.