pub struct Component<T: 'static> { /* private fields */ }
Expand description
Component key
Implementations§
Source§impl<T: 'static> Component<T>
impl<T: 'static> Component<T>
Sourcepub fn desc(&self) -> ComponentDesc
pub fn desc(&self) -> ComponentDesc
Returns an untyped description of the component key
Source§impl<T: ComponentValue + Default> Component<T>
impl<T: ComponentValue + Default> Component<T>
pub fn with_default(&self) -> Entity
Source§impl<T: ComponentValue> Component<T>
impl<T: ComponentValue> Component<T>
pub fn changed(self) -> ChangedQuery<T>
Methods from Deref<Target = ComponentDesc>§
Sourcepub fn path_last(&self) -> String
pub fn path_last(&self) -> String
The last segment of the component path. Do not use this as a unique identifier; use Self::path instead.
Sourcepub fn name(&self) -> Option<String>
pub fn name(&self) -> Option<String>
A human-friendly name, if available. Corresponds to the Name attribute.
Sourcepub fn description(&self) -> Option<String>
pub fn description(&self) -> Option<String>
A human-friendly description, if available. Corresponds to the Description attribute.
pub fn type_name(&self) -> &'static str
pub fn type_id(&self) -> TypeId
pub fn has_attribute<A: ComponentAttribute>(&self) -> bool
pub fn attribute<A: ComponentAttribute>(&self) -> Option<AttributeGuard<A>>
pub fn attributes(&self) -> AttributeStoreGuard
pub fn attributes_mut(&self) -> AttributeStoreGuardMut
pub fn as_debug<'a>(&self, value: &'a dyn Any) -> &'a dyn Debug
pub fn index(&self) -> u32
pub fn from_json(&self, value: &str) -> Result<ComponentEntry, Error>
Sourcepub fn to_json(&self, value: &ComponentEntry) -> Result<String, Error>
pub fn to_json(&self, value: &ComponentEntry) -> Result<String, Error>
Converts the value to json
pub fn create_buffer(&self) -> Box<dyn IComponentBuffer>
Trait Implementations§
Source§impl<'a, T: ComponentValue> ComponentQuery<'a> for Component<T>
impl<'a, T: ComponentValue> ComponentQuery<'a> for Component<T>
type Data = &'a T
type DataMut = &'a mut T
type DataCloned = T
fn write_component_ids(&self, set: &mut ComponentSet)
fn get_change_filtered(&self, _: &mut Vec<ComponentDesc>)
fn get_data(&self, world: &'a World, acc: &EntityAccessor) -> Self::Data
fn get_data_mut(&self, world: &'a World, acc: &EntityAccessor) -> Self::DataMut
fn get_data_cloned( &self, world: &'a World, acc: &EntityAccessor, ) -> Self::DataCloned
Source§impl<'de, T: ComponentValue> Deserialize<'de> for Component<T>
impl<'de, T: ComponentValue> Deserialize<'de> for Component<T>
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<T: 'static> From<Component<T>> for ComponentDesc
impl<T: 'static> From<Component<T>> for ComponentDesc
Source§impl<T: 'static> From<ComponentDesc> for Component<T>
impl<T: 'static> From<ComponentDesc> for Component<T>
Source§fn from(value: ComponentDesc) -> Self
fn from(value: ComponentDesc) -> Self
Converts to this type from the input type.
Source§impl<T: ComponentValue> Hash for Component<T>
impl<T: ComponentValue> Hash for Component<T>
Source§impl<T> Ord for Component<T>
impl<T> Ord for Component<T>
Source§impl<T> PartialEq<Component<T>> for ComponentDesc
impl<T> PartialEq<Component<T>> for ComponentDesc
Source§impl<T> PartialEq<ComponentDesc> for Component<T>
impl<T> PartialEq<ComponentDesc> for Component<T>
Source§impl<T> PartialOrd for Component<T>
impl<T> PartialOrd for Component<T>
Source§impl<T: ComponentValue> Serialize for Component<T>
impl<T: ComponentValue> Serialize for Component<T>
impl<T> Copy for Component<T>
impl<T> Eq for Component<T>
Auto Trait Implementations§
impl<T> Freeze for Component<T>
impl<T> RefUnwindSafe for Component<T>where
T: RefUnwindSafe,
impl<T> Send for Component<T>where
T: Send,
impl<T> Sync for Component<T>where
T: Sync,
impl<T> Unpin for Component<T>where
T: Unpin,
impl<T> UnwindSafe for Component<T>where
T: UnwindSafe,
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> ComponentValueBase for T
impl<T> ComponentValueBase for T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§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.Source§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> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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