mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-23 05:50:01 +00:00
fix(flatbuffers): use manual impl Default for struct object types (#8947)
* fix(flatbuffers): use manual impl Default for struct object types * fix: handle bool and float zero literals in struct object Default impl * fix: regenerate all test bindings with generate_code.py * fix: data type check on swift build * fix: test large array on struct and enum
This commit is contained in:
@@ -179,13 +179,23 @@ impl<'a> NestedStruct {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct NestedStructT {
|
||||
pub a: [i32; 2],
|
||||
pub b: TestEnum,
|
||||
pub c: [TestEnum; 2],
|
||||
pub d: [i64; 2],
|
||||
}
|
||||
impl Default for NestedStructT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
a: [0; 2],
|
||||
b: TestEnum::A,
|
||||
c: ::flatbuffers::array_init(|_| Default::default()),
|
||||
d: [0; 2],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl NestedStructT {
|
||||
pub fn pack(&self) -> NestedStruct {
|
||||
|
||||
Reference in New Issue
Block a user