pub enum DecodedValue<'a> {
    Null(),
    Bool(bool),
    Int(i64),
    Float(f32),
    Double(f64),
    String(&'a [u8]),
    Object(DecodedObject<'a>),
    Array(DecodedArray<'a>),
}
Expand description

The central data type of Binary. It is modelled similar to JSON, however, contains a couple of noteworthy differences.

The differences with JSON:

  • Floats are either 32-bits or 64-bits;
  • All strings are u8: they can contain both text or binary data.

Variants

Null()

Bool(bool)

Int(i64)

Signed 64-bits integer (that is packed into smaller value in the wire format if possible).

Float(f32)

32-bits float type.

Double(f64)

64-bits float type.

String(&'a [u8])

Can be both binary data as regular strings. So not necessary UTF-8 (like Rust strings).

Object(DecodedObject<'a>)

Array(DecodedArray<'a>)

Implementations

Returns the size needed if we serialize the Binary to a binary wire-format. See DecodedValue::print_binary() for explanation of the compact argument.

Converts a Binary to a wire representation of that Binary. This wire representation can be sent to other implementations as it is stable and ‘endian safe’.

For objects we have a compact representation and one that inserts hints how to process the wire-representation faster when using an expression to evaluate the Binary to another value. This is controlled with the compact argument.

This function expects that the writer has enough room. The needed room can be queried beforehand by using the DecodedValue::size_of_binary.

Converts a Binary to a wire representation of that Binary, in a self contained ValueVec unsing DecodedValue::print_binary.

Converts a Binary to a wire representation of that Binary, in a self contained ValueVec unsing DecodedValue::print_binary.

Convert a Binary value to a JSON output.

Note that some Binary values can not be encoded, because not all strings can be encoded as UTF-8. If this is the case, this method will result in a Utf8Error.

Based on a variable length integer read for the wire, return the ValueType raw number.

Based on a variable length integer read for the wire, return the length of the current entry.

Parse the wire-format.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

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

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.