{"id":19282438,"url":"https://github.com/dvvcz/constime","last_synced_at":"2025-04-22T01:31:40.963Z","repository":{"id":65501599,"uuid":"585791472","full_name":"DvvCz/constime","owner":"DvvCz","description":"Zig's comptime for Rust, with zero dependencies.","archived":false,"fork":false,"pushed_at":"2025-01-18T05:30:37.000Z","size":15,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T17:57:58.763Z","etag":null,"topics":["compile-time","comptime","macro","metaprogramming","proc-macro","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/constime","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/DvvCz.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}},"created_at":"2023-01-06T04:42:41.000Z","updated_at":"2025-03-29T20:56:55.000Z","dependencies_parsed_at":"2024-11-20T13:32:30.890Z","dependency_job_id":null,"html_url":"https://github.com/DvvCz/constime","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"08e383d2a525c5ca81431c45ee19fe495e50e1cc"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DvvCz%2Fconstime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DvvCz%2Fconstime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DvvCz%2Fconstime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DvvCz%2Fconstime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DvvCz","download_url":"https://codeload.github.com/DvvCz/constime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250162041,"owners_count":21385032,"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","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":["compile-time","comptime","macro","metaprogramming","proc-macro","rust"],"created_at":"2024-11-09T21:26:55.064Z","updated_at":"2025-04-22T01:31:40.956Z","avatar_url":"https://github.com/DvvCz.png","language":"Rust","readme":"\u003ch1 align=\"center\"\u003e constime \u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\tZig's \u003ccode\u003ecomptime\u003c/code\u003e for Rust, with zero dependencies.\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\t\u003ca href=\"https://github.com/DvvCz/constime/actions\"\u003e\n\t\t\u003cimg alt=\"GitHub Actions Workflow Status\" src=\"https://img.shields.io/github/actions/workflow/status/DvvCz/constime/ci.yml?label=build\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://crates.io/crates/constime\"\u003e\n\t\t\u003cimg alt=\"Crates.io Version\" src=\"https://img.shields.io/crates/v/constime\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://github.com/DvvCz/constime/releases/latest\"\u003e\n\t\t\u003cimg alt=\"GitHub Release\" src=\"https://img.shields.io/github/v/release/DvvCz/constime\"\u003e\n\t\u003c/a\u003e\n\u003c/div\u003e\n\n## Usage\n\n```bash\ncargo add constime\n```\n\nDependencies in `comptime!` can be stored in either `[dependencies]` or `[build-dependencies]`.\n\nIf you use build dependencies, you will need to explicitly link with `extern crate` and a `build.rs` file to force them to compile.\n\n## Example\n\n```rust\nfn main() {\n\tuse constime::comptime;\n\n\t// Let's use a pure-build time dependency\n\tprintln!(\"Here's a fact about the number 5: {}\", comptime! {\n\t\textern crate ureq;\n\n\t\tureq::get(\"http://numbersapi.com/5/math\")\n\t\t\t.call()\n\t\t\t.unwrap()\n\t\t\t.into_string()\n\t\t\t.unwrap()\n\t});\n\n\t// Standard library works fine too.\n\tprintln!(\n\t\t\"Compiled {} seconds after unix epoch.\",\n\t\tcomptime! {\n\t\t\tstd::time::SystemTime::now()\n\t\t\t\t.duration_since(std::time::UNIX_EPOCH)\n\t\t\t\t.expect(\"Time went backwards\")\n\t\t\t\t.as_secs()\n\t\t}\n\t);\n}\n```\n\n## Note\n\n**You should get autocomplete and error feedback when using the macro.**\n\nThis works with temporary files, which currently aren't automatically cleared.\n\nIf you notice your project getting a little large, periodically run `cargo clean` to remove these.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvvcz%2Fconstime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvvcz%2Fconstime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvvcz%2Fconstime/lists"}