mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 06:30:19 +00:00
feat: Reflection implementations on Identifier (#13648)
# Objective - Follow-up on some changes in #11498 - Unblock using `Identifier` to replace `ComponentId` internals. ## Solution - Implement the same `Reflect` impls from `Entity` onto `Identifier` as they share same/similar purposes, ## Testing - No compile errors. Currently `Identifier` has no serialization impls, so there's no need to test a serialization/deserialization roundtrip to ensure correctness. --- ## Changelog ### Added - Reflection implementations on `Identifier`.
This commit is contained in:
parent
e6a0f75a63
commit
36f2542f63
1 changed files with 5 additions and 0 deletions
|
@ -3,6 +3,9 @@
|
|||
//! or other IDs that can be packed and expressed within a `u64` sized type.
|
||||
//! [`Identifier`]s cannot be created directly, only able to be converted from other
|
||||
//! compatible IDs.
|
||||
#[cfg(feature = "bevy_reflect")]
|
||||
use bevy_reflect::Reflect;
|
||||
|
||||
use self::{error::IdentifierError, kinds::IdKind, masks::IdentifierMask};
|
||||
use std::{hash::Hash, num::NonZeroU32};
|
||||
|
||||
|
@ -15,6 +18,8 @@ pub(crate) mod masks;
|
|||
/// segment, a 31-bit high segment, and the significant bit reserved as type flags to denote
|
||||
/// entity kinds.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[cfg_attr(feature = "bevy_reflect", derive(Reflect))]
|
||||
#[cfg_attr(feature = "bevy_reflect", reflect_value(Debug, Hash, PartialEq))]
|
||||
// Alignment repr necessary to allow LLVM to better output
|
||||
// optimised codegen for `to_bits`, `PartialEq` and `Ord`.
|
||||
#[repr(C, align(8))]
|
||||
|
|
Loading…
Reference in a new issue