Module bonsaidb::core::key

Expand description

Key trait and related types.

Modules

  • Key implementations for time types.

Structs

  • Prevents checking for null bytes in variable length fields in composite keys. Key types that have a fixed width have no edge cases with null bytes. See CompositeKeyFieldContainsNullByte for an explanation and example of the edge case introduced when allowing null bytes to be used without escaping.
  • Decodes multiple Key values from a byte slice previously encoded with CompositeKeyEncoder.
  • A description of a multi-field key encoded using CompositeKeyEncoder.
  • Encodes multiple KeyEncoding implementors into a single byte buffer, preserving the ordering guarantees necessary for Key.
  • An error occurred inside of one of the composite key fields.
  • Null bytes in variable fields encoded with CompositeKeyEncoder can cause sort order to misbehave.
  • Checks for null bytes when encoding variable length fields in composite keys and returns an error if any are encountered. This prevents extra processing when encoding fields, but may introduce incorrect sort ordering (see CompositeKeyFieldContainsNullByte for more).
  • Adds Key support to an enum. Requires implementing ToPrimitive and FromPrimitive, or using a crate like num-derive to do it automatically. Take care when using enums as keys: if the order changes or if the meaning of existing numerical values changes, make sure to update any related views’ version number to ensure the values are re-evaluated.
  • Escapes null bytes in variable length fields in composite keys. This option ensures proper sort order is maintained even when null bytes are used within vairable fields.
  • An error that indicates an unexpected number of bytes were present.
  • A Transmog Format implementation that uses Key to serialize and deserialize the contents.
  • OptionKeyV1Deprecated
    A type that preserves the original implementation of Key for Option<T>. This should not be used in new code and will be removed in a future version.
  • TupleEncodingV1Deprecated
    This type enables wrapping a tuple to preserve the behavior of the initial implementation of tuple key encoding. This type should not be used in new code and should only be used to preserve backwards compatibility. See https://github.com/khonsulabs/bonsaidb/issues/240 for more information about why this implementation should be avoided.
  • An error that indicates an unexpected enum variant value was found.
  • A wrapper type for Rust’s built-in integer types that encodes with variable length and implements the Key trait.

Enums

Traits

Functions

  • Decodes a value previously encoded using encode_composite_field(). The result is a tuple with the first element being the decoded value, and the second element is the remainig byte slice.
  • Encodes a value using the Key trait in such a way that multiple values can still be ordered at the byte level when chained together.

Derive Macros

  • Derives the bonsaidb::core::key::Key trait.