Formatter

Trait Formatter 

Source
pub trait Formatter {
    // Required methods
    fn key(key: &[u8]) -> String;
    fn value(key: &[u8], value: &[u8]) -> String;

    // Provided methods
    fn key_value(key: &[u8], row: impl AsRef<[u8]>) -> String { ... }
    fn key_maybe_value(key: &[u8], value: Option<impl AsRef<[u8]>>) -> String { ... }
}
Expand description

Formats encoded keys and values.

Required Methods§

Source

fn key(key: &[u8]) -> String

Formats a key.

Source

fn value(key: &[u8], value: &[u8]) -> String

Formats a value. Also takes the key to determine the ty of value.

Provided Methods§

Source

fn key_value(key: &[u8], row: impl AsRef<[u8]>) -> String

Formats a key/encoded pair.

Source

fn key_maybe_value(key: &[u8], value: Option<impl AsRef<[u8]>>) -> String

Formats a key/encoded pair, where the value may not exist.

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§