Skip to main content

encode_index_key

Function encode_index_key 

Source
pub fn encode_index_key(
    spec: &IndexSpec,
    fields: &[Dynamic],
) -> Result<EncodedIndexKey>
Expand description

Encode fields into a single index key under the kind-specific rules.

  • Standard, Unique, Each: fields.len() must be 1; the output is the order-preserving encoding of that field, with no envelope tag. The caller appends the Id suffix for non-unique kinds.
  • Composite: fields.len() must equal spec.key_paths.len() (≥ 2 by IndexSpec::validate); the output is the composite-envelope tag (0x80) followed by the concatenated per-field encodings.

§Errors