pub struct EntitySnapshot {
pub id: EntityId,
pub name: String,
pub position: Option<(f32, f32)>,
pub velocity: Option<(f32, f32)>,
pub active: bool,
pub components: HashMap<String, Value>,
}Expand description
Entity snapshot for inspection
Fields§
§id: EntityIdEntity ID
name: StringEntity name (for debugging)
position: Option<(f32, f32)>Position (x, y)
velocity: Option<(f32, f32)>Velocity (vx, vy)
active: boolIs entity active
components: HashMap<String, Value>Custom components as JSON
Implementations§
Source§impl EntitySnapshot
impl EntitySnapshot
Sourcepub const fn with_position(self, x: f32, y: f32) -> Self
pub const fn with_position(self, x: f32, y: f32) -> Self
Set position
Sourcepub const fn with_velocity(self, vx: f32, vy: f32) -> Self
pub const fn with_velocity(self, vx: f32, vy: f32) -> Self
Set velocity
Sourcepub fn add_component(&mut self, name: impl Into<String>, value: Value)
pub fn add_component(&mut self, name: impl Into<String>, value: Value)
Add a component
Trait Implementations§
Source§impl Clone for EntitySnapshot
impl Clone for EntitySnapshot
Source§fn clone(&self) -> EntitySnapshot
fn clone(&self) -> EntitySnapshot
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 EntitySnapshot
impl Debug for EntitySnapshot
Source§impl<'de> Deserialize<'de> for EntitySnapshot
impl<'de> Deserialize<'de> for EntitySnapshot
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for EntitySnapshot
impl RefUnwindSafe for EntitySnapshot
impl Send for EntitySnapshot
impl Sync for EntitySnapshot
impl Unpin for EntitySnapshot
impl UnsafeUnpin for EntitySnapshot
impl UnwindSafe for EntitySnapshot
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> 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>
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 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>
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