3 ms·
Someone help me, a rust programmer , understand this: is this like having a function be generic over structs with some fields? Like having `<T: {width: f64, de
by aerzen 1y ago
Someone help me, a rust programmer , understand this: is this like having a function be generic over structs with some fields?
Like having `<T: {width: f64, depth: f64}>`?
I have such a hard time understanding the multiple arrows notation of ML family languages.
- malcolmgreaves 1y agoYes! The idea is that we just care that it’s something with the named & typed fields. It can have more fields, but we’re really setting a lower bound on what we need to exist for our function to work.
- maegul 1y agoHmmm … my beginner’s rust is getting too rusty. Is this valid rust (it’d be new to me)?! If not, I’m guessing, from memory, the only way at this in rust is to through traits?