pub type EntityIdU8<Tag> = EntityIdU8Inner<PhantomData<Tag>>;Expand description
A u8-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 EntityIdU8<Tag>(/* private fields */);Implementations§
Source§impl<Tag> EntityIdU8<Tag>
impl<Tag> EntityIdU8<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 EntityIdU8<Tag>
impl<Tag: EntityTagArith, Delta: EntityDelta> Add<Delta> for EntityIdU8<Tag>
Source§impl<Tag: EntityTagArith, Delta: EntityDelta> AddAssign<Delta> for EntityIdU8<Tag>
impl<Tag: EntityTagArith, Delta: EntityDelta> AddAssign<Delta> for EntityIdU8<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 EntityIdU8<Tag>
impl<Tag: EntityTag> Debug for EntityIdU8<Tag>
Source§impl<Tag: EntityTag> Display for EntityIdU8<Tag>
impl<Tag: EntityTag> Display for EntityIdU8<Tag>
Source§impl<Tag: EntityTag> EntityId for EntityIdU8<Tag>
impl<Tag: EntityTag> EntityId for EntityIdU8<Tag>
Source§impl<Tag: EntityTagArith> EntityIdArith for EntityIdU8<Tag>
impl<Tag: EntityTagArith> EntityIdArith for EntityIdU8<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 EntityIdU8<Tag>
impl<Tag: EntityTagArith> Sub for EntityIdU8<Tag>
Source§impl<Tag: EntityTagArith, Delta: EntityDelta> Sub<Delta> for EntityIdU8<Tag>
impl<Tag: EntityTagArith, Delta: EntityDelta> Sub<Delta> for EntityIdU8<Tag>
Source§impl<Tag: EntityTagArith, Delta: EntityDelta> SubAssign<Delta> for EntityIdU8<Tag>
impl<Tag: EntityTagArith, Delta: EntityDelta> SubAssign<Delta> for EntityIdU8<Tag>
Source§fn sub_assign(&mut self, x: Delta)
fn sub_assign(&mut self, x: Delta)
Performs the
-= operation. Read more