pub struct SkipUnknown;Expand description
Unknown keys stepped over rather than refused.
The policy for reading a subset of a document you did not define, or one written against a newer version of your schema.
use structio::{ErrorCode, SkipUnknown, from_str, from_str_with};
let doc = r#"{"port":8080,"debug":true}"#;
assert_eq!(from_str::<Port>(doc).unwrap_err().code, ErrorCode::UnknownKey);
assert_eq!(from_str_with::<SkipUnknown, Port>(doc).unwrap().port, 8080);Trait Implementations§
Source§impl Clone for SkipUnknown
impl Clone for SkipUnknown
impl Copy for SkipUnknown
Source§impl Debug for SkipUnknown
impl Debug for SkipUnknown
Source§impl Default for SkipUnknown
impl Default for SkipUnknown
impl Eq for SkipUnknown
Source§impl Hash for SkipUnknown
impl Hash for SkipUnknown
Source§impl Options for SkipUnknown
impl Options for SkipUnknown
Source§const ERROR_ON_UNKNOWN_KEYS: bool = false
const ERROR_ON_UNKNOWN_KEYS: bool = false
Refuse a document that holds a key no field claims. Read more
Source§const PRETTY: bool = false
const PRETTY: bool = false
Write JSON across multiple lines, indented by nesting depth. Read more
Source§const NEW_LINES_IN_ARRAYS: bool = true
const NEW_LINES_IN_ARRAYS: bool = true
Source§const ERROR_ON_MISSING_KEYS: bool = false
const ERROR_ON_MISSING_KEYS: bool = false
Refuse a document that leaves a declared field out. Read more
Source§const ALLOW_COMMENTS: bool = false
const ALLOW_COMMENTS: bool = false
Source§impl PartialEq for SkipUnknown
impl PartialEq for SkipUnknown
impl StructuralPartialEq for SkipUnknown
Auto Trait Implementations§
impl Freeze for SkipUnknown
impl RefUnwindSafe for SkipUnknown
impl Send for SkipUnknown
impl Sync for SkipUnknown
impl Unpin for SkipUnknown
impl UnsafeUnpin for SkipUnknown
impl UnwindSafe for SkipUnknown
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more