Skip to main content

CollationProvider

Trait CollationProvider 

Source
pub trait CollationProvider: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn compare(&self, a: &str, b: &str) -> Ordering;

    // Provided methods
    fn supports_substring_search(&self) -> bool { ... }
    fn normalize(&self, s: &str) -> String { ... }
}
Expand description

A custom collation — sort order for string comparison.

Required Methods§

Source

fn name(&self) -> &str

Collation name ("icu.en_US", "case_insensitive_ascii", …).

Source

fn compare(&self, a: &str, b: &str) -> Ordering

Compare two strings under this collation.

Provided Methods§

Whether this collation supports substring search (for FTS / LIKE compatibility).

Source

fn normalize(&self, s: &str) -> String

Canonicalize a string for index lookups (e.g., lowercase + NFC).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§