pub trait Id:
Copy
+ Eq
+ Hash
+ Ord
+ Send
+ Sync
+ Sized
+ 'static {
// Required methods
fn from_u32(value: u32) -> Self;
fn id(&self) -> u32;
}
Expand description
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§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.