|
|
|
|
|
by StreamBright
2237 days ago
|
|
Just a minor example. https://github.com/awslabs/aws-lambda-rust-runtime/blob/mast... Could you explain to a junior what Box<dyn std::error::Error + Send + Sync + 'static> does and how should a person who is starting to learn Rust come up with something like this? Second minor example. I have a configuration string like let's say timeout for a certain type of connection. What is the recommended way to have that as a string that is accessible to all functions without fighting with the borrow checker? In Elixir, I would use @timeout in the module for example. In Rust, I am not sure. Cloning the value to every place it needs it as a workaround. |
|
It's like people using `std::string` and not necessarily caring for years what `template<class CharT, class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT>> class basic_string;` means or does.
For the second example: environment variable. Once you need more, you can start researching static cells and use a ready crate for configuration loading / processing. If you want more, googling "rust mutable global configuration" brought me https://stackoverflow.com/questions/27791532/how-do-i-create... which gives a pretty good solution.