Module index

Module index 

Source
Expand description

Branded (phantom-typed) index types for type-safe collection access.

Index<T> wraps a usize with a phantom type parameter T so that indices into different collections cannot be accidentally mixed at compile time.

§Why No Default?

Index 0 is valid data (the first element), not a sentinel value. Providing Default would invite bugs where an “uninitialized” index silently points at element 0.

§Examples

use hwpforge_foundation::CharShapeIndex;

let idx = CharShapeIndex::new(3);
assert_eq!(idx.get(), 3);

// Bounds checking
assert!(idx.checked_get(10).is_ok());
assert!(idx.checked_get(2).is_err());

Structs§

BorderFillMarker
Phantom marker for border/fill indices.
CharShapeMarker
Phantom marker for character shape indices.
FontMarker
Phantom marker for font indices.
Index
A branded index into a typed collection.
NumberingMarker
Phantom marker for numbering definition indices.
ParaShapeMarker
Phantom marker for paragraph shape indices.
StyleMarker
Phantom marker for style indices.
TabMarker
Phantom marker for tab property indices.

Type Aliases§

BorderFillIndex
Index into a border/fill collection.
CharShapeIndex
Index into a character shape collection.
FontIndex
Index into a font collection.
NumberingIndex
Index into the numbering definition list.
ParaShapeIndex
Index into a paragraph shape collection.
StyleIndex
Index into a style collection.
TabIndex
Index into the tab properties list.