Struct wgpu_core::track::range::RangedStates

source ·
pub(crate) struct RangedStates<I, T> {
    ranges: SmallVec<[(Range<I>, T); 1]>,
}
Expand description

Structure that keeps track of a I -> T mapping, optimized for a case where keys of the same values are often grouped together linearly.

Fields§

§ranges: SmallVec<[(Range<I>, T); 1]>

List of ranges, each associated with a singe value. Ranges of keys have to be non-intersecting and ordered.

Implementations§

source§

impl<I: Copy + Ord, T: Copy + PartialEq> RangedStates<I, T>

source

pub fn from_range(range: Range<I>, value: T) -> Self

source

pub fn iter(&self) -> impl Iterator<Item = &(Range<I>, T)> + Clone

source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut (Range<I>, T)>

source

pub fn coalesce(&mut self)

Merge the neighboring ranges together, where possible.

source

pub fn iter_filter<'a>( &'a self, range: &'a Range<I>, ) -> impl Iterator<Item = (Range<I>, &'a T)> + 'a

source

pub fn isolate(&mut self, index: &Range<I>, default: T) -> &mut [(Range<I>, T)]

Split the storage ranges in such a way that there is a linear subset of them occupying exactly index range, which is returned mutably.

Gaps in the ranges are filled with default value.

Trait Implementations§

source§

impl<I: Clone, T: Clone> Clone for RangedStates<I, T>

source§

fn clone(&self) -> RangedStates<I, T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I: Debug, T: Debug> Debug for RangedStates<I, T>

source§

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

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

impl<I: PartialEq, T: PartialEq> PartialEq for RangedStates<I, T>

source§

fn eq(&self, other: &RangedStates<I, T>) -> 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<I, T> StructuralPartialEq for RangedStates<I, T>

Auto Trait Implementations§

§

impl<I, T> Freeze for RangedStates<I, T>
where T: Freeze, I: Freeze,

§

impl<I, T> RefUnwindSafe for RangedStates<I, T>

§

impl<I, T> Send for RangedStates<I, T>
where T: Send, I: Send,

§

impl<I, T> Sync for RangedStates<I, T>
where T: Sync, I: Sync,

§

impl<I, T> Unpin for RangedStates<I, T>
where T: Unpin, I: Unpin,

§

impl<I, T> UnwindSafe for RangedStates<I, 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<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> Downcast<T> for T

source§

fn downcast(&self) -> &T

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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

impl<T> WasmNotSync for T
where T: Sync,