`VectorView?` type alias too restrictive?
- Dominant language
- Rust
- Stars
- 4.8k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to pass parts of vectors as reference, and it seems way too convoluted for me.
MRE:
```rust
fn only_needs_ref<'a, const T: usize, const U: usize>(
vec3: VectorView<'a, i32, Const<3>, Const, Const>,
) {
println!("{}", vec3)
}
fn main() {
let vec6 = vector![1, 2, 3, 4, 5, 6];
only_needs_ref(vec6.fixed_rows(0))
}
```
I wanted to use `VectorView3`, but the types do not match:
```rust
fn only_needs_ref(vec3: VectorView3) {
println!("{}", vec3)
}
fn main() {
let vec6 = vector![1, 2, 3, 4, 5, 6];
only_needs_ref(vec6.fixed_rows(0))
}
```
```
expected struct `Matrix, _, ViewStorage<'_, i32, Const<3>, _, _, Const<3>>>`
found struct `Matrix<{integer}, Const<_>, _, ViewStorage<'_, {integer}, Const<_>, _, _, Const<6>>>`
```
Did I do something wrong? I just started with rust and nalgebra and might just have no idea how to properly do it.
------------------------------
As a side note / question:
If I want to pass the whole vector, I would type it like so:
```rust
fn only_needs_ref(vec3: &Vector6) {
println!("{}", vec3)
}
fn main() {
let vec3 = vector![1, 2, 3];
only_needs_ref(&vec3)
}
```
What is the point of the Views then? Only when I want to reference specific parts of matrizes?
Thanks
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.