Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
In [ ]:
:timing
:sccache 1
In [6]:
let v = vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
In [13]:
&v[2..7]
Out[13]:
In [14]:
&v[2..]
Out[14]:
In [16]:
&v[..4]
Out[16]:
Nested Slices¶
Slices in Rust can be nested. That is, you can get (sub) slice out of a slice.
In [21]:
&v[2..7][1..3]
Out[21]:
std::slice::binary_search¶
In [9]:
&v[2..7].binary_search(&8)
Out[9]:
In [10]:
&v[2..7].binary_search(&4)
Out[10]:
In [ ]: