You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.
I have a large application where I dump about 30 MB worth of smaller objects into a file. All objects are using serde auto-derive [derive(Serialize, Deserialize)].
I am using serde_yaml = "0.9" and the code which writes my file looks like this:
let mut file = std::fs::OpenOptions::new()
.write(true)
.create(true)
.open(filename)
.context(filename.to_owned())?;
let mut out = BufWriter::new(file);
serde_yaml::to_writer(&mut out, &my_stuff).context("serialization to YAML")?;
out.flush()?;
(Note: I tried and it also happens without the BufWriter.)
my_stuff above is a large map with about 20000 objects.
Unfortunately this emits an invalid YAML file where there are obviously some pieces missing. Here is an excerpt of the file which was written:
There is no ? before in the file. There is simply content missing at the location where the : appears in the file. The emitted file does not pass the serialize - deserialize test and panics during deserialization with serde_yaml.
When I switch to JSON by simply replacing serde_yaml::to_writer with serde_json::to_writer_pretty it is working fine.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have a large application where I dump about 30 MB worth of smaller objects into a file. All objects are using serde auto-derive
[derive(Serialize, Deserialize)]
.I am using
serde_yaml = "0.9"
and the code which writes my file looks like this:(Note: I tried and it also happens without the BufWriter.)
my_stuff
above is a large map with about 20000 objects.Unfortunately this emits an invalid YAML file where there are obviously some pieces missing. Here is an excerpt of the file which was written:
There is a single line with a stray
:
and there is some data missing at that location.So far I can say: it does seem to happen exactly once in the file and it happens towards the end of the file (this was line 1727330 of 1743267).
The text was updated successfully, but these errors were encountered: