{"id":33918802,"url":"https://github.com/nonnorm/toml-migrate","last_synced_at":"2026-06-05T18:31:30.941Z","repository":{"id":259007613,"uuid":"875875857","full_name":"nonnorm/toml-migrate","owner":"nonnorm","description":"Automatically migrate versioned config files to the latest version","archived":false,"fork":false,"pushed_at":"2025-05-10T14:56:01.000Z","size":13,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-13T14:44:09.101Z","etag":null,"topics":[],"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/nonnorm.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-21T02:42:59.000Z","updated_at":"2025-05-10T14:56:04.000Z","dependencies_parsed_at":"2025-05-10T15:32:37.748Z","dependency_job_id":null,"html_url":"https://github.com/nonnorm/toml-migrate","commit_stats":null,"previous_names":["ravenclaw900/toml-migrate","nonnorm/toml-migrate"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nonnorm/toml-migrate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonnorm%2Ftoml-migrate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonnorm%2Ftoml-migrate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonnorm%2Ftoml-migrate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonnorm%2Ftoml-migrate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nonnorm","download_url":"https://codeload.github.com/nonnorm/toml-migrate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonnorm%2Ftoml-migrate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30382669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T12:49:11.341Z","status":"ssl_error","status_checked_at":"2026-03-11T12:46:41.342Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-12-12T08:33:44.496Z","updated_at":"2026-03-11T13:17:51.887Z","avatar_url":"https://github.com/nonnorm.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# toml_migrate\nA crate that lets you read versioned config files and easily migrate them to the latest version.\nInspired by the [magic_migrate](https://crates.io/crates/magic_migrate) library.\n\n## Why?\nMany applications need their configuration files to evolve over time as features get added and changed. This aims to simplify the process of taking a old config file and transforming it to the latest version.\n\n## How does it work?\nFor every version of your library, define a configuration struct that can be deserialized. This struct should not include the version field:\n```rust\n#[derive(Deserialize)]\nstruct ConfigV1 {\n    name: String,\n    timeout: u32,\n}\n\n#[derive(Deserialize)]\nstruct ConfigV2 {\n    name: String,\n    timeout: u32,\n    // new!\n    retries: u8,\n}\n```\nThen, implement `From\u003cPreviousConfig\u003e` for all of your config types:\n```rust\nimpl From\u003cConfigV1\u003e for ConfigV2 {\n    fn from(prev: ConfigV1) -\u003e Self {\n        Self {\n            name: prev.name,\n            timeout: prev.timeout,\n            retries: 4,\n        }\n    }\n}\n```\nFinally, use the [`build_migration_chain!`] macro to automatically implement the `Migrate` trait for all of your structs:\n```rust\nbuild_migration_chain!(ConfigV1 = 1, ConfigV2 = 2);\n```\nFrom there, you can use the [`ConfigMigrator`] to easily migrate your config file from a string:\n```rust\nfn read_config() -\u003e ConfigV2 {\n    let config_str = r#\"\n        version = 1\n        name = \"MyApp\"\n        timeout = 60\n    \"#;\n\n    let migrator = ConfigMigrator::new(\"version\");\n    let (config, _) = migrator.migrate_config(config_str).unwrap();\n\n    config\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonnorm%2Ftoml-migrate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnonnorm%2Ftoml-migrate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonnorm%2Ftoml-migrate/lists"}