tokio::sync::RwLock has no support for serde Serialize and Deserialize? #4380
Answered
by
Darksonn
CSRaghunandan
asked this question in
Q&A
-
|
I am trying to convert a piece of code that used std::sync::RwLock to tokio::sync::RwLock, but i'm getting the below errors: |
Beta Was this translation helpful? Give feedback.
Answered by
Darksonn
Jan 5, 2022
Replies: 2 comments 1 reply
-
|
It's not possible because reading the data in the |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
CSRaghunandan
-
|
Is there an async version of serde which can serialize and deserialize tokio's RwLock? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's not possible because reading the data in the
RwLockrequires taking a read lock, but serde is not performing the serialization in an async environment, so it cannot do the.awaitnecessary to lock the rw-lock.