blob: deb8ff740de062d87dafe2dc55153e5d57e55c23 [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.
James Kuszmaul8e62b022022-03-22 09:33:25 -070022//! To use this crate, first generate code with the `flatc` compiler, as described here: <https://google.github.io/flatbuffers/>
Austin Schuhe89fa2d2019-08-14 20:24:23 -070023//! 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//!
James Kuszmaul8e62b022022-03-22 09:33:25 -070028//! At this time, to generate Rust code, you will need the latest `master` version of `flatc`, available from here: <https://github.com/google/flatbuffers>
Austin Schuhe89fa2d2019-08-14 20:24:23 -070029//! (On OSX, you can install FlatBuffers from `HEAD` with the Homebrew package manager.)
30
James Kuszmaul3b15b0c2022-11-08 14:03:16 -080031#![cfg_attr(not(feature = "std"), no_std)]
32#![cfg_attr(all(nightly, not(feature = "std")), feature(error_in_core))]
James Kuszmaul8e62b022022-03-22 09:33:25 -070033
James Kuszmaul3b15b0c2022-11-08 14:03:16 -080034#[cfg(not(feature = "std"))]
James Kuszmaul8e62b022022-03-22 09:33:25 -070035extern crate alloc;
36
37mod array;
Austin Schuhe89fa2d2019-08-14 20:24:23 -070038mod builder;
39mod endian_scalar;
40mod follow;
James Kuszmaul8e62b022022-03-22 09:33:25 -070041mod get_root;
Austin Schuhe89fa2d2019-08-14 20:24:23 -070042mod primitives;
43mod push;
44mod table;
45mod vector;
James Kuszmaul8e62b022022-03-22 09:33:25 -070046mod verifier;
Austin Schuhe89fa2d2019-08-14 20:24:23 -070047mod vtable;
48mod vtable_writer;
49
James Kuszmaul8e62b022022-03-22 09:33:25 -070050pub use crate::array::{array_init, emplace_scalar_array, Array};
Austin Schuh272c6132020-11-14 16:37:52 -080051pub use crate::builder::FlatBufferBuilder;
James Kuszmaul3b15b0c2022-11-08 14:03:16 -080052pub use crate::endian_scalar::{emplace_scalar, read_scalar, read_scalar_at, EndianScalar};
Austin Schuh272c6132020-11-14 16:37:52 -080053pub use crate::follow::{Follow, FollowStart};
54pub use crate::primitives::*;
55pub use crate::push::Push;
James Kuszmaul8e62b022022-03-22 09:33:25 -070056pub use crate::table::{buffer_has_identifier, Table};
James Kuszmaul3b15b0c2022-11-08 14:03:16 -080057pub use crate::vector::{follow_cast_ref, Vector, VectorIter};
James Kuszmaul8e62b022022-03-22 09:33:25 -070058pub use crate::verifier::{
59 ErrorTraceDetail, InvalidFlatbuffer, SimpleToVerifyInSlice, Verifiable, Verifier,
60 VerifierOptions,
61};
Austin Schuh272c6132020-11-14 16:37:52 -080062pub use crate::vtable::field_index_to_field_offset;
James Kuszmaul8e62b022022-03-22 09:33:25 -070063pub use bitflags;
64pub use get_root::*;
Austin Schuhe89fa2d2019-08-14 20:24:23 -070065
Austin Schuhe89fa2d2019-08-14 20:24:23 -070066// TODO(rw): Split fill ops in builder into fill_small, fill_big like in C++.