Struct ambient_guest_bridge::ecs::Entity
source · pub struct Entity(/* private fields */);
Expand description
Implementations§
source§impl Entity
impl Entity
sourcepub fn has<T>(&self, component: Component<T>) -> boolwhere
T: SupportedValue,
pub fn has<T>(&self, component: Component<T>) -> boolwhere
T: SupportedValue,
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>(&self, component: Component<T>) -> Option<T>where
T: SupportedValue,
pub fn get<T>(&self, component: Component<T>) -> Option<T>where
T: SupportedValue,
Gets the data for component
in this, if it exists.
sourcepub fn get_ref<T>(&self, component: Component<T>) -> Option<&T>where
T: SupportedValueRef,
pub fn get_ref<T>(&self, component: Component<T>) -> Option<&T>where
T: SupportedValueRef,
Gets a reference to the data for component
in this, if it exists.
sourcepub fn set<T>(&mut self, component: Component<T>, value: T)where
T: SupportedValue,
pub fn set<T>(&mut self, component: Component<T>, value: T)where
T: SupportedValue,
Adds component
to this with value
. It will replace an existing component if present.
sourcepub fn set_default<T>(&mut self, component: Component<T>)where
T: SupportedValue + Default,
pub fn set_default<T>(&mut self, component: Component<T>)where
T: SupportedValue + Default,
Sets the component
in this to the default value for T
.
sourcepub fn with<T>(self, component: Component<T>, value: T) -> Entitywhere
T: SupportedValue,
pub fn with<T>(self, component: Component<T>, value: T) -> Entitywhere
T: SupportedValue,
Adds component
to this with value
, and returns self
to allow for easy chaining.
sourcepub fn with_merge(self, other: impl Into<Entity>) -> Entity
pub fn with_merge(self, other: impl Into<Entity>) -> Entity
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>(self, component: Component<T>) -> Entitywhere
T: SupportedValue,
pub fn without<T>(self, component: Component<T>) -> Entitywhere
T: SupportedValue,
Removes component
to this with value
, and returns self
to allow for easy chaining.
sourcepub fn remove<T>(&mut self, component: Component<T>) -> Option<T>where
T: SupportedValue,
pub fn remove<T>(&mut self, component: Component<T>) -> Option<T>where
T: SupportedValue,
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<Entity, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Entity, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Entity
impl PartialEq for Entity
source§impl Serialize for Entity
impl Serialize for Entity
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 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