[][src]Struct rdx::util::PartitionInfo

pub struct PartitionInfo {
    pub count_or_offset: usize,
    pub next_offset: usize,
}

Partition information for an array

Fields

count_or_offset: usize

The beginning of a partition or the number of elements which should be in a partition depending on the phase of the algorithm.

next_offset: usize

The end of the partition

Methods

impl PartitionInfo[src]

pub fn slice_offset<T>(slice: &[T], offset: usize) -> PartitionInfo[src]

Create a partition for a given slice at a given offset

pub fn slice<'a, T>(&self, slice: &'a [T]) -> &'a [T][src]

Get a slice of a partition from an array

pub fn slice_mut<'a, T>(&self, slice: &'a mut [T]) -> &'a mut [T][src]

Get a mutable slice of a partition from an array

pub fn end<'a, T>(&self, slice: &'a [T]) -> &'a [T][src]

Get a slice up to the end of a partition from an array

pub fn end_mut<'a, T>(&self, slice: &'a mut [T]) -> &'a mut [T][src]

Get a mutable slice up to the end of a partition from an array

pub fn filter<T, P>(&mut self, slice: &mut [T], p: P) -> usize where
    P: Fn(&T) -> bool
[src]

Filter this partition, removing all elements satisfying predicate p and moving them to the old beginning of the partition. Return the number of elements removed.

pub fn filter_mut<T, P>(&mut self, slice: &mut [T], p: P) -> usize where
    P: FnMut(&T) -> bool
[src]

Filter this partition, removing all elements satisfying predicate p and moving them to the old beginning of the partition. Return the number of elements removed.

pub fn stack(&mut self, other: PartitionInfo)[src]

Set this partition's beginning to the other's end

pub fn len(&self) -> usize[src]

Get the length of this partition

pub fn is_valid<T>(&self, arr: &[T]) -> bool[src]

Check if this partition is valid

Trait Implementations

impl Clone for PartitionInfo[src]

impl Copy for PartitionInfo[src]

impl Debug for PartitionInfo[src]

impl Default for PartitionInfo[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.