I have this code:
struct NPoint<N>(VectorN<usize, N>) where N : Dimension;
Where Dimension
was defined as
trait Dimension: DimName + Dim {}
because of other errors in other generics.
The error I get at the struct definition is:
error[E0277]: the trait bound `<N as nalgebra::DimName>::Value: std::ops::Mul<typenum::UInt<typenum::UTerm, typenum::B1>>` is not satisfied
--> src/lib.rs:24:18
|
24 | struct NPoint<N>(VectorN<usize, N>) where N : Dimension;
| ^^^^^^^^^^^^^^^^^^ no implementation for `<N as nalgebra::DimName>::Value * typenum::UInt<typenum::UTerm, typenum::B1>`
|
= help: the trait `std::ops::Mul<typenum::UInt<typenum::UTerm, typenum::B1>>` is not implemented for `<N as nalgebra::DimName>::Value`
= help: consider adding a `where <N as nalgebra::DimName>::Value: std::ops::Mul<typenum::UInt<typenum::UTerm, typenum::B1>>` bound
= note: required by `nalgebra::MatrixArray`
I have tried adding the help suggested by the compiler, but that just made it worse, I don’t even know what the error became, it just went on and on.
The docs said I could use typenum
, so originally I tried to just use N : Unsigned
in my generics, but I was getting errors about Dim
and DimName
, that’s why I defined Dimension
. I tried looking at the definition of DimName
but it’s too high level for me.
Full disclosure: I am pretty noobish at Rust.