|
Dominoes posted:My ROT: If you use a `Fn` trait and you get compile errors, prepend `dyn`, If that doesn't work, also wrap it in a box. If you give up, use a `fn` pointer instead. I hate that I’ve been using Rust for a few months now and I have no idea what this means.
|
# ¿ Jan 14, 2023 22:24 |
|
|
# ¿ May 13, 2024 10:44 |
|
I’m working with a couple giant RESTful actix apps. I guess if I looked under the hood more I’d see those higher order functions in action.
|
# ¿ Jan 15, 2023 23:47 |
|
Advice on stack overflow is often invalid if it’s more than a couple years old. Library documentation isn’t great, and sometimes there’s just no one (publicly) using the function you’re trying to figure out.
|
# ¿ Apr 7, 2023 20:17 |
|
The Result and Option and match and enum are so good. Everyone talks about the speed and memory management, but for me it’s all about those algebraic data types. I had to build an SDK in Go a couple weeks ago, and on one hand I like that it doesn’t have null values, but where was my Option?
|
# ¿ May 26, 2023 03:29 |
|
What’s the best practice for storing simple enums in a database? I’ve been manually implementing Display and FromStr to make it easy to convert to and from an SQL text column, but is there a better way?
|
# ¿ Jul 3, 2023 15:25 |
|
|
# ¿ May 13, 2024 10:44 |
|
gonadic io posted:How simple? If there's no (and can never be) any fields in any of the variants, then that's a job for the ol' integer. Exactly that simple. I haven’t used enum discriminants. How do I convert from an integer back to the enum? Google is telling me I need to write a try_from function. Is that correct?
|
# ¿ Jul 3, 2023 16:22 |