Struct Segment

Source
pub struct Segment<'a, K, T>
where K: SegmentedOver<Target = T>, T: Ranged,
{ /* private fields */ }
Available on crate features arrayvec or alloc only.

Implementations§

Source§

impl<K, T, const N: usize> Segment<'_, K, ArrayVec<<K as ClosedArrayVec<N>>::Item, N>>
where K: ClosedArrayVec<N, Item = T> + SegmentedOver<Target = ArrayVec<T, N>>,

Source

pub fn truncate(&mut self, len: usize)

Available on crate feature arrayvec only.
Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&mut T) -> bool,

Available on crate feature arrayvec only.
Source

pub fn insert(&mut self, index: usize, item: T)

Available on crate feature arrayvec only.
Source

pub fn insert_back(&mut self, item: T)

Available on crate feature arrayvec only.
Source

pub fn remove(&mut self, index: usize) -> T

Available on crate feature arrayvec only.
Source

pub fn remove_back(&mut self) -> Option<T>

Available on crate feature arrayvec only.
Source

pub fn swap_remove(&mut self, index: usize) -> T

Available on crate feature arrayvec only.
Source

pub fn clear(&mut self)

Available on crate feature arrayvec only.
Source

pub fn len(&self) -> usize

Available on crate feature arrayvec only.
Source

pub fn as_slice(&self) -> &[T]

Available on crate feature arrayvec only.
Source

pub fn as_mut_slice(&mut self) -> &mut [T]

Available on crate feature arrayvec only.
Source

pub fn as_ptr(&self) -> *const T

Available on crate feature arrayvec only.
Source

pub fn as_mut_ptr(&mut self) -> *mut T

Available on crate feature arrayvec only.
Source

pub fn is_empty(&self) -> bool

Available on crate feature arrayvec only.
Source§

impl<T, K, V> Segment<'_, T, BTreeMap<<T as ClosedBTreeMap>::Key, <T as ClosedBTreeMap>::Value>>
where T: ClosedBTreeMap<Key = K, Value = V> + SegmentedOver<Target = BTreeMap<K, V>>, K: Clone + Ord,

Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&K, &mut V) -> bool,

Available on crate feature alloc only.
Source

pub fn insert_in_range(&mut self, key: K, value: V) -> Result<Option<V>, (K, V)>

Available on crate feature alloc only.
Source

pub fn append_in_range(&mut self, other: &mut BTreeMap<K, V>)

Available on crate feature alloc only.
Source

pub fn remove(&mut self, key: &K) -> Option<V>

Available on crate feature alloc only.
Source

pub fn clear(&mut self)

Available on crate feature alloc only.
Source

pub fn get(&self, key: &K) -> Option<&V>

Available on crate feature alloc only.
Source

pub fn first_key_value(&self) -> Option<(&K, &V)>

Available on crate feature alloc only.
Source

pub fn last_key_value(&self) -> Option<(&K, &V)>

Available on crate feature alloc only.
Source

pub fn contains_key(&self, key: &K) -> bool

Available on crate feature alloc only.
Source§

impl<K, T> Segment<'_, K, BTreeSet<<K as ClosedBTreeSet>::Item>>
where K: ClosedBTreeSet<Item = T> + SegmentedOver<Target = BTreeSet<T>>, T: Clone + Ord,

Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&T) -> bool,

Available on crate feature alloc only.
Source

pub fn insert_in_range(&mut self, item: T) -> Result<bool, T>

Available on crate feature alloc only.
Source

pub fn append_in_range(&mut self, other: &mut BTreeSet<T>)

Available on crate feature alloc only.
Source

pub fn remove(&mut self, item: &T) -> bool

Available on crate feature alloc only.
Source

pub fn take(&mut self, item: &T) -> Option<T>

Available on crate feature alloc only.
Source

pub fn clear(&mut self)

Available on crate feature alloc only.
Source

pub fn get(&self, item: &T) -> Option<&T>

Available on crate feature alloc only.
Source

pub fn first(&self) -> Option<&T>

Available on crate feature alloc only.
Source

