{"id":22820171,"url":"https://github.com/kizzycode/serde_dynamic_typing-rust","last_synced_at":"2025-08-18T21:15:16.835Z","repository":{"id":57666682,"uuid":"399251821","full_name":"KizzyCode/serde_dynamic_typing-rust","owner":"KizzyCode","description":"A simplified `serde`-compatible type model that allows dynamic runtime inspection","archived":false,"fork":false,"pushed_at":"2021-10-15T00:50:38.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-14T11:41:57.379Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KizzyCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE BSD 2-CLAUSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-23T21:25:41.000Z","updated_at":"2021-10-15T00:50:41.000Z","dependencies_parsed_at":"2022-09-26T20:31:53.847Z","dependency_job_id":null,"html_url":"https://github.com/KizzyCode/serde_dynamic_typing-rust","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/KizzyCode/serde_dynamic_typing-rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KizzyCode%2Fserde_dynamic_typing-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KizzyCode%2Fserde_dynamic_typing-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KizzyCode%2Fserde_dynamic_typing-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KizzyCode%2Fserde_dynamic_typing-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KizzyCode","download_url":"https://codeload.github.com/KizzyCode/serde_dynamic_typing-rust/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KizzyCode%2Fserde_dynamic_typing-rust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271061608,"owners_count":24692586,"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-18T02:00:08.743Z","response_time":89,"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":[],"created_at":"2024-12-12T15:16:49.864Z","updated_at":"2025-08-18T21:15:16.809Z","avatar_url":"https://github.com/KizzyCode.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![docs.rs](https://docs.rs/serde_dynamic_typing/badge.svg)](https://docs.rs/serde_dynamic_typing)\n[![License BSD-2-Clause](https://img.shields.io/badge/License-BSD--2--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)\n[![License MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![crates.io](https://img.shields.io/crates/v/serde_dynamic_typing.svg)](https://crates.io/crates/serde_dynamic_typing)\n[![Download numbers](https://img.shields.io/crates/d/serde_dynamic_typing.svg)](https://crates.io/crates/serde_dynamic_typing)\n[![AppVeyor CI](https://ci.appveyor.com/api/projects/status/github/KizzyCode/serde_dynamic_typing-rust?svg=true)](https://ci.appveyor.com/project/KizzyCode/serde-dynamic-typing-rust)\n[![dependency status](https://deps.rs/crate/serde_dynamic_typing/0.1.0/status.svg)](https://deps.rs/crate/serde_dynamic_typing/0.1.0)\n\n# `serde_dynamic_typing`\nWelcome to `serde_dynamic_typing` 🎉\n\nThis crate implements a simplified `serde`-compatible type model which offers a simplified representation of various\nRust data structures and allows dynamic runtime inspection. The type model can also be used as intermediate\nrepresentation for custom serializers etc.\n\n## Why?\nSince the Rust compiler erases most type information, it makes runtime inspection and modification basically impossible.\nThere are some powerful ways such as the `Any`-trait or `serde`, however the first is mostly useful to implement dynamic\ninterfaces whereas the latter is designed to offer (de-)serialization of predefined static data structures.\n\n`serde_dynamic_typing` sits somewhere in the middle: On one side it behaves similar to `Any` since it offers a\nsimplified type model which can be used to build and inspect nearly arbitrarily complex data structures dynamically at\nruntime. On the other side it strives to be compatible with `serde` and `serde_derive`, so that you can transform\nexisting Rust types and structs to `AnyValue` and vice-versa.\n\nFurthermore it can also serve as a simple abstraction layer for `serde`: While `serde` is extremely versatile and\nefficient, it also requires a more complex type model and implementation. If you just want to write a simple\n(de-)serializer without the need for the full efficiency and features `serde` offers, `serde_dynamic_typing` can greatly\nsimplify the implementation.\n\n\n## Details and Example\nThe entire data model model is based around a few core types and an enum-based \"generic\" value type.\n\nThe simplified types are:\n - `Boolean` represents booleans\n - `Bytes` represents byte containers like `Vec\u003cu8\u003e`, `[u8]` or `[u8; N]`\n - `Enumeration` represents a Rust-native `enum` with optional associated values\n - `Float` represents floating point numbers\n - `Integer` represents integer types\n - `Map` represents map like types like `BTreeMap` and is also used to represent `struct`s and `enum`-values with named \n   fields\n - `Sequence` represents sequence types `Vec\u003c...\u003e`, `[...]` or `[...; N]` with arbitrary values and is also used to\n   represent `struct`s and `enum`s with tuple fields\n - `Utf8String` represents UTF-8 string types like `String`, `str` or `char`\n\nFurthermore there is a \"generic\" enum-type `AnyValue` which can hold any value of the types above.\n\nFor example, a struct like\n```rust\n#[derive(Serialize, Deserialize)]\nstruct ByteContainer {\n    #[serde(with = \"serde_bytes\")]\n    bytes: Vec\u003cu8\u003e\n}\n```\nis represented as\n```rust\nAnyValue::Map([\n    (\n        AnyValue::Utf8String(Utf8String::from(\"bytes\")),      // \u003c- map key\n        AnyValue::Bytes(Bytes::from(/* value of `bytes` */))  // \u003c- associated value\n    )\n])\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkizzycode%2Fserde_dynamic_typing-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkizzycode%2Fserde_dynamic_typing-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkizzycode%2Fserde_dynamic_typing-rust/lists"}