{"id":13683531,"url":"https://github.com/bitflags/bitflags","last_synced_at":"2025-12-12T14:09:35.930Z","repository":{"id":25848318,"uuid":"29287955","full_name":"bitflags/bitflags","owner":"bitflags","description":"A macro to generate structures which behave like bitflags","archived":false,"fork":false,"pushed_at":"2025-03-01T10:02:39.000Z","size":733,"stargazers_count":1007,"open_issues_count":10,"forks_count":149,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-04-29T06:05:50.442Z","etag":null,"topics":["bitflags","macros","structures"],"latest_commit_sha":null,"homepage":"","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/bitflags.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-01-15T08:30:44.000Z","updated_at":"2025-04-28T09:38:40.000Z","dependencies_parsed_at":"2024-02-15T03:26:46.867Z","dependency_job_id":"c30a897f-b190-4900-8408-d31992c09bbf","html_url":"https://github.com/bitflags/bitflags","commit_stats":{"total_commits":484,"total_committers":82,"mean_commits":5.902439024390244,"dds":"0.49380165289256195","last_synced_commit":"9c447a4585907ccca2d18aedcdc21e35e9f4e568"},"previous_names":["rust-lang/bitflags"],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflags%2Fbitflags","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflags%2Fbitflags/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflags%2Fbitflags/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflags%2Fbitflags/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitflags","download_url":"https://codeload.github.com/bitflags/bitflags/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251446171,"owners_count":21590668,"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":["bitflags","macros","structures"],"created_at":"2024-08-02T13:02:14.637Z","updated_at":"2025-12-12T14:09:35.852Z","avatar_url":"https://github.com/bitflags.png","language":"Rust","readme":"bitflags\n========\n\n[![Rust](https://github.com/bitflags/bitflags/workflows/Rust/badge.svg)](https://github.com/bitflags/bitflags/actions)\n[![Latest version](https://img.shields.io/crates/v/bitflags.svg)](https://crates.io/crates/bitflags)\n[![Documentation](https://docs.rs/bitflags/badge.svg)](https://docs.rs/bitflags)\n![License](https://img.shields.io/crates/l/bitflags.svg)\n\n`bitflags` generates flags enums with well-defined semantics and ergonomic end-user APIs.\n\nYou can use `bitflags` to:\n\n- provide more user-friendly bindings to C APIs where flags may or may not be fully known in advance.\n- generate efficient options types with string parsing and formatting support.\n\nYou can't use `bitflags` to:\n\n- guarantee only bits corresponding to defined flags will ever be set. `bitflags` allows access to the underlying bits type so arbitrary bits may be set.\n- define bitfields. `bitflags` only generates types where set bits denote the presence of some combination of flags.\n\n- [Documentation](https://docs.rs/bitflags)\n- [Specification](https://github.com/bitflags/bitflags/blob/main/spec.md)\n- [Release notes](https://github.com/bitflags/bitflags/releases)\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nbitflags = \"2.9.0\"\n```\n\nand this to your source code:\n\n```rust\nuse bitflags::bitflags;\n```\n\n## Example\n\nGenerate a flags structure:\n\n```rust\nuse bitflags::bitflags;\n\n// The `bitflags!` macro generates `struct`s that manage a set of flags.\nbitflags! {\n    /// Represents a set of flags.\n    #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]\n    struct Flags: u32 {\n        /// The value `A`, at bit position `0`.\n        const A = 0b00000001;\n        /// The value `B`, at bit position `1`.\n        const B = 0b00000010;\n        /// The value `C`, at bit position `2`.\n        const C = 0b00000100;\n\n        /// The combination of `A`, `B`, and `C`.\n        const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits();\n    }\n}\n\nfn main() {\n    let e1 = Flags::A | Flags::C;\n    let e2 = Flags::B | Flags::C;\n    assert_eq!((e1 | e2), Flags::ABC);   // union\n    assert_eq!((e1 \u0026 e2), Flags::C);     // intersection\n    assert_eq!((e1 - e2), Flags::A);     // set difference\n    assert_eq!(!e2, Flags::A);           // set complement\n}\n```\n\n## Rust Version Support\n\nThe minimum supported Rust version is documented in the `Cargo.toml` file.\nThis may be bumped in minor releases as necessary.\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitflags%2Fbitflags","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitflags%2Fbitflags","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitflags%2Fbitflags/lists"}