#Conditional Traits based on Const Generics.
2 messages · Page 1 of 1 (latest)
This is pretty straightforward, just impl Trait for Vector<1>. Same as type generics. You can't really do ranges of values though.
2 messages · Page 1 of 1 (latest)
I am wondering if there is a way to have conditional generics. This would be if you had a Vector<const N: usize> could implement Num and Float if N = 1, or a Matrix<const M: usize, const N:usize> could implent a Vector or Num trait if the matrix is a single value or a linear value.
This is pretty straightforward, just impl Trait for Vector<1>. Same as type generics. You can't really do ranges of values though.