{"id":21585968,"url":"https://github.com/magiclen/lazy-static-include","last_synced_at":"2025-08-24T16:12:37.713Z","repository":{"id":60775555,"uuid":"148018438","full_name":"magiclen/lazy-static-include","owner":"magiclen","description":"This crate provides `lazy_static_include_bytes` and `lazy_static_include_str` macros to replace `include_bytes` and `include_str` macros.","archived":false,"fork":false,"pushed_at":"2023-09-11T00:29:55.000Z","size":89,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-18T17:36:09.820Z","etag":null,"topics":["rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magiclen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2018-09-09T11:22:31.000Z","updated_at":"2022-08-24T15:05:50.000Z","dependencies_parsed_at":"2025-04-10T20:14:54.431Z","dependency_job_id":"f050bebc-56e0-468b-bf28-f65afe5659c7","html_url":"https://github.com/magiclen/lazy-static-include","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/magiclen/lazy-static-include","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Flazy-static-include","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Flazy-static-include/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Flazy-static-include/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Flazy-static-include/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magiclen","download_url":"https://codeload.github.com/magiclen/lazy-static-include/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Flazy-static-include/sbom","scorecard":{"id":611774,"data":{"date":"2025-08-11","repo":{"name":"github.com/magiclen/lazy-static-include","commit":"291310b5b79b47c687b52a0e85c7c6445c0da737"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/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":"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":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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/ci-version.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/magiclen/lazy-static-include/ci-version.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci-version.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/magiclen/lazy-static-include/ci-version.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci-version.yml:50: update your workflow using https://app.stepsecurity.io/secureworkflow/magiclen/lazy-static-include/ci-version.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci-version.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/magiclen/lazy-static-include/ci-version.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/magiclen/lazy-static-include/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/magiclen/lazy-static-include/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/magiclen/lazy-static-include/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/magiclen/lazy-static-include/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/magiclen/lazy-static-include/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/magiclen/lazy-static-include/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/magiclen/lazy-static-include/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/magiclen/lazy-static-include/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/magiclen/lazy-static-include/ci.yml/master?enable=pin","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   7 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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci-version.yml:1","Warn: no topLevel permission defined: .github/workflows/ci.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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE: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"}}]},"last_synced_at":"2025-08-21T02:50:31.981Z","repository_id":60775555,"created_at":"2025-08-21T02:50:31.981Z","updated_at":"2025-08-21T02:50:31.981Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271901482,"owners_count":24841116,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"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":["rust"],"created_at":"2024-11-24T15:12:16.538Z","updated_at":"2025-08-24T16:12:37.660Z","avatar_url":"https://github.com/magiclen.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Lazy Static Include\n====================\n\n[![CI](https://github.com/magiclen/lazy-static-include/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/lazy-static-include/actions/workflows/ci.yml)\n\nThis crate provides `lazy_static_include_bytes` and `lazy_static_include_str` macros to replace `include_bytes` and `include_str` macros.\n\nWhy should we do that?\nBecause the original `include_bytes` and `include_str` macros bring extra data from files into the compiled executable binary file, the time for compiling surges.\n\nHigh compilation time is detrimental to software development. `lazy_static_include_bytes` and `lazy_static_include_str` macros can help you **lazy load** data from files\nwhen you are not using the **release** profile. In other words, if you are using `include_bytes` and `include_str` macros, and you think your compilation time is too high to wait,\nyou can choose to use `lazy_static_include_bytes` and `lazy_static_include_str` macros.\n\n`lazy_static_include_bytes` and `lazy_static_include_str` macros include data from files into the compiled executable binary file **only** when you are using the **release** profile.\nBe careful when you distribute your program.\n\nThe paths used for `lazy_static_include_bytes` and `lazy_static_include_str` are relative to **CARGO_MANIFEST_DIR**.\n\n## Examples\n\n```rust\nuse lazy_static_include::*;\n\nlazy_static_include_str! {\n    /// doc\n    TEST =\u003e \"data/test.txt\",\n}\n\nlazy_static_include_str! {\n    /// doc\n    pub TEST2 =\u003e (\"data\", \"test-2.txt\"),\n}\n\nassert_eq!(\"This is just a test text.\", TEST);\nassert_eq!(\"Some text...\", TEST2);\n```\n\n```rust\nuse lazy_static_include::*;\n\nlazy_static_include_bytes! {\n    /// doc\n    TEST =\u003e \"data/test.txt\",\n}\n\nlazy_static_include_bytes! {\n    /// doc\n    pub TEST2 =\u003e (\"data\", \"test-2.txt\"),\n}\n\nassert_eq!(\"This is just a test text.\".as_bytes(), TEST);\nassert_eq!(\"Some text...\".as_bytes(), TEST2);\n```\n\nYou should notice that the value created from `lazy_static_include_bytes` and `lazy_static_include_str` macros isn't equal to `\u0026'static [u8]` or `\u0026'static str`. If you want to get an exact `\u0026'static [u8]` or `\u0026'static str` reference, you can **dereference** the value.\n\n```rust\nuse lazy_static_include::*;\n\nlazy_static_include_bytes! {\n    /// doc\n    TEST =\u003e \"data/test.txt\",\n}\n\nlet data: \u0026'static [u8] = *TEST;\n```\n\nAlso, private items (without `pub`) and public items (with `pub*`) cannot be put together.\n\n## Include Array\n\nThere is a special macro `lazy_static_include_array` which can include arrays from files.\nThe array is fixed sized and can be one of these following types: `bool`, `char`, `usize`, `u8`, `u16`, `u32`, `u64`, `u128`, `isize`, `i8`, `i16`, `i32`, `i64`, `i128`, `f32`, `f64`, `\u0026'static str`.\n\nAlso, the `lazy_static_include_array` macro includes data from files into the compiled executable binary file **only** when you are using the **release** profile.\nBe careful when you distribute your program.\n\nThe paths used for `lazy_static_include_array` are relative to **CARGO_MANIFEST_DIR**.\n\n```rust\nuse lazy_static_include::*;\n\nlazy_static_include_array! {\n    /// doc\n    TEST: [u64; 5] =\u003e \"data/u64_array.txt\",\n}\n\nlazy_static_include_array! {\n    /// doc\n    pub TEST2: [\u0026'static str; 3] =\u003e (\"data\", \"string_array.txt\")\n}\n\nassert_eq!(123, TEST[0]);\nassert_eq!(456, TEST[1]);\nassert_eq!(789, TEST[2]);\nassert_eq!(1000, TEST[3]);\nassert_eq!(500000000000u64, TEST[4]);\n\nassert_eq!(\"Hi\", TEST2[0]);\nassert_eq!(\"Hello\", TEST2[1]);\nassert_eq!(\"哈囉\", TEST2[2]);\n```\n\n## Benchmark\n\nUsing static mechanisms makes your program faster. See my benchmark result below (AMD Ryzen 9 3900X 12-Core Processor 12C/24T 3.90GHz, ran on 2020/07/02):\n\n```text\ntest include_array_lazy_static   ... bench:          46 ns/iter (+/- 3)\ntest include_array_native_static ... bench:          48 ns/iter (+/- 3)\ntest include_array_no_static     ... bench:      22,414 ns/iter (+/- 297)\ntest include_bytes_lazy_static   ... bench:         844 ns/iter (+/- 3)\ntest include_bytes_native_static ... bench:         863 ns/iter (+/- 5)\ntest include_bytes_no_static     ... bench:       4,764 ns/iter (+/- 189)\ntest include_str_lazy_static     ... bench:         857 ns/iter (+/- 8)\ntest include_str_native_static   ... bench:         842 ns/iter (+/- 10)\ntest include_str_no_static       ... bench:       4,837 ns/iter (+/- 145)\n```\n\nWhen using the **release** profile, the performance of `lazy_static_include_*` is very close to `include_*`. That means you don't need to worry about the overhead, but just enjoy the faster compilation time.\n\nYou can run the benchmark program by executing,\n\n```bash\ncargo bench\n```\n\n## Crates.io\n\nhttps://crates.io/crates/lazy-static-include\n\n## Documentation\n\nhttps://docs.rs/lazy-static-include\n\n## License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Flazy-static-include","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagiclen%2Flazy-static-include","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Flazy-static-include/lists"}