Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Should be able to store a Value in a struct #23

Closed
andrewrynhard opened this issue Aug 7, 2016 · 2 comments
Closed

Should be able to store a Value in a struct #23

andrewrynhard opened this issue Aug 7, 2016 · 2 comments
Milestone

Comments

@andrewrynhard
Copy link

andrewrynhard commented Aug 7, 2016

In the process of moving from serde_json to serde_yaml and I am trying to store a Value in a struct

use serde_yaml::Value;

#[derive(Debug, Serialize, Deserialize)]
pub struct GenericInstructions {
    #[serde(rename="type")]
    pub _type: String,
    pub config: Value,
}

but I get

the trait bound `serde_yaml::Yaml: serde::Serialize` is not satisfied

This works fine using serde_json.

@Amndeep7
Copy link

I think this can be generalized to Value having to implement the Serialize and Deserialize traits. Moreover, this would create parity with serde_json's behavior in regards to the "serialize-ability" of Value: https://docs.serde.rs/serde_json/value/enum.Value.html.

@dtolnay
Copy link
Owner

dtolnay commented Oct 14, 2016

I released 0.5.0 containing serde_yaml::Value which implements Serialize and Deserialize.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants