Struct ambient_api_core::ecs::Entity
source · pub struct Entity(/* private fields */);
Expand description
Implementations§
source§impl Entity
impl Entity
sourcepub fn has<T: SupportedValue>(&self, component: Component<T>) -> bool
pub fn has<T: SupportedValue>(&self, component: Component<T>) -> bool
Returns true if this has component
.
sourcepub fn has_components(&self, components: &[&dyn UntypedComponent]) -> bool
pub fn has_components(&self, components: &[&dyn UntypedComponent]) -> bool
Returns true if this has all of components
.
sourcepub fn get<T: SupportedValue>(&self, component: Component<T>) -> Option<T>
pub fn get<T: SupportedValue>(&self, component: Component<T>) -> Option<T>
Gets the data for component
in this, if it exists.
sourcepub fn get_ref<T: SupportedValueRef>(
&self,
component: Component<T>
) -> Option<&T>
pub fn get_ref<T: SupportedValueRef>( &self, component: Component<T> ) -> Option<&T>
Gets a reference to the data for component
in this, if it exists.
sourcepub fn set<T: SupportedValue>(&mut self, component: Component<T>, value: T)
pub fn set<T: SupportedValue>(&mut self, component: Component<T>, value: T)
Adds component
to this with value
. It will replace an existing component if present.
sourcepub fn set_default<T: SupportedValue + Default>(
&mut self,
component: Component<T>
)
pub fn set_default<T: SupportedValue + Default>( &mut self, component: Component<T> )
Sets the component
in this to the default value for T
.
sourcepub fn with<T: SupportedValue>(self, component: Component<T>, value: T) -> Self
pub fn with<T: SupportedValue>(self, component: Component<T>, value: T) -> Self
Adds component
to this with value
, and returns self
to allow for easy chaining.
sourcepub fn with_merge(self, other: impl Into<Entity>) -> Self
pub fn with_merge(self, other: impl Into<Entity>) -> Self
Merges in the other
Entity and returns this; any fields that were present in both will be replaced by other
’s.
sourcepub fn without<T: SupportedValue>(self, component: Component<T>) -> Self
pub fn without<T: SupportedValue>(self, component: Component<T>) -> Self
Removes component
to this with value
, and returns self
to allow for easy chaining.
sourcepub fn remove<T: SupportedValue>(
&mut self,
component: Component<T>
) -> Option<T>
pub fn remove<T: SupportedValue>( &mut self, component: Component<T> ) -> Option<T>
Removes the specified component from this, and returns the value if it was present.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Entity
impl<'de> Deserialize<'de> for Entity
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
source§impl PartialEq for Entity
impl PartialEq for Entity
impl StructuralPartialEq for Entity
Auto Trait Implementations§
impl RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl UnwindSafe for Entity
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