mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-27 20:48:05 +00:00
[Rust] Ensure unions are referenced with the correct path (#6422)
* Add codegen test for namespaced unions * [Rust] Handle cross-namespace union use * [Rust] Test namespace handling * [Rust] Drop trailing whitespace in codegen * [Rust] Set flags in generate_code.bat to match .sh * [C#] Add additional namespace test file
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package NamespaceB
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
|
||||
NamespaceA__NamespaceB "NamespaceA/NamespaceB"
|
||||
)
|
||||
|
||||
type UnionInNestedNST struct {
|
||||
Type UnionInNestedNS
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
func (t *UnionInNestedNST) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil {
|
||||
return 0
|
||||
}
|
||||
switch t.Type {
|
||||
case UnionInNestedNSTableInNestedNS:
|
||||
return t.Value.(*NamespaceA__NamespaceB.TableInNestedNST).Pack(builder)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv UnionInNestedNS) UnPack(table flatbuffers.Table) *UnionInNestedNST {
|
||||
switch rcv {
|
||||
case UnionInNestedNSTableInNestedNS:
|
||||
x := TableInNestedNS{_tab: table}
|
||||
return &NamespaceA__NamespaceB.UnionInNestedNST{ Type: UnionInNestedNSTableInNestedNS, Value: x.UnPack() }
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user