{"id":22822594,"url":"https://github.com/manighazaee/strpatmatch","last_synced_at":"2025-04-14T01:55:16.705Z","repository":{"id":265498159,"uuid":"896118184","full_name":"ManiGhazaee/strpatmatch","owner":"ManiGhazaee","description":"Simple string pattern matching","archived":false,"fork":false,"pushed_at":"2024-11-29T16:43:21.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T01:55:10.619Z","etag":null,"topics":["library","pattern-matching","rust","string"],"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/ManiGhazaee.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":"2024-11-29T15:25:54.000Z","updated_at":"2025-01-16T16:33:32.000Z","dependencies_parsed_at":"2024-11-29T16:53:13.769Z","dependency_job_id":"3f63f9c2-7f75-479b-bfec-ee260ed2623a","html_url":"https://github.com/ManiGhazaee/strpatmatch","commit_stats":null,"previous_names":["manighazaee/strpatmatch"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ManiGhazaee%2Fstrpatmatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ManiGhazaee%2Fstrpatmatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ManiGhazaee%2Fstrpatmatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ManiGhazaee%2Fstrpatmatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ManiGhazaee","download_url":"https://codeload.github.com/ManiGhazaee/strpatmatch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248809032,"owners_count":21164895,"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":["library","pattern-matching","rust","string"],"created_at":"2024-12-12T16:12:28.827Z","updated_at":"2025-04-14T01:55:16.679Z","avatar_url":"https://github.com/ManiGhazaee.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# String Pattern Matching\n\n## Features\n\n- Fast\n- Simple\n\n## Example\n\n```rust\nlet x = \"2a343bb8 c9\";\nassert_eq!(Some((\"2\", \"343\", \"8\", \"9\")), match_str!(x, {} \"a\" {} \"bb\" {} \" c\" {}));\nassert_eq!(None, match_str!(x, {} \"a\" {} \"d\" {})); // x doesn't contain \"d\"\nassert_eq!(Some(\"a343bb8 c\"), match_str!(x, \"2\" {} \"9\"));\nassert_eq!(None, match_str!(x, \"a\" {} \"c\")); // x doesn't start with \"a\" and end with \"c\"\n```\n\n---\n\n```rust\nlet x = match_str!(\"foo bar baz fuzz\", {} \"bar\" {} \"fuzz\");\nassert_eq!(Some((\"foo \", \" baz \")), x);\n```\n\nmacro expansion:\n\n```rust\nlet x = {\n    let s = strpatmatch::first_match_start(\"foo bar baz fuzz\", \"bar\");\n    if let Some(s) = s {\n        if let Some(m) = {\n            if (\u0026\"foo bar baz fuzz\"[s + \"bar\".len()..]).ends_with(\"fuzz\") {\n                Some((\n                    \u0026(\u0026\"foo bar baz fuzz\"[s\n                        + \"bar\"\n                        .len() - \"fuzz\".len())],\n                ))\n            } else {\n                None\n            }\n        } {\n            Some(strpatmatch::tuples::concat((\u0026\"foo bar baz fuzz\"[0..s],), m))\n        } else {\n            None\n        }\n    } else {\n        None\n    }\n};\n// assert_eq! ... \n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanighazaee%2Fstrpatmatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanighazaee%2Fstrpatmatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanighazaee%2Fstrpatmatch/lists"}