Removed unneeded conversion to a slice.

Vec<T> can index now so its a useless conversion.
doc: adding example for type definitions
auto merge of #19134 : sinistersnare/rust/patch-2, r=alexcrichton

Vec<T> can index now so its a useless conversion.
auto merge of #19136 : alfie/rust/master, r=steveklabnik

An example of how type definitions work would be handy