pub fn last(&self) -> Option<&T>

Available on crate feature alloc only.
Source

pub fn contains(&self, item: &T) -> bool

Available on crate feature alloc only.
Source§

impl<T, K, V, S> Segment<'_, T, IndexMap<<T as ClosedIndexMap>::Key, <T as ClosedIndexMap>::Value, <T as ClosedIndexMap>::State>>
where T: ClosedIndexMap<Key = K, Value = V, State = S> + SegmentedOver<Target = IndexMap<K, V, S>>,

Source

pub fn truncate(&mut self, len: usize)

Available on crate feature indexmap only.
Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&K, &mut V) -> bool,

Available on crate feature indexmap only.
Source

pub fn move_index(&mut self, from: usize, to: usize)

Available on crate feature indexmap only.
Source

pub fn swap_indices(&mut self, a: usize, b: usize)

Available on crate feature indexmap only.
Source

pub fn shift_remove_index(&mut self, index: usize) -> Option<(K, V)>

Available on crate feature indexmap only.
Source

pub fn swap_remove_index(&mut self, index: usize) -> Option<(K, V)>

Available on crate feature indexmap only.
Source

pub fn clear(&mut self)

Available on crate feature indexmap only.
Source

pub fn len(&self) -> usize

Available on crate feature indexmap only.
Source§

impl<T, K, V, S> Segment<'_, T, IndexMap<<T as ClosedIndexMap>::Key, <T as ClosedIndexMap>::Value, <T as ClosedIndexMap>::State>>
where T: ClosedIndexMap<Key = K, Value = V, State = S> + SegmentedOver<Target = IndexMap<K, V, S>>, S: BuildHasher,

Source

pub fn contains_key<Q>(&self, query: &Q) -> bool
where Q: Equivalent<K> + Hash + ?Sized,

Available on crate feature indexmap only.
Source§

impl<K, T, S> Segment<'_, K, IndexSet<<K as ClosedIndexSet>::Item, <K as ClosedIndexSet>::State>>
where K: ClosedIndexSet<Item = T, State = S> + SegmentedOver<Target = IndexSet<T, S>>,

Source

pub fn truncate(&mut self, len: usize)

Available on crate feature indexmap only.
Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&T) -> bool,

Available on crate feature indexmap only.
Source

pub fn move_index(&mut self, from: usize, to: usize)

Available on crate feature indexmap only.
Source

pub fn swap_indices(&mut self, a: usize, b: usize)

Available on crate feature indexmap only.
Source

pub fn shift_remove_index(&mut self, index: usize) -> Option<T>

Available on crate feature indexmap only.
Source

pub fn swap_remove_index(&mut self, index: usize) -> Option<T>

Available on crate feature indexmap only.
Source

pub fn clear(&mut self)

Available on crate feature indexmap only.
Source

pub fn len(&self) -> usize

Available on crate feature indexmap only.
Source§

impl<K, T, S> Segment<'_, K, IndexSet<<K as ClosedIndexSet>::Item, <K as ClosedIndexSet>::State>>
where K: ClosedIndexSet<Item = T, State = S> + SegmentedOver<Target = IndexSet<T, S>>, T: Eq + Hash, S: BuildHasher,

Source

pub fn shift_insert(&mut self, index: usize, item: T) -> bool

Available on crate feature indexmap only.
Source§

impl<K, A, T> Segment<'_, K, SmallVec<<K as ClosedSmallVec>::Array>>
where K: ClosedSmallVec<Array = A> + SegmentedOver<Target = SmallVec<A>>, A: Array<Item = T>,

Source

pub fn resize(&mut self, len: usize, fill: T)
where T: Clone,

Available on crate feature smallvec only.
Source

pub fn resize_with<F>(&mut self, len: usize, f: F)
where F: FnMut() -> T,

Available on crate feature smallvec only.
Source

pub fn truncate(&mut self, len: usize)

Available on crate feature smallvec only.
Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&T) -> bool,

Available on crate feature smallvec only.
Source

pub fn retain_mut<F>(&mut self, f: F)
where F: FnMut(&mut T) -> bool,

