How manishearth/triomphe works
Triomphe is a Rust shared-ownership pointer library: users choose Arc or a specialized representation, then use its ownership, borrowing, and conversion APIs. Arc is the core reference-counted owner; Header supports dynamically sized allocations, while UniqueArc, OffsetArc, ThinArc, and ArcUnion provide distinct ownership or layout variants. Optional arc-swap support adapts Arc and ThinArc to that crate’s reference-count interface. The map follows documented capabilities and excerpted calls; unsampled implementation details and unshown links are omitted.
Main entry points: arc.rs Arc · unique_arc.rs UniqueArc · thin_arc.rs ThinArc · arc_borrow.rs ArcBorrow
Components 11
Pointer representations
Allocation and integration
- Header layouts
src/header.rs - Iterator adapter
src/iterator_as_exact_size_iterator.rs - Allocation error
src/alloc_error.rs - Arc-swap adapter
src/arc_swap_support.rs
Other components
- Library user
Connections 17
- Library user → Arc: creates and shares
README.md - Library user → UniqueArc: builds mutable owner
README.md - Library user → OffsetArc: uses for FFI
README.md - Library user → ArcBorrow: borrows data
README.md - Library user → ThinArc: uses thin pointer
README.md - Library user → ArcUnion: stores either type
README.md - Arc → UniqueArc: converts ownership
src/arc.rs - UniqueArc → Arc: becomes shareable
src/unique_arc.rs - ArcBorrow → Arc: clones owner
src/arc_borrow.rs - OffsetArc → Arc: reconstructs owner
src/offset_arc.rs - ArcUnion → ArcBorrow: creates borrow
src/arc_union.rs - ThinArc → Arc: converts representation
src/thin_arc.rs - ThinArc → Header layouts: uses length layout
src/thin_arc.rs - Arc → Header layouts: allocates header data
src/header.rs - UniqueArc → Iterator adapter: wraps exact-size iterator
src/unique_arc.rs - Arc-swap adapter → Arc: implements RefCnt
src/arc_swap_support.rs - Arc-swap adapter → ThinArc: implements RefCnt
src/arc_swap_support.rs