Skip to main content

Collatable

Trait Collatable 

Source
pub trait Collatable {
    // Required methods
    fn to_bytes(&self) -> Vec<u8> ;
    fn successor_bytes(&self) -> Option<Vec<u8>>;
    fn predecessor_bytes(&self) -> Option<Vec<u8>>;
    fn is_minimum(&self) -> bool;
    fn is_maximum(&self) -> bool;

    // Provided methods
    fn compare(&self, other: &Self) -> Ordering { ... }
    fn is_in_range(
        &self,
        lower: RangeBound<&Self>,
        upper: RangeBound<&Self>,
    ) -> bool { ... }
}
Expand description

Trait for types that support collation operations

Required Methods§

Source

fn to_bytes(&self) -> Vec<u8>

Convert the value to its binary representation for collation

Source

fn successor_bytes(&self) -> Option<Vec<u8>>

Returns the immediate successor’s binary representation if one exists

Source

fn predecessor_bytes(&self) -> Option<Vec<u8>>

Returns the immediate predecessor’s binary representation if one exists

Source

fn is_minimum(&self) -> bool

Returns true if this value represents a minimum bound in its domain

Source

fn is_maximum(&self) -> bool

Returns true if this value represents a maximum bound in its domain

Provided Methods§

Source

fn compare(&self, other: &Self) -> Ordering

Compare two values in the collation order

Source

fn is_in_range( &self, lower: RangeBound<&Self>, upper: RangeBound<&Self>, ) -> bool

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.

Implementations on Foreign Types§

Source§

impl Collatable for &str

Source§

impl Collatable for Literal

Source§

impl Collatable for f64

Source§

impl Collatable for i64

Implementors§