Trait specs_static::Id
[−]
[src]
pub trait Id: Copy + Eq + Hash + Ord + Send + Sync + Sized + 'static { fn from_u32(value: u32) -> Self; fn id(&self) -> u32; }
The ids component storages are indexed with. This is mostly just a newtype wrapper with a u32
in it.
Examples
use specs_static::Id; #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct MyAmazingId(pub u32); impl Id for MyAmazingId { fn from_u32(value: u32) -> Self { MyAmazingId(value) } fn id(&self) -> u32 { self.0 } }
Required Methods
fn from_u32(value: u32) -> Self
Creates an idea from a u32
.
fn id(&self) -> u32
Returns the id
integer value.