Skip to main content

SliceMutSource

Struct SliceMutSource 

Source
pub struct SliceMutSource<'k, K> {
    pub slice: &'k mut [K],
    pub len: usize,
}
Expand description

Implements KeySet, storing keys in the mutable slice.

Retain operations reorder the slice, putting retained keys at the beginning of the slice.

Fields§

§slice: &'k mut [K]

All keys (retained ones occupy len beginning indices).

§len: usize

How many first keys are retained.

Implementations§

Source§

impl<'k, K> SliceMutSource<'k, K>

Source

pub fn new(slice: &'k mut [K]) -> Self

Trait Implementations§

Source§

impl<'k, K> From<&'k mut [K]> for SliceMutSource<'k, K>

Source§

fn from(slice: &'k mut [K]) -> Self

Converts to this type from the input type.
Source§

impl<'k, K: Sync> KeySet<K> for SliceMutSource<'k, K>

Source§

fn keys_len(&self) -> usize

Returns number of retained keys. Guarantee to be very fast.
Source§

fn has_par_for_each_key(&self) -> bool

Returns true only if Self::par_for_each_key can use multiple threads.
Source§

fn for_each_key<F, P>(&self, f: F, _retained_hint: P)
where F: FnMut(&K),

Call f for each key in the set, using single thread. Read more
Source§

fn par_for_each_key<F, P>(&self, f: F, _retained_hint: P)
where F: Fn(&K) + Sync + Send,

Multi-threaded version of for_each_key.
Source§

fn map_each_key<R, M, P>(&self, map: M, _retained_hint: P) -> Vec<R>
where M: FnMut(&K) -> R,

Calls map for each key in the set, and returns outputs of these calls. Uses single thread. Read more
Source§

fn par_map_each_key<R, M, P>(&self, map: M, _retained_hint: P) -> Vec<R>
where M: Fn(&K) -> R + Sync + Send, R: Send,

Multi-threaded version of map_each_key.
Source§

fn retain_keys<F, P, R>( &mut self, filter: F, _retained_hint: P, _remove_count: R, )
where F: FnMut(&K) -> bool,

Retains in self keys pointed by the filter and remove the rest, using single thread. Read more
Source§

fn maybe_par_map_each_key<R, M, P>( &self, map: M, retained_hint: P, use_mt: bool, ) -> Vec<R>
where M: Fn(&K) -> R + Sync + Send, R: Send, P: Fn(&K) -> bool + Sync + Send,

Calls either map_each_key (if use_mt is false) or par_map_each_key (if use_mt is true).
Source§

fn par_retain_keys<F, P, R>( &mut self, filter: F, retained_earlier: P, remove_count: R, )
where F: Fn(&K) -> bool + Sync + Send, P: Fn(&K) -> bool + Sync + Send, R: Fn() -> usize,

Multi-threaded version of retain_keys.
Source§

fn maybe_par_retain_keys<F, P, R>( &mut self, filter: F, retained_earlier: P, remove_count: R, use_mt: bool, )
where F: Fn(&K) -> bool + Sync + Send, P: Fn(&K) -> bool + Sync + Send, R: Fn() -> usize,

Calls either retain_keys (if use_mt is false) or par_retain_keys (if use_mt is true).
Source§

fn retain_keys_with_indices<IF, F, P, R>( &mut self, _index_filter: IF, filter: F, retained_earlier: P, remove_count: R, )
where IF: FnMut(usize) -> bool, F: FnMut(&K) -> bool, P: FnMut(&K) -> bool, R: FnMut() -> usize,

Retains in self keys pointed by the index_filter (or filter if self does not support index_filter) and remove the rest. Uses single thread. Read more
Source§

fn par_retain_keys_with_indices<IF, F, P, R>( &mut self, _index_filter: IF, filter: F, retained_earlier: P, remove_count: R, )
where IF: Fn(usize) -> bool + Sync + Send, F: Fn(&K) -> bool + Sync + Send, P: Fn(&K) -> bool + Sync + Send, R: Fn() -> usize,

Multi-threaded version of retain_keys_with_indices.
Source§

fn maybe_par_retain_keys_with_indices<IF, F, P, R>( &mut self, index_filter: IF, filter: F, retained_earlier: P, remove_count: R, use_mt: bool, )
where IF: Fn(usize) -> bool + Sync + Send, F: Fn(&K) -> bool + Sync + Send, P: Fn(&K) -> bool + Sync + Send, R: Fn() -> usize,

Calls either retain_keys_with_indices (if use_mt is false) or par_retain_keys_with_indices (if use_mt is true).
Source§

fn into_vec<P>(self, retained_hint: P) -> Vec<K>
where P: FnMut(&K) -> bool, K: Clone, Self: Sized,

Convert self into the vector of retained keys. Read more
Source§

fn par_into_vec<P>(self, retained_hint: P) -> Vec<K>
where P: Fn(&K) -> bool + Sync + Send, Self: Sized, K: Clone + Send,

Multi-threaded version of into_vec.

Auto Trait Implementations§

§

impl<'k, K> Freeze for SliceMutSource<'k, K>

§

impl<'k, K> RefUnwindSafe for SliceMutSource<'k, K>
where K: RefUnwindSafe,

§

impl<'k, K> Send for SliceMutSource<'k, K>
where K: Send,

§

impl<'k, K> Sync for SliceMutSource<'k, K>
where K: Sync,

§

impl<'k, K> Unpin for SliceMutSource<'k, K>

§

impl<'k, K> UnsafeUnpin for SliceMutSource<'k, K>

§

impl<'k, K> !UnwindSafe for SliceMutSource<'k, K>

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

Source§

fn cast_from(value: T) -> T

Call Self as W
Source§

impl<T, U> CastableInto<U> for T
where U: CastableFrom<T>,

Source§

fn cast(self) -> U

Call W::cast_from(self)
Source§

impl<T> DowncastableFrom<T> for T

Source§

fn downcast_from(value: T) -> T

Truncate the current UnsignedInt to a possibly smaller size
Source§

impl<T, U> DowncastableInto<U> for T
where U: DowncastableFrom<T>,

Source§

fn downcast(self) -> U

Call W::downcast_from(self)
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<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Splat<T> for T

Source§

fn splat(value: T) -> T

Source§

impl<T> To<T> for T

Source§

fn to(self) -> T

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

Source§

fn upcast_from(value: T) -> T

Extend the current UnsignedInt to a possibly bigger size.
Source§

impl<T, U> UpcastableInto<U> for T
where U: UpcastableFrom<T>,

Source§

fn upcast(self) -> U

Call W::upcast_from(self)
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V