Struct flatbuffers::Builder [] [src]

pub struct Builder { /* fields omitted */ }

Builder provides functions to build Flatbuffer data.

A Builder constructs byte buffers in a last-first manner for simplicity and performance.

Methods

impl Builder
[src]

Start a new FlatBuffer Builder backed by a buffer with an initial capacity of size.

Start encoding a new object in the buffer.

finish off writing the object that is under construction.

Returns the offset of the object in the inside the buffer.

Initializes bookkeeping for writing a new vector.

finish off writing the current vector.

Finish off writing the current vector of length len.

Useful if you dont know the exact size of the vector when you start it.

Create a string in the buffer from an already encoded UTF-8 String.

Create a vector in the buffer from an already encoded byte vector.

Create a vector of UOffsetT in the buffer. This function will encode the values to LittleEndian.

Finalize a table, pointing to the given root_table.

Get a reference to the underlying buffer. Buffer starts from the first byte of useful data i.e. &[pos..].

Returns the current buffer and replaces it with a new_buffer.

Thie function facilitates some reuse of the Builder object. Use into() if the Builder is no longer required.

Resets the builder.

Clears the buffer without resizing. This allows for reuse without allocating new memeory.

Returns the length of the buffer.

Offset relative to the end of the buffer.

Returns the offset relative to the beggining of the buffer.

prepare to write an element of size after additional_bytes have been written.

pad places zeros at the current offset.

impl Builder
[src]

Add a bool to the buffer, backwards from the current location. Doesn't align nor check for space.

Add a byte to the buffer, backwards from the current location. Doesn't align nor check for space.

Add a value of type i8 to the buffer, backwards from the current location. Doesn't align nor check for space.

Add a value of type u16 to the buffer, backwards from the current location. Doesn't align nor check for space.

Add a value of type i16 to the buffer, backwards from the current location. Doesn't align nor check for space.

Add a value of type u32 to the buffer, backwards from the current location. Doesn't align nor check for space.

Add a value of type i32 to the buffer, backwards from the current location. Doesn't align nor check for space.

Add a value of type u64 to the buffer, backwards from the current location. Doesn't align nor check for space.

Add a value of type i64 to the buffer, backwards from the current location. Doesn't align nor check for space.

Add a value of type f32 to the buffer, backwards from the current location. Doesn't align nor check for space.

Add a value of type f64 to the buffer, backwards from the current location. Doesn't align nor check for space.

Add a value of type UOffsetT to the buffer, backwards from the current location. Doesn't align nor check for space.

Add a bool to the buffer, properly aligned, and grows the buffer (if necessary).

Add a value of type u8 to the buffer, properly aligned, and grows the buffer (if necessary).

Add a value of type i8 to the buffer, properly aligned, and grows the buffer (if necessary).

Add a value of type u16 to the buffer, properly aligned, and grows the buffer (if necessary).

Add a value of type i16 to the buffer, properly aligned, and grows the buffer (if necessary).

Add a value of type u32 to the buffer, properly aligned, and grows the buffer (if necessary).

Add a value of type i32 to the buffer, properly aligned, and grows the buffer (if necessary).

Add a value of type u64 to the buffer, properly aligned, and grows the buffer (if necessary).

Add a value of type i64 to the buffer, properly aligned, and grows the buffer (if necessary).

Add a value of type f32 to the buffer, properly aligned, and grows the buffer (if necessary).

Add a value of type f64 to the buffer, properly aligned, and grows the buffer (if necessary).

Add a value of type f64 to the buffer, properly aligned, and grows the buffer (if necessary). prepends an UOffsetT, relative to where it will be written.

Slot sets the vtable key voffset to the current location in the buffer.

Add a bool onto the object at vtable slot o. If value x equals default d, then the slot will be set to zero and no other data will be written.

Add a value of type u8 onto the object at vtable slot o. If value x equals default d, then the slot will be set to zero and no other data will be written.

Add a value of type i8 onto the object at vtable slot o. If value x equals default d, then the slot will be set to zero and no other data will be written.

Add a value of type u16 onto the object at vtable slot o. If value x equals default d, then the slot will be set to zero and no other data will be written.

Add a value of type i16 onto the object at vtable slot o. If value x equals default d, then the slot will be set to zero and no other data will be written.

Add a value of type u32 onto the object at vtable slot o. If value x equals default d, then the slot will be set to zero and no other data will be written.

Add a value of type i32 onto the object at vtable slot o. If value x equals default d, then the slot will be set to zero and no other data will be written.

Add a value of type u64 onto the object at vtable slot o. If value x equals default d, then the slot will be set to zero and no other data will be written.

Add a value of type i64 onto the object at vtable slot o. If value x equals default d, then the slot will be set to zero and no other data will be written.

Add a value of type f32 onto the object at vtable slot o. If value x equals default d, then the slot will be set to zero and no other data will be written.

Add a value of type f64 onto the object at vtable slot o. If value x equals default d, then the slot will be set to zero and no other data will be written.

Add a value of type UOffsetT onto the object at vtable slot o. If value x equals default d, then the slot will be set to zero and no other data will be written.

prepends an UOffsetT, relative to where it will be written.

PrependStructSlot prepends a struct onto the object at vtable slot o. Structs are stored inline, so nothing additional is being added. In generated code, d is always 0.

Place a u8 at pos relative to the beginning of the underlaying buffer.

Place a u32 with LittleEndian encoding at pos relative to the beginning of the underlaying buffer.

Place a i32 with LittleEndian encoding at pos relative to the beginning of the underlaying buffer.

Place a u64 with LittleEndian encoding at pos relative to the beginning of the underlaying buffer.

Check to assert finish has not been called.

Check to assert start_object has not been called.

Check to assert start_object has been called.

Helper method to read a VOffsetT at pos relative to the beginning of the underlying buffer - this may not be the start of any useful data. Use with offset() to get the UOffsetT of useful data.

Helper method to read a UOffsetT at pos relative to the beginning of the underlying buffer - this may not be the start of any useful data. Use with offset() to get the UOffsetT of useful data.

Doubles the size of the buffer.

Copies the old data towards the end of the new buffer (since we build the buffer backwards). Max buffer size is 2 Gigabytes - otherwise u16 index values might be invalid.

Trait Implementations

impl Debug for Builder
[src]

Formats the value using the given formatter.

impl Clone for Builder
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Default for Builder
[src]

Returns the "default value" for a type. Read more

impl Into<Vec<u8>> for Builder
[src]

Performs the conversion.