From bb2fd32d27e98062f816c23893baa4809b2ce0c9 Mon Sep 17 00:00:00 2001 From: Intege-rs Date: Thu, 13 Mar 2025 15:49:29 -0400 Subject: [PATCH] constructors for aligned --- sub/core/src/align.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sub/core/src/align.rs b/sub/core/src/align.rs index db1d9db..739c557 100644 --- a/sub/core/src/align.rs +++ b/sub/core/src/align.rs @@ -2,6 +2,16 @@ pub struct Align( ::Alignment ) where Self: Aligned; pub trait Aligned { type Alignment; } +impl Align where Self: Aligned { + const fn new() -> Self { unsafe { core::mem::zeroed() } } +} + +unsafe impl crate::data::Zeroed for Align where Self: Aligned {} + +impl Default for Align where Self: Aligned { + fn default() -> Self { Self::new() } +} + macro_rules! gen_alignment { ($($alignment:literal),+) => { $(