Comments (5)
Hi @K4rakara!
Thanks for your report! I'm going to fix it during the next week :)
from gura.
I am pleased to announce that I have now released version 0.1.4
of the crate 🥳 I noticed that it was throwing an error when the HashMap
key was numeric instead of String. With the new version of Serde Gura you can now use the example above but with usize
, isize
, u8
, u32
, i32
, i32
, u64
, i64
, etc as the key type!
// ...
#[derive(Debug, Deserialize, Serialize, PartialEq)]
struct Shards {
resumable_shards: HashMap<usize, Values>, // NEW: numeric key!
}
// ...
Thanks for reporting and using Gura! I will close the issue, feel free to reopen it if you consider that the problem is still not solved.
Regards! 😄
from gura.
Excuse me @K4rakara , could you provide the code you're trying, please? So I can replicate exactly
from gura.
Hi! I've been trying but I couldn't replicate the error. The following code serializes/deserializes correctly:
use std::collections::HashMap;
use serde_derive::{Deserialize, Serialize};
use serde_gura::Result;
#[derive(Debug, Deserialize, Serialize, PartialEq)]
struct Values {
session_id: String,
sequence: u32
}
#[derive(Debug, Deserialize, Serialize, PartialEq)]
struct Shards {
resumable_shards: HashMap<String, Values>,
}
fn main() -> Result<()> {
let gura_string = r#"resumable_shards:
0:
session_id: "xxxx"
sequence: 2"#;
let shards: Shards = serde_gura::from_str(gura_string)?;
println!("{:?}", shards);
println!("{}", serde_gura::to_string(&shards).unwrap());
Ok(())
}
Anyway, I would like to know how the structure you are deserializing is, since the error line indicates that there is an Error
variant that I didn't consider in the implementation of the Display
trait for serde_gura::Error
.
from gura.
I'll see if I can repo, though I've changed my code a fair deal since then, so I'll have to test it in an isolated example.
from gura.
Related Issues (10)
- Array trailing comma seems "mandatory" HOT 1
- `.gura` extension? HOT 2
- Inconsistent documentation for variables as boolean HOT 5
- Gura parser for Dart HOT 4
- Impossible to serialize an empty object? HOT 2
- "A bare key must be non-empty." HOT 1
- Invalid object keys HOT 2
- Avoid false binary input HOT 2
- Better recommended formatting for array of objects? HOT 2
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 gura.