mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-13 21:51:04 +00:00
add a "ignore_field" handler when a deserializable is skipping a field
This commit is contained in:
@@ -193,6 +193,12 @@ pub trait Deserializer<E>: Iterator<Result<Token, E>> {
|
||||
/// named `field`.
|
||||
fn missing_field_error(&mut self, field: &'static str) -> E;
|
||||
|
||||
/// Called when a deserializable has decided to not consume this token.
|
||||
fn ignore_field(&mut self, _token: Token) -> Result<(), E> {
|
||||
let _: IgnoreTokens = try!(Deserializable::deserialize(self));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn expect_token(&mut self) -> Result<Token, E> {
|
||||
match self.next() {
|
||||
|
||||
Reference in New Issue
Block a user