[][src]Struct flatbuffers_pool::FlatBufferBuilderPool

pub struct FlatBufferBuilderPool { /* fields omitted */ }

FlatBufferBuilder pool.

Examples

use flatbuffers_pool::FlatBufferBuilderPool;

let mut b = FlatBufferBuilderPool::get();
let name = b.create_string("something fun");
b.finish(name, None);

Methods

impl FlatBufferBuilderPool[src]

pub fn get() -> GlobalBuilder[src]

Get the FlatBufferBuilder from the global pool.

Examples

use flatbuffers_pool::FlatBufferBuilderPool;

let mut b = FlatBufferBuilderPool::get();
let name = b.create_string("something fun");
b.finish(name, None);

pub fn init_global_pool_size(size: usize)[src]

Change the initial global pool size.

It should be called before calling the first get function otherwise the change won't applicable.

Examples

use flatbuffers_pool::FlatBufferBuilderPool;

FlatBufferBuilderPool::init_global_pool_size(0);
let mut b = FlatBufferBuilderPool::get();
let name = b.create_string("something fun");
b.finish(name, None);

pub fn max_global_pool_size(size: usize)[src]

Change the maximum global pool size.

It should be called before calling the first get function otherwise the change won't applicable.

Examples

use flatbuffers_pool::FlatBufferBuilderPool;

FlatBufferBuilderPool::max_global_pool_size(4);
let mut b = FlatBufferBuilderPool::get();
let name = b.create_string("something fun");
b.finish(name, None);

pub fn global_buffer_capacity(capacity: usize)[src]

Change the initial FlatBufferBuilder buffer size.

The value only applicable for the newly allocated FlatBufferBuilder instances.

Examples

use flatbuffers_pool::FlatBufferBuilderPool;

FlatBufferBuilderPool::global_buffer_capacity(64);
let mut b = FlatBufferBuilderPool::get();
let name = b.create_string("something fun");
b.finish(name, None);

impl FlatBufferBuilderPool[src]

pub fn new() -> Self[src]

Create a local FlatBufferBuilder pool instance.

Examples

use flatbuffers_pool::FlatBufferBuilderPool;

// Get the builder from the local pool.
let mut pool = FlatBufferBuilderPool::new().build();
let mut b = pool.get();
let name = b.create_string("something fun");
b.finish(name, None);

pub fn init_pool_size(self, size: usize) -> Self[src]

Change the initial local pool size.

It should be called before calling the first get function otherwise the change won't applicable.

Examples

use flatbuffers_pool::FlatBufferBuilderPool;

// Get the builder from the local pool.
let pool = FlatBufferBuilderPool::new()
    .init_pool_size(0)
    .build();
let mut b = pool.get();
let name = b.create_string("something fun");
b.finish(name, None);

pub fn max_pool_size(self, size: usize) -> Self[src]

Change the maximum local pool size.

It should be called before calling the first get function otherwise the change won't applicable.

Examples

use flatbuffers_pool::FlatBufferBuilderPool;

// Get the builder from the local pool.
let pool = FlatBufferBuilderPool::new()
    .max_pool_size(4)
    .build();
let mut b = pool.get();
let name = b.create_string("something fun");
b.finish(name, None);

pub fn buffer_capacity(self, capacity: usize) -> Self[src]

Change the initial FlatBufferBuilder buffer size.

The value only applicable for the newly allocated FlatBufferBuilder instances.

Examples

use flatbuffers_pool::FlatBufferBuilderPool;

// Get the builder from the local pool.
let pool = FlatBufferBuilderPool::new()
    .buffer_capacity(64)
    .build();
let mut b = pool.get();
let name = b.create_string("something fun");
b.finish(name, None);

pub fn build<'a>(&self) -> FlatBufferBuilderLocalPool<'a>[src]

Build a local FlatBufferBuilder pool.

Examples

use flatbuffers_pool::FlatBufferBuilderPool;

// Get the builder from the local pool.
let pool = FlatBufferBuilderPool::new()
    .build();
let mut b = pool.get();
let name = b.create_string("something fun");
b.finish(name, None);

Trait Implementations

impl Default for FlatBufferBuilderPool[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.