Available on crate feature smallvec only.
Source

pub fn insert(&mut self, index: usize, item: T)

Available on crate feature smallvec only.
Source

pub fn insert_back(&mut self, item: T)

Available on crate feature smallvec only.
Source

pub fn remove(&mut self, index: usize) -> T

Available on crate feature smallvec only.
Source

pub fn remove_back(&mut self) -> Option<T>

Available on crate feature smallvec only.
Source

pub fn swap_remove(&mut self, index: usize) -> T

Available on crate feature smallvec only.
Source

pub fn clear(&mut self)

Available on crate feature smallvec only.
Source

pub fn len(&self) -> usize

Available on crate feature smallvec only.
Source

pub fn as_slice(&self) -> &[T]

Available on crate feature smallvec only.
Source

pub fn as_mut_slice(&mut self) -> &mut [T]

Available on crate feature smallvec only.
Source

pub fn as_ptr(&self) -> *const T

Available on crate feature smallvec only.
Source

pub fn as_mut_ptr(&mut self) -> *mut T

Available on crate feature smallvec only.
Source

pub fn is_empty(&self) -> bool

Available on crate feature smallvec only.
Source§

impl<T> Segment<'_, Vec<T>, Vec<<Vec<T> as ClosedVec>::Item>>

Source

pub fn drain<R>(&mut self, range: R) -> DrainSegment<'_, T>
where PositionalRange: Project<R, Output = PositionalRange>, R: RangeBounds<usize>,

Available on crate feature alloc only.
Source§

impl<T> Segment<'_, NonEmpty<Vec<T>>, Vec<<NonEmpty<Vec<T>> as ClosedVec>::Item>>

Source

pub fn swap_drain<R>(&mut self, range: R) -> SwapDrainSegment<'_, T>
where PositionalRange: Project<R, Output = PositionalRange>, R: RangeBounds<usize>,

Available on crate feature alloc only.
Source§

impl<K, T> Segment<'_, K, Vec<<K as ClosedVec>::Item>>
where K: ClosedVec<Item = T> + SegmentedOver<Target = Vec<T>>,

Source

pub fn split_off(&mut self, at: usize) -> Vec<T>

Available on crate feature alloc only.
Source

pub fn resize(&mut self, len: usize, fill: T)
where T: Clone,

Available on crate feature alloc only.
Source

pub fn resize_with<F>(&mut self, len: usize, f: F)
where F: FnMut() -> T,

Available on crate feature alloc only.
Source

pub fn truncate(&mut self, len: usize)

Available on crate feature alloc only.
Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&T) -> bool,

Available on crate feature alloc only.
Source

pub fn retain_mut<F>(&mut self, f: F)
where F: FnMut(&mut T) -> bool,

Available on crate feature alloc only.
Source

pub fn insert(&mut self, index: usize, item: T)

Available on crate feature alloc only.
Source

pub fn insert_back(&mut self, item: T)

Available on crate feature alloc only.
Source

pub fn remove(&mut self, index: usize) -> T

Available on crate feature alloc only.
Source

pub fn remove_back(&mut self) -> Option<T>

Available on crate feature alloc only.
Source

pub fn swap_remove(&mut self, index: usize) -> T

Available on crate feature alloc only.
Source

pub fn clear(&mut self)

Available on crate feature alloc only.
Source

pub fn len(&self) -> usize

Available on crate feature alloc only.
Source

pub fn as_slice(&self) -> &[T]

Available on crate feature alloc only.
Source

pub fn as_mut_slice(&mut self) -> &mut [T]

Available on crate feature alloc only.
Source

pub fn as_ptr(&self) -> *const T

Available on crate feature alloc only.
Source

pub fn as_mut_ptr(&mut self) -> *mut T

Available on crate feature alloc only.
Source

pub fn is_empty(&self) -> bool

Available on crate feature alloc only.
Source§

impl<K, T> Segment<'_, K, VecDeque<<K as ClosedVecDeque>::Item>>
where K: ClosedVecDeque<Item = T> + SegmentedOver<Target = VecDeque<T>>,

