mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-25 09:18:38 +00:00
Rework enums in rust. (#6098)
* Rework enums in rust. They're now a unit struct, rather than an enum. This is a backwards incompatible change but the previous version had UB and was also backwards incompatible so... * Update and test sample rust flatbuffers * Use bitflags crate to properly support rust enums. Previously, the bitflags attribute was just ignored. This is a breaking change as the bitflgs API is not like a normal rust enum (duh). * variant_name() -> Option<_> * repr transparent * Reexport bitflags from flatbuffers * Make bitflags constants CamelCase, matching normal enums * Deprecate c-style associated enum constants Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
@@ -12,3 +12,4 @@ categories = ["encoding", "data-structures", "memory-management"]
|
||||
|
||||
[dependencies]
|
||||
smallvec = "1.0"
|
||||
bitflags = "1.2"
|
||||
|
||||
@@ -38,6 +38,7 @@ mod vector;
|
||||
mod vtable;
|
||||
mod vtable_writer;
|
||||
|
||||
pub use bitflags;
|
||||
pub use crate::builder::FlatBufferBuilder;
|
||||
pub use crate::endian_scalar::{
|
||||
byte_swap_f32, byte_swap_f64, emplace_scalar, read_scalar, read_scalar_at, EndianScalar,
|
||||
|
||||
Reference in New Issue
Block a user