this post was submitted on 18 Jun 2023
14 points (93.8% liked)
Rust
6029 readers
1 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
If the data represented in the Arc is supposed to be immutable, why not pass around a reference of
Vec<T>
instead of cloning theArc<[T]>
over and over? The latter appears more expensive.Arc<String>
is always going to be worse thanArc<str>
becauseArc<String>
is roughly equivalent toArc<Vec<char>>
. Lastly, instead of the overhead of a tuple struct, we could defineand maybe define and implement traits on it for additional methods.
Nitpick: it's
Vec<u8>
, notVec<char>
.Gee thanks, nice catch!