serde::de::value::StrDeserializer cannot be deserialized as borrowed str

Subj example

Anyone knows if it is intended?
Seems weird behavior to me, but I cannot create issue on serde as some "smart" guy put me into black list for no reason

P.s. if it looks like a bug, please report it to serde

String literal"lolka" is not a valid JSON string. "/"lolka/"" is.

Edit: Somehow I was confused it with serde_json::Value. Please ignore it.

1 Like

Umm this has nothing to do with json?

I directly supply deserialiezer to my Deserialize implementation.
If you change StrDeserialzier to BorrowedStrDeserializer it would work

I believe that is the intended behavior. You’re trying to borrow data from the &str by trying to deserialize to a &str. This is exactly what BorrowedStrSerializer is for. StrDeserializer just stores a &str for deserialization but does not allow it to be borrowed from.

1 Like

Looks like Germany is the official sponsor for Serde deserialization