pub trait ZeroVecLike<'a, T: ?Sized> {
    type GetType: ?Sized + 'static;
    type BorrowedVariant: ZeroVecLike<'a, T, GetType = Self::GetType> + BorrowedZeroVecLike<'a, T> + Copy;

Show 14 methods fn zvl_new() -> Self; fn zvl_binary_search(&self, k: &T) -> Result<usize, usize>
    where
        T: Ord
; fn zvl_binary_search_in_range(
        &self,
        k: &T,
        range: Range<usize>
    ) -> Option<Result<usize, usize>>
    where
        T: Ord
; fn zvl_binary_search_by(
        &self,
        predicate: impl FnMut(&T) -> Ordering
    ) -> Result<usize, usize>; fn zvl_get(&self, index: usize) -> Option<&Self::GetType>; fn zvl_len(&self) -> usize; fn zvl_is_ascending(&self) -> bool
    where
        T: Ord
; fn zvl_as_borrowed(&'a self) -> Self::BorrowedVariant; fn zvl_as_borrowed_inner(&self) -> Option<Self::BorrowedVariant>; fn zvl_from_borrowed(b: Self::BorrowedVariant) -> Self; fn zvl_get_as_t<R>(g: &Self::GetType, f: impl FnOnce(&T) -> R) -> R; fn zvl_is_empty(&self) -> bool { ... } fn t_cmp_get(t: &T, g: &Self::GetType) -> Ordering
    where
        T: Ord
, { ... } fn get_cmp_get(a: &Self::GetType, b: &Self::GetType) -> Ordering
    where
        T: Ord
, { ... }
}
Expand description

Trait abstracting over ZeroVec and VarZeroVec, for use in ZeroMap. You should not be implementing or calling this trait directly.

The T type is the type received by Self::zvl_binary_search(), as well as the one used for human-readable serialization.

Methods are prefixed with zvl_* to avoid clashes with methods on the types themselves

Required Associated Types

The type returned by Self::get()

A fully borrowed version of this

Required Methods

Create a new, empty vector

Search for a key in a sorted vector, returns Ok(index) if found, returns Err(insert_index) if not found, where insert_index is the index where it should be inserted to maintain sort order.

Search for a key within a certain range in a sorted vector. Returns None if the range is out of bounds, and Ok or Err in the same way as zvl_binary_search. Indices are returned relative to the start of the range.

Search for a key in a sorted vector by a predicate, returns Ok(index) if found, returns Err(insert_index) if not found, where insert_index is the index where it should be inserted to maintain sort order.

Get element at index

The length of this vector

Check if this vector is in ascending order according to Ts Ord impl

Construct a borrowed variant by borrowing from &self.

This function behaves like &'b self -> Self::BorrowedVariant<'b>, where 'b is the lifetime of the reference to this object.

Note: We rely on the compiler recognizing 'a and 'b as covariant and casting &'b Self<'a> to &'b Self<'b> when this gets called, which works out for ZeroVec and VarZeroVec containers just fine.

Extract the inner borrowed variant if possible. Returns None if the data is owned.

This function behaves like &'_ self -> Self::BorrowedVariant<'a>, where 'a is the lifetime of this object’s borrowed data.

This function is similar to matching the Borrowed variant of ZeroVec or VarZeroVec, returning the inner borrowed type.

Construct from the borrowed version of the type

These are useful to ensure serialization parity between borrowed and owned versions

Obtain a reference to T, passed to a closure

This uses a callback because it’s not possible to return owned-or-borrowed types without GATs

Provided Methods

Check if this vector is empty

Compare this type with a Self::GetType. This must produce the same result as if g were converted to Self

Compare two values of Self::GetType. This must produce the same result as if both a and b were converted to Self

Implementors