Struct KeyDef

Source
pub struct KeyDef { /* private fields */ }

Implementations§

Source§

impl KeyDef

Source

pub fn new(items: Vec<KeyDefItem>) -> Self

Create key definition with key fields with passed typed on passed positions. May be used for tuple format creation and/or tuple comparison.

  • items - array with key field identifiers and key field types (see FieldType)
Source

pub fn compare(&self, tuple_a: &Tuple, tuple_b: &Tuple) -> Ordering

Compare tuples using the key definition.

  • tuple_a - first tuple
  • tuple_b - second tuple

Returns:

  • Ordering::Equal if key_fields(tuple_a) == key_fields(tuple_b)
  • Ordering::Less if key_fields(tuple_a) < key_fields(tuple_b)
  • Ordering::Greater if key_fields(tuple_a) > key_fields(tuple_b)
Source

pub fn compare_with_key<K>(&self, tuple: &Tuple, key: &K) -> Ordering
where K: AsTuple,

Compare tuple with key using the key definition.

  • tuple - tuple
  • key - key with MessagePack array header

Returns:

  • Ordering::Equal if key_fields(tuple) == parts(key)
  • Ordering::Less if key_fields(tuple) < parts(key)
  • Ordering::Greater if key_fields(tuple) > parts(key)

Trait Implementations§

Source§

impl Drop for KeyDef

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for KeyDef

§

impl RefUnwindSafe for KeyDef

§

impl !Send for KeyDef

§

impl !Sync for KeyDef

§

impl Unpin for KeyDef

§

impl UnwindSafe for KeyDef

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.