Trait SeekKeyEncoder

Source
pub trait SeekKeyEncoder<S: Schema + ?Sized>: Sized {
    // Required method
    fn encode_seek_key(&self) -> Result<Vec<u8>>;
}
Expand description

This defines a type that can be used to seek a SchemaIterator, via interfaces like SchemaIterator::seek. Mind you, not all KeyEncoders shall be SeekKeyEncoders, and vice versa. E.g.:

  • Some key types don’t use an encoding that results in sensible seeking behavior under lexicographic ordering (what RocksDB uses by default), which means you shouldn’t implement SeekKeyEncoder at all.
  • Other key types might maintain full lexicographic order, which means the original key type can also be SeekKeyEncoder.
  • Other key types may be composite, and the first field alone may be a good candidate for SeekKeyEncoder.

Required Methods§

Source

fn encode_seek_key(&self) -> Result<Vec<u8>>

Converts self to bytes which is used to seek the underlying raw iterator.

If self is also a KeyEncoder, then SeekKeyEncoder::encode_seek_key MUST return the same bytes as KeyEncoder::encode_key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§