Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Tips and Traps

  1. A slice is a dynamically-sized view into a contiguous sequence. It is basically a fat pointer which consists of a pointer and a length. For this reason, a slice has a len method. As a matter of fact, many methods of array and Vec are implemented via slice.

[2, 3, 4, 5, 6]
[2, 3, 4, 5, 6, 7, 8, 9]
[0, 1, 2, 3]

Nested Slices

Slices in Rust can be nested. That is, you can get (sub) slice out of a slice.

[3, 4]
Err(5)
Ok(2)