7
MaybeUninit::copy/clone_from_slice
source link: https://github.com/rust-lang/rust/pull/79607
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Contributor
DrMeepster commented 28 days ago
This PR adds 2 new methods to MaybeUninit under the feature of maybe_uninit_write_slice
: copy_from_slice
and clone_from_slice
.
These are useful for initializing uninitialized buffers (such as the one returned by Vec::spare_capacity_mut
for example) with initialized data.
The methods behave similarly to the methods on slices, but the destination is uninitialized and they return the destination slice as an initialized slice.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK