pub type EntityIdU32<Tag> = EntityIdU32Inner<PhantomData<Tag>>;Expand description
A u32-sized id type.
The Tag generic parameter allows distinguishing IDs that are semantically of a different type.
The Tag must implement EntityTag. While implementing that trait, you may also
specify how the IDs with that tag should be displayed.
§Formatting
When formatting the ID with either the Debug ({:?}) or Display ({})
specifier, the numeric value will be prefixed by EntityTag::PREFIX. However, this
can be suppressed by using the {:#} format specifier, i.e. Display with the
alternate flag set.
struct ChipTag;
type ChipId = EntityIdU16<ChipTag>;
impl EntityTag for ChipTag {
const PREFIX: &'static str = "CHIP";
}
let n = ChipId::from_idx(3);
assert_eq!(format!("{}", n), "CHIP3");
assert_eq!(format!("{:?}", n), "CHIP3");
assert_eq!(format!("{:#}", n), "3");Aliased Type§
pub struct EntityIdU32<Tag>(/* private fields */);Implementations§
Source§impl<Tag> EntityIdU32<Tag>
impl<Tag> EntityIdU32<Tag>
pub const fn from_idx_const(idx: usize) -> Self
pub const fn to_idx_const(self) -> usize
Trait Implementations§
Source§impl<Tag: EntityTagArith, Delta: EntityDelta> Add<Delta> for EntityIdU32<Tag>
impl<Tag: EntityTagArith, Delta: EntityDelta> Add<Delta> for EntityIdU32<Tag>
Source§impl<Tag: EntityTagArith, Delta: EntityDelta> AddAssign<Delta> for EntityIdU32<Tag>
impl<Tag: EntityTagArith, Delta: EntityDelta> AddAssign<Delta> for EntityIdU32<Tag>
Source§fn add_assign(&mut self, x: Delta)
fn add_assign(&mut self, x: Delta)
Performs the
+= operation. Read moreSource§impl<Tag: EntityTag> Debug for EntityIdU32<Tag>
impl<Tag: EntityTag> Debug for EntityIdU32<Tag>
Source§impl<Tag: EntityTag> Display for EntityIdU32<Tag>
impl<Tag: EntityTag> Display for EntityIdU32<Tag>
Source§impl<Tag: EntityTag> EntityId for EntityIdU32<Tag>
impl<Tag: EntityTag> EntityId for EntityIdU32<Tag>
Source§impl<Tag: EntityTagArith> EntityIdArith for EntityIdU32<Tag>
impl<Tag: EntityTagArith> EntityIdArith for EntityIdU32<Tag>
fn range_until(self, other: Self) -> EntityRange<Self>
fn range_until_inclusive(self, other: Self) -> EntityRange<Self>
fn range_around(self, down: usize, up: usize) -> EntityRange<Self>
fn range_up(self, len: usize) -> EntityRange<Self>
fn range_down(self, len: usize) -> EntityRange<Self>
Source§impl<Tag: EntityTagArith> Sub for EntityIdU32<Tag>
impl<Tag: EntityTagArith> Sub for EntityIdU32<Tag>
Source§impl<Tag: EntityTagArith, Delta: EntityDelta> Sub<Delta> for EntityIdU32<Tag>
impl<Tag: EntityTagArith, Delta: EntityDelta> Sub<Delta> for EntityIdU32<Tag>
Source§impl<Tag: EntityTagArith, Delta: EntityDelta> SubAssign<Delta> for EntityIdU32<Tag>
impl<Tag: EntityTagArith, Delta: EntityDelta> SubAssign<Delta> for EntityIdU32<Tag>
Source§fn sub_assign(&mut self, x: Delta)
fn sub_assign(&mut self, x: Delta)
Performs the
-= operation. Read more