data-structure

Official

Design safe, index-based compiler data structures

Authorplankevm
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Provides concrete design guidance for compiler data structures to avoid lifetime complexity, invalid indices, and fragile references when managing arenas and interlinked collections.

Core Features & Use Cases

  • Prefer storing typed indices instead of direct references to avoid Rust lifetime issues and enable mutation without borrow conflicts.
  • Use Span for contiguous child ranges that point into a shared arena to keep parent structs compact and often Copy.
  • Never manually construct indices; obtain them from collection operations such as push, enumerate_idx, or iter_idx to guarantee validity.
  • Anti-patterns to avoid: using plain Vec when elements are referenced by index, mixing raw usize across collections, storing &T references for long-term linking, and constructing indices by hand.
  • Libraries and patterns: use newtype_index to declare compact typed indices, plank_core IndexVec for index-typed collections, Span for range semantics, and DenseIndexSet for bitset membership operations.

Quick Start

When adding a new AST node, define a typed index with newtype_index, store instances in plank_core IndexVec, and reference child ranges using Span instead of per-parent Vecs.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: data-structure
Download link: https://github.com/plankevm/plank-monorepo/archive/main.zip#data-structure

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.