Trait tidb_query_datatype::codec::collation::Collator[][src]

pub trait Collator: 'static + Send + Sync + Debug {
    type Charset: Charset;
    type Weight: Unsigned;

    const IS_CASE_INSENSITIVE: bool;

    fn char_weight(char: <Self::Charset as Charset>::Char) -> Self::Weight;
fn write_sort_key<W: BufferWriter>(
        writer: &mut W,
        bstr: &[u8]
    ) -> Result<usize>;
fn sort_compare(a: &[u8], b: &[u8]) -> Result<Ordering>;
fn sort_hash<H: Hasher>(state: &mut H, bstr: &[u8]) -> Result<()>; fn sort_key(bstr: &[u8]) -> Result<Vec<u8>> { ... } }

Associated Types

type Charset: Charset[src]

type Weight: Unsigned[src]

Loading content...

Associated Constants

const IS_CASE_INSENSITIVE: bool[src]

Loading content...

Required methods

fn char_weight(char: <Self::Charset as Charset>::Char) -> Self::Weight[src]

Returns the weight of a given char. The chars that have equal weight are considered as the same char with this collation. See more on http://www.unicode.org/reports/tr10/#Weight_Level_Defn.

fn write_sort_key<W: BufferWriter>(writer: &mut W, bstr: &[u8]) -> Result<usize>[src]

Writes the SortKey of bstr into writer.

fn sort_compare(a: &[u8], b: &[u8]) -> Result<Ordering>[src]

Compares a and b based on their SortKey.

fn sort_hash<H: Hasher>(state: &mut H, bstr: &[u8]) -> Result<()>[src]

Hashes bstr based on its SortKey directly.

WARN: sort_hash(str) != hash(sort_key(str)).

Loading content...

Provided methods

fn sort_key(bstr: &[u8]) -> Result<Vec<u8>>[src]

Returns the SortKey of bstr as an owned byte vector.

Loading content...

Implementors

impl Collator for CollatorBinary[src]

impl Collator for CollatorLatin1Bin[src]

impl Collator for CollatorUtf8Mb4Bin[src]

impl Collator for CollatorUtf8Mb4BinNoPadding[src]

impl Collator for CollatorUtf8Mb4GeneralCi[src]

impl Collator for CollatorUtf8Mb4UnicodeCi[src]

Loading content...