Skip to content

Simplify low level wrapper

Please don't do this kind of checks on the low level warpper, checking for dims and raising exceptions should be done on the pure python side.

#[pymethods]
impl Vector {
    #[new]
    fn new(obj: &PyRawObject, in_array: Vec<f64>) {
        if in_array.len() != 3 {
            // TODO: raise an exception
            panic!("Wrong number of rows");
        }
        let mut tmp_vector = KdlVector::zeros();
        for i in 0..in_array.len() {
            tmp_vector[i] = in_array[i];
        }
        obj.init(Self { vector: tmp_vector });
    }
}
Edited by Javier