Skip to content

tokio::sync::RwLock has no support for serde Serialize and Deserialize? #4380

Answered by Darksonn
CSRaghunandan asked this question in Q&A
Discussion options

You must be logged in to vote

It's not possible because reading the data in the RwLock requires taking a read lock, but serde is not performing the serialization in an async environment, so it cannot do the .await necessary to lock the rw-lock.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by CSRaghunandan
Comment options

You must be logged in to vote
1 reply
@Darksonn
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants