{"id":13611782,"url":"https://github.com/doctorn/obake","last_synced_at":"2025-04-13T05:33:38.663Z","repository":{"id":47449411,"uuid":"400179052","full_name":"doctorn/obake","owner":"doctorn","description":"Versioned data-structures for Rust","archived":false,"fork":false,"pushed_at":"2023-04-20T14:48:59.000Z","size":76,"stargazers_count":202,"open_issues_count":3,"forks_count":8,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-01T18:34:53.655Z","etag":null,"topics":["migration","rust","serialization","versioning"],"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/doctorn.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2021-08-26T13:28:55.000Z","updated_at":"2024-04-13T22:22:23.000Z","dependencies_parsed_at":"2024-01-14T06:51:27.363Z","dependency_job_id":"6f4a131d-2f75-4ff2-99a9-fe9822ff077f","html_url":"https://github.com/doctorn/obake","commit_stats":{"total_commits":34,"total_committers":4,"mean_commits":8.5,"dds":"0.11764705882352944","last_synced_commit":"4087ea477cc7e09e26b82f604f36879a51bb64e9"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doctorn%2Fobake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doctorn%2Fobake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doctorn%2Fobake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doctorn%2Fobake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doctorn","download_url":"https://codeload.github.com/doctorn/obake/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670513,"owners_count":21142896,"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":["migration","rust","serialization","versioning"],"created_at":"2024-08-01T19:02:07.378Z","updated_at":"2025-04-13T05:33:33.999Z","avatar_url":"https://github.com/doctorn.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"[![Build](https://github.com/doctorn/obake/actions/workflows/obake.yml/badge.svg)](https://github.com/doctorn/obake/actions/workflows/obake.yml)\n[![Issues][issues-shield]][issues-url]\n[![crates.io][crates-io-shield]][crates-io-url]\n[![License][license-shield]][license-url]\n\n\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003eお化け\u003c/h1\u003e\n  \u003ch3 align=\"center\"\u003eObake\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    Versioned data-structures for Rust.\n    \u003cbr /\u003e\n    \u003ca href=\"https://docs.rs/obake/\"\u003e\u003cstrong\u003eView on docs.rs »\u003c/strong\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n## About\n\nObake is a procedural macro for declaring and maintaining versioned data-structures. The name\n'obake' is taken from the Japanese 'お化け (おばけ)', a class of supernatural beings in\nJapanese folklore that shapeshift.\n\nWhen developing an application, configuration formats and internal data-structures typically evolve\nbetween versions. However, maintaining backwards compatibility between these versions requires\ndeclaring and maintaining data-structures for legacy formats and code for migrating between them.\nObake aims to make this process effortless.\n\n## Getting Started\n\nTo get started, add the following to your `Cargo.toml` file:\n\n```toml\n[dependencies]\nobake = \"1.0\"\n```\n\n## Example\n\n```rust\n#[obake::versioned]                 // create a versioned data-structure\n#[obake(version(\"0.1.0\"))]          // declare some versions\n#[obake(version(\"0.2.0\"))]\n#[derive(Debug, PartialEq, Eq)]     // additional attributes are applied to all versions\nstruct Foo {\n    #[obake(cfg(\"0.1.0\"))]          // enable fields for specific versions with\n    foo: String,                    // semantic version constraints\n   \n    #[obake(cfg(\"\u003e=0.2, \u003c=0.3.0\"))] // any semantic version constraint can appear in\n    bar: u32,                       // a `cfg` attribute \n   \n    #[obake(cfg(\"0.1.0\"))]          // multiple `cfg` attributes are treated as a\n    #[obake(cfg(\"\u003e=0.3\"))]          // disjunction over version constraints\n    baz: char,\n}\n\n// describe migrations between versions using the `From` trait\n// and an automatically generated type-level macro for referring to\n// specific versions of `Foo`\nimpl From\u003cFoo![\"0.1.0\"]\u003e for Foo![\"0.2.0\"] {\n    fn from(foo: Foo![\"0.1.0\"]) -\u003e Self {\n        Self { bar: 0 }\n    }\n}\n\n// an enumeration of all versions of `Foo` is accessed using the `obake::AnyVersion` type\n// alias\nlet versioned_example: obake::AnyVersion\u003cFoo\u003e = (Foo { bar: 42 }).into();\n\n// this enumeration implements `Into\u003cFoo\u003e`, where `Foo` is the latest declared\n// version of `Foo` (in this case, `Foo![\"0.2.0\"]`)\nlet example: Foo = versioned_example.into();\n\nassert_eq!(example, Foo { bar: 42 });\n```\n\n## Other Features\n\n- `#[obake(inherit)]`: allows nesting of versioned data-structures.\n- `#[obake(derive(...))]`: allows derive attributes to be applied to generated enums.\n- `#[obake(serde(...))]`: allows [`serde`](https://serde.rs) attributes to be applied to\n  generated `enum`s.\n  - Note: requires the feature `serde`.\n\n## Limitations\n\n- Cannot be applied to tuple structs (or enum variants with unnamed fields).\n- Cannot be applied to items with generic parameters.\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 Obake by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\u003c/sub\u003e\n\n[crates-io-shield]: https://img.shields.io/crates/v/obake\n[crates-io-url]: https://crates.io/crates/obake\n[issues-shield]: https://img.shields.io/github/issues/doctorn/obake.svg\n[issues-url]: https://github.com/doctorn/obake/issues\n[license-shield]: https://img.shields.io/crates/l/obake\n[license-url]: https://github.com/doctorn/obake/blob/main/LICENSE-APACHE\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoctorn%2Fobake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoctorn%2Fobake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoctorn%2Fobake/lists"}