Struct specs::saveload::SimpleMarker
source · #[repr(transparent)]pub struct SimpleMarker<T: ?Sized>(/* private fields */);
Expand description
Basic marker implementation usable for saving and loading, uses u64
as
identifier
Trait Implementations§
source§impl<T: ?Sized> Clone for SimpleMarker<T>
impl<T: ?Sized> Clone for SimpleMarker<T>
source§impl<T> Component for SimpleMarker<T>where
T: 'static + ?Sized + Send + Sync,
impl<T> Component for SimpleMarker<T>where T: 'static + ?Sized + Send + Sync,
§type Storage = DenseVecStorage<SimpleMarker<T>>
type Storage = DenseVecStorage<SimpleMarker<T>>
Associated storage type for this component.
source§impl<T: ?Sized> Debug for SimpleMarker<T>
impl<T: ?Sized> Debug for SimpleMarker<T>
source§impl<'de, T: ?Sized> Deserialize<'de> for SimpleMarker<T>
impl<'de, T: ?Sized> Deserialize<'de> for SimpleMarker<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: ?Sized> Hash for SimpleMarker<T>
impl<T: ?Sized> Hash for SimpleMarker<T>
source§impl<T> Marker for SimpleMarker<T>where
T: 'static + ?Sized + Send + Sync,
impl<T> Marker for SimpleMarker<T>where T: 'static + ?Sized + Send + Sync,
§type Allocator = SimpleMarkerAllocator<T>
type Allocator = SimpleMarkerAllocator<T>
Allocator for this
Marker
§type Identifier = u64
type Identifier = u64
Id of the marker
source§impl<T> MarkerAllocator<SimpleMarker<T>> for SimpleMarkerAllocator<T>where
T: 'static + ?Sized + Send + Sync,
impl<T> MarkerAllocator<SimpleMarker<T>> for SimpleMarkerAllocator<T>where T: 'static + ?Sized + Send + Sync,
source§fn allocate(&mut self, entity: Entity, id: Option<u64>) -> SimpleMarker<T>
fn allocate(&mut self, entity: Entity, id: Option<u64>) -> SimpleMarker<T>
Allocates a new marker for a given entity.
If you don’t pass an id, a new unique id will be created.
source§fn retrieve_entity_internal(&self, id: u64) -> Option<Entity>
fn retrieve_entity_internal(&self, id: u64) -> Option<Entity>
Get an
Entity
by a marker identifier.
This function only accepts an id; it does not update the marker data. Read moresource§fn maintain(
&mut self,
entities: &EntitiesRes,
storage: &ReadStorage<'_, SimpleMarker<T>>
)
fn maintain( &mut self, entities: &EntitiesRes, storage: &ReadStorage<'_, SimpleMarker<T>> )
Maintain internal data. Cleanup if necessary.
source§fn retrieve_entity(
&mut self,
marker: M,
storage: &mut WriteStorage<'_, M>,
entities: &EntitiesRes
) -> Entity
fn retrieve_entity( &mut self, marker: M, storage: &mut WriteStorage<'_, M>, entities: &EntitiesRes ) -> Entity
Tries to retrieve an entity by the id of the marker;
if no entity has a marker with the same id, a new entity
will be created and
marker
will be inserted for it. Read moresource§impl<T: ?Sized> PartialEq<SimpleMarker<T>> for SimpleMarker<T>
impl<T: ?Sized> PartialEq<SimpleMarker<T>> for SimpleMarker<T>
source§impl<T: ?Sized> Serialize for SimpleMarker<T>
impl<T: ?Sized> Serialize for SimpleMarker<T>
impl<T: ?Sized> Copy for SimpleMarker<T>
impl<T: ?Sized> Eq for SimpleMarker<T>
Auto Trait Implementations§
impl<T: ?Sized> RefUnwindSafe for SimpleMarker<T>where T: RefUnwindSafe,
impl<T: ?Sized> Send for SimpleMarker<T>where T: Send,
impl<T: ?Sized> Sync for SimpleMarker<T>where T: Sync,
impl<T: ?Sized> Unpin for SimpleMarker<T>where T: Unpin,
impl<T: ?Sized> UnwindSafe for SimpleMarker<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> CallHasher for Twhere
T: Hash + ?Sized,
impl<T> CallHasher for Twhere T: Hash + ?Sized,
source§impl<C, M> ConvertSaveload<M> for Cwhere
C: Clone + Serialize + DeserializeOwned,
impl<C, M> ConvertSaveload<M> for Cwhere C: Clone + Serialize + DeserializeOwned,
§type Error = Infallible
type Error = Infallible
Error may occur during serialization or deserialization of component
source§fn convert_into<F>(
&self,
_: F
) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>where
F: FnMut(Entity) -> Option<M>,
fn convert_into<F>( &self, _: F ) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>where F: FnMut(Entity) -> Option<M>,
Convert this data type into serializable form (
Data
) using
entity to marker mapping functionsource§fn convert_from<F>(
data: <C as ConvertSaveload<M>>::Data,
_: F
) -> Result<C, <C as ConvertSaveload<M>>::Error>where
F: FnMut(M) -> Option<Entity>,
fn convert_from<F>( data: <C as ConvertSaveload<M>>::Data, _: F ) -> Result<C, <C as ConvertSaveload<M>>::Error>where F: FnMut(M) -> Option<Entity>,
Convert this data from a deserializable form (
Data
) using
entity to marker mapping function