gpt4 book ai didi

rust - 为什么 "large"数组没有实现 std::fmt::Debug?

转载 作者:行者123 更新时间:2023-11-29 07:57:37 24 4
gpt4 key购买 nike

<分区>

我可以在 Debug 中打印以下数组:

fn main() {
let array = [0; 5];
println!("{:?}", array);
}

但是,如果大小更大,假设为 50,则默认不会实现 std::fmt::Debug 特性:

fn main() {
let array = [0; 50];
println!("{:?}", array);
}

编译错误:

error[E0277]: the trait bound [{integer}; 50]: std::fmt::Debug is not satisfied

为什么 std::fmt::Debug 特性没有为某些大小的数组实现?

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com