miden-utils-indexing 0.36.0

Type-safe u32-indexed vector utilities for Miden
docs.rs failed to build miden-utils-indexing-0.36.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: miden-utils-indexing-0.36.2

miden-utils-indexing

Type-safe u32-indexed vector utilities for Miden.

This crate provides utilities for working with u32-indexed vectors in a type-safe manner, including the IndexVec type and related functionality.

Main Types

IndexVec<I, T>

A dense vector indexed by ID types that provides O(1) access and storage for dense ID-indexed data.

DenseIdMap<From, To>

A dense mapping from ID to ID, equivalent to IndexVec<From, Option<To>>.

Usage

Create typed IDs using the newtype_id! macro:

use miden_utils_indexing::{IndexVec, newtype_id};

newtype_id!(UserId);  // Creates a newtyped ID type

let mut users = IndexVec::<UserId, String>::new();
let alice_id = users.push("Alice".to_string()).unwrap();
let bob_id = users.push("Bob".to_string()).unwrap();

// Access by typed ID
println!("User: {}", users[alice_id]);

Features

  • std (default): Enable standard library support
  • serde: Enable serialization/deserialization support