@@ -262,3 +262,26 @@ The benefit of having this restriction is that Rust can prevent data races at co
In Rust, the compiler guarantees that references will never be dangling references: if you have a reference to some data, the compiler will ensure that the data will not go out of scope before the reference to the data does.
######The Slice Type
`slice` does not have ownership. It lets you reference a contiguous sequence of elements in a collection rather than the whole collection.
A `string slice` is a reference to a part of a `String`:
let s = String::from("hello world");
let hello = &s[0..5]; //hello
let world = &s[6..11]; // world
Write a function that takes a string and returns the first word it finds in that string. If the function doesn’t find a space in the string, the whole string must be one word, so the entire string should be returned: