Skip to main content

UseListId

Struct UseListId 

Source
pub struct UseListId { /* private fields */ }
Expand description

A clean dense id (generated by define_id*!): backing integer with the MSB always clear (type invariant), naming a value in [0, id_bound). The stolen MSB is available to Tagged consumers.

Implementations§

Source§

impl UseListId

Source

pub fn new(n: u32) -> UseListId

Construct from a raw integer known to fit below the tag bit. Production parity: asserts at runtime (a verified caller has proven the range; an unverified one is trapped before an id with the tag bit set — violating the type invariant — could exist).

Source

pub fn raw(self) -> u32

The raw clean value (production parity).

Source

pub fn index(self) -> usize

The dense index as a usize (for indexing arena vectors).

Source

pub fn to_usize(self) -> usize

Production DenseId::to_usize parity (the heavily-used consumer spelling; same contract as index).

Source§

impl UseListId

Source

pub const MAX_RAW: u32 = 2147483647u32

Largest storable raw payload (production surface).

Trait Implementations§

Source§

impl Clone for UseListId

Source§

fn clone(&self) -> UseListId

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for UseListId

Source§

impl Debug for UseListId

Source§

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

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

impl Default for UseListId

Default is id 0 (MSB clear ⟹ type invariant holds). Required by semi-persistent containers indexing with this id: restore fills reclaimed slots with Idx::default() before overwriting them.

Source§

fn default() -> UseListId

Returns the “default value” for a type. Read more
Source§

impl DenseId for UseListId

Source§

type Index = u32

Natural storage word for this id (production’s DenseId::Index: u8, u16, u32, or u64). This is the Word a NodeLayout stores keys as, and is what makes the B+tree generic over the 31-bit (u32) and 63-bit (u64) id families. Read more
Source§

fn to_index(self) -> u32

Exec: serialize the id to its storage word (production’s Into<Self::Index>, used as key_to_word(k) = k.into()). The word’s dense index equals the id’s, so ordering on words agrees with ordering on ids; this is what lets the B+tree store and compare Index words while reasoning about the abstract id_nat model.
Source§

fn from_usize(n: usize) -> UseListId

Exec: construct from a usize. Bounded IDs panic when n >= id_bound() rather than narrowing or aliasing; use Self::try_new at an untrusted capacity boundary. DenseUsize spans every usize, so it round-trips unconditionally.
Source§

fn try_new(n: usize) -> Option<UseListId>

Exec: range-checked construction — Some exactly on the representable range. The primitive IdFactory allocates through (production’s try_alloc checked the WORD range, not the id range, and would panic half-way through the bit-stealing family’s word range; checking id_bound here is the corrected contract).
Source§

fn bit_stealing() -> bool

Exec counterpart of is_bit_stealing: a static type property, so every impl is a literal and the check const-folds; it exists so the B+tree’s total shell can refuse a non-bit-stealing key at runtime instead of carrying a requires.
Source§

fn to_usize(self) -> usize

Production’s DenseId::to_usize spelling (containers/src/dense_id.rs:23). prod-parity: the consumer calls to_usize; verus’s own code uses as_usize. Provided default delegates through the supertrait as_usize; the bridge law reconciles its as_nat-stated ensures with id_nat.
Source§

impl Display for UseListId

Source§

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

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

impl Eq for UseListId

Source§

impl Hash for UseListId

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IndexLike for UseListId

Source§

fn min() -> UseListId

Exec: zero / minimum value.
Source§

fn max() -> UseListId

Exec: maximum value.
Source§

fn as_usize(self) -> usize

Exec: project to usize. Equal to as_nat() viewed as usize.
Source§

fn try_from_usize(n: usize) -> Option<UseListId>

Exec: try to construct from a usize. Succeeds iff n < max_nat().
Source§

fn lt(self, other: UseListId) -> bool

Exec: less-than. Implemented via as_usize round-trip on primitives.
Source§

fn le(self, other: UseListId) -> bool

Exec: less-than-or-equal.
Source§

impl Ord for UseListId

Source§

fn cmp(&self, other: &UseListId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for UseListId

Source§

fn eq(&self, other: &UseListId) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for UseListId

Source§

fn partial_cmp(&self, other: &UseListId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Tagged for UseListId

Source§

type Repr = u32

Source§

fn into_repr(self) -> u32

Encode a clean value with tag = false. Result is well-formed.
Source§

fn from_repr(r: &u32) -> UseListId

Decode a Repr to its clean value, stripping the tag.
Source§

fn tag(r: &u32) -> bool

Read the tag bit.
Source§

fn set_tag(r: &mut u32)

Set the tag bit. Value, well-formedness preserved.
Source§

fn clear_tag(r: &mut u32)

Clear the tag bit. Value, well-formedness preserved.
Source§

impl TryFrom<u32> for UseListId

Source§

type Error = IdRangeError

The type returned in the event of a conversion error.
Source§

fn try_from(raw: u32) -> Result<UseListId, <UseListId as TryFrom<u32>>::Error>

Performs the conversion.
Source§

impl View for UseListId

Source§

type V = nat

Auto Trait Implementations§

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.