« first day (2533 days earlier)      last day (949 days later) » 

6:36 AM
Hello all! I'm new to Rust as I just finished reading the book. I'll try to play with it a bit with some kind of project, I really like this language so far!
 
6:49 AM
@AlexandreMarcq Well done! Don't forget that there are plenty of valuable sources of information beyond The Book, some could be found here, some elsewhere, for instance the async book or the macro book. Don't overwhelm yourself though, there are plenty more to learn, but equally, practice makes perfect, so hack the flip out of Rust now!
4
 
 
4 hours later…
10:34 AM
Alert: this answer is wrong in so many ways.
 
 
2 hours later…
12:22 PM
it turned red less than one second after the page loaded for me
I've often wished I could comment on deleted posts to tell them what's wrong... although in this case I guess I wouldn't know where to begin
 
 
1 hour later…
1:43 PM
Is using .clone() to escape "cannot move" some kind of code smell? namely, here, cloning the result of accessing serde_json result (sheet is an &serde_json::Value) :
let grid_properties: GridProperties = serde_json::from_value(sheet["properties"]["gridProperties"].clone()).unwrap();
 
2:01 PM
let grid_properties: GridProperties = serde_json::from_value(&sheet["properties"]["gridProperties"]).unwrap();?
mm not possible Vlaue is consumed docs.serde.rs/serde_json/fn.from_value.html
can't tell you without complete code
 
I have a feeling the whole &[u8] -> &str -> serde_json::from_str -> serde_json::from_value of a subset of the previous transformation is heavy handed, but at the same time I don't need the whole google response so transforming only what I need into structs feels more explicit of what I want
 
2:17 PM
just make a struct with only what you want to deserialize serde will ignore the rest
 
@FĂ©lixAdriyelGagnon-Grenier Great edit
 
    let sheets = douchypool_metadata["sheets"].as_array_mut().unwrap();

    for sheet in sheets {
        let sheet: Sheet = serde_json::from_value(sheet.take()).unwrap();
        println!("{:?}", sheet);
    }
@FélixAdriyelGagnon-Grenier just for you github.com/serde-rs/serde/issues/2094 :p
 
2:40 PM
@Stargateur hah! great :P
 
 
7 hours later…

« first day (2533 days earlier)      last day (949 days later) »