mirror of
https://github.com/serde-rs/serde.git
synced 2025-09-28 13:30:48 +00:00
Support ignoring enum with IgnoredAny
This commit is contained in:
parent
1c97a7ecb3
commit
e75efbfd31
@ -1,6 +1,8 @@
|
|||||||
use lib::*;
|
use lib::*;
|
||||||
|
|
||||||
use de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor};
|
use de::{
|
||||||
|
Deserialize, Deserializer, EnumAccess, Error, MapAccess, SeqAccess, VariantAccess, Visitor,
|
||||||
|
};
|
||||||
|
|
||||||
/// An efficient way of discarding data from a deserializer.
|
/// An efficient way of discarding data from a deserializer.
|
||||||
///
|
///
|
||||||
@ -205,6 +207,14 @@ impl<'de> Visitor<'de> for IgnoredAny {
|
|||||||
let _ = bytes;
|
let _ = bytes;
|
||||||
Ok(IgnoredAny)
|
Ok(IgnoredAny)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn visit_enum<A>(self, data: A) -> Result<Self::Value, A::Error>
|
||||||
|
where
|
||||||
|
A: EnumAccess<'de>,
|
||||||
|
{
|
||||||
|
let (IgnoredAny, content) = data.variant()?;
|
||||||
|
content.newtype_variant()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for IgnoredAny {
|
impl<'de> Deserialize<'de> for IgnoredAny {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user