[Rust] idl_gen_rust.cpp: (Option/required-aware codegen for unions) (#5850)
authorjrop <jrapodaca@gmail.com>
Mon, 4 May 2020 07:16:57 +0000 (01:16 -0600)
committerGitHub <noreply@github.com>
Mon, 4 May 2020 07:16:57 +0000 (00:16 -0700)
commite3cb07d321e28bdd913eac2a9ae70d131ec2cdb9
tree29b0b014a177bb56630d232329c8f773b9e4d251
parent712866d57b5e95b64858db31425816eb97ea7630
[Rust] idl_gen_rust.cpp: (Option/required-aware codegen for unions) (#5850)

* idl_gen_rust.cpp: Fix google/flatbuffers#5849 (Option/required-aware
codegen for unions)

The generated code was assuming that an Option is always returned by the
union-getter method: however, this is only true if the field is not
marked as `(required)`.

* idl_gen_rust.cpp: flip conditional

* idl_gen_rust.cpp: Add comment, as requested in review

The code added is not covered by the integration test
src/idl_gen_rust.cpp