use ALIGN for Push::alignment in struct types (#8398)

* use ALIGN for Push::alignment in struct types

* regenerate and add a test for struct alignment
This commit is contained in:
Benjamin Kietzman
2024-10-28 10:42:55 -05:00
committed by GitHub
parent 807adb73b2
commit 49061f8c7c
22 changed files with 89 additions and 1 deletions

View File

@@ -51,6 +51,10 @@ impl<'b> flatbuffers::Push for Ability {
let src = ::core::slice::from_raw_parts(self as *const Ability as *const u8, Self::size());
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4)
}
}
impl<'a> flatbuffers::Verifiable for Ability {

View File

@@ -52,6 +52,10 @@ impl<'b> flatbuffers::Push for StructOfStructs {
let src = ::core::slice::from_raw_parts(self as *const StructOfStructs as *const u8, Self::size());
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4)
}
}
impl<'a> flatbuffers::Verifiable for StructOfStructs {

View File

@@ -50,6 +50,10 @@ impl<'b> flatbuffers::Push for StructOfStructsOfStructs {
let src = ::core::slice::from_raw_parts(self as *const StructOfStructsOfStructs as *const u8, Self::size());
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4)
}
}
impl<'a> flatbuffers::Verifiable for StructOfStructsOfStructs {

View File

@@ -51,6 +51,10 @@ impl<'b> flatbuffers::Push for Test {
let src = ::core::slice::from_raw_parts(self as *const Test as *const u8, Self::size());
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(2)
}
}
impl<'a> flatbuffers::Verifiable for Test {

View File

@@ -55,6 +55,10 @@ impl<'b> flatbuffers::Push for Vec3 {
let src = ::core::slice::from_raw_parts(self as *const Vec3 as *const u8, Self::size());
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(8)
}
}
impl<'a> flatbuffers::Verifiable for Vec3 {

View File

@@ -50,6 +50,10 @@ impl<'b> flatbuffers::Push for Unused {
let src = ::core::slice::from_raw_parts(self as *const Unused as *const u8, Self::size());
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(4)
}
}
impl<'a> flatbuffers::Verifiable for Unused {