{"id":21586051,"url":"https://github.com/magiclen/boyer-moore-magiclen","last_synced_at":"2025-04-10T20:15:07.951Z","repository":{"id":57524718,"uuid":"179300490","full_name":"magiclen/boyer-moore-magiclen","owner":"magiclen","description":"Boyer-Moore-MagicLen, a fast string search algorithm implemented in Rust.","archived":false,"fork":false,"pushed_at":"2024-05-01T13:26:49.000Z","size":204,"stargazers_count":13,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T17:55:19.065Z","etag":null,"topics":["boyer-moore","rust","string-search"],"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/magiclen.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":"2019-04-03T13:52:16.000Z","updated_at":"2025-01-30T16:33:29.000Z","dependencies_parsed_at":"2024-05-01T15:02:04.378Z","dependency_job_id":"baadbb28-39db-476e-895e-9e33f9a5a377","html_url":"https://github.com/magiclen/boyer-moore-magiclen","commit_stats":{"total_commits":54,"total_committers":1,"mean_commits":54.0,"dds":0.0,"last_synced_commit":"874d0ea68c2f18b569a3bca5c3ec0c0675b854a7"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fboyer-moore-magiclen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fboyer-moore-magiclen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fboyer-moore-magiclen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fboyer-moore-magiclen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magiclen","download_url":"https://codeload.github.com/magiclen/boyer-moore-magiclen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248288618,"owners_count":21078907,"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":["boyer-moore","rust","string-search"],"created_at":"2024-11-24T15:12:30.187Z","updated_at":"2025-04-10T20:15:07.930Z","avatar_url":"https://github.com/magiclen.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Boyer-Moore-MagicLen\n====================\n\n[![CI](https://github.com/magiclen/boyer-moore-magiclen/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/boyer-moore-magiclen/actions/workflows/ci.yml)\n\nThis crate can be used to search substrings in a string or search any sub-sequences in any sequence by using boyer-moore-magiclen (which is sometimes faster than boyer-moore and boyer-moore-horspool).\n\n## Usage\n\nFor binary data and UTF-8 data, use the `BMByte` struct. For character sequences, use the `BMCharacter` struct (however it is much slower than `BMByte`). The `BMCharacter` struct needs the standard library support, and you have to enable the `character` feature to make it available.\n\nEvery `BMXXX` has a `from` associated function to create the instance by a search pattern (the needle).\n\nFor example,\n\n```rust\nuse boyer_moore_magiclen::BMByte;\n\nlet bmb = BMByte::from(\"oocoo\").unwrap();\n```\n\nNow, we can search any binary data or UTF-8 data for the pattern `oocoo`.\n\nThere are two search modes and two search directions. The first mode is called **full text search**, which finds the positions of the matched sub-sequences including the overlapping ones.\n\n```rust\nuse boyer_moore_magiclen::BMByte;\n\nlet bmb = BMByte::from(\"oocoo\").unwrap();\n\nassert_eq!(vec![1, 4], bmb.find_full_in(\"coocoocoocoo\", 2));\n```\n\nThe other mode is called **normal text search**, which finds the positions of the matched sub-sequences excluding the overlapping ones.\n\n```rust\nuse boyer_moore_magiclen::BMByte;\n\nlet bmb = BMByte::from(\"oocoo\").unwrap();\n\nassert_eq!(vec![1, 7], bmb.find_in(\"coocoocoocoo\", 2));\n```\n\nThe search direction can be from the head (searching forward, `find_xxx`) or from the tail (searching backward, `rfind_xxx`).\n\n```rust\nuse boyer_moore_magiclen::BMByte;\n\nlet bmb = BMByte::from(\"oocoo\").unwrap();\n\nassert_eq!(vec![7, 1], bmb.rfind_in(\"coocoocoocoo\", 2));\n```\n\nTo search all results at a time, use the `find_all_in`, `rfind_all_in`, `find_full_all_in` or `rfind_full_all_in` method.\n\n```rust\nuse boyer_moore_magiclen::BMByte;\n\nlet bmb = BMByte::from(\"oocoo\").unwrap();\n\nassert_eq!(vec![7, 4, 1], bmb.rfind_full_all_in(\"coocoocoocoo\"));\n```\n\n## Benchmark\n\n```bash\ncargo bench --bench full_text_search\n```\n\nor\n\n```bash\ncargo bench --bench normal_text_search\n```\n\n## Crates.io\n\nhttps://crates.io/crates/boyer-moore-magiclen\n\n## Documentation\n\nhttps://docs.rs/boyer-moore-magiclen\n\n## License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Fboyer-moore-magiclen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagiclen%2Fboyer-moore-magiclen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Fboyer-moore-magiclen/lists"}