I suggest you try various things you are wondering about on the Playground. For example, here's your second example. As you can see, it does not even compile:
error[E0277]: the type `[{integer}]` cannot be indexed by `T`
--> src/main.rs:6:16
|
6 | let _val = a[b];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `std::slice::SliceIndex<[{integer}]>` is not implemented for `T`
= note: required because of the requirements on the impl of `std::ops::Index<T>` for `[{integer}]`
There are great resources available online for learning Rust. This is not a beginner's forum, I am afraid. It is called "internals" for a reason. There's a dedicated forum for using Rust for questions such as this.