Source

pub fn split_off(&mut self, at: usize) -> VecDeque<T>

Available on crate feature alloc only.
Source

pub fn resize(&mut self, len: usize, fill: T)
where T: Clone,

Available on crate feature alloc only.
Source

pub fn resize_with<F>(&mut self, len: usize, f: F)
where F: FnMut() -> T,

Available on crate feature alloc only.
Source

pub fn truncate(&mut self, len: usize)

Available on crate feature alloc only.
Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&T) -> bool,

Available on crate feature alloc only.
Source

pub fn retain_mut<F>(&mut self, f: F)
where F: FnMut(&mut T) -> bool,

Available on crate feature alloc only.
Source

pub fn insert(&mut self, index: usize, item: T)

Available on crate feature alloc only.
Source

pub fn insert_front(&mut self, item: T)

Available on crate feature alloc only.
Source

pub fn insert_back(&mut self, item: T)

Available on crate feature alloc only.
Source

pub fn remove(&mut self, index: usize) -> Option<T>

Available on crate feature alloc only.
Source

pub fn remove_front(&mut self) -> Option<T>

Available on crate feature alloc only.
Source

pub fn remove_back(&mut self) -> Option<T>

Available on crate feature alloc only.
Source

pub fn swap_remove_front(&mut self, index: usize) -> Option<T>

Available on crate feature alloc only.
Source

pub fn swap_remove_back(&mut self, index: usize) -> Option<T>

Available on crate feature alloc only.
Source

pub fn clear(&mut self)

Available on crate feature alloc only.
Source

pub fn len(&self) -> usize

Available on crate feature alloc only.
Source

pub fn iter(&self) -> Iter<'_, T>

Available on crate feature alloc only.
Source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Available on crate feature alloc only.
Source

pub fn is_empty(&self) -> bool

Available on crate feature alloc only.

Trait Implementations§

Source§

impl<K, T> Debug for Segment<'_, K, T>
where K: SegmentedOver<Target = T>, K::Target: Debug, <K::Target as Ranged>::Range: Debug, T: Debug + Ranged,

Source§

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

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

impl<'a, KT, KU, AT, AU, T, U> PartialEq<Segment<'a, KU, SmallVec<<KU as ClosedSmallVec>::Array>>> for Segment<'a, KT>
where KT: ClosedSmallVec<Array = AT> + SegmentedOver<Target = SmallVec<AT>>, KU: ClosedSmallVec<Array = AU> + SegmentedOver<Target = SmallVec<AU>>, AT: Array<Item = T>, AU: Array<Item = U>, T: PartialEq<U>,

Available on crate feature smallvec only.
Source§

fn eq(&self, other: &Segment<'a, KU>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, KT, KU, T, U> PartialEq<Segment<'a, KU, Vec<<KU as ClosedVec>::Item>>> for Segment<'a, KT>
where KT: ClosedVec<Item = T> + SegmentedOver<Target = Vec<T>>, KU: ClosedVec<Item = U> + SegmentedOver<Target = Vec<U>>, T: PartialEq<U>,

Available on crate feature alloc only.
Source§

fn eq(&self, other: &Segment<'a, KU>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<K, T> SegmentedOver for Segment<'_, K, T>
where K: SegmentedOver<Target = T>, T: Ranged,

Auto Trait Implementations§

§

impl<'a, K, T> Freeze for Segment<'a, K, T>
where <T as Ranged>::Range: Freeze,

§

impl<'a, K, T> RefUnwindSafe for Segment<'a, K, T>
where <T as Ranged>::Range: RefUnwindSafe, T: RefUnwindSafe,

§

impl<'a, K, T> Send for Segment<'a, K, T>
where <T as Ranged>::Range: Send, T: Send,

§

impl<'a, K, T> Sync for Segment<'a, K, T>
where <T as Ranged>::Range: Sync, T: Sync,

§

impl<'a, K, T> Unpin for Segment<'a, K, T>
where <T as Ranged>::Range: Unpin,

§

impl<'a, K, T> !UnwindSafe for Segment<'a, K, T>

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.