[Rust] Add the Allocator trait for the builder API (#8106)

* Add an Allocator trait for FlatBufferBuilder

* Update rust generated code
This commit is contained in:
adsnaider
2023-10-07 14:28:52 -05:00
committed by GitHub
parent f4e23bf91e
commit 205285c35c
56 changed files with 658 additions and 449 deletions

View File

@@ -138,7 +138,7 @@ impl AnyT {
Self::MyGameExample2Monster(_) => Any::MyGame_Example2_Monster,
}
}
pub fn pack(&self, fbb: &mut flatbuffers::FlatBufferBuilder) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(&self, fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> {
match self {
Self::NONE => None,
Self::Monster(v) => Some(v.pack(fbb).as_union_value()),