I found that buffer[n..] returns [T] when buffer.get(n..) returns reference to slice &[T]
So the question is: does buffer[n..] make copy of the all bytes unlike get?
Will get method use less of memory or it's same methods inside, but with panic only?
I want to make reference to bytes of the file (for io buffer), without copying its [u8] content into the memory, so definitively stuck with this everything (in memory usage context)
In general when you index something (xxx[i..] or just xxx[i]) this does not necessarily copy the elements. It is called a place expression in Rust, and whether the elements are copied or not depends on what you do with it. If you simply reference it by prepending a &, then no elements are copied.