Closed Connoropolous closed 4 years ago
I think Will and I used our undeveloped rust skills to write this, and it was really sad that this was the code that worked the way we wanted to, but seemed to look horrible, and I imagine there MUST be a better way
Hi, sorry if I shouldn't have stepped in but I saw the issue and thought it would be a quick task. https://github.com/h-be/acorn-hc/pull/56
Stepping in is fine. Now we've made some progress on this, I will take David off and assign you
@thedavidmeister could still chime in with advice if you have some, and we haven't solved this by the time you look into it
@Connoropolous or @hector0513 can you do the destructuring in one step?
if let Ok(Some(Entry::App(_, entry_value) {
..
} else {
Err(ZomeApiInternal::Internal(""get_links did not return an app entry".into()))
}
Hector discovered get_as_type in the HDK and in some ways it does that for us. It is cool to see how it might be done without though
@Connoropolous mhmm, i think destructuring matches is "the rust way" in general, as this is also what clippy says to do (obviously clippy doesn't know anything about the hdk though)
I didn't know the syntax you used there was called destructuring, so even that's a helpful lesson
The point of this code is to KEEP the original addresses of the nodes, since they are what "edges" reference
https://github.com/h-be/acorn-hc/blob/7eb544d26e5b92ca74aae4aea4d0d9f378ca182b/zomes/holo_acorn/code/src/lib.rs#L575-L603
@thedavidmeister can you take a peek at this and give comment? possibly fix?