constructors for aligned
This commit is contained in:
@@ -2,6 +2,16 @@
|
|||||||
pub struct Align<const ALIGNMENT: usize>( <Self as Aligned>::Alignment ) where Self: Aligned;
|
pub struct Align<const ALIGNMENT: usize>( <Self as Aligned>::Alignment ) where Self: Aligned;
|
||||||
pub trait Aligned { type Alignment; }
|
pub trait Aligned { type Alignment; }
|
||||||
|
|
||||||
|
impl <const ALIGNMENT: usize> Align<ALIGNMENT> where Self: Aligned {
|
||||||
|
const fn new() -> Self { unsafe { core::mem::zeroed() } }
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl <const ALIGNMENT: usize> crate::data::Zeroed for Align<ALIGNMENT> where Self: Aligned {}
|
||||||
|
|
||||||
|
impl <const ALIGNMENT: usize> Default for Align<ALIGNMENT> where Self: Aligned {
|
||||||
|
fn default() -> Self { Self::new() }
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! gen_alignment {
|
macro_rules! gen_alignment {
|
||||||
($($alignment:literal),+) => {
|
($($alignment:literal),+) => {
|
||||||
$(
|
$(
|
||||||
|
|||||||
Reference in New Issue
Block a user