awaitlink / vk-bot

:package: Crate for building chat bots for VK communities (uses Callback API)
https://crates.io/crates/vk-bot
MIT License
5 stars 2 forks source link

Why is api attribute in context Mutex? #9

Closed prostomarkeloff closed 4 years ago

prostomarkeloff commented 4 years ago

https://github.com/u32i64/vk-bot/blob/master/src/context.rs#L18

awaitlink commented 4 years ago

Are you generally asking what a Mutex is and why it's needed here, or you specifically know that it's possible to not use it here?

prostomarkeloff commented 4 years ago

Are you generally asking what a Mutex is and why it's needed here, or you specifically know that it's possible to not use it here?

The second. I see no reasons why using it (or maybe I look bad :)). With a half of the first :). I really don't understand why Mutex is used here.

awaitlink commented 4 years ago

You're right :man_facepalming:. Arc isn't needed as well. Sharing a &APIClient between threads works.

Thanks!