Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何正确实现下面的代码?
let mut bigger: [u8; 100] = [0u8; 100]; let smaller: [u8; 3] = [1, 2, 3]; // do something like: // bigger[0..3] = smaller;
使用copy_from_slice:
copy_from_slice
bigger[0..3].copy_from_slice(&smaller);
(操场)