Avatar ·

How to split a string into parts in Rust? I can't understand split() at all

Hi everyone! I just started learning Rust, switched from Python, and I'm having trouble with string splitting. In Python, I'm used to doing `"a,b,c".split(",")` and getting a list `["a", "b", "c"]`. In Rust, I'm trying to do the same thing, but nothing works. Here's my code: ```rust let text = "apple,banana,cherry"; let parts = text.split(","); println!("{:?}", parts); ``` The compiler gives a strange error about some iterators, and in the output I see something like `Split(SplitInternal { ... })` instead of a list of strings. I tried reading the documentation, but it's too complicated for a beginner. I need to: 1. Split a string by comma. 2. Access each element individually. 3. Preferably collect the result into a vector, like in Python. Please explain in simple terms how to work correctly