{"id":16918461,"url":"https://github.com/poignardazur/assert_let","last_synced_at":"2026-03-16T10:05:35.251Z","repository":{"id":56776646,"uuid":"525018752","full_name":"PoignardAzur/assert_let","owner":"PoignardAzur","description":"Rust macro `assert_let` to provide convenient pattern matching in tests.","archived":false,"fork":false,"pushed_at":"2023-02-21T13:21:25.000Z","size":8,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T12:41:19.100Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/PoignardAzur.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":"2022-08-15T14:28:42.000Z","updated_at":"2024-10-15T04:25:09.000Z","dependencies_parsed_at":"2025-02-19T19:34:14.776Z","dependency_job_id":"16a74a52-f25c-46c6-9e49-9ee358bfecea","html_url":"https://github.com/PoignardAzur/assert_let","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PoignardAzur%2Fassert_let","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PoignardAzur%2Fassert_let/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PoignardAzur%2Fassert_let/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PoignardAzur%2Fassert_let/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PoignardAzur","download_url":"https://codeload.github.com/PoignardAzur/assert_let/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248441748,"owners_count":21104062,"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":[],"created_at":"2024-10-13T19:40:06.722Z","updated_at":"2025-10-16T00:21:54.760Z","avatar_url":"https://github.com/PoignardAzur.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# assert_let_bind\n\nA convenience macro for writing pattern-matching tests in the Rust programming\nlanguage.\n\nThe `assert_let` macro tests whether a value matches a given pattern, binding\nthe pattern in the current scope if the match succeeds and causing a panic if\nthe match fails.\n\n(Strongly inspired by\n[assert_matches](https://github.com/murarth/assert_matches))\n\n```\nuse assert_let_bind::assert_let;\n\n#[derive(Debug)]\nenum Foo {\n    A(i32, i32),\n    B(i32),\n}\n\nlet foo = Foo::A(3000, 2000);\n\nassert_let!(Foo::A(x, y), foo);\nassert_eq!(x + y, 5000);\n```\n\nGenerally speaking, `assert_let(pattern, expr)` is roughly equivalent to:\n\n```rust\nlet pattern = expr else { panic!(\"some panic message with {} {}\", pattern, expr)};\n```\n\n## Usage\n\nThis macro relies on `let else`, and thus only compiles from Rust 1.65 onwards.\n\nTo add it to your project:\n\n```rust\ncargo add assert_let_bind\n```\n\nTo add it only to your tests:\n\n```rust\ncargo add --dev assert_let_bind\n```\n\n## License\n\nThis code is distributed under the terms of the MIT license. See LICENSE file\nfor details.\n\n## Contributing\n\nContributions are unnecessary because this crate is already perfect.\n\nIn the unlikely eventuality that it isn't, issues and pull requests welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoignardazur%2Fassert_let","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoignardazur%2Fassert_let","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoignardazur%2Fassert_let/lists"}