Respect #[serde(transparent)] attribute (#17)
This commit is contained in:
parent
509a1c3b7b
commit
5a28cef598
8 changed files with 121 additions and 5 deletions
|
@ -49,6 +49,16 @@ impl<'a> Container<'a> {
|
|||
pub fn name(&self) -> String {
|
||||
self.serde_attrs.name().deserialize_name()
|
||||
}
|
||||
|
||||
pub fn transparent_field(&'a self) -> Option<&'a Field> {
|
||||
if self.serde_attrs.transparent() {
|
||||
if let Data::Struct(_, fields) = &self.data {
|
||||
return Some(&fields[0]);
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Variant<'a> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue