{"id":18019585,"url":"https://github.com/laysakura/fid-rs","last_synced_at":"2026-03-16T08:01:25.492Z","repository":{"id":34748066,"uuid":"182409639","full_name":"laysakura/fid-rs","owner":"laysakura","description":"High performance FID (Fully Indexable Dictionary) library","archived":false,"fork":false,"pushed_at":"2024-07-19T09:07:17.000Z","size":5695,"stargazers_count":23,"open_issues_count":3,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T07:06:58.757Z","etag":null,"topics":["fid","fully-indexable-dictionary","rust","succinct-bit-vector","succinct-data-structure"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/fid-rs","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/laysakura.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","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-20T13:30:52.000Z","updated_at":"2024-04-14T21:55:52.000Z","dependencies_parsed_at":"2024-10-30T05:43:14.543Z","dependency_job_id":null,"html_url":"https://github.com/laysakura/fid-rs","commit_stats":{"total_commits":76,"total_committers":2,"mean_commits":38.0,"dds":0.07894736842105265,"last_synced_commit":"40f52ab3f3701b270ec21735758f6bed111067bb"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysakura%2Ffid-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysakura%2Ffid-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysakura%2Ffid-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysakura%2Ffid-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laysakura","download_url":"https://codeload.github.com/laysakura/fid-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625493,"owners_count":21135513,"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":["fid","fully-indexable-dictionary","rust","succinct-bit-vector","succinct-data-structure"],"created_at":"2024-10-30T05:11:16.179Z","updated_at":"2026-03-16T08:01:20.415Z","avatar_url":"https://github.com/laysakura.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fid-rs\n\nHigh performance FID (Fully Indexable Dictionary) library.\n\n[Master API Docs](https://laysakura.github.io/fid-rs/fid_rs/)\n|\n[Released API Docs](https://docs.rs/crate/fid-rs)\n|\n[Benchmark Results](https://laysakura.github.io/fid-rs/criterion/report/)\n|\n[Changelog](https://github.com/laysakura/fid-rs/blob/master/CHANGELOG.md)\n\n[![GitHub Actions Status](https://github.com/laysakura/fid-rs/actions/workflows/clippy.yml/badge.svg)](https://github.com/laysakura/fid-rs/actions)\n[![Travis Status](https://travis-ci.com/laysakura/fid-rs.svg?branch=master)](https://travis-ci.com/laysakura/fid-rs)\n[![Crates.io Version](https://img.shields.io/crates/v/fid-rs.svg)](https://crates.io/crates/fid-rs)\n[![Crates.io Downloads](https://img.shields.io/crates/d/fid-rs.svg)](https://crates.io/crates/fid-rs)\n[![Minimum rustc version](https://img.shields.io/badge/rustc-1.33+-lightgray.svg)](https://github.com/laysakura/fid-rs#rust-version-supports)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/laysakura/fid-rs/blob/master/LICENSE-MIT)\n[![License: Apache 2.0](https://img.shields.io/badge/license-Apache_2.0-blue.svg)](https://github.com/laysakura/fid-rs/blob/master/LICENSE-APACHE)\n\n## Quickstart\n\nTo use fid-rs, add the following to your `Cargo.toml` file:\n\n```toml\n[dependencies]\nfid-rs = \"0.1\"  # NOTE: Replace to latest minor version.\n```\n\n### Usage Overview\n\n```rust\nuse fid_rs::Fid;\n\nlet fid = Fid::from(\"0100_1\");  // Tips: Fid::from::\u003c\u0026str\u003e() ignores '_'.\n\n// Basic operations ---------------------\nassert_eq!(fid[0], false);  // [0]1001; 0th bit is '0' (false)\nassert_eq!(fid[1], true);   // 0[1]001; 1st bit is '1' (true)\nassert_eq!(fid[4], true);   // 0100[1]; 4th bit is '1' (true)\n\nassert_eq!(fid.rank(0), 0);  // [0]1001; Range [0, 0] has no '1'\nassert_eq!(fid.rank(3), 1);  // [0100]1; Range [0, 3] has 1 '1'\nassert_eq!(fid.rank(4), 2);  // [01001]; Range [0, 4] has 2 '1's\n\nassert_eq!(fid.select(0), Some(0)); // []01001; Minimum i where range [0, i] has 0 '1's is i=0\nassert_eq!(fid.select(1), Some(1)); // 0[1]001; Minimum i where range [0, i] has 1 '1's is i=1\nassert_eq!(fid.select(2), Some(4)); // 0100[1]; Minimum i where range [0, i] has 2 '1's is i=4\nassert_eq!(fid.select(3), None);    // There is no i where range [0, i] has 3 '1's\n\n// rank0, select0 -----------------------\nassert_eq!(fid.rank0(0), 1);  // [0]1001; Range [0, 0] has no '0'\nassert_eq!(fid.rank0(3), 3);  // [0100]1; Range [0, 3] has 3 '0's\nassert_eq!(fid.rank0(4), 3);  // [01001]; Range [0, 4] has 3 '0's\n\nassert_eq!(fid.select0(0), Some(0)); // []01001; Minimum i where range [0, i] has 0 '0's is i=0\nassert_eq!(fid.select0(1), Some(0)); // [0]1001; Minimum i where range [0, i] has 1 '0's is i=0\nassert_eq!(fid.select0(2), Some(2)); // 01[0]01; Minimum i where range [0, i] has 2 '0's is i=2\nassert_eq!(fid.select0(4), None);    // There is no i where range [0, i] has 4 '0's\n```\n\n### Constructors\n\n```rust\nuse fid_rs::Fid;\n\n// Most human-friendly way: Fid::from::\u003c\u0026str\u003e()\nlet fid = Fid::from(\"0100_1\");\n\n// Complex construction in simple way: Fid::from::\u003c\u0026[bool]\u003e()\nlet mut arr = [false; 5];\narr[1] = true;\narr[4] = true;\nlet fid = Fid::from(\u0026arr[..]);\n```\n\n### Iterator\n\n```rust\nuse fid_rs::Fid;\n\nlet fid = Fid::from(\"0100_1\");\n\nfor bit in fid.iter() {\n    println!(\"{}\", bit);\n}\n// =\u003e\n// false\n// true\n// false\n// false\n// true\n```\n\n### Utility Methods\n\n```rust\nuse fid_rs::Fid;\n\nlet fid = Fid::from(\"0100_1\");\n\nassert_eq!(fid.len(), 5);\n```\n\n## Features\n\n- **Arbitrary length support with minimum working memory**: fid-rs provides virtually _arbitrary size_ of FID. It is carefully designed to use as small memory space as possible.\n- **Parallel build of FID**: Build operations (`Fid::from()`) takes _O(N)_ time. It is parallelized and achieves nearly optimal scale-out.\n- **No memory copy while/after build operations**: After internally creating bit vector representation, any operation does not do memory copy.\n- **Latest benchmark results are always accessible**: fid-rs is continuously benchmarked in Travis CI using [Criterion.rs](https://crates.io/crates/criterion). Graphical benchmark results are published [here](https://laysakura.github.io/fid-rs/criterion/report/).\n\n### Complexity\n\nWhen the length of a `Fid` is _N_:\n\n| Operation | Time-complexity | Space-complexity |\n|-----------|-----------------|------------------|\n| [Fid::from::\u003c\u0026str\u003e()](https://laysakura.github.io/fid-rs/fid_rs/fid/struct.Fid.html#implementations) | _O(N)_ | _N + o(N)_ |\n| [Fid::from::\u003c\u0026[bool]\u003e()](https://laysakura.github.io/fid-rs/fid_rs/fid/struct.Fid.html#implementations) | _O(N)_ | _N + o(N)_ |\n| [Index\u0026lt;u64\u0026gt;](https://laysakura.github.io/fid-rs/fid_rs/fid/struct.Fid.html#impl-Index\u003cu64\u003e) | _O(1)_ | _0_ |\n| [Fid::rank()](https://laysakura.github.io/fid-rs/fid_rs/fid/struct.Fid.html#method.rank) | _O(1)_ | _O(1)_ |\n| [Fid::rank0()](https://laysakura.github.io/fid-rs/fid_rs/fid/struct.Fid.html#method.rank0) | _O(1)_ | _O(1)_ |\n| [Fid::select()](https://laysakura.github.io/fid-rs/fid_rs/fid/struct.Fid.html#method.select) | _O(log N)_ | _O(1)_ |\n| [Fid::select0()](https://laysakura.github.io/fid-rs/fid_rs/fid/struct.Fid.html#method.select0) | _O(log N)_ | _O(1)_ |\n\n(Actually, `select()`'s time-complexity can be _O(1)_ with complex implementation but fid-rs, like many other libraries, uses binary search of `rank()`'s result).\n\n## Versions\nfid-rs uses [semantic versioning](http://semver.org/spec/v2.0.0.html).\n\nSince current major version is _0_, minor version update might involve breaking public API change (although it is carefully avoided).\n\n## Rust Version Supports\n\nfid-rs is continuously tested with these Rust versions in Travis CI:\n\n- 1.33.0\n- Latest stable version\n- Beta version\n- Nightly build\n\nSo it expectedly works with Rust 1.33.0 and any newer versions.\n\nOlder versions may also work, but are not tested or guaranteed.\n\n## Contributing\n\nAny kind of pull requests are appreciated.\n\n### Guidelines\n\n- `README.md` is generated from `$ cargo readme` command. Do not manually update `README.md` but edit `src/lib.rs` and then `$ cargo readme \u003e README.md`.\n- Travis CI automatically does the following commit \u0026 push to your pull-requests:\n    - `$ cargo readme \u003e README.md`\n    - `$ cargo fmt --all`\n\n## License\n\nMIT OR Apache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaysakura%2Ffid-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaysakura%2Ffid-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaysakura%2Ffid-rs/lists"}