pub struct Vals<O, V> {
    pub offs: O,
    pub vals: V,
}
Expand description

A container for non-empty lists of values.

Fields§

§offs: O

Offsets used to provide indexes from keys to values.

The length of this list is one longer than keys, so that we can avoid bounds logic.

§vals: V

Concatenated ordered lists of values, bracketed by offsets in offs.

Implementations§

Source§

impl<O: for<'a> BatchContainer<ReadItem<'a> = usize>, V: BatchContainer> Vals<O, V>

Source

pub fn bounds(&self, index: usize) -> (usize, usize)

Lower and upper bounds in self.vals of the indexed list.

Source

pub fn get_rel(&self, list_idx: usize, item_idx: usize) -> V::ReadItem<'_>

Retrieves a value using relative indexes.

The first index identifies a list, and the second an item within the list. The method adds the list’s lower bound to the item index, and then calls get_abs. Using absolute indexes within the list’s bounds can be more efficient than using relative indexing.

Source

pub fn len(&self) -> usize

Number of lists in the container.

Source

pub fn get_abs(&self, index: usize) -> V::ReadItem<'_>

Retrieves a value using an absolute rather than relative index.

Source

pub fn with_capacity(o_size: usize, v_size: usize) -> Self

Allocates with capacities for a number of lists and values.

Source

pub fn merge_capacity(this: &Self, that: &Self) -> Self

Allocates with enough capacity to contain two inputs.

Trait Implementations§

Source§

impl<O: Debug, V: Debug> Debug for Vals<O, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<O: for<'a> BatchContainer<ReadItem<'a> = usize>, V: BatchContainer> Default for Vals<O, V>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, O, V> Deserialize<'de> for Vals<O, V>
where O: Deserialize<'de>, V: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<O, V> Serialize for Vals<O, V>
where O: Serialize, V: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<O, V> Freeze for Vals<O, V>
where O: Freeze, V: Freeze,

§

impl<O, V> RefUnwindSafe for Vals<O, V>

§

impl<O, V> Send for Vals<O, V>
where O: Send, V: Send,

§

impl<O, V> Sync for Vals<O, V>
where O: Sync, V: Sync,

§

impl<O, V> Unpin for Vals<O, V>
where O: Unpin, V: Unpin,

§

impl<O, V> UnwindSafe for Vals<O, V>
where O: UnwindSafe, V: UnwindSafe,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<'a, S, T> Semigroup<&'a S> for T
where T: Semigroup<S>,

Source§

fn plus_equals(&mut self, rhs: &&'a S)

The method of std::ops::AddAssign, for types that do not implement AddAssign.
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,