mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-26 13:22:40 +00:00
Update README.md
Added Quick State to the main readme file
This commit is contained in:
41
README.md
41
README.md
@@ -14,6 +14,47 @@
|
|||||||
**FlatBuffers** is a cross platform serialization library architected for
|
**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.
|
maximum memory efficiency. It allows you to directly access serialized data without parsing/unpacking it first, while still having great forwards/backwards compatibility.
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
1. Build the compiler for flatbuffers (`flatc`)
|
||||||
|
|
||||||
|
Use `cmake` to create the build files for your platform and then perform the compliation (Linux example).
|
||||||
|
|
||||||
|
```
|
||||||
|
cmake -G "Unix Makefiles"
|
||||||
|
make -j
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Define your flatbuffer schema (`.fbs`)
|
||||||
|
|
||||||
|
Write the [schema](https://flatbuffers.dev/flatbuffers_guide_writing_schema.html) to define the data you want to serialize. See [monster.fbs](https://github.com/google/flatbuffers/blob/master/samples/monster.fbs) for an example.
|
||||||
|
|
||||||
|
3. Generate code for your language(s)
|
||||||
|
|
||||||
|
Use the `flatc` compiler to take your schema and generate language-specific code:
|
||||||
|
|
||||||
|
```
|
||||||
|
./flatc --cpp --rust monster.fbs
|
||||||
|
```
|
||||||
|
|
||||||
|
Which generates `monster_generated.h` and `monster_generated.rs` files.
|
||||||
|
|
||||||
|
4. Serialize data
|
||||||
|
|
||||||
|
Use the generated code, as well as the `FlatBufferBuilder` to construct your serialized buffer. ([`C++` example](https://github.com/google/flatbuffers/blob/master/samples/sample_binary.cpp#L24-L56))
|
||||||
|
|
||||||
|
5. Transmit/store/save Buffer
|
||||||
|
|
||||||
|
Use your serialized buffer however you want. Send it to someone, save it for later, etc...
|
||||||
|
|
||||||
|
6. Read the data
|
||||||
|
|
||||||
|
Use the generated accessors to read the data from the serialized buffer.
|
||||||
|
|
||||||
|
It doesn't need to be the same language/schema version, FlatBuffers ensures the data is readable across languages and schema versions. See the [`Rust` example](https://github.com/google/flatbuffers/blob/master/samples/sample_binary.rs#L92-L106) reading the data written by `C++`.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
**Go to our [landing page][] to browse our documentation.**
|
**Go to our [landing page][] to browse our documentation.**
|
||||||
|
|
||||||
## Supported operating systems
|
## Supported operating systems
|
||||||
|
|||||||
Reference in New Issue
Block a user