Hello, community,
in summer, I posted reflections on one and a half years into Rust. Now I have new vision.
Since then, I noticed there wasn't pretty much any difficulty. But then I had to use a new, unfamiliar package, and it was painful. The APIs are complex, sometimes because Rust has no function/method overloading like C, nor optional arguments like Python.
So authors either make several interfaces, or extra structs like "options builder", or resort to macros. Or do all of these. And getting a new package to work, beyond the hello-world examples in the docs, becomes very hard and frustrating.
For instance, I needed a simple HTTP wrapper around an API, and decided to take axum
. From the docs, I could not find out how to make fallible method for it. So I tried reading the sources, to see what the get
function does (it works like get(my_function)
, ...but it's like this:
top_level_handler_fn!(delete, DELETE);
top_level_handler_fn!(get, GET);
top_level_handler_fn!(head, HEAD);
top_level_handler_fn!(options, OPTIONS);
top_level_handler_fn!(patch, PATCH);
top_level_handler_fn!(post, POST);
top_level_handler_fn!(put, PUT);
top_level_handler_fn!(trace, TRACE);
Names aren't found in the sources -- you should expand macros to see what it turns into.
Again, all I needed was a simple API method that runs, but has multiple error points that had to be caught -- but that required getting familiar with a good portion of the library, or asking trivial questions in the forum. Sometimes, you need the whole knowledge just once, and learning the library internals to get it working in a slightly more complex way seems too much.
Apart from that, when you're not needing new 3rd party code, things are intuitive.