Trait Comparable

Source
pub trait Comparable<Q>: Equivalent<Q>
where Q: ?Sized,
{ // Required method fn compare(&self, key: &Q) -> Ordering; }
Expand description

Key ordering trait.

This trait allows ordered map lookup to be customized. It has one blanket implementation that uses the regular solution with Borrow and Ord, just like BTreeMap does, so that you can pass &str to lookup into a map with String keys and so on.

Required Methods§

Source

fn compare(&self, key: &Q) -> Ordering

Compare self to key and return their ordering.

Implementations on Foreign Types§

Source§

impl Comparable<VacantBuffer<'_>> for [u8]

Source§

fn compare(&self, other: &VacantBuffer<'_>) -> Ordering

Source§

impl Comparable<SliceRef<'_>> for &&[u8]

Source§

fn compare(&self, other: &SliceRef<'_>) -> Ordering

Source§

impl Comparable<SliceRef<'_>> for &Cow<'_, [u8]>

Source§

fn compare(&self, other: &SliceRef<'_>) -> Ordering

Source§

impl Comparable<SliceRef<'_>> for &Box<[u8]>

Source§

fn compare(&self, other: &SliceRef<'_>) -> Ordering

Source§

impl Comparable<SliceRef<'_>> for &Arc<[u8]>

Source§

fn compare(&self, other: &SliceRef<'_>) -> Ordering

Source§

impl Comparable<SliceRef<'_>> for &Vec<u8>

Source§

fn compare(&self, other: &SliceRef<'_>) -> Ordering

Source§

impl Comparable<SliceRef<'_>> for &[u8]

Source§

fn compare(&self, other: &SliceRef<'_>) -> Ordering

Source§

impl Comparable<SliceRef<'_>> for Cow<'_, [u8]>

Source§

fn compare(&self, other: &SliceRef<'_>) -> Ordering

Source§

impl Comparable<SliceRef<'_>> for Box<[u8]>

Source§

fn compare(&self, other: &SliceRef<'_>) -> Ordering

Source§

impl Comparable<SliceRef<'_>> for Arc<[u8]>

Source§

fn compare(&self, other: &SliceRef<'_>) -> Ordering

Source§

impl Comparable<SliceRef<'_>> for Vec<u8>

Source§

fn compare(&self, other: &SliceRef<'_>) -> Ordering

Source§

impl Comparable<SliceRef<'_>> for [u8]

Source§

fn compare(&self, key: &SliceRef<'_>) -> Ordering

Source§

impl Comparable<Str<'_>> for &&str

Source§

fn compare(&self, other: &Str<'_>) -> Ordering

Source§

impl Comparable<Str<'_>> for &Cow<'_, str>

Source§

fn compare(&self, other: &Str<'_>) -> Ordering

Source§

impl Comparable<Str<'_>> for &str

Source§

fn compare(&self, other: &Str<'_>) -> Ordering

Source§

impl Comparable<Str<'_>> for &Box<str>

Source§

fn compare(&self, other: &Str<'_>) -> Ordering

Source§

impl Comparable<Str<'_>> for &String

Source§

fn compare(&self, other: &Str<'_>) -> Ordering

Source§

impl Comparable<Str<'_>> for &Arc<str>

Source§

fn compare(&self, other: &Str<'_>) -> Ordering

Source§

impl Comparable<Str<'_>> for Cow<'_, str>

Source§

fn compare(&self, other: &Str<'_>) -> Ordering

Source§

impl Comparable<Str<'_>> for str

Source§

fn compare(&self, key: &Str<'_>) -> Ordering

Source§

impl Comparable<Str<'_>> for Box<str>

Source§

fn compare(&self, other: &Str<'_>) -> Ordering

Source§

impl Comparable<Str<'_>> for String

Source§

fn compare(&self, other: &Str<'_>) -> Ordering

Source§

impl Comparable<Str<'_>> for Arc<str>

Source§

fn compare(&self, other: &Str<'_>) -> Ordering

Source§

impl<const N: usize> Comparable<SliceRef<'_>> for &[u8; N]

Source§

fn compare(&self, other: &SliceRef<'_>) -> Ordering

Source§

impl<const N: usize> Comparable<SliceRef<'_>> for [u8; N]

Source§

fn compare(&self, other: &SliceRef<'_>) -> Ordering

Implementors§

Source§

impl Comparable<&&str> for Str<'_>

Source§

impl Comparable<&&[u8]> for SliceRef<'_>

Source§

impl Comparable<&Cow<'_, str>> for Str<'_>

Source§

impl Comparable<&Cow<'_, [u8]>> for SliceRef<'_>

Source§

impl Comparable<&str> for Str<'_>

Source§

impl Comparable<&Box<str>> for Str<'_>

Source§

impl Comparable<&Box<[u8]>> for SliceRef<'_>

Source§

impl Comparable<&String> for Str<'_>

Source§

impl Comparable<&Arc<str>> for Str<'_>

Source§

impl Comparable<&Arc<[u8]>> for SliceRef<'_>

Source§

impl Comparable<&Vec<u8>> for SliceRef<'_>

Source§

impl Comparable<&[u8]> for SliceRef<'_>

Source§

impl Comparable<Cow<'_, str>> for Str<'_>

Source§

impl Comparable<Cow<'_, [u8]>> for SliceRef<'_>

Source§

impl Comparable<Box<str>> for Str<'_>

Source§

impl Comparable<Box<[u8]>> for SliceRef<'_>

Source§

impl Comparable<String> for Str<'_>

Source§

impl Comparable<Arc<str>> for Str<'_>

Source§

impl Comparable<Arc<[u8]>> for SliceRef<'_>

Source§

impl Comparable<Vec<u8>> for SliceRef<'_>

Source§

impl<K, Q> Comparable<Q> for K
where K: Borrow<Q> + ?Sized, Q: Ord + ?Sized,

Source§

impl<const N: usize> Comparable<&[u8; N]> for SliceRef<'_>

Source§

impl<const N: usize> Comparable<[u8; N]> for SliceRef<'_>