As of Rust 1.34, you can use TryFrom / TryInto : use std::convert::TryFrom; fn example(slice: &[u8]) { let array = <&[u8; 3]>::try_from(slice); println!(
確定! 回上一頁