# mmastrac/linktime

Link-time initialization, destruction, scattered data collection macros for Rust

Repository: https://github.com/mmastrac/linktime
Canonical: https://ross.abutalabs.com/products/linktime
Language: Rust
License: Apache-2.0
License Family: permissive
Topics: rust, macros, constructor, dylib, ctor, dtor, link-section, linktime
Last push: 2026-08-14T14:31:44+00:00

## Health v2 (maintenance only)
Score: 98/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 97, release rhythm 98, longevity 100
- inputs: {"age_days": 2827, "days_push": 19, "days_rel": 19, "gap_med": 0, "n_releases_24m": 46}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1071, forks 79 (observed 2026-08-28T04:03:28.088042+00:00)

## What it is
A set of Rust crates providing link-time initialization, destruction, and scattered data collection macros (ctor, dtor, link-section, scattered-collect). It lets Rust code run before/after main and collect items across a linked binary via linker-managed sections.

## Use cases
- run initialization code before main in rust
- register plugins or handlers at link time
- collect scattered items into a single section across a binary
- run cleanup code after main exits
- build a registry of items without explicit registration calls

## When to choose
- you need C-style constructor/destructor semantics in Rust
- you want linker-managed registries or typed sections across crates
- you need code to run before main for setup or side effects

## When to avoid
- you only need simple lazy initialization with std::sync::Once or LazyLock
- you want portable code without platform-specific linker tricks
- you need initialization ordering guarantees across arbitrary crates

## Facets
- artifact type: library
- maturity: active
- function: developer-tools, plugin-system, concurrency
- domain: developer-tools, programming-languages
- platform: rust, cross-platform, windows
- tags: macros, ctor, dtor, link-section, linker, dylib, rust-crate, procedural-macros, automation, linux, macos

## Member repositories
- mmastrac/linktime (main) score 98

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:28.088042+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:53:51.276189+00:00, confidence not recorded.
  - readme: https://github.com/mmastrac/linktime (fetched 2026-08-28T04:03:28.088042+00:00, sha 1f82940907da)
  - registry_crates: https://crates.io/api/v1/crates/linktime (fetched 2026-08-29T12:55:55.867623+00:00, sha 8a446c8cb3f9)
- Data as of 2026-08-30T08:39:29.467469+00:00.
