3 ms·
I’m not sure why the API wouldn’t implement Write for connection so you could do: connection.write_all(data) Where data could be an argument that impls To
by spease 3y ago
I’m not sure why the API wouldn’t implement Write for connection so you could do:
connection.write_all(data)
Where data could be an argument that impls ToOwned or Into so that it would either use the object you pass in (if by value) or implicitly clone it (if by reference).
Basically this looks more like an API design problem than a limitation of the language.
- sgtnoodle 3y agoMy example wasn't meant to be taken so literally. I'd say there's some truth to there being an API design problem to untangle, though. It's a relatively new language in a repo with dozens of contributors all frantically trying to get their work done. I'm just the salty senior engineer that's getting sucked in before wheels fly off. Stepping back even further, I think there was perhaps an overeager desire to use multithreading, both unnecessarily and at the wrong level of abstraction. That lead to a lot of lifetime management complexity at the lowest, deepest level. Then, folk slapped on progressively higher level abstractions, applying band-aids as they went rather than refactoring the lower layers.