pub struct ValueIndex(/* private fields */);Expand description
A type safe reference to one word of the ValueVec, as a segment and an
index within it.
§Representation
The pair is packed into a single u32: the ValueSegment in the top two bits and the
index in the bottom Self::INDEX_BITS. Constraint systems hold millions of these, so the
packing keeps a ShiftedValueIndex at eight bytes rather than
twelve.
The packing also makes the derived Ord order the words by segment and then by index, which
is the order they occupy in the value vector.
Implementations§
Source§impl ValueIndex
impl ValueIndex
Sourcepub const INDEX_BITS: u32 = 30
pub const INDEX_BITS: u32 = 30
The number of bits the index occupies, the segment tag taking the remaining two.
Sourcepub const SEGMENT_CAPACITY: u32
pub const SEGMENT_CAPACITY: u32
The number of values one segment can hold.
Sourcepub const fn new(segment: ValueSegment, index: u32) -> Self
pub const fn new(segment: ValueSegment, index: u32) -> Self
Creates an index naming the given word of the given segment.
§Panics
Panics if the index is not below Self::SEGMENT_CAPACITY.
Sourcepub const fn segment(self) -> ValueSegment
pub const fn segment(self) -> ValueSegment
The segment this index names.
Sourcepub const fn index(self) -> u32
pub const fn index(self) -> u32
The index within Self::segment.
Trait Implementations§
Source§impl Clone for ValueIndex
impl Clone for ValueIndex
Source§fn clone(&self) -> ValueIndex
fn clone(&self) -> ValueIndex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValueIndex
Prints the segment and index rather than the packed word, which reads as a nonsense integer.
impl Debug for ValueIndex
Prints the segment and index rather than the packed word, which reads as a nonsense integer.
Source§impl DeserializeBytes for ValueIndex
impl DeserializeBytes for ValueIndex
fn deserialize(read_buf: impl Buf) -> Result<Self, SerializationError>where
Self: Sized,
Source§impl Hash for ValueIndex
impl Hash for ValueIndex
Source§impl Index<ValueIndex> for ValueVec
impl Index<ValueIndex> for ValueVec
Source§impl IndexMut<ValueIndex> for ValueVec
impl IndexMut<ValueIndex> for ValueVec
Source§impl Ord for ValueIndex
impl Ord for ValueIndex
Source§fn cmp(&self, other: &ValueIndex) -> Ordering
fn cmp(&self, other: &ValueIndex) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ValueIndex
impl PartialEq for ValueIndex
Source§fn eq(&self, other: &ValueIndex) -> bool
fn eq(&self, other: &ValueIndex) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for ValueIndex
impl PartialOrd for ValueIndex
Source§impl SerializeBytes for ValueIndex
impl SerializeBytes for ValueIndex
impl Copy for ValueIndex
impl Eq for ValueIndex
impl StructuralPartialEq for ValueIndex
Auto Trait Implementations§
impl Freeze for ValueIndex
impl RefUnwindSafe for ValueIndex
impl Send for ValueIndex
impl Sync for ValueIndex
impl Unpin for ValueIndex
impl UnsafeUnpin for ValueIndex
impl UnwindSafe for ValueIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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