{"id":24756357,"url":"https://github.com/dalance/bitpattern","last_synced_at":"2025-12-12T13:21:07.571Z","repository":{"id":52406955,"uuid":"280208668","full_name":"dalance/bitpattern","owner":"dalance","description":"bitwise pattern matching and extracting","archived":false,"fork":false,"pushed_at":"2024-04-03T11:46:02.000Z","size":18,"stargazers_count":5,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-19T00:36:04.032Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dalance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"dalance"}},"created_at":"2020-07-16T16:52:55.000Z","updated_at":"2024-01-16T16:26:36.000Z","dependencies_parsed_at":"2022-09-06T10:20:52.523Z","dependency_job_id":null,"html_url":"https://github.com/dalance/bitpattern","commit_stats":null,"previous_names":["dalance/bitmatch"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Fbitpattern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Fbitpattern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Fbitpattern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Fbitpattern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dalance","download_url":"https://codeload.github.com/dalance/bitpattern/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236026072,"owners_count":19083318,"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":"2025-01-28T13:51:06.138Z","updated_at":"2025-10-11T02:31:35.564Z","avatar_url":"https://github.com/dalance.png","language":"Rust","funding_links":["https://github.com/sponsors/dalance"],"categories":[],"sub_categories":[],"readme":"# bitpattern\nbitwise pattern matching and extracting\n\n[![Actions Status](https://github.com/dalance/bitpattern/workflows/Regression/badge.svg)](https://github.com/dalance/bitpattern/actions)\n[![Crates.io](https://img.shields.io/crates/v/bitpattern.svg)](https://crates.io/crates/bitpattern)\n[![Docs.rs](https://docs.rs/bitpattern/badge.svg)](https://docs.rs/bitpattern)\n![Minimum rustc version](https://img.shields.io/badge/rustc-1.45+-lightgray.svg)\n\n## Usage\n\n```Cargo.toml\n[dependencies]\nbitpattern = \"0.1.0\"\n```\n\n## Example\n\n```rust\n    let x = 0xacu8; // 10101100\n\n    // '0' means the bit must be 0.\n    // '1' means the bit must be 1.\n    // '_' can be uses as separator.\n    assert_eq!(bitpattern!(\"1010_1100\", x), Some(()));\n    assert_eq!(bitpattern!(\"1010_0100\", x), None);\n\n    // '?' means the bit can be 0 or 1.\n    assert_eq!(bitpattern!(\"1?10_1?00\", x), Some(()));\n\n    // Other charactors can be used for extracting.\n    // 'a' extracts a single bit.\n    assert_eq!(bitpattern!(\"1a10_1100\", x), Some(0));\n    assert_eq!(bitpattern!(\"10a0_1100\", x), Some(1));\n\n    // Multi-bit extracting by continuous charactors.\n    assert_eq!(bitpattern!(\"1aaa_a100\", x), Some(5));\n\n    // Multiple extracting.\n    assert_eq!(bitpattern!(\"1aa0_aa00\", x), Some((1, 3)));\n\n    // If the extracting fields are adjacent, the different charactors can be used.\n    assert_eq!(bitpattern!(\"1aab_bccc\", x), Some((1, 1, 4)));\n```\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalance%2Fbitpattern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdalance%2Fbitpattern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalance%2Fbitpattern/lists"}