pub fn write_box_via_move<T>(
b: Box<MaybeUninit<T>>,
x: T,
) -> Box<MaybeUninit<T>>🔬This is a nightly-only experimental API. (
liballoc_internals)Expand description
Writes x into b.
This is needed for vec!, which can’t afford any extra copies of the argument (or else debug
builds regress), has to be written fully as a call chain without let (or else this breaks inference
of e.g. unsizing coercions), and can’t use an unsafe block as that would then also
include the user-provided $x.