Files
phy/bevy_ecs/entity/index.html
Orion Kindel 0ce894e6b0 doc
2025-03-18 10:30:23 -05:00

21 lines
13 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Entity handling types."><title>bevy_ecs::entity - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="bevy_ecs" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="icon" href="https://bevyengine.org/assets/icon.png"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../../bevy_ecs/index.html"><img src="https://bevyengine.org/assets/icon.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../bevy_ecs/index.html"><img src="https://bevyengine.org/assets/icon.png" alt="logo"></a><h2><a href="../../bevy_ecs/index.html">bevy_<wbr>ecs</a><span class="version">0.15.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module entity</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#usage" title="Usage">Usage</a></li></ul><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li><li><a href="#derives" title="Derive Macros">Derive Macros</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate bevy_<wbr>ecs</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">bevy_ecs</a></span><h1>Module <span>entity</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/bevy_ecs/entity/mod.rs.html#1-1227">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Entity handling types.</p>
<p>An <strong>entity</strong> exclusively owns zero or more <a href="../component/trait.Component.html" title="trait bevy_ecs::component::Component">component</a> instances, all of different types, and can dynamically acquire or lose them over its lifetime.</p>
<p><strong>empty entity</strong>: Entity with zero components.
<strong>pending entity</strong>: Entity reserved, but not flushed yet (see <a href="struct.Entities.html#method.flush" title="method bevy_ecs::entity::Entities::flush"><code>Entities::flush</code></a> docs for reference).
<strong>reserved entity</strong>: same as <strong>pending entity</strong>.
<strong>invalid entity</strong>: <strong>pending entity</strong> flushed with invalid (see <a href="struct.Entities.html#method.flush_as_invalid" title="method bevy_ecs::entity::Entities::flush_as_invalid"><code>Entities::flush_as_invalid</code></a> docs for reference).</p>
<p>See <a href="struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a> to learn more.</p>
<h2 id="usage"><a class="doc-anchor" href="#usage">§</a>Usage</h2>
<p>Operations involving entities and their components are performed either from a system by submitting commands,
or from the outside (or from an exclusive system) by directly using <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a> methods:</p>
<div><table><thead><tr><th style="text-align: center">Operation</th><th style="text-align: center">Command</th><th style="text-align: center">Method</th></tr></thead><tbody>
<tr><td style="text-align: center">Spawn an entity with components</td><td style="text-align: center"><a href="../system/struct.Commands.html#method.spawn" title="method bevy_ecs::system::Commands::spawn"><code>Commands::spawn</code></a></td><td style="text-align: center"><a href="../world/struct.World.html#method.spawn" title="method bevy_ecs::world::World::spawn"><code>World::spawn</code></a></td></tr>
<tr><td style="text-align: center">Spawn an entity without components</td><td style="text-align: center"><a href="../system/struct.Commands.html#method.spawn_empty" title="method bevy_ecs::system::Commands::spawn_empty"><code>Commands::spawn_empty</code></a></td><td style="text-align: center"><a href="../world/struct.World.html#method.spawn_empty" title="method bevy_ecs::world::World::spawn_empty"><code>World::spawn_empty</code></a></td></tr>
<tr><td style="text-align: center">Despawn an entity</td><td style="text-align: center"><a href="../system/struct.EntityCommands.html#method.despawn" title="method bevy_ecs::system::EntityCommands::despawn"><code>EntityCommands::despawn</code></a></td><td style="text-align: center"><a href="../world/struct.World.html#method.despawn" title="method bevy_ecs::world::World::despawn"><code>World::despawn</code></a></td></tr>
<tr><td style="text-align: center">Insert a component, bundle, or tuple of components and bundles to an entity</td><td style="text-align: center"><a href="../system/struct.EntityCommands.html#method.insert" title="method bevy_ecs::system::EntityCommands::insert"><code>EntityCommands::insert</code></a></td><td style="text-align: center"><a href="../world/struct.EntityWorldMut.html#method.insert" title="method bevy_ecs::world::EntityWorldMut::insert"><code>EntityWorldMut::insert</code></a></td></tr>
<tr><td style="text-align: center">Remove a component, bundle, or tuple of components and bundles from an entity</td><td style="text-align: center"><a href="../system/struct.EntityCommands.html#method.remove" title="method bevy_ecs::system::EntityCommands::remove"><code>EntityCommands::remove</code></a></td><td style="text-align: center"><a href="../world/struct.EntityWorldMut.html#method.remove" title="method bevy_ecs::world::EntityWorldMut::remove"><code>EntityWorldMut::remove</code></a></td></tr>
</tbody></table>
</div></div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Entities.html" title="struct bevy_ecs::entity::Entities">Entities</a></div><div class="desc docblock-short">A <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a>s internal metadata store on all of its entities.</div></li><li><div class="item-name"><a class="struct" href="struct.Entity.html" title="struct bevy_ecs::entity::Entity">Entity</a></div><div class="desc docblock-short">Lightweight identifier of an <a href="index.html" title="mod bevy_ecs::entity">entity</a>.</div></li><li><div class="item-name"><a class="struct" href="struct.EntityHash.html" title="struct bevy_ecs::entity::EntityHash">Entity<wbr>Hash</a></div><div class="desc docblock-short">A <a href="https://doc.rust-lang.org/1.84.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher"><code>BuildHasher</code></a> that results in a <a href="struct.EntityHasher.html" title="struct bevy_ecs::entity::EntityHasher"><code>EntityHasher</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.EntityHasher.html" title="struct bevy_ecs::entity::EntityHasher">Entity<wbr>Hasher</a></div><div class="desc docblock-short">A very fast hash that is only designed to work on generational indices
like <a href="struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a>. It will panic if attempting to hash a type containing
non-u64 fields.</div></li><li><div class="item-name"><a class="struct" href="struct.EntityLocation.html" title="struct bevy_ecs::entity::EntityLocation">Entity<wbr>Location</a></div><div class="desc docblock-short">A location of an entity in an archetype.</div></li><li><div class="item-name"><a class="struct" href="struct.ReserveEntitiesIterator.html" title="struct bevy_ecs::entity::ReserveEntitiesIterator">Reserve<wbr>Entities<wbr>Iterator</a></div><div class="desc docblock-short">An <a href="https://doc.rust-lang.org/1.84.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator"><code>Iterator</code></a> returning a sequence of <a href="struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a> values from</div></li><li><div class="item-name"><a class="struct" href="struct.SceneEntityMapper.html" title="struct bevy_ecs::entity::SceneEntityMapper">Scene<wbr>Entity<wbr>Mapper</a></div><div class="desc docblock-short">A wrapper for <a href="type.EntityHashMap.html" title="type bevy_ecs::entity::EntityHashMap"><code>EntityHashMap&lt;Entity&gt;</code></a>, augmenting it with the ability to allocate new <a href="struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a> references in a destination
world. These newly allocated references are guaranteed to never point to any living entity in that world.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.EntityMapper.html" title="trait bevy_ecs::entity::EntityMapper">Entity<wbr>Mapper</a></div><div class="desc docblock-short">An implementor of this trait knows how to map an <a href="struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a> into another <a href="struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.MapEntities.html" title="trait bevy_ecs::entity::MapEntities">MapEntities</a></div><div class="desc docblock-short">Operation to map all contained <a href="struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a> fields in a type to new values.</div></li><li><div class="item-name"><a class="trait" href="trait.VisitEntities.html" title="trait bevy_ecs::entity::VisitEntities">Visit<wbr>Entities</a></div><div class="desc docblock-short">Apply an operation to all entities in a container.</div></li><li><div class="item-name"><a class="trait" href="trait.VisitEntitiesMut.html" title="trait bevy_ecs::entity::VisitEntitiesMut">Visit<wbr>Entities<wbr>Mut</a></div><div class="desc docblock-short">Apply an operation to mutable references to all entities in a container.</div></li></ul><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="type" href="type.EntityHashMap.html" title="type bevy_ecs::entity::EntityHashMap">Entity<wbr>Hash<wbr>Map</a></div><div class="desc docblock-short">A <a href="../../hashbrown/map/struct.HashMap.html" title="struct hashbrown::map::HashMap"><code>HashMap</code></a> pre-configured to use <a href="struct.EntityHash.html" title="struct bevy_ecs::entity::EntityHash"><code>EntityHash</code></a> hashing.</div></li><li><div class="item-name"><a class="type" href="type.EntityHashSet.html" title="type bevy_ecs::entity::EntityHashSet">Entity<wbr>Hash<wbr>Set</a></div><div class="desc docblock-short">A <a href="../../hashbrown/set/struct.HashSet.html" title="struct hashbrown::set::HashSet"><code>HashSet</code></a> pre-configured to use <a href="struct.EntityHash.html" title="struct bevy_ecs::entity::EntityHash"><code>EntityHash</code></a> hashing.</div></li></ul><h2 id="derives" class="section-header">Derive Macros<a href="#derives" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="derive" href="derive.VisitEntities.html" title="derive bevy_ecs::entity::VisitEntities">Visit<wbr>Entities</a></div></li><li><div class="item-name"><a class="derive" href="derive.VisitEntitiesMut.html" title="derive bevy_ecs::entity::VisitEntitiesMut">Visit<wbr>Entities<wbr>Mut</a></div></li></ul></section></div></main></body></html>