#Wellp, this looks fun, fighting with the borrow checker in an async context

6 messages · Page 1 of 1 (latest)

proud fossil
#

Hey, i'm trying to fight the borrow checker shocking, i know anyway. I'm trying to ... well, it's easier to explain it in code itself.

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e4e95d24b6516c96020c8eb612165f64

I also tried following and it got a lot worse :/
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=4e1e941edbc98a46b1046c87a35dcb2d

any idea how i could implement this correctly ? I don't want you to write my code, I just want some rough directions for me to take to figure this out :/

#

or maybe even an alternative for my PlayerDatabase problem ?
when i fight the borrow checker, i know i must've gone down the wrong way to a solution.

sterile birch
#

Return a Option<Arc<Mutex<Player>>> from get

#

then people can lock it after that if they please

proud fossil
#

yea, i guess you're right. i'm just overengineering it ig