Skip to content

Commit

Permalink
add missing visit_enum
Browse files Browse the repository at this point in the history
  • Loading branch information
frederik-uni authored Oct 18, 2024
1 parent 4b3178b commit 6fefeb1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions serde/src/private/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,13 +525,16 @@ mod content {
Ok(Content::Map(vec))
}

fn visit_enum<V>(self, _visitor: V) -> Result<Self::Value, V::Error>
fn visit_enum<V>(self, visitor: V) -> Result<Self::Value, V::Error>
where
V: EnumAccess<'de>,
{
Err(de::Error::custom(
"untagged and internally tagged enums do not support enum input",
))
use crate::de::VariantAccess;
let (key, data) = tri!(visitor.variant::<String>());
Ok(Content::Map(vec![(
Content::String(key),
tri!(data.newtype_variant::<Self::Value>()),
)]))
}
}

Expand Down

0 comments on commit 6fefeb1

Please sign in to comment.