20 lines
269 B
Rust
20 lines
269 B
Rust
trait Dim {
|
|
fn dim() -> usize;
|
|
}
|
|
|
|
enum Dim3 {}
|
|
|
|
impl Dim for Dim3 {
|
|
fn dim() -> usize {
|
|
3
|
|
}
|
|
}
|
|
|
|
pub struct Vector<T, D: Dim> {
|
|
entries: [T; D::dim()],
|
|
//~^ ERROR no function or associated item named `dim` found
|
|
_dummy: D,
|
|
}
|
|
|
|
fn main() {}
|