Make Slot and SlotDuration transparent (#2999)

I have a use case that for safety requires all contained data structures
to be `#[repr(C)]` or `#[repr(transparent)]` and it seemed like
non-invasive change.
This commit is contained in:
Nazar Mokrynskyi
2024-01-19 23:20:18 +02:00
committed by GitHub
parent e02c5204b3
commit 4fb2a55904
@@ -26,6 +26,7 @@ use sp_timestamp::Timestamp;
/// Unit type wrapper that represents a slot.
#[derive(Debug, Encode, MaxEncodedLen, Decode, Eq, Clone, Copy, Default, Ord, Hash, TypeInfo)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(transparent)]
pub struct Slot(u64);
impl core::ops::Deref for Slot {
@@ -135,6 +136,7 @@ impl From<Slot> for u64 {
Eq,
TypeInfo,
)]
#[repr(transparent)]
pub struct SlotDuration(u64);
impl SlotDuration {