{"id":49479449,"url":"https://github.com/mmastrac/linktime","last_synced_at":"2026-05-29T01:04:21.061Z","repository":{"id":33681831,"uuid":"160615620","full_name":"mmastrac/linktime","owner":"mmastrac","description":"Link-time initialization, destruction, scattered data collection macros for Rust","archived":false,"fork":false,"pushed_at":"2026-05-03T22:03:29.000Z","size":1136,"stargazers_count":983,"open_issues_count":8,"forks_count":70,"subscribers_count":6,"default_branch":"master","last_synced_at":"2026-05-03T23:28:15.727Z","etag":null,"topics":["constructor","ctor","dtor","dylib","link-section","linktime","macros","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mmastrac.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"mmastrac","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2018-12-06T03:50:42.000Z","updated_at":"2026-05-03T21:43:41.000Z","dependencies_parsed_at":"2022-08-07T23:00:18.780Z","dependency_job_id":"1d49fd6a-1357-418e-84ca-615fc096986f","html_url":"https://github.com/mmastrac/linktime","commit_stats":{"total_commits":241,"total_committers":29,"mean_commits":8.310344827586206,"dds":0.3817427385892116,"last_synced_commit":"fc9cd685f881b6a4055fddc9da3a28779bad6e10"},"previous_names":["mmastrac/linktime","mmastrac/rust-ctor"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/mmastrac/linktime","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmastrac%2Flinktime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmastrac%2Flinktime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmastrac%2Flinktime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmastrac%2Flinktime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mmastrac","download_url":"https://codeload.github.com/mmastrac/linktime/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmastrac%2Flinktime/sbom","scorecard":{"id":654065,"data":{"date":"2025-08-11","repo":{"name":"github.com/mmastrac/rust-ctor","commit":"63382b833ddcbfb8b064f4e86bfa1ed4026ff356"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/rust.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":10,"reason":"12 commit(s) and 8 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/rust.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/mmastrac/rust-ctor/rust.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/rust.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/mmastrac/rust-ctor/rust.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/rust.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/mmastrac/rust-ctor/rust.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/rust.yml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/mmastrac/rust-ctor/rust.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE-APACHE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE-APACHE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: RUSTSEC-2023-0051"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 11 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T14:12:57.364Z","repository_id":33681831,"created_at":"2025-08-21T14:12:57.364Z","updated_at":"2025-08-21T14:12:57.364Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32595202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["constructor","ctor","dtor","dylib","link-section","linktime","macros","rust"],"created_at":"2026-04-30T22:00:24.356Z","updated_at":"2026-05-29T01:04:21.055Z","avatar_url":"https://github.com/mmastrac.png","language":"Rust","funding_links":["https://github.com/sponsors/mmastrac"],"categories":["Rust"],"sub_categories":[],"readme":"# linktime\n\nCross-platform libraries for link-time initialization, finalization and\ncollection in Rust.\n\n![Build Status](https://github.com/mmastrac/linktime/actions/workflows/rust.yml/badge.svg)\n\n| crate               |                                                         | docs                                                                                         | version                                                                                                           |\n| ------------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |\n| `linktime`          | Convenience crate for `ctor`, `dtor` and `link-section` | [![docs.rs](https://docs.rs/linktime/badge.svg)](https://docs.rs/linktime)                   | [![crates.io](https://img.shields.io/crates/v/linktime.svg)](https://crates.io/crates/linktime)                   |\n| `ctor`              | Module initialization functions before main             | [![docs.rs](https://docs.rs/ctor/badge.svg)](https://docs.rs/ctor)                           | [![crates.io](https://img.shields.io/crates/v/ctor.svg)](https://crates.io/crates/ctor)                           |\n| `dtor`              | Module shutdown functions before main                   | [![docs.rs](https://docs.rs/dtor/badge.svg)](https://docs.rs/dtor)                           | [![crates.io](https://img.shields.io/crates/v/dtor.svg)](https://crates.io/crates/dtor)                           |\n| `link-section`      | Linker-managed typed (slices) and untyped sections      | [![docs.rs](https://docs.rs/link-section/badge.svg)](https://docs.rs/link-section)           | [![crates.io](https://img.shields.io/crates/v/link-section.svg)](https://crates.io/crates/link-section)           |\n| `scattered-collect` | Linker-managed collections: slices, sorted slices, maps | [![docs.rs](https://docs.rs/scattered-collect/badge.svg)](https://docs.rs/scattered-collect) | [![crates.io](https://img.shields.io/crates/v/scattered-collect.svg)](https://crates.io/crates/scattered-collect) |\n\n## Crates\n\nThe `linktime` project comprises three crates, and the top-level `linktime`\ncrate aggregates them all.\n\nPick-and-choose, or import the top-level crate to get all three.\n\n## [`ctor`](ctor/)\n\nModule initialization functions for Rust (like `__attribute__((constructor))` in\nC/C++).\n\nRun code before `main` to initialize data, external resources, or other state.\n\n```toml\n[dependencies]\nlinktime = { version = \"...\", features = [\"ctor\"] }  # note: already enabled by default\n# or\nctor = \"...\"\n```\n\n```rust\nuse linktime::ctor; // or ctor::ctor\nuse libc_print::*;\n\n#[ctor(unsafe)]\nfn foo() {\n    libc_println!(\"Life before main!\");\n}\n```\n\n## [`dtor`](dtor/)\n\nModule shutdown functions for Rust (like `__attribute__((destructor))`).\n\nRun code after `main` to clean up resources, or perform other final operations.\n\n```toml\n[dependencies]\nlinktime = { version = \"...\", features = [\"dtor\"] }  # note: already enabled by default\n# or\ndtor = \"...\"\n```\n\n```rust\nuse linktime::dtor; // or dtor::dtor\nuse libc_print::*;\n\n#[dtor(unsafe)]\nfn foo() {\n    libc_println!(\"Life after main!\");\n}\n```\n\n## [`link-section`](link-section/)\n\nTyped and untyped link section support for Rust.\n\nCollect related items from an entire linked binary into a single link section.\n\n```toml\n[dependencies]\nlinktime = { version = \"...\", features = [\"link-section\"] }  # note: already enabled by default\n# or\nlink-section = \"...\"\n```\n\n```rust\nuse linktime::link_section::{section, in_section, TypedSection};\nuse linktime::ctor;\nuse libc_print::*;\n\n#[section(typed)]\nstatic FOO: TypedSection\u003cfn()\u003e;\n\n#[in_section(FOO)]\nfn foo() {\n    libc_println!(\"Hello, world!\");\n}\n\n#[ctor(unsafe)]\nfn print_numbers() {\n    for f in FOO {\n        f();\n    }\n}\n```\n\n## [`scattered-collect`](scattered-collect/)\n\nA crate for defining zero-allocation,linker-managed scattered collections in\nRust.\n\n- `ScatteredIterable`: A collection of items that are available only via\n- `ScatteredSlice`: A collection of sized items that collected into a slice in\n  an arbitrary order.\n- `ScatteredSortedSlice`: A collection of items that are available via slice,\n  in sorted order.\n- `ScatteredReferencedSlice`: A collection of items collected into a slice\n  (link order).\n- `ScatteredSortedReferencedSlice`: A collection of sized items that are\n  available both via sorted slice and via reference at the declaration site.\n- `ScatteredMap`: A collection of key-value pairs that are available via\n  slice, as well as indexed by key.\n\n```rust,ignore\nuse scattered_collect::{gather, scatter, slice::ScatteredSlice};\n\n#[gather]\nstatic SLICE_PLUGINS: ScatteredSlice\u003c\u0026'static str\u003e;\n\n#[scatter(SLICE_PLUGINS)]\nconst _: \u0026'static str = \"json\";\n\n#[scatter(SLICE_PLUGINS)]\nconst _: \u0026'static str = \"yaml\";\n\nfn main() {\n    assert_eq!(SLICE_PLUGINS.len(), 2);\n    assert!(SLICE_PLUGINS.contains(\u0026\"json\"));\n}\n```\n\n## Contributing\n\nContributions are welcome!\n\n## License\n\nThese projects are dual-licensed under the Apache License, Version 2.0 and the\nMIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmastrac%2Flinktime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmastrac%2Flinktime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmastrac%2Flinktime/lists"}