2 ms·
In my opinion that's a contrived example. Why specify the type signature explicitly in the `let` line, instead of allowing the compiler to infer it? Why put a s
by mintplant 9y ago
In my opinion that's a contrived example. Why specify the type signature explicitly in the `let` line, instead of allowing the compiler to infer it? Why put a struct inside a `Box` (a heap-allocated pointer) and then the `Box` inside an `Rc` (a reference counted heap-allocated pointer)? Why go through the trouble of extracting the contents of this nesting doll of heap-allocated types, only to rewrap it back up in the same type structure before passing it to `my_trait_fn`? Why does `my_trait_fn` need to take ownership of an `Rc`? And if it really, really needs to, why not just use `clone`? Then you'd actually be taking advantage of the, uh, reference counting.