mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-21 01:07:32 +00:00
Implement Rust object API defaults (#6444)
* Implment Rust object API defaults * satisfy return analysis * git clang format Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
@@ -491,10 +491,17 @@ impl std::fmt::Debug for TableInNestedNS<'_> {
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableInNestedNST {
|
||||
pub foo: i32,
|
||||
}
|
||||
impl Default for TableInNestedNST {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
foo: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TableInNestedNST {
|
||||
pub fn pack<'b>(
|
||||
&self,
|
||||
|
||||
@@ -491,10 +491,17 @@ impl std::fmt::Debug for TableInNestedNS<'_> {
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableInNestedNST {
|
||||
pub foo: i32,
|
||||
}
|
||||
impl Default for TableInNestedNST {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
foo: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TableInNestedNST {
|
||||
pub fn pack<'b>(
|
||||
&self,
|
||||
@@ -710,13 +717,23 @@ impl std::fmt::Debug for TableInFirstNS<'_> {
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableInFirstNST {
|
||||
pub foo_table: Option<Box<namespace_b::TableInNestedNST>>,
|
||||
pub foo_enum: namespace_b::EnumInNestedNS,
|
||||
pub foo_union: namespace_b::UnionInNestedNST,
|
||||
pub foo_struct: Option<namespace_b::StructInNestedNST>,
|
||||
}
|
||||
impl Default for TableInFirstNST {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
foo_table: None,
|
||||
foo_enum: namespace_b::EnumInNestedNS::A,
|
||||
foo_union: namespace_b::UnionInNestedNST::NONE,
|
||||
foo_struct: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TableInFirstNST {
|
||||
pub fn pack<'b>(
|
||||
&self,
|
||||
@@ -843,10 +860,17 @@ impl std::fmt::Debug for SecondTableInA<'_> {
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct SecondTableInAT {
|
||||
pub refer_to_c: Option<Box<super::namespace_c::TableInCT>>,
|
||||
}
|
||||
impl Default for SecondTableInAT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
refer_to_c: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl SecondTableInAT {
|
||||
pub fn pack<'b>(
|
||||
&self,
|
||||
@@ -993,11 +1017,19 @@ impl std::fmt::Debug for TableInC<'_> {
|
||||
}
|
||||
}
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TableInCT {
|
||||
pub refer_to_a1: Option<Box<super::namespace_a::TableInFirstNST>>,
|
||||
pub refer_to_a2: Option<Box<super::namespace_a::SecondTableInAT>>,
|
||||
}
|
||||
impl Default for TableInCT {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
refer_to_a1: None,
|
||||
refer_to_a2: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TableInCT {
|
||||
pub fn pack<'b>(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user