Rust: Fix lifetime in union _as_ accessors (#5140)

* Fix lifetime in union _as_ accessors

In the accessors for union field, the return value is implicitly taking the lifetime of &self.
This is irrelevant and prevents usages of the returned value, because it is needlessly bound to the parent field lifetime.

This patch makes the return value inherit the lifetime of the data, like other methods do.
2 files changed
tree: d1add74de52f286d49a18963686e473351ac5b58
  1. .appveyor/
  2. .bazelci/
  3. .github/
  4. .travis/
  5. android/
  6. CMake/
  7. conan/
  8. dart/
  9. docs/
  10. go/
  11. grpc/
  12. include/
  13. java/
  14. js/
  15. lobster/
  16. lua/
  17. net/
  18. php/
  19. python/
  20. reflection/
  21. rust/
  22. samples/
  23. src/
  24. tests/
  25. .clang-format
  26. .editorconfig
  27. .gitattributes
  28. .gitignore
  29. .travis.yml
  30. appveyor.yml
  31. BUILD
  32. build_defs.bzl
  33. CMakeLists.txt
  34. composer.json
  35. conanfile.py
  36. CONTRIBUTING.md
  37. LICENSE.txt
  38. package.json
  39. pom.xml
  40. readme.md
  41. WORKSPACE
readme.md

logo FlatBuffers

Join the chat at https://gitter.im/google/flatbuffers Build Status Build status

FlatBuffers is a cross platform serialization library architected for maximum memory efficiency. It allows you to directly access serialized data without parsing/unpacking it first, while still having great forwards/backwards compatibility.

Go to our landing page to browse our documentation.

Supported operating systems

  • Windows
  • MacOS X
  • Linux
  • Android
  • And any others with a recent C++ compiler.

Supported programming languages

  • C++
  • C#
  • C
  • Dart
  • Go
  • Java
  • JavaScript
  • Lobster
  • Lua
  • PHP
  • Python
  • Rust
  • TypeScript

and more in progress...

Contribution

To contribute to this project, see CONTRIBUTING.

Licensing

Flatbuffers is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.