Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The docs are a tad misleading but the important piece is to look at the signature. The `where P: Pattern<'a>` portion states that split needs a type that implements the Pattern trait. If you follow the link to the Pattern trait then at the bottom you'll see a section[0] listing types implementing the trait (&[char] being one) and therefore can be passed into split. Hope that helps!

[0] https://doc.rust-lang.org/std/str/pattern/trait.Pattern.html...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: