Skip to content

Commit d6c7aa9

Browse files
committed
use ALIGN for Push::alignment in struct types
1 parent c7a8102 commit d6c7aa9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

rust/flatbuffers/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub use crate::builder::{Allocator, DefaultAllocator, FlatBufferBuilder};
5252
pub use crate::endian_scalar::{emplace_scalar, read_scalar, read_scalar_at, EndianScalar};
5353
pub use crate::follow::{Follow, FollowStart};
5454
pub use crate::primitives::*;
55-
pub use crate::push::Push;
55+
pub use crate::push::{Push, PushAlignment};
5656
pub use crate::table::{buffer_has_identifier, Table};
5757
pub use crate::vector::{follow_cast_ref, Vector, VectorIter};
5858
pub use crate::verifier::{

src/idl_gen_rust.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2703,6 +2703,10 @@ class RustGenerator : public BaseGenerator {
27032703
"{{STRUCT_TY}} as *const u8, Self::size());";
27042704
code_ += " dst.copy_from_slice(src);";
27052705
code_ += " }";
2706+
code_ += " #[inline]";
2707+
code_ += " fn alignment() -> PushAlignment {";
2708+
code_ += " PushAlignment::new({{ALIGN}})";
2709+
code_ += " }";
27062710
code_ += "}";
27072711
code_ += "";
27082712

0 commit comments

Comments
 (0)