pub struct Card { /* private fields */ }
Expand description
Represents a tradable card.
Strictly speaking, this is just a bare-bones Entity
.
Implementations§
Source§impl Card
impl Card
Sourcepub fn new(
id: Snowflake,
component_manager: Arc<ComponentManager<Card>>,
components_attached: HashSet<TypeId>,
) -> Card
pub fn new( id: Snowflake, component_manager: Arc<ComponentManager<Card>>, components_attached: HashSet<TypeId>, ) -> Card
Create a new Card
instance.
Sourcepub fn generate(
snowflake_gen: &mut SnowflakeGenerator,
component_manager: Arc<ComponentManager<Card>>,
) -> Card
pub fn generate( snowflake_gen: &mut SnowflakeGenerator, component_manager: Arc<ComponentManager<Card>>, ) -> Card
Create an ‘empty’ Card
instance with a random ID.
Sourcepub fn component_manager(&self) -> &ComponentManager<Card>
pub fn component_manager(&self) -> &ComponentManager<Card>
Get a reference to this Card
’s associated ComponentManager
.
Trait Implementations§
Source§impl Entity for Card
impl Entity for Card
fn new( id: Snowflake, cm: Arc<ComponentManager<Card>>, components: HashSet<TypeId>, ) -> Card
Source§fn component_manager(&self) -> &ComponentManager<Card>
fn component_manager(&self) -> &ComponentManager<Card>
Gets a reference to the
ComponentManager
used to perform operations on this Entity.Source§fn components_attached(&self) -> &HashSet<TypeId>
fn components_attached(&self) -> &HashSet<TypeId>
Source§fn components_attached_mut(&mut self) -> &mut HashSet<TypeId>
fn components_attached_mut(&mut self) -> &mut HashSet<TypeId>
Gets a mutable reference to the
HashSet
of attached component
TypeId
s.fn preloaded_components( &self, ) -> &DashMap<TypeId, Box<dyn Component<Self> + Send + Sync + 'static>>
Source§fn dirty(&self) -> bool
fn dirty(&self) -> bool
Checks whether any
Components
have been modified
on this Entity.Source§fn get_component<T: Component<Self> + 'static>(
&self,
) -> Result<Option<T>, Error>
fn get_component<T: Component<Self> + 'static>( &self, ) -> Result<Option<T>, Error>
Gets a
Component
attached to this Entity.Source§fn set_component<T: Component<Self> + 'static>(
&mut self,
component: T,
) -> Result<(), Error>
fn set_component<T: Component<Self> + 'static>( &mut self, component: T, ) -> Result<(), Error>
Source§fn preload_component<T: Component<Self> + Sync + Send + 'static>(
&mut self,
component: T,
) -> Result<(), Error>
fn preload_component<T: Component<Self> + Sync + Send + 'static>( &mut self, component: T, ) -> Result<(), Error>
Source§fn has_component<T: Component<Self> + 'static>(&self) -> bool
fn has_component<T: Component<Self> + 'static>(&self) -> bool
Source§fn delete_component<T: Component<Self> + 'static>(
&mut self,
) -> Result<(), Error>
fn delete_component<T: Component<Self> + 'static>( &mut self, ) -> Result<(), Error>
Deletes an attached
Component
from this Entity.Source§fn clear_components(&mut self) -> Result<(), ClearComponentsError>
fn clear_components(&mut self) -> Result<(), ClearComponentsError>
Delete all
Components
attached to this Entity. Read moreimpl Component<Card> for AttachedCardType
Auto Trait Implementations§
impl Freeze for Card
impl !RefUnwindSafe for Card
impl Send for Card
impl Sync for Card
impl Unpin for Card
impl !UnwindSafe for Card
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> 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.