关于 rust 数组的问题(常量大小的数组,[T, ..Size])。我正在尝试进行以下工作:
#[deriving(PartialEq)]
struct Test {
dats : [f32, ..16]
}
我知道我不能使用派生并简单地编写自己的 PartialEq,但这相当令人讨厌......给出的错误消息对我来说也很神秘(见下文)。有没有合适的乡村方式来做到这一点?
rustc ar.rs
ar.rs:4:3: 4:20 error: mismatched types: expected `&&[f32]` but found `&[f32, .. 16]` (expected &-ptr but found vector)
ar.rs:4 dat : [f32, ..16]
^~~~~~~~~~~~~~~~~
note: in expansion of #[deriving]
ar.rs:2:1: 3:7 note: expansion site
ar.rs:4:3: 4:20 error: mismatched types: expected `&&[f32]` but found `&[f32, .. 16]` (expected &-ptr but found vector)
ar.rs:4 dat : [f32, ..16]
^~~~~~~~~~~~~~~~~
note: in expansion of #[deriving]
ar.rs:2:1: 3:7 note: expansion site
error: aborting due to 2 previous error
从今天开始,我每天都在生锈。
谢谢!