# bitflags/bitflags

A macro to generate structures which behave like bitflags

Repository: https://github.com/bitflags/bitflags
Canonical: https://ross.abutalabs.com/products/bitflags
Language: Rust
License: Apache-2.0
License Family: permissive
Topics: bitflags, structures, macros
Last push: 2026-07-16T09:48:24+00:00

## Health v2 (maintenance only)
Score: 90/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 92, release rhythm 81, longevity 100
- inputs: {"age_days": 4248, "days_push": 48, "days_rel": 49, "gap_med": 45, "n_releases_24m": 14}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1153, forks 167 (observed 2026-08-28T04:03:47.373683+00:00)

## What it is
A Rust crate providing a macro to generate structures that behave like sets of bitflags with well-defined semantics and ergonomic APIs. It supports set operations like union, intersection, difference, and complement, plus optional serde and bytemuck integrations.

## Use cases
- generate flags enums in Rust with ergonomic set operations
- wrap C API flags that may contain unknown bits
- create efficient options types with string parsing and formatting
- serialize and deserialize bitmask types with serde
- manage combinations of boolean options in a single integer

## When to choose
- you need type-safe bitflag sets in Rust
- you are binding to C APIs with flag parameters
- you want efficient multi-option types with parsing support

## When to avoid
- you need guaranteed-only-defined-bits enforcement
- you need C-style bitfields rather than flag sets

## Facets
- artifact type: library
- maturity: stable
- function: serialization
- domain: developer-tools, programming-languages
- platform: rust
- tags: bitflags, bitmask, macros, flags-enum, rust-crate

## Member repositories
- bitflags/bitflags (main) score 90

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:47.373683+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:33:27.267410+00:00, confidence not recorded.
  - readme: https://github.com/bitflags/bitflags (fetched 2026-08-28T04:03:47.373683+00:00, sha 4fd0ec385222)
  - registry_crates: https://crates.io/api/v1/crates/bitflags (fetched 2026-08-29T12:37:56.520080+00:00, sha d76c2ae9445e)
- Data as of 2026-08-30T08:39:29.467469+00:00.
