Skip to content

Commit

Permalink
use ALIGN for Push::alignment in struct types
Browse files Browse the repository at this point in the history
  • Loading branch information
bkietz committed Oct 7, 2024
1 parent 2f59a03 commit d3b781b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rust/flatbuffers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub use crate::builder::{Allocator, DefaultAllocator, FlatBufferBuilder};
pub use crate::endian_scalar::{emplace_scalar, read_scalar, read_scalar_at, EndianScalar};
pub use crate::follow::{Follow, FollowStart};
pub use crate::primitives::*;
pub use crate::push::Push;
pub use crate::push::{Push, PushAlignment};
pub use crate::table::{buffer_has_identifier, Table};
pub use crate::vector::{follow_cast_ref, Vector, VectorIter};
pub use crate::verifier::{
Expand Down
4 changes: 4 additions & 0 deletions src/idl_gen_rust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() -> PushAlignment {";
code_ += " PushAlignment::new({{ALIGN}})";
code_ += " }";
code_ += "}";
code_ += "";

Expand Down

0 comments on commit d3b781b

Please sign in to comment.