blob: 3abd33b4a4e8eb8730f34f6d91f361f80cfc1ae7 [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001/*
2 * Copyright 2018 Google Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17//! # FlatBuffers
18//!
19//! A library for memory-efficient serialization of data.
20//!
21//! This crate provides runtime support for the FlatBuffers format in the Rust programming language.
22//! To use this crate, first generate code with the `flatc` compiler, as described here: https://google.github.io/flatbuffers/
23//! Then, include that code into your project.
24//! Finally, add this crate to your `Cargo.toml`.
25//!
26//! At this time, Rust support is experimental, and APIs may change between minor versions.
27//!
28//! At this time, to generate Rust code, you will need the latest `master` version of `flatc`, available from here: https://github.com/google/flatbuffers
29//! (On OSX, you can install FlatBuffers from `HEAD` with the Homebrew package manager.)
30
31mod builder;
32mod endian_scalar;
33mod follow;
34mod primitives;
35mod push;
36mod table;
37mod vector;
38mod vtable;
39mod vtable_writer;
40
Austin Schuh272c6132020-11-14 16:37:52 -080041pub use bitflags;
42pub use crate::builder::FlatBufferBuilder;
43pub use crate::endian_scalar::{
Austin Schuhe89fa2d2019-08-14 20:24:23 -070044 byte_swap_f32, byte_swap_f64, emplace_scalar, read_scalar, read_scalar_at, EndianScalar,
45};
Austin Schuh272c6132020-11-14 16:37:52 -080046pub use crate::follow::{Follow, FollowStart};
47pub use crate::primitives::*;
48pub use crate::push::Push;
49pub use crate::table::{buffer_has_identifier, get_root, get_size_prefixed_root, Table};
50pub use crate::vector::{follow_cast_ref, SafeSliceAccess, Vector, VectorIter};
51pub use crate::vtable::field_index_to_field_offset;
Austin Schuhe89fa2d2019-08-14 20:24:23 -070052
53// TODO(rw): Unify `create_vector` and `create_vector_direct` by using
54// `Into<Vector<...>>`.
55// TODO(rw): Split fill ops in builder into fill_small, fill_big like in C++.