Enum flexbuffers::FlexBufferType[][src]

#[repr(u8)]
pub enum FlexBufferType {
Show variants Null, Int, UInt, Float, Bool, Key, String, IndirectInt, IndirectUInt, IndirectFloat, Map, Vector, VectorInt, VectorUInt, VectorFloat, VectorKey, VectorString, VectorBool, VectorInt2, VectorUInt2, VectorFloat2, VectorInt3, VectorUInt3, VectorFloat3, VectorInt4, VectorUInt4, VectorFloat4, Blob,
}
Expand description

Represents all the valid types in a flexbuffer.

Flexbuffers supports heterogenous maps, heterogenous vectors, typed vectors, and fixed length typed vectors for some lengths and types. Rust types are converted into Flexbuffers via the Pushable trait.

For exact details see the internals document

Notes:

  • In the binary format, Each element of a Map or (heterogenous) Vector is stored with a byte describing its FlexBufferType and BitWidth.

  • Typed vectors do not store this extra type information and fixed length typed vectors do not store length. Whether a vector is stored as a typed vector or fixed length typed vector is determined dymaically from the given data.

  • Indirect numbers are stored as an offset instead of inline. Using indirect numbers instead of their inline counterparts in maps and typed vectors can reduce the minimum element width and therefore bytes used.

Variants

Null
Expand description

Nulls are represented with () in Rust.

Int
Expand description

Variable width signed integer: i8, i16, i32, i64

UInt
Expand description

Variable width unsigned integer: u8, u16, u32, u64

Float
Expand description

Variable width floating point: f32, f64

Bool
Key
Expand description

Null termintated, utf8 string. Typically used with Maps.

String
Expand description

Stored with a unsigned integer length, then UTF-8 bytes, and an extra null terminator that is not counted with the length.

IndirectInt
Expand description

An Int, stored by offset rather than inline. Indirect types can keep the bitwidth of a vector or map small when the inline value would have increased the bitwidth.

IndirectUInt
Expand description

A UInt, stored by offset rather than inline. Indirect types can keep the bitwidth of a vector or map small when the inline value would have increased the bitwidth.

IndirectFloat
Expand description

A Float, stored by offset rather than inline. Indirect types can keep the bitwidth of a vector or map small when the inline value would have increased the bitwidth.

Map
Expand description

Maps are like Vectors except elements are associated with, and sorted by, keys.

Vector
Expand description

Heterogenous Vector (stored with a type table).

VectorInt
Expand description

Homogenous Vector of Ints.

VectorUInt
Expand description

Homogenous Vector of UInts.

VectorFloat
Expand description

Homogenous Vector of Floats.

VectorKey
Expand description

Homogenous Vector of Keys.

VectorString
👎 Deprecated:

Please use Vector or VectorKey instead. See https://github.com/google/flatbuffers/issues/5627

Expand description

Homogenous Vector of Strings.

VectorBool
Expand description

Since the elements of a vector use the same BitWidth as the length, Blob is more efficient for >255 element boolean vectors.

VectorInt2
Expand description

Homogenous vector of two Ints

VectorUInt2
Expand description

Homogenous vector of two UInts

VectorFloat2
Expand description

Homogenous vector of two Floats

VectorInt3
Expand description

Homogenous vector of three Ints

VectorUInt3
Expand description

Homogenous vector of three UInts

VectorFloat3
Expand description

Homogenous vector of three Floats

VectorInt4
Expand description

Homogenous vector of four Ints

VectorUInt4
Expand description

Homogenous vector of four UInts

VectorFloat4
Expand description

Homogenous vector of four Floats

Blob
Expand description

An array of bytes. Stored with a variable width length.

Implementations

impl FlexBufferType[src]

pub fn is_inline(self) -> bool[src]

Returns true for flexbuffer types that are stored inline.

pub fn is_reference(self) -> bool[src]

Returns true for flexbuffer types that are stored by offset.

pub fn is_vector(self) -> bool[src]

Returns true if called on a map, vector, typed vector, or fixed length typed vector.

pub fn has_length_slot(self) -> bool[src]

True iff the binary format stores the length. This applies to Blob, String, Maps, and Vectors of variable length.

pub fn is_fixed_length_vector(self) -> bool[src]

Returns true if called on a fixed length typed vector.

pub fn typed_vector_type(self) -> Option<FlexBufferType>[src]

If called on a fixed type vector, returns the type of the elements.

pub fn fixed_length_vector_length(self) -> Option<usize>[src]

Return the length of the fixed length vector or None.

pub fn is_heterogenous(self) -> bool[src]

Returns true if self is a Map or Vector. Typed vectors are not heterogenous.

pub fn to_direct(self) -> Option<Self>[src]

If self is an indirect scalar, remap it to the scalar. Otherwise do nothing.

pub fn is_null(self) -> bool[src]

pub fn is_int(self) -> bool[src]

pub fn is_uint(self) -> bool[src]

pub fn is_float(self) -> bool[src]

pub fn is_bool(self) -> bool[src]

pub fn is_key(self) -> bool[src]

pub fn is_string(self) -> bool[src]

pub fn is_indirect_int(self) -> bool[src]

pub fn is_indirect_uint(self) -> bool[src]

pub fn is_indirect_float(self) -> bool[src]

pub fn is_map(self) -> bool[src]

pub fn is_heterogenous_vector(self) -> bool[src]

pub fn is_vector_int(self) -> bool[src]

pub fn is_vector_uint(self) -> bool[src]

pub fn is_vector_float(self) -> bool[src]

pub fn is_vector_key(self) -> bool[src]

pub fn is_vector_string(self) -> bool[src]

pub fn is_vector_bool(self) -> bool[src]

pub fn is_vector_int2(self) -> bool[src]

pub fn is_vector_uint2(self) -> bool[src]

pub fn is_vector_float2(self) -> bool[src]

pub fn is_vector_int3(self) -> bool[src]

pub fn is_vector_uint3(self) -> bool[src]

pub fn is_vector_float3(self) -> bool[src]

pub fn is_vector_int4(self) -> bool[src]

pub fn is_vector_uint4(self) -> bool[src]

pub fn is_vector_float4(self) -> bool[src]

pub fn is_blob(self) -> bool[src]

Trait Implementations

impl Clone for FlexBufferType[src]

fn clone(&self) -> FlexBufferType[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for FlexBufferType[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for FlexBufferType[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl<'de> Deserialize<'de> for FlexBufferType[src]

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl PartialEq<FlexBufferType> for FlexBufferType[src]

fn eq(&self, other: &FlexBufferType) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl Serialize for FlexBufferType[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl TryFrom<u8> for FlexBufferType[src]

type Error = TryFromPrimitiveError<Self>

The type returned in the event of a conversion error.

fn try_from(number: u8) -> Result<Self, TryFromPrimitiveError<Self>>[src]

Performs the conversion.

impl TryFromPrimitive for FlexBufferType[src]

type Primitive = u8

const NAME: &'static str[src]

fn try_from_primitive(
    number: Self::Primitive
) -> Result<Self, TryFromPrimitiveError<Self>>
[src]

impl Copy for FlexBufferType[src]

impl Eq for FlexBufferType[src]

impl StructuralEq for FlexBufferType[src]

impl StructuralPartialEq for FlexBufferType[src]

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]