Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-string keys error #5

Closed
vorner opened this issue Aug 18, 2019 · 2 comments · Fixed by #6
Closed

Non-string keys error #5

vorner opened this issue Aug 18, 2019 · 2 comments · Fixed by #6

Comments

@vorner
Copy link

vorner commented Aug 18, 2019

Hello

I'm getting a non-string key error when trying to deserialize things like HashMap<usize, usize>. How hard would it be to support them?

This panics on the last command:

use std::collections::HashMap;

use serde_yaml::Value;

fn main() {
    const CFG: &str = r#"
    1: 42
    2: 0
    "#;
    let x: HashMap<usize, usize> = serde_yaml::from_str(CFG).unwrap();
    let d: Value = serde_yaml::from_str(CFG).unwrap();
    let y: HashMap<usize, usize> = serde_ignored::deserialize(d, |p| {
        println!("Ignoring {}", p);
    }).unwrap();
}
@dtolnay
Copy link
Owner

dtolnay commented Aug 18, 2019

Fixed in 0.1.0.

@vorner
Copy link
Author

vorner commented Aug 18, 2019

Thank you! :-)

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

Successfully merging a pull request may close this issue.

2 participants