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

@@ -2703,6 +2703,10 @@ class RustGenerator : public BaseGenerator {
"{{STRUCT_TY}} as *const u8, Self::size());";
code_ += " dst.copy_from_slice(src);";
code_ += " }";
code_ += " #[inline]";
code_ += " fn alignment() -> flatbuffers::PushAlignment {";
code_ += " flatbuffers::PushAlignment::new({{ALIGN}})";
code_ += " }";
code_ += "}";
code_ += "";