Closed Listum closed 1 year ago
The simplest way is to collect all pp values into a new Vec
and then serializing that.
Assuming you want to serialize as a json string, it would look something like this
let recent_scores: Vec<Score> = ...
let pp: Vec<_> = recent_scores.iter().map(|score| score.pp).collect();
let serialized_pp: String = serde_json::to_string(&pp).unwrap();
Thanks a lot <3
Im new to Rust. How can i serialize output, let's say through sedre. I already tried substituting my struct, but it doesn't accept other vectors. I can't even convert the output to string. Can you tell me how I can output, let's say, only the recent score pp.
Thank you very much.