4 ms·
The only runtime performance cost here is one you would need regardless for correctness- you only need to copy if you're going to hold onto the data longer than
by Rusky 11y ago
The only runtime performance cost here is one you would need regardless for correctness- you only need to copy if you're going to hold onto the data longer than a borrow would allow.
In fact, Rust's semantics allows a fewer number of copies than naive use of std::string, since an already-owned value won't be copied, as mentioned above.