{"id":15980253,"url":"https://github.com/appcypher/lazy-attribute","last_synced_at":"2026-02-05T15:31:29.757Z","repository":{"id":204544072,"uuid":"711783744","full_name":"appcypher/lazy-attribute","owner":"appcypher","description":"Convenient attribute macro for lazy function execution","archived":false,"fork":false,"pushed_at":"2024-07-08T08:42:08.000Z","size":111,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-14T01:34:15.514Z","etag":null,"topics":["crate","docs","function","lazy-evaluation","proc-macro-attributes","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/appcypher.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-30T07:05:22.000Z","updated_at":"2023-12-11T18:54:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"8d91d902-5803-4a09-8788-18350b0c92af","html_url":"https://github.com/appcypher/lazy-attribute","commit_stats":{"total_commits":39,"total_committers":3,"mean_commits":13.0,"dds":0.4358974358974359,"last_synced_commit":"6143377ffe86c21b7152419f259fd4b9c2c6a368"},"previous_names":["zerocore-ai/lazy-attribute","appcypher/lazy-attribute"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/appcypher/lazy-attribute","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcypher%2Flazy-attribute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcypher%2Flazy-attribute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcypher%2Flazy-attribute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcypher%2Flazy-attribute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appcypher","download_url":"https://codeload.github.com/appcypher/lazy-attribute/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcypher%2Flazy-attribute/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29124801,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T14:05:12.718Z","status":"ssl_error","status_checked_at":"2026-02-05T14:03:53.078Z","response_time":65,"last_error":"SSL_read: 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":["crate","docs","function","lazy-evaluation","proc-macro-attributes","rust"],"created_at":"2024-10-08T00:03:16.906Z","updated_at":"2026-02-05T15:31:29.740Z","avatar_url":"https://github.com/appcypher.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003elazy-attribute\u003c/h1\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://crates.io/crates/lazy-attribute\"\u003e\n      \u003cimg src=\"https://img.shields.io/crates/v/lazy-attribute?label=crates\" alt=\"Crate\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/zerocore-ai/lazy-attribute\"\u003e\n      \u003cimg src=\"https://codecov.io/gh/zerocore-ai/lazy-attribute/branch/main/graph/badge.svg?token=SOMETOKEN\" alt=\"Code Coverage\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/zerocore-ai/lazy-attribute/actions?query=\"\u003e\n      \u003cimg src=\"https://github.com/zerocore-ai/lazy-attribute/actions/workflows/tests_and_checks.yml/badge.svg\" alt=\"Build Status\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/zerocore-ai/lazy-attribute/blob/main/LICENSE-APACHE\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" alt=\"License-Apache\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/zerocore-ai/lazy-attribute/blob/main/LICENSE-MIT\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg\" alt=\"License-MIT\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://docs.rs/lazy-attribute\"\u003e\n      \u003cimg src=\"https://img.shields.io/static/v1?label=Docs\u0026message=docs.rs\u0026color=blue\" alt=\"Docs\"\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n`lazy-attributes` provides attribute macros for simplifying working with lazily evaluated functions.\n\nFunctions decorated with `#[lazy_ref]` will only be executed the first time they are called.\nOn subsequent calls, the cached return value is returned.\n\n## Outline\n\n- [Usage](#usage)\n- [Contributing](#contributing)\n- [Getting Help](#getting-help)\n- [External Resources](#external-resources)\n- [License](#license)\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nlazy-attribute = \"0.1\"\n```\n\n### Examples\n\nWith [`lazy_attribute::lazy_ref`][crate::lazy_ref], you can annotate a function that you want to lazily evaluate:\n\n```rust\nuse lazy_attribute::lazy_ref;\n\n#[lazy_ref]\nfn get_string() -\u003e String {\n    println!(\"Called once!\");\n    String::from(\"Hello, world!\")\n}\n\nfn main() {\n    println!(\"{}\", get_string());  // Outputs: Called once! Hello, world!\n    println!(\"{}\", get_string());  // Outputs: Hello, world!\n}\n```\n\nThe first time the function is called, it will be evaluated and its result will be cached. Subsequent calls will return\nthe cached result.\n\n`lazy_ref` macro roughly desugars the `get_string` function to:\n\n```ignore\nstatic __lazy_static_get_string: OnceCell\u003cString\u003e = OnceCell::new();\n\nfn get_string() -\u003e \u0026'static String {\n    __lazy_static_get_string.get_or_init(|| {\n        println!(\"Called once!\");\n        String::from(\"Hello, world!\")\n    })\n}\n```\n\nWith `async` feature enabled, `lazy_ref` can also be used with async functions:\n\n```rust\nuse lazy_attribute::lazy_ref;\n\n#[lazy_ref]\nasync fn get_string() -\u003e String {\n    println!(\"Called once!\");\n    String::from(\"Hello, world!\")\n}\n\n#[tokio::main]\nasync fn main() {\n    println!(\"{}\", get_string().await);  // Outputs: Called once! Hello, world!\n    println!(\"{}\", get_string().await);  // Outputs: Hello, world!\n}\n```\n\n## Caveats\n\n- `lazy_*` macros do not support functions with arguments. You will get an error telling you arguments are not supported.\n\n## Crate Features\n\n- `async` - Enables support for lazily evaluating async functions.\n\n### Crate Features\n\n- `async` - Enables support for lazily evaluating async functions.\n\n## Contributing\n\nFeedback welcome! Check the [contributing guide](./CONTRIBUTING.md) to you want to get involved. We\nalso adhere to our [Code of Conduct](./CODE_OF_CONDUCT.md).\n\n### Testing the Project\n\n- Run tests\n\n  ```console\n  cargo test --all-features\n  ```\n\n### Formatting\n\nFor formatting Rust in particular, please use `cargo +nightly fmt` as it uses\nspecific nightly features we recommend. **Make sure you have nightly\ninstalled**.\n\n### Pre-commit Hook\n\nThis project recommends using [pre-commit][pre-commit] for running pre-commit\nhooks. Please run this before every commit and/or push.\n\n- Once installed, Run `pre-commit install` and `pre-commit install --hook-type commit-msg`\n  to setup the pre-commit hooks locally. This will reduce failed CI builds.\n\n- If you are doing interim commits locally, and for some reason if you _don't_\n  want pre-commit hooks to fire, you can run\n  `git commit -a -m \"Your message here\" --no-verify`.\n\n## License\n\nThis project is licensed under either of\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](./LICENSE-APACHE) or [http://www.apache.org/licenses/LICENSE-2.0][apache])\n- MIT license ([LICENSE-MIT](./LICENSE-MIT) or [http://opensource.org/licenses/MIT][mit])\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in the work by you, as defined in the Apache-2.0\nlicense, shall be dual licensed as above, without any additional terms or\nconditions.\n\n[apache]: https://www.apache.org/licenses/LICENSE-2.0\n[cargo-expand]: https://github.com/dtolnay/cargo-expand\n[cargo-udeps]: https://github.com/est31/cargo-udeps\n[cargo-watch]: https://github.com/watchexec/cargo-watch\n[commit-spec]: https://www.conventionalcommits.org/en/v1.0.0/#specification\n[commit-spec-site]: https://www.conventionalcommits.org/\n[irust]: https://github.com/sigmaSd/IRust\n[mit]: http://opensource.org/licenses/MIT\n[pre-commit]: https://pre-commit.com/\n[crate::lazy_ref]: https://docs.rs/lazy-attribute/latest/lazy_attribute/attr.lazy_ref.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappcypher%2Flazy-attribute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappcypher%2Flazy-attribute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappcypher%2Flazy-attribute/lists"}