{"id":25349832,"url":"https://github.com/metaswitch/frunk-enum","last_synced_at":"2025-10-18T06:33:43.225Z","repository":{"id":49170876,"uuid":"186439699","full_name":"Metaswitch/frunk-enum","owner":"Metaswitch","description":"Extensions to frunk (https://github.com/lloydmeta/frunk) to allow transmogrification of `enum` types","archived":false,"fork":false,"pushed_at":"2025-01-01T08:22:44.000Z","size":68,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-01T14:17:45.213Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Metaswitch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE-APACHE-2.0","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}},"created_at":"2019-05-13T14:48:19.000Z","updated_at":"2024-05-17T14:37:39.000Z","dependencies_parsed_at":"2023-11-15T19:47:03.247Z","dependency_job_id":null,"html_url":"https://github.com/Metaswitch/frunk-enum","commit_stats":{"total_commits":25,"total_committers":3,"mean_commits":8.333333333333334,"dds":"0.16000000000000003","last_synced_commit":"ee70a93453fa0a815f43444d901c1d1b71d52a83"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Metaswitch%2Ffrunk-enum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Metaswitch%2Ffrunk-enum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Metaswitch%2Ffrunk-enum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Metaswitch%2Ffrunk-enum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Metaswitch","download_url":"https://codeload.github.com/Metaswitch/frunk-enum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238878934,"owners_count":19545855,"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":"2025-02-14T16:58:21.421Z","updated_at":"2025-10-18T06:33:43.140Z","avatar_url":"https://github.com/Metaswitch.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Frunk Enum Support\n\n[![Crates.io - frunk-enum](https://img.shields.io/crates/v/frunk-enum-core.svg)](https://crates.io/crates/frunk-enum-core) [![License: MIT/APACHE-2.0](https://img.shields.io/badge/License-MIT%2FAPACHE--2.0-green.svg)](https://opensource.org/licenses/MIT)\n\n## Usage\n\nThese crates augment the [frunk](https://docs.rs/frunk/latest/frunk/) crate to\nallow transmogrification of `enum`s as well as `struct`s.  For more information\non transmogrification and the `LabelledGeneric` trait it's based around, see\nhttps://docs.rs/frunk/latest/frunk/#transmogrifying and\nhttps://docs.rs/frunk/latest/frunk/labelled/trait.LabelledGeneric.html.\n\nTo take advantage of this feature for your own enum you need to:\n\n* Add the `frunk-enum-derive` as a `[dev-dependency]` to your `Cargo.toml`\n* Mark the enum with the custom derive:\n\n    ```\n    #[derive(LabelledGenericEnum)]\n    enum Foo {\n        Bar(String),\n        Baz { name: String, id: Identity },\n    }\n    ```\n* Add the `frunk-enum-core` and `frunk-core` crates as `[dependency]` entries\n  to your `Cargo.toml`\n* Then (assuming there's a `NewFoo` enum with the same structure as `Foo`) you can write:\n\n    ```\n    let foo = Foo::Baz { name: \"Andy\".into(), id: Identity };\n    let new_foo: NewFoo = foo.transmogrify();\n    ```\n\nThis works by deriving an implementation of `LabelledGeneric` for `Foo` which\nallows conversion to and from an instance of a generic sum-type.  The core\ncrate provides tools for converting between these generic sum-types where the\nbodies of the variants are recursively transmogrifiable.  This allows for\narbitrarily deep conversion between types, especially useful where the two\ntypes in question are autogenerated from some common input file, but are deemed\nto be different types by the rust compiler (e.g. because they're in separate\ncrates).\n\n## Contributing\n\nThank you for your interest in frunk-enum, all contributions are welcome whether\nthey be reports of issues, feature requests or code contributions.\n\n### Issue Contribution\n\nWhen opening issues please provide a description of the issue, the version of\nfrunk and frunk-enum plus example code which exhibits the issue.\n\n### Code Contribution\n\nIf you wish to contribute code to frunk-enum, you are welcome to do so using a\ngithub pull request, however you will need to sign each commit, to indicate\nthat you are abiding to the terms of the [DCO](DCO).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetaswitch%2Ffrunk-enum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetaswitch%2Ffrunk-enum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetaswitch%2Ffrunk-enum/lists"}