Struct ambient_ui_native::World
source · pub struct World { /* private fields */ }
Implementations§
source§impl World
impl World
pub fn new(name: &'static str) -> World
pub fn new_with_config(name: &'static str, resources: bool) -> World
sourcepub fn from_entities(
world: &World,
entities: impl IntoIterator<Item = EntityId>,
serializable_only: bool
) -> World
pub fn from_entities( world: &World, entities: impl IntoIterator<Item = EntityId>, serializable_only: bool ) -> World
Clones all entities specified in the source world and returns a new world with them
pub async fn from_file( path: impl AsRef<Path> ) -> impl Future<Output = Result<World, Error>>
pub fn from_slice(content: &[u8]) -> Result<World, Error>
pub fn spawn(&mut self, entity_data: Entity) -> EntityId
pub fn batch_spawn( &mut self, entity_data: Entity, count: usize ) -> Vec<EntityId, Global>
sourcepub fn spawn_with_id(
&mut self,
entity_id: EntityId,
entity_data: Entity
) -> bool
pub fn spawn_with_id( &mut self, entity_id: EntityId, entity_data: Entity ) -> bool
Returns false if the id already exists
pub fn batch_spawn_with_ids( &mut self, entity_data: Entity, ids: Vec<EntityId, Global> )
pub fn despawn(&mut self, entity_id: EntityId) -> Option<Entity>
pub fn despawn_all(&mut self)
pub fn next_frame(&mut self)
pub fn set<T>( &mut self, entity_id: EntityId, component: Component<T>, value: T ) -> Result<T, ECSError>where T: ComponentValue,
pub fn set_entry( &mut self, entity_id: EntityId, entry: ComponentEntry ) -> Result<ComponentEntry, ECSError>
pub fn set_components( &mut self, entity_id: EntityId, data: Entity ) -> Result<(), ECSError>
sourcepub fn set_if_changed<T>(
&mut self,
entity_id: EntityId,
component: Component<T>,
value: T
) -> Result<(), ECSError>where
T: ComponentValue + PartialEq<T>,
pub fn set_if_changed<T>( &mut self, entity_id: EntityId, component: Component<T>, value: T ) -> Result<(), ECSError>where T: ComponentValue + PartialEq<T>,
Sets the value iff it is different to the current
pub fn get_mut<T>( &mut self, entity_id: EntityId, component: Component<T> ) -> Result<&mut T, ECSError>where T: ComponentValue,
pub fn get<T>( &self, entity_id: EntityId, component: Component<T> ) -> Result<T, ECSError>where T: Copy + ComponentValue,
pub fn get_cloned<T>( &self, entity_id: EntityId, component: Component<T> ) -> Result<T, ECSError>where T: Clone + ComponentValue,
pub fn get_ref<T>( &self, entity_id: EntityId, component: Component<T> ) -> Result<&T, ECSError>where T: ComponentValue,
pub fn get_entry( &self, entity_id: EntityId, component: ComponentDesc ) -> Result<ComponentEntry, ECSError>
pub fn has_component_index( &self, entity_id: EntityId, component_index: u32 ) -> bool
pub fn has_component_ref( &self, entity_id: EntityId, component: impl Into<ComponentDesc> ) -> bool
pub fn has_component( &self, entity_id: EntityId, component: impl Into<ComponentDesc> ) -> bool
pub fn has_components( &self, entity_id: EntityId, components: &ComponentSet ) -> bool
pub fn get_components( &self, entity_id: EntityId ) -> Result<Vec<ComponentDesc, Global>, ECSError>
pub fn clone_entity(&self, entity_id: EntityId) -> Result<Entity, ECSError>
pub fn entities(&self) -> Vec<(EntityId, Entity), Global>
pub fn exists(&self, entity_id: EntityId) -> bool
pub fn add_components( &mut self, entity_id: EntityId, data: Entity ) -> Result<(), ECSError>
pub fn add_component<T>( &mut self, entity_id: EntityId, component: Component<T>, value: T ) -> Result<(), ECSError>where T: ComponentValue,
pub fn add_resource<T>(&mut self, component: Component<T>, value: T)where T: ComponentValue,
sourcepub fn remove_component(
&mut self,
entity_id: EntityId,
component: impl Into<ComponentDesc>
) -> Result<(), ECSError>
pub fn remove_component( &mut self, entity_id: EntityId, component: impl Into<ComponentDesc> ) -> Result<(), ECSError>
Does nothing if the component does not exist
pub fn remove_components( &mut self, entity_id: EntityId, components: Vec<ComponentDesc, Global> ) -> Result<(), ECSError>
pub fn resource_entity(&self) -> EntityId
pub fn resource_opt<T>(&self, component: Component<T>) -> Option<&T>where T: ComponentValue,
pub fn resource<T>(&self, component: Component<T>) -> &Twhere T: ComponentValue,
pub fn resource_mut_opt<T>(&mut self, component: Component<T>) -> Option<&mut T>where T: ComponentValue,
pub fn resource_mut<T>(&mut self, component: Component<T>) -> &mut Twhere T: ComponentValue,
pub fn archetypes(&self) -> &Vec<Archetype, Global>
pub fn entity_loc(&self, id: EntityId) -> Option<&EntityLocation>
sourcepub fn get_component_content_version(
&self,
entity_id: EntityId,
index: u32
) -> Result<u64, ECSError>
pub fn get_component_content_version( &self, entity_id: EntityId, index: u32 ) -> Result<u64, ECSError>
Returns the content version of this component, which only changes when the component is written to (not when the entity changes archetype)
pub fn loc_changed(&self) -> &FramedEvents<EntityId>
pub fn init_shape_change_tracking(&mut self)
pub fn reset_events(&mut self)
sourcepub fn spawn_into_world(
&self,
world: &mut World,
components: Option<Entity>
) -> Vec<EntityId, Global>
pub fn spawn_into_world( &self, world: &mut World, components: Option<Entity> ) -> Vec<EntityId, Global>
Spawn all entities of this world into the destination world
pub fn is_empty(&self) -> bool
pub fn debug_archetypes(&self) -> DebugWorldArchetypes<'_>
pub fn dump(&self, f: &mut dyn Write)
pub fn dump_to_tmp_file(&self)
pub fn dump_entity(&self, entity_id: EntityId, indent: usize, f: &mut dyn Write)
pub fn dump_entity_to_yml( &self, entity_id: EntityId ) -> Option<(String, LinkedHashMap<Yaml, Yaml, RandomState>)>
pub fn set_name(&mut self, name: &'static str)
pub fn name(&self) -> &'static str
pub fn add_entry( &mut self, id: EntityId, entry: ComponentEntry ) -> Result<(), ECSError>
Trait Implementations§
source§impl<'de> Deserialize<'de> for World
impl<'de> Deserialize<'de> for World
source§fn deserialize<D>(
deserializer: D
) -> Result<World, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>( deserializer: D ) -> Result<World, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl IndexExt for World
impl IndexExt for World
fn sync_index( &mut self, index: Component<Index>, id: EntityId, filter: ArchetypeFilter )
source§impl Serialize for World
impl Serialize for World
source§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Send for World
impl Sync for World
Auto Trait Implementations§
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> ComponentValueBase for Twhere
T: Send + Sync + 'static,
impl<T> ComponentValueBase for Twhere T: Send + Sync + 'static,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
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)
Convert
&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)
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> ElementComponentName for T
impl<T> ElementComponentName for T
source§fn element_component_name(&self) -> &'static str
fn element_component_name(&self) -> &'static str
Returns the name of the type implementing ElementComponent.