3 ms·
> Actually the problem is Rust currently doesn't implement traits for static-sized arrays because the size is part of the type signature and each size would nee
by pcwalton 12y ago
> Actually the problem is Rust currently doesn't implement traits for static-sized arrays because the size is part of the type signature and each size would need to be implemented separately.
But it does implement those traits for slices. So this isn't typically a problem in practice because you can coerce fixed-length arrays to slices and then compare those.
- kaoD 12y agoIndeed, though it's still a pain for nested arrays, as you have to coerce the inner layers first via mapping. Quite burdensome for arbitrary nesting. Anyways, most of the time you're better off implementing a concrete type like he did.