doc: add an `.as_slice` example to the cheatsheet.

A lot of questions about this on IRC and stackoverflow.
auto merge of #14578 : huonw/rust/as_slice-cheatsheet, r=sfackler

doc: add an `.as_slice` example to the cheatsheet.

A lot of questions about this on IRC and stackoverflow.