|
I'm having trouble with BufWriter living inside an option. I'm creating it as:code:
Something like code:
I've been trying a number of things but they're getting increasingly convoluted in a way that makes me think I'm fighting the languge.
|
# ¿ Aug 24, 2022 21:12 |
|
|
# ¿ May 12, 2024 15:19 |
|
gonadic io posted:You want `match fs.as_mut()`. That and `as_ref` seem pretty unknown but are one of my most-used Option methods tbh That worked! Thanks!
|
# ¿ Aug 24, 2022 21:41 |
|
gonadic io posted:Once your code is more settled you'll find that clippy will tell you that lots of your matches are equivalent to functions like `map` and `ok` and so on, make the code much easier to read. No worries when just messing around though. Yeah I'm already a big fan of clippy, but I wasn't even able to get the thing to compile so it wasn't helping.
|
# ¿ Aug 25, 2022 17:50 |
|
Had a failure of intuition today. code:
|
# ¿ Oct 21, 2022 20:51 |
|
Thanks for the wisdom everybody, I think I get it now.
|
# ¿ Oct 23, 2022 12:37 |
|
|
# ¿ May 12, 2024 15:19 |
|
A "pointer" can be something that indexes into an array. You could have a data structure that contains a next_index and prev_index and update those as you iterate thru.
|
# ¿ Dec 11, 2023 19:32 |