[−][src]Crate flatbuffers
FlatBuffers
A library for memory-efficient serialization of data.
This crate provides runtime support for the FlatBuffers format in the Rust programming language.
To use this crate, first generate code with the flatc
compiler, as described here: https://google.github.io/flatbuffers/
Then, include that code into your project.
Finally, add this crate to your Cargo.toml
.
At this time, Rust support is experimental, and APIs may change between minor versions.
At this time, to generate Rust code, you will need the latest master
version of flatc
, available from here: https://github.com/google/flatbuffers
(On OSX, you can install FlatBuffers from HEAD
with the Homebrew package manager.)
Structs
BackwardsSOffset | ForwardsSOffset is used by Follow to traverse a FlatBuffer: the pointer is incremented by the negative of the value contained in this type. |
FileIdentifier | FileIdentifier is used by Follow to traverse a FlatBuffer: the pointer is dereferenced into a byte slice, whose bytes are the file identifer value. |
FlatBufferBuilder | FlatBufferBuilder builds a FlatBuffer through manipulating its internal
state. It has an owned |
FollowStart | FollowStart wraps a Follow impl in a struct type. This can make certain programming patterns more ergonomic. |
ForwardsUOffset | ForwardsUOffset is used by Follow to traverse a FlatBuffer: the pointer is incremented by the value contained in this type. |
ForwardsVOffset | ForwardsVOffset is used by Follow to traverse a FlatBuffer: the pointer is incremented by the value contained in this type. |
SkipFileIdentifier | SkipFileIdentifier is used by Follow to traverse a FlatBuffer: the pointer is incremented by a fixed constant in order to skip over the file identifier value. |
SkipRootOffset | SkipRootOffset is used by Follow to traverse a FlatBuffer: the pointer is incremented by a fixed constant in order to skip over the root offset value. |
SkipSizePrefix | SkipSizePrefix is used by Follow to traverse a FlatBuffer: the pointer is incremented by a fixed constant in order to skip over the size prefix value. |
Table | |
TableFinishedWIPOffset | TableFinishedWIPOffset marks a WIPOffset as being for a finished table. |
TableUnfinishedWIPOffset | TableUnfinishedWIPOffset marks a WIPOffset as being for an unfinished table. |
UnionWIPOffset | UnionWIPOffset marks a WIPOffset as being for a union value. |
VTableWIPOffset | VTableWIPOffset marks a WIPOffset as being for a vtable. |
Vector | |
WIPOffset | WIPOffset contains an UOffsetT with a special meaning: it is the location of data relative to the end of an in-progress FlatBuffer. The FlatBufferBuilder uses this to track the location of objects in an absolute way. The impl of Push converts a WIPOffset into a ForwardsUOffset. |
Constants
Traits
EndianScalar | Trait for values that must be stored in little-endian byte order, but might be represented in memory as big-endian. Every type that implements EndianScalar is a valid FlatBuffers scalar value. |
Follow | Follow is a trait that allows us to access FlatBuffers in a declarative, type safe, and fast way. They compile down to almost no code (after optimizations). Conceptually, Follow lifts the offset-based access patterns of FlatBuffers data into the type system. This trait is used pervasively at read time, to access tables, vtables, vectors, strings, and all other data. At this time, Follow is not utilized much on the write path. |
Push | Trait to abstract over functionality needed to write values (either owned or referenced). Used in FlatBufferBuilder and implemented for generated types. |
SafeSliceAccess |
Functions
buffer_has_identifier | |
byte_swap_f32 | Swaps the bytes of an f32. |
byte_swap_f64 | Swaps the bytes of an f64. |
emplace_scalar | Place an EndianScalar into the provided mutable byte slice. Performs endian conversion, if necessary. |
field_index_to_field_offset | |
follow_cast_ref | |
get_root | |
get_size_prefixed_root | |
read_scalar | Read an EndianScalar from the provided byte slice. Performs endian conversion, if necessary. |
read_scalar_at | Read an EndianScalar from the provided byte slice at the specified location. Performs endian conversion, if necessary. |
Type Definitions
SOffsetT | SOffsetT is an i32 that is used by tables to reference their vtables. |
UOffsetT | UOffsetT is a u32 that is used by pervasively to represent both pointers and lengths of vectors. |
VOffsetT | VOffsetT is a i32 that is used by vtables to store field data. |