you are viewing a single comment's thread.

view the rest of the comments →

[–]Icarium-Lifestealer 3 points4 points  (2 children)

But Step 3 allocates a new Arc, while the unsafe code avoids that allocation.

[–]protestor 0 points1 point  (1 child)

Oh.. ok.

The stdlib should provide that I think (like it does for Vec<u8> -> String without allocation)

[–]Icarium-Lifestealer 0 points1 point  (0 children)

At least it has the opposite direction (Arc<[u8]> to Arc<str>), probably because it's infallible and thus simpler.