fn first_word_like_pros(s: &str) -> &str {
    let bytes = s.as_bytes();

    for (i, &item) in bytes.iter().enumerate() {
        if item == b' ' {
            return &s[0..i];
        }
    }

    &s[..]
}
// A more experienced Rustacean would write the signature shown in Listing 4-9 instead because it
// allows us to use the same function on both &String values and &str values.
A more experienced Rustacean would write the signature shown in Listing 4-9 instead because it
allows us to use the same function on both &String values and &str values.
A more experienced Rustacean would write the signature shown in Listing 4 - 9 instead because it allows us to use the same function on both &String values and &str values .
fn first_word_like_pros(s: &str) -> &str {
    let bytes = s.as_bytes();
    for (i, &item) in bytes.iter().enumerate() {
        if item == b' ' {
            return &s[0..i];
        }
    }
    &s[..]
}
fn first_word_like_pros ( s : & str ) -> & str { let bytes = s . as_bytes ( ) ; for ( i , & item ) in bytes . iter ( ) . enumerate ( ) { if item == b' ' { return & s [ 0 .. i ] ; } } & s [ .. ] }
A more experienced Rustacean would write the signature shown in Listing 4-9 instead because it
allows us to use the same function on both &String values and &str values.
A more experienced Rustacean would write the signature shown in Listing 4 - 9 instead because it allows us to use the same function on both &String values and &str values .
s
&str
s
&str