{"id":18823599,"url":"https://github.com/yvt/flags-macro-rs","last_synced_at":"2026-03-15T05:15:31.782Z","repository":{"id":57630193,"uuid":"158909944","full_name":"yvt/flags-macro-rs","owner":"yvt","description":"Provides a helper macro for writing bitflags in Rust.","archived":false,"fork":false,"pushed_at":"2020-01-08T14:13:04.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-22T02:50:08.004Z","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":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yvt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-24T06:42:26.000Z","updated_at":"2020-01-08T14:13:07.000Z","dependencies_parsed_at":"2022-09-26T20:11:17.238Z","dependency_job_id":null,"html_url":"https://github.com/yvt/flags-macro-rs","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/yvt/flags-macro-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvt%2Fflags-macro-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvt%2Fflags-macro-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvt%2Fflags-macro-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvt%2Fflags-macro-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yvt","download_url":"https://codeload.github.com/yvt/flags-macro-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvt%2Fflags-macro-rs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262327154,"owners_count":23294212,"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":"2024-11-08T00:54:08.209Z","updated_at":"2026-03-15T05:15:26.749Z","avatar_url":"https://github.com/yvt.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flags-macro\n\n[\u003cimg src=\"https://docs.rs/flags-macro/badge.svg\" alt=\"docs.rs\"\u003e](https://docs.rs/flags-macro/)\n\nThis crate provides a convenient macro `flags` for constructing bitflags.\nIt's designed to be compatible with [`bitflags`] and [`enumflags`] but works\nwith any bitflags-like types.\n\n[`bitflags`]: https://crates.io/crates/bitflags\n[`enumflags`]: https://crates.io/crates/enumflags\n\n## Examples\n\n`bitflags`:\n\n```rust\n#[macro_use]\nextern crate bitflags;\nbitflags! {\n    struct Test: u32 {\n        const A = 0b0001;\n        const B = 0b0010;\n    }\n}\n\nlet flags0 = flags![Test::{}];\nlet flags1 = flags![Test::{A}];\nlet flags2 = flags![Test::{A | B}];\n\nassert_eq!(flags0, Test::empty());\nassert_eq!(flags1, Test::A);\nassert_eq!(flags2, Test::A | Test::B);\n```\n\n`enumflags`:\n\n```rust\n#[macro_use]\nextern crate enumflags;\n#[derive(EnumFlags, Copy, Clone, PartialEq, Eq, Debug)]\n#[repr(u8)]\npub enum Test { A = 0b0001, B = 0b0010 }\n\nlet flags0 = flags![Test::{}];\nlet flags1 = flags![Test::{A}];\nlet flags2 = flags![Test::{A | B}];\n\nassert_eq!(flags0, enumflags::BitFlags::empty());\nassert_eq!(flags1, Test::A);\nassert_eq!(flags2, Test::A | Test::B);\n```\n\nLicense: CC0-1.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyvt%2Fflags-macro-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyvt%2Fflags-macro-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyvt%2Fflags-macro-rs/lists"}