oxc_data_structures 0.153.0

A collection of JavaScript tools written in Rust.
Documentation
# Oxc Data Structures

Common data structures and utilities used across oxc crates.

## Overview

This crate provides specialized data structures and utilities that are used throughout the oxc toolchain. These structures are optimized for the specific needs of compiler and tooling workloads.

## Key Features

- **Stacks**: Efficient stack types, optimized for fast `push`, `pop`, and `last`
- **Code buffer**: Efficient string building with segment tracking
- **Inline strings**: Memory-efficient string storage for short strings
- **Slice iterators**: Enhanced iteration capabilities for slices
- **Rope data structure**: Efficient text manipulation for large documents
- **Box macros**: Macros for creating boxed arrays / slices (similar to `vec!` macro)
- **Fieldless enums macro**: Macro for creating enums with a `VARIANTS` constant listing all variants
- **Non-null pointers**: `NonNullConst<T>` and `NonNullMut<T>` - non-null pointer types with explicit const/mut permissions
- **Branch prediction hints**: `likely` and `unlikely` functions to hint to the compiler whether a branch is likely to be taken (also re-exports `std::hint::cold_path`)
- **`StringExt` trait**: Add methods to `String` to push without capacity checks
- **String utilities**: `const`-compatible string helpers (e.g. `const_str_eq` for comparing strings in a `const` context)
- **Type utilities**: `implements!` macro to determine if a type implements a trait

## Architecture

These data structures are designed with specific compiler requirements in mind:

- **Performance**: Optimized for common patterns in parsing and code generation
- **Memory efficiency**: Minimize allocations and memory overhead
- **Safety**: Provide safe abstractions over potentially unsafe operations
- **Ergonomics**: Easy to use APIs that integrate well with other oxc components

The structures complement Rust's standard library with domain-specific optimizations for JavaScript/TypeScript tooling.