{"id":20384939,"url":"https://github.com/d-e-s-o/serde_variant","last_synced_at":"2025-08-04T12:12:19.449Z","repository":{"id":37930727,"uuid":"236425181","full_name":"d-e-s-o/serde_variant","owner":"d-e-s-o","description":"Retrieve serde provided variant names for enum objects.","archived":false,"fork":false,"pushed_at":"2025-03-23T17:51:38.000Z","size":62,"stargazers_count":13,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-22T11:01:14.938Z","etag":null,"topics":["enum","rust","serde","variant"],"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/d-e-s-o.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,"zenodo":null}},"created_at":"2020-01-27T05:25:45.000Z","updated_at":"2025-05-10T05:33:59.000Z","dependencies_parsed_at":"2024-11-15T02:31:50.458Z","dependency_job_id":"e228f841-489b-4c23-b2e5-3b0c37e4a27f","html_url":"https://github.com/d-e-s-o/serde_variant","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":"0.050000000000000044","last_synced_commit":"5e9de2b6951c0aeb49401a0aa319abb1205dd3d5"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/d-e-s-o/serde_variant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-e-s-o%2Fserde_variant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-e-s-o%2Fserde_variant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-e-s-o%2Fserde_variant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-e-s-o%2Fserde_variant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d-e-s-o","download_url":"https://codeload.github.com/d-e-s-o/serde_variant/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-e-s-o%2Fserde_variant/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268695307,"owners_count":24292009,"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","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["enum","rust","serde","variant"],"created_at":"2024-11-15T02:30:47.034Z","updated_at":"2025-08-04T12:12:19.420Z","avatar_url":"https://github.com/d-e-s-o.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![pipeline](https://github.com/d-e-s-o/serde_variant/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/d-e-s-o/serde_variant/actions/workflows/test.yml)\n[![crates.io](https://img.shields.io/crates/v/serde_variant.svg)](https://crates.io/crates/serde_variant)\n[![Docs](https://docs.rs/serde_variant/badge.svg)](https://docs.rs/serde_variant)\n[![rustc](https://img.shields.io/badge/rustc-1.57+-blue.svg)](https://blog.rust-lang.org/2021/12/02/Rust-1.57.0.html)\n\nserde_variant\n=============\n\n- [Documentation][docs-rs]\n- [Changelog](CHANGELOG.md)\n\nSo you have just carefully defined your `enum` to be serialized and\ndeserialized using [`serde`][serde] as you intended and now you need an\nadditional `FromStr` or `Display` implementation that uses the same\nnames for `enum` variants as `serde` uses? You are reluctant to\nduplicate all those definitions in two places?\n\n**serde_variant** is a crate that allows you to retrieve back the\nidentifier of any `enum` variant passed to it.\n\n\nUsage\n-----\n\nThe crate provides a single function, `to_variant_name`, that retrieves\nthe name of a passed in `enum` variant. For example:\n```rust\nuse serde_variant::to_variant_name;\n\n#[derive(Serialize)]\nenum Foo {\n  Var1,\n  #[serde(rename = \"VAR2\")]\n  Var2,\n}\n\nassert_eq!(to_variant_name(\u0026Foo::Var1).unwrap(), \"Var1\");\nassert_eq!(to_variant_name(\u0026Foo::Var2).unwrap(), \"VAR2\");\n```\n\n[docs-rs]: https://docs.rs/crate/serde_variant\n[serde]: https://crates.io/crates/serde\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd-e-s-o%2Fserde_variant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd-e-s-o%2Fserde_variant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd-e-s-o%2Fserde_variant/lists"}