我可以打印Debug以下数组:
fn main() {
let array = [0; 5];
println!("{:?}", array);
}
Run Code Online (Sandbox Code Playgroud)
但是,如果大小更大,假设它是50,则std::fmt::Debug默认情况下不会实现该特征:
fn main() {
let array = [0; 50];
println!("{:?}", array);
}
Run Code Online (Sandbox Code Playgroud)
编译错误:
错误[E0277]:
[{integer}; 50]: std::fmt::Debug不满足特征限制
为什么std::fmt::Debug某些大小的数组没有实现这种特性?
rust ×1