How to create a struct containing three vectors (using nalgebra)?

#1
extern crate nalgebra as na;

#[allow(unused_imports)]
use na::{Matrix4, Matrix4x3, Vector3};
#[allow(dead_code)]
pub struct PlaneSurface{
hx: Vector3,
hy: Vector3,
hz: Vector3,
}

fn main() {

// Try to initialize a plane with a local basis
let v1 = Vector3::new(0,0,0);
// The usual origin 
let mut plane1 = PlaneSurface {hx : v1, hy : v1, hx : v1 };
println!("{:?}", plane1);

}

I simply want to define a plane using three vectors coming from the nalgebra library in rust since later on I expect to perform computations on them. However whenever I write cargo build I get the following error:

error[E0107]: wrong number of type arguments: expected 1, found 0
–> src/main.rs:9:6
|
9 | hx: Vector3,
| ^^^^^^^ expected 1 type argument

error[E0107]: wrong number of type arguments: expected 1, found 0
–> src/main.rs:10:6
|
10 | hy: Vector3,
| ^^^^^^^ expected 1 type argument

error[E0107]: wrong number of type arguments: expected 1, found 0
–> src/main.rs:11:6
|
11 | hz: Vector3,
| ^^^^^^^ expected 1 type argument

error: aborting due to 3 previous errors


I am new to rust coming from c++/python background and so it would be great if I could get some advice on how to fix this issue.

#2

You didn’t specify the type of the elements of the vector. As you can see in the documentation, Vector3 takes a type parameters (similar to C++ templates). You need to specify if you want a vector of integers, floats, etc. For example:

pub struct PlaneSurface{
    hx: Vector3<f32>,
    hy: Vector3<f32>,
    hz: Vector3<f32>,
}
#3

Vector3 needs a type parameter.

extern crate nalgebra as na;

#[allow(unused_imports)]
use na::{Matrix4, Matrix4x3, Vector3};
#[allow(dead_code)]
#[derive(Debug)]
pub struct PlaneSurface {
    hx: Vector3<f32>,
    hy: Vector3<f32>,
    hz: Vector3<f32>,
}

fn main() {
    // Try to initialize a plane with a local basis
    let v1 = Vector3::<f32>::new(0., 0., 0.);
    // The usual origin
    let mut plane1 = PlaneSurface {
        hx: v1.clone(),
        hy: v1.clone(),
        hz: v1.clone(),
    };
    println!("{:?}", plane1);
}