Struct BucketArrayPair

Source
pub struct BucketArrayPair<'a, 'b, const N: usize, const CAP: usize, C: Count, A: Copy, B: Copy> { /* private fields */ }
Available on crate feature bucket-array only.
Expand description

Concrete binding between one [BucketState] and a pair of BucketArrayMemory

Implementations§

Source§

impl<'a, 'b, const N: usize, const CAP: usize, C: Count, A: Copy, B: Copy> BucketArrayPair<'a, 'b, N, CAP, C, A, B>

Source

pub fn new( mem_a: &'a mut BucketArrayMemory<N, CAP, A>, mem_b: &'b mut BucketArrayMemory<N, CAP, B>, ) -> Self

A new BucketArray wraps a new [BucketState] and two BucketArrayMemory

Source

pub fn item_range(&self, bucket: usize) -> Range<usize>

Look up the valid item range for a particular bucket.

Panics if the bucket index is out of range.

Source

pub fn item_value_first(&self, bucket: usize, item: usize) -> A

Look up the first value for one item in one bucket.

Panics if the indices are out of range.

Source

pub fn item_value_second(&self, bucket: usize, item: usize) -> B

Look up the second value for one item in one bucket.

Panics if the indices are out of range.

Source

pub fn insert(&mut self, bucket: usize, first: A, second: B) -> Result<(), ()>

Append a new item pair to a bucket.

If the bucket is full, returns Err(()) and makes no changes.

Source

pub fn drop_first(self) -> BucketArray<'b, N, CAP, C, B>

Transfer the [BucketState] to a new single BucketArray, keeping the second half and dropping the first.

Auto Trait Implementations§

§

impl<'a, 'b, const N: usize, const CAP: usize, C, A, B> Freeze for BucketArrayPair<'a, 'b, N, CAP, C, A, B>
where C: Freeze,

§

impl<'a, 'b, const N: usize, const CAP: usize, C, A, B> RefUnwindSafe for BucketArrayPair<'a, 'b, N, CAP, C, A, B>

§

impl<'a, 'b, const N: usize, const CAP: usize, C, A, B> Send for BucketArrayPair<'a, 'b, N, CAP, C, A, B>
where C: Send, A: Send, B: Send,

§

impl<'a, 'b, const N: usize, const CAP: usize, C, A, B> Sync for BucketArrayPair<'a, 'b, N, CAP, C, A, B>
where C: Sync, A: Sync, B: Sync,

§

impl<'a, 'b, const N: usize, const CAP: usize, C, A, B> Unpin for BucketArrayPair<'a, 'b, N, CAP, C, A, B>
where C: Unpin,

§

impl<'a, 'b, const N: usize, const CAP: usize, C, A, B> !UnwindSafe for BucketArrayPair<'a, 'b, N, CAP, C, A, B>

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

Source§

type Output = T

Should always be Self
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.