[−][src]Enum flexbuffers::FlexBufferType
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
Nulls are represented with ()
in Rust.
Variable width signed integer: i8, i16, i32, i64
Variable width unsigned integer: u8, u16, u32, u64
Variable width floating point: f32, f64
Null termintated, utf8 string. Typically used with Map
s.
Stored with a unsigned integer length, then UTF-8 bytes, and an extra null terminator that is not counted with the length.
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.
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.
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.
Maps are like Vectors except elements are associated with, and sorted by, keys.
Heterogenous Vector (stored with a type table).
Homogenous Vector of Ints.
Homogenous Vector of UInts.
Homogenous Vector of Floats.
Homogenous Vector of Keys.
Please use Vector or VectorKey instead. See https://github.com/google/flatbuffers/issues/5627
Homogenous Vector of Strings.
Since the elements of a vector use the same BitWidth
as the length,
Blob is more efficient for >255 element boolean vectors.
Homogenous vector of two Ints
Homogenous vector of two UInts
Homogenous vector of two Floats
Homogenous vector of three Ints
Homogenous vector of three UInts
Homogenous vector of three Floats
Homogenous vector of four Ints
Homogenous vector of four UInts
Homogenous vector of four Floats
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]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for FlexBufferType
[src]
impl Debug for FlexBufferType
[src]
impl Default for FlexBufferType
[src]
impl<'de> Deserialize<'de> for FlexBufferType
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for FlexBufferType
[src]
impl PartialEq<FlexBufferType> for FlexBufferType
[src]
fn eq(&self, other: &FlexBufferType) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for FlexBufferType
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for FlexBufferType
[src]
impl StructuralPartialEq for FlexBufferType
[src]
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]
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]
number: Self::Primitive
) -> Result<Self, TryFromPrimitiveError<Self>>
Auto Trait Implementations
impl RefUnwindSafe for FlexBufferType
impl Send for FlexBufferType
impl Sync for FlexBufferType
impl Unpin for FlexBufferType
impl UnwindSafe for FlexBufferType
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,