{"id":15994680,"url":"https://github.com/taiki-e/find-crate","last_synced_at":"2026-02-07T09:01:27.371Z","repository":{"id":45270276,"uuid":"170461579","full_name":"taiki-e/find-crate","owner":"taiki-e","description":"Find the crate name from the current Cargo.toml.","archived":false,"fork":false,"pushed_at":"2026-01-11T10:35:59.000Z","size":386,"stargazers_count":8,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-11T15:30:25.758Z","etag":null,"topics":["rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/find-crate","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/taiki-e.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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":"taiki-e"}},"created_at":"2019-02-13T07:29:18.000Z","updated_at":"2026-01-11T10:36:03.000Z","dependencies_parsed_at":"2023-12-24T11:32:22.718Z","dependency_job_id":"ee998b21-5f30-4712-8ee8-d8bc4cd9a83a","html_url":"https://github.com/taiki-e/find-crate","commit_stats":{"total_commits":318,"total_committers":3,"mean_commits":106.0,"dds":0.009433962264150941,"last_synced_commit":"2e9190815b8b22de43e884e4dc83b868ce866a41"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/taiki-e/find-crate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Ffind-crate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Ffind-crate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Ffind-crate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Ffind-crate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taiki-e","download_url":"https://codeload.github.com/taiki-e/find-crate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Ffind-crate/sbom","scorecard":{"id":865836,"data":{"date":"2025-08-11","repo":{"name":"github.com/taiki-e/find-crate","commit":"66aa90a86e1e46f60587e417215eb0550463c816"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/29 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":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","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":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/ci.yml:51","Info: jobLevel 'repository-projects' permission set to 'read': .github/workflows/ci.yml:53","Warn: jobLevel 'contents' permission set to 'write': .github/workflows/release.yml:20","Info: topLevel 'contents' permission set to 'read': .github/workflows/ci.yml:4","Info: topLevel 'contents' permission set to 'read': .github/workflows/release.yml:4"],"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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/taiki-e/find-crate/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/taiki-e/find-crate/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/taiki-e/find-crate/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/taiki-e/find-crate/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/taiki-e/find-crate/release.yml/main?enable=pin","Info:   0 out of   5 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":"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-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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/taiki-e/.github/SECURITY.md:1","Info: Found linked content: github.com/taiki-e/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/taiki-e/.github/SECURITY.md:1","Info: Found text in security policy: github.com/taiki-e/.github/SECURITY.md:1"],"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 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-24T02:40:43.608Z","repository_id":45270276,"created_at":"2025-08-24T02:40:43.609Z","updated_at":"2025-08-24T02:40:43.609Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29190842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-10-08T07:09:46.579Z","updated_at":"2026-02-07T09:01:27.365Z","avatar_url":"https://github.com/taiki-e.png","language":"Rust","funding_links":["https://github.com/sponsors/taiki-e"],"categories":[],"sub_categories":[],"readme":"# find-crate\n\n[![crates.io](https://img.shields.io/crates/v/find-crate?style=flat-square\u0026logo=rust)](https://crates.io/crates/find-crate)\n[![docs.rs](https://img.shields.io/badge/docs.rs-find--crate-blue?style=flat-square\u0026logo=docs.rs)](https://docs.rs/find-crate)\n[![license](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue?style=flat-square)](#license)\n[![msrv](https://img.shields.io/badge/msrv-1.76-blue?style=flat-square\u0026logo=rust)](https://www.rust-lang.org)\n[![github actions](https://img.shields.io/github/actions/workflow/status/taiki-e/find-crate/ci.yml?branch=main\u0026style=flat-square\u0026logo=github)](https://github.com/taiki-e/find-crate/actions)\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:start:src/lib.rs --\u003e\n\nFind the crate name from the current `Cargo.toml`.\n\nWhen writing declarative macros, `$crate` representing the current crate is\nvery useful, but procedural macros do not have this. If you know the current\nname of the crate you want to use, you can do the same thing as `$crate`.\nThis crate provides the features to make it easy.\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nfind-crate = \"0.7\"\n```\n\n## Examples\n\n[`find_crate`] function gets the crate name from the current `Cargo.toml`.\n\n```rust\nuse find_crate::find_crate;\nuse proc_macro2::{Ident, Span, TokenStream};\nuse quote::quote;\n\nfn import() -\u003e TokenStream {\n    let name = find_crate(|name| name == \"foo\").unwrap().name;\n    let name = Ident::new(\u0026name, Span::call_site());\n    // If your proc-macro crate is 2018 edition, use `quote!(use #name as _foo;)` instead.\n    quote!(extern crate #name as _foo;)\n}\n```\n\nAs in this example, it is easy to handle cases where proc-macro is exported\nfrom multiple crates.\n\n```rust\nuse find_crate::find_crate;\nuse proc_macro2::{Ident, Span, TokenStream};\nuse quote::quote;\n\nfn import() -\u003e TokenStream {\n    let name = find_crate(|name| name == \"foo\" || name == \"foo-core\").unwrap().name;\n    let name = Ident::new(\u0026name, Span::call_site());\n    // If your proc-macro crate is 2018 edition, use `quote!(use #name as _foo;)` instead.\n    quote!(extern crate #name as _foo;)\n}\n```\n\nUsing [`Manifest`] to search for multiple crates. It is much more efficient\nthan using [`find_crate`] function for each crate.\n\n```rust\nuse find_crate::Manifest;\nuse proc_macro2::{Ident, Span, TokenStream};\nuse quote::{format_ident, quote};\n\nconst CRATE_NAMES: \u0026[\u0026[\u0026str]] = \u0026[\n    \u0026[\"foo\", \"foo-core\"],\n    \u0026[\"bar\", \"bar-util\", \"bar-core\"],\n    \u0026[\"baz\"],\n];\n\nfn imports() -\u003e TokenStream {\n    let mut tokens = TokenStream::new();\n    let manifest = Manifest::new().unwrap();\n\n    for names in CRATE_NAMES {\n        let name = manifest.find(|name| names.contains(\u0026name)).unwrap().name;\n        let name = Ident::new(\u0026name, Span::call_site());\n        let import_name = format_ident!(\"_{}\", names[0]);\n        // If your proc-macro crate is 2018 edition, use `quote!(use #name as #import_name;)` instead.\n        tokens.extend(quote!(extern crate #name as #import_name;));\n    }\n    tokens\n}\n```\n\nBy default it will be searched from `dependencies` and `dev-dependencies`.\nThis behavior can be adjusted by changing the [`Manifest::dependencies`] field.\n\n[`find_crate`] and [`Manifest::new`] functions read `Cargo.toml` in\n[`CARGO_MANIFEST_DIR`] as manifest.\n\n## Alternatives\n\nIf you write function-like procedural macros, [you can combine it with\ndeclarative macros to support both crate renaming and macro\nre-exporting.][rust-lang/futures-rs#2124]\n\nThis crate is intended to provide more powerful features such as support\nfor multiple crate names and versions. For general purposes,\n[proc-macro-crate], which provides a simpler API, may be easier to use.\n\n[`CARGO_MANIFEST_DIR`]: https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates\n[rust-lang/futures-rs#2124]: https://github.com/rust-lang/futures-rs/pull/2124\n[proc-macro-crate]: https://github.com/bkchr/proc-macro-crate\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:end --\u003e\n\n[`Manifest::new`]: https://docs.rs/find-crate/latest/find_crate/struct.Manifest.html#method.new\n[`Manifest`]: https://docs.rs/find-crate/latest/find_crate/struct.Manifest.html\n[`find_crate`]: https://docs.rs/find-crate/latest/find_crate/fn.find_crate.html\n\n## License\n\nLicensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or\n[MIT license](LICENSE-MIT) at your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Ffind-crate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaiki-e%2Ffind-crate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Ffind-crate/lists"}