Creation of constant vectors


Is there a way to create a const foo: Vector3? Rust doesn’t support calling functions during the creation of a constant, but the inner workings of nalgebra are obfuscated due to the generic code so creating one from fields is hardly an option as well.


No, there is unfortunately no way of creating a const vector because it has hidden fields (for phantom types) which prevent its construction with the Vector3 { data: ... } notation. I think we’d have to wait for rust to support function calls to initialize constants (here is the relevant rfc) as you pointed out.