mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-25 05:47:56 +00:00
Use try_borrow for serializing RefCell
This commit is contained in:
@@ -459,7 +459,10 @@ where
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
self.borrow().serialize(serializer)
|
||||
match self.try_borrow() {
|
||||
Ok(value) => value.serialize(serializer),
|
||||
Err(_) => Err(S::Error::custom("already mutably borrowed")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user