{"id":13822325,"url":"https://github.com/dtolnay/monostate","last_synced_at":"2025-05-16T09:02:38.237Z","repository":{"id":51292928,"uuid":"451809918","full_name":"dtolnay/monostate","owner":"dtolnay","description":"Type that deserializes only from one specific value","archived":false,"fork":false,"pushed_at":"2025-03-03T04:50:11.000Z","size":154,"stargazers_count":231,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-09T22:03:16.626Z","etag":null,"topics":["serde"],"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/dtolnay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"dtolnay"}},"created_at":"2022-01-25T09:16:43.000Z","updated_at":"2025-03-03T04:50:15.000Z","dependencies_parsed_at":"2023-12-17T03:24:43.796Z","dependency_job_id":"b6db5727-0283-43bf-9bb9-e12674a58417","html_url":"https://github.com/dtolnay/monostate","commit_stats":{"total_commits":69,"total_committers":2,"mean_commits":34.5,"dds":0.01449275362318836,"last_synced_commit":"a24dda18123c36b7c862c7a3bbddece6be9380c5"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtolnay%2Fmonostate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtolnay%2Fmonostate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtolnay%2Fmonostate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtolnay%2Fmonostate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dtolnay","download_url":"https://codeload.github.com/dtolnay/monostate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254501548,"owners_count":22081526,"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":["serde"],"created_at":"2024-08-04T08:01:54.756Z","updated_at":"2025-05-16T09:02:38.036Z","avatar_url":"https://github.com/dtolnay.png","language":"Rust","funding_links":["https://github.com/sponsors/dtolnay"],"categories":["Rust"],"sub_categories":[],"readme":"Monostate\n=========\n\n[\u003cimg alt=\"github\" src=\"https://img.shields.io/badge/github-dtolnay/monostate-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github\" height=\"20\"\u003e](https://github.com/dtolnay/monostate)\n[\u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/monostate.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust\" height=\"20\"\u003e](https://crates.io/crates/monostate)\n[\u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/badge/docs.rs-monostate-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logo=docs.rs\" height=\"20\"\u003e](https://docs.rs/monostate)\n[\u003cimg alt=\"build status\" src=\"https://img.shields.io/github/actions/workflow/status/dtolnay/monostate/ci.yml?branch=master\u0026style=for-the-badge\" height=\"20\"\u003e](https://github.com/dtolnay/monostate/actions?query=branch%3Amaster)\n\nThis library implements a type macro for a zero-sized type that is Serde\ndeserializable only from one specific value.\n\n```toml\n[dependencies]\nmonostate = \"0.1\"\n```\n\n\u003cbr\u003e\n\n## Examples\n\n```rust\nuse monostate::MustBe;\nuse serde::Deserialize;\n\n#[derive(Deserialize)]\nstruct Example {\n    kind: MustBe!(\"success\"),\n    code: MustBe!(200),\n}\n```\n\nThe above struct would deserialize from `{\"kind\":\"success\", \"code\":200}` in\nJSON, but would fail the deserialization if \"kind\" or \"code\" were any other\nvalue.\n\nThis can sometimes be helpful in processing untagged enums in which the variant\nidentification is more convoluted than what is handled by Serde's externally\ntagged and internally tagged representations, for example because the variant\ntag has an inconsistent type or key.\n\n```rust\nuse monostate::MustBe;\nuse serde::Deserialize;\n\n#[derive(Deserialize)]\n#[serde(untagged)]\npub enum ApiResponse {\n    Success {\n        success: MustBe!(true),\n    },\n    Error {\n        kind: MustBe!(\"error\"),\n        message: String,\n    },\n}\n```\n\n\u003cbr\u003e\n\n#### License\n\n\u003csup\u003e\nLicensed under either of \u003ca href=\"LICENSE-APACHE\"\u003eApache License, Version\n2.0\u003c/a\u003e or \u003ca href=\"LICENSE-MIT\"\u003eMIT license\u003c/a\u003e at your option.\n\u003c/sup\u003e\n\n\u003cbr\u003e\n\n\u003csub\u003e\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this crate by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\u003c/sub\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtolnay%2Fmonostate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdtolnay%2Fmonostate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtolnay%2Fmonostate/lists"}