{"id":20673696,"url":"https://github.com/cpg314/skip-if","last_synced_at":"2026-02-13T07:37:05.104Z","repository":{"id":255528562,"uuid":"806216332","full_name":"cpg314/skip-if","owner":"cpg314","description":"Rust attribute macro to skip running a function that produces files","archived":false,"fork":false,"pushed_at":"2025-02-26T07:58:06.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-11T01:09:36.156Z","etag":null,"topics":["proc-macro","rust"],"latest_commit_sha":null,"homepage":"https://c.pgdm.ch/code","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/cpg314.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-05-26T17:39:17.000Z","updated_at":"2025-02-26T07:58:09.000Z","dependencies_parsed_at":"2025-03-10T18:06:12.709Z","dependency_job_id":null,"html_url":"https://github.com/cpg314/skip-if","commit_stats":null,"previous_names":["cpg314/skip-if"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cpg314/skip-if","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fskip-if","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fskip-if/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fskip-if/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fskip-if/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cpg314","download_url":"https://codeload.github.com/cpg314/skip-if/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fskip-if/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29398749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["proc-macro","rust"],"created_at":"2024-11-16T20:42:17.935Z","updated_at":"2026-02-13T07:37:05.079Z","avatar_url":"https://github.com/cpg314.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# skip-if\n\nThis Rust [attribute macro](https://doc.rust-lang.org/reference/procedural-macros.html#attribute-macros) skips running a function that produces a file or a folder (`output`) depending on a `strategy`.\n\n```rust\n#[skip_if(output=\"avatars.join(name)\", strategy=\"...\")]\nfn render_avatar(name: \u0026str, avatars: \u0026Path) -\u003e anyhow::Result\u003c()\u003e {\n  // This will be skipped depending on the strategy.\n  // e.g. do not run if the output already exists or if the function previously\n  // failed on these arguments.\n  Ok(())\n}\n```\n\nThe strategy (specified in the `strategy` attribute) has access to:\n\n- The arguments hash (excluding the ones provided in the `args_skip` attributes);\n- The source code hash;\n- The output path (as provided in the `output` attribute).\n- A callback with a reference to the result of the method call.\n\nFor convenience, the function on which the `skip_if` attribute is applied can access the value of the `output` expression through the `skip_if_output` variable.\n\n## Sample strategies\n\nThe simplest strategy, `skip_if::FileExists`, is to skip when the `output` path exists.\n\n```rust\n#[skip_if(output = \"output\", strategy = \"skip_if::FileExists\")]\n```\n\nA more advanced strategy, `skip_if::Markers`, offers the following options:\n\n- Use a marker success file (`{output}.success`) with source and arguments hashes to never skip when these change, even if the output file already exists.\n- Use a marker failure file (`{output}.failure`) to skip after a failure.\n  - Optionally, take into account source and argument hashes to retry nevertheless when these change.\n  - Optionally, mark some errors as retriable.\n- Directory mode, where output is assumed to be a directory. The `success` and `failure` markers are stored inside.\n\n```rust\n#[skip_if(\n  output = \"output\",\n  strategy = \"skip_if::Markers::default()\",\n  // or:\n  // strategy = \"skip_if::Markers::default().folder()\",\n)]\n```\n\n## TODO\n\n- Allow selectively disabling code and argument hashing (they are now tied together).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpg314%2Fskip-if","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcpg314%2Fskip-if","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpg314%2Fskip-if/lists"}