Comments (4)
Can you give a bit more detail on how you are using LinkedHashMap in your project? In particular, what is stopping you from upgrading your own linked-hash-map dependency to 0.4 without worrying about what serde_yaml uses?
from serde-yaml.
I forked your repository and added a branch with a simple reproduction / example: https://github.com/CmdrMoozy/serde-yaml/tree/issue_46.
The problem is that I want to deserialize a YAML structure which contains some sub-structure that is opaque to me (both its contents and structure vary wildly), so I want to have a serde_yaml::Mapping member of the struct I deserialize into.
However, serde_yaml's dependency on linked_hash_map doesn't enable its serde support, and version 0.3 of linked_hash_map is depending on serde 0.8, so we need to both bump the version and enable the serde_impl feature to get LinkedHashMap to implement Serialize, Deserialize for the right version of serde.
from serde-yaml.
Rather than bumping the dependency and relying on their Serde impls, I would prefer to go in the direction that serde_json has taken with serde_json::Map
which is an opaque wrapper around an underlying map type. So in our case we would have:
pub struct Mapping {
map: LinkedHashMap<Value, Value>,
}
impl Mapping { /* ... */ }
impl Default, Clone, PartialEq, Index, IndexMut, Debug, Extend,
FromIterator, IntoIterator, Serialize, Deserialize for Mapping { /* ... */ }
This way we avoid tying the serde_yaml public API to a particular version of linked-hash-map and we can swap out the underlying implementation transparently when linked-hash-map makes breaking changes or is superseded by a different library.
Would you be able to submit a PR for this change?
from serde-yaml.
Sure, I'll send a PR later today.
from serde-yaml.
Related Issues (20)
- #[serde(flatten)] disables treating an integer as a string
- Make Iterator implementation of Deserializer::from_reader lazy
- Fail to deserialize i128 in internally tagged enum HOT 1
- Deserialization using serde_yaml seems to be failing when it involves a nested struct
- [BUG] Tagged null at end of flow sequence gives scanner error
- Inconsistent Quoting Behavior in String Serialization HOT 2
- QUESTION: decoded from blank dictionary field
- Document the YAML specification version and schema
- Enhancement: Allow compact one-line representation of some fields HOT 1
- Yaml with colon at the beginning of a value won't parse
- Support for serialization/deserialization of nested enums HOT 1
- Deserializer only acknowledges first line of YAML HOT 2
- Long Map keys bug HOT 3
- Untagged variant will make tagged ones unparsable HOT 1
- Thoughts about libyaml-safer HOT 3
- how can I merge 2 serde_yaml::Value? HOT 1
- ignore trailing document separators
- Unable to deserialize number as string for HashMap if flattened or inside untagged enum
- Why is it trying to deserialize a map instead of an enum?
- Singleton Map Recursion fails to compile due to recursion
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serde-yaml.