Struct PartitionState

pub(in ::slice::sort::stable::quicksort) struct PartitionState<T> { pub(in ::slice::sort::stable::quicksort) scratch_base: *mut T, pub(in ::slice::sort::stable::quicksort) scan: *const T, pub(in ::slice::sort::stable::quicksort) num_left: usize, pub(in ::slice::sort::stable::quicksort) scratch_rev: *mut T }

Fields

scratch_base: *mut T
scan: *const T
num_left: usize
scratch_rev: *mut T

Implementations

impl<T> PartitionState<T>

unsafe fn new(scan: *const T, scratch: *mut T, len: usize) -> Self

Safety

scan and scratch must point to valid disjoint buffers of length len. The scan buffer must be initialized.

unsafe fn partition_one(&mut self, towards_left: bool) -> *mut T

Depending on the value of towards_left this function will write a value to the growing left or right side of the scratch memory. This forms the branchless core of the partition.

Safety

This function may be called at most len times. If it is called exactly len times the scratch buffer then contains a copy of each element from the scan buffer exactly once - a permutation, and num_left <= len.

Auto Trait Implementations

impl<T> !Send for PartitionState<T>

impl<T> !Sync for PartitionState<T>

impl<T> Freeze for PartitionState<T> where *mut T: Freeze + Freeze, *const T: Freeze,

impl<T> RefUnwindSafe for PartitionState<T> where *mut T: RefUnwindSafe + RefUnwindSafe, *const T: RefUnwindSafe,

impl<T> Unpin for PartitionState<T> where *mut T: Unpin + Unpin, *const T: Unpin,

impl<T> UnsafeUnpin for PartitionState<T> where *mut T: UnsafeUnpin + UnsafeUnpin, *const T: UnsafeUnpin,

impl<T> UnwindSafe for PartitionState<T> where *mut T: UnwindSafe + UnwindSafe, *const T: UnwindSafe,

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> From<T> for PartitionState<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for PartitionState<T> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for PartitionState<T>

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

fn into(self) -> U

Calls U::from(self).

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

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

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

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

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