How to clone an array with length bigger than 32?

前端 未结 2 1981
南旧
南旧 2020-12-17 17:11

A fixed-length array of a native type (or of a type that implements the Copy trait) can be cloned in Rust up to the length of 32. That is, this compiles:

<
2条回答
  •  南方客
    南方客 (楼主)
    2020-12-17 17:59

    You can clone arbitrary-length arrays since Rust 1.21.0. The "Libraries" section of the CHANGELOG says:

    Generate builtin impls for Clone for all arrays and tuples that are T: Clone

提交回复
热议问题