For informational purposes, this is what I still find difficult:
- The module system. It constantly catches me out.
- I think that I understand traits but struggle using libraries that have a lot of traits in the public interface.
- Error handling is nice but there are error handling libraries going in and out of fashion every few months. Which one do I use?
- Callbacks combined with the borrow checker.
- Complexity of idiomatic code such as state machines [1].
- The strict string handling. What about strings that should be UTF-8 but come over a network protocol?
- Combining async code with non-async code. Also, how do you write a library that does I/O and supports both sync and async?
- Iterators. I have some functional programming experience but I hit problems with iterators combined with the borrow checker.
[1] This example has just 3 states and is much simpler than most real world examples: https://hoverbear.org/blog/rust-state-machine-pattern/
> - The strict string handling. What about strings that should be UTF-8 but come over a network protocol?
From your description, it looks like you're looking for String::{from_utf8,from_utf8_lossy,from_utf8_unchecked}[0], but I'm guessing you've seen those already, so I'm confused.
> - Combining async code with non-async code. Also, how do you write a library that does I/O and supports both sync and async?
I think you'll have to just duplicate the code, but I'd be happy to be proven wrong.
[0]: https://doc.rust-lang.org/std/string/struct.String.html#meth...