We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Given the following code:
use serde::Deserialize; #[derive(Debug, Deserialize)] #[serde(rename = "Renamed")] struct Original { bar: String, baz: String, } #[cfg(test)] mod tests { use super::*; #[test] fn it_works() { serde_json::from_str::<Original>("\"Bar\"").unwrap(); } }
The test fail with the following error: Error("invalid type: string \"Bar\", expected struct Original", line: 1, column: 5)
Error("invalid type: string \"Bar\", expected struct Original", line: 1, column: 5)
I would expect the following:
Error("invalid type: string \"Bar\", expected struct Renamed", line: 1, column: 5)
Running cargo expand, I see that the rename macro has some effects:
cargo expand
_serde::Deserializer::deserialize_struct( __deserializer, "Renamed", FIELDS, __Visitor { marker: _serde::__private::PhantomData::<Original>, lifetime: _serde::__private::PhantomData, }, )
but I also see
fn expecting( &self, __formatter: &mut _serde::__private::Formatter, ) -> _serde::__private::fmt::Result { _serde::__private::Formatter::write_str( __formatter, "struct Original", ) }
So it seems it is the source of the issue.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Given the following code:
The test fail with the following error:
Error("invalid type: string \"Bar\", expected struct Original", line: 1, column: 5)
I would expect the following:
Error("invalid type: string \"Bar\", expected struct Renamed", line: 1, column: 5)
Running
cargo expand
, I see that the rename macro has some effects:but I also see
So it seems it is the source of the issue.
The text was updated successfully, but these errors were encountered: