pub struct JsonPart {
pub level: u32,
pub group: Option<u32>,
pub parse_object_values: bool,
pub ignore_list_entries: bool,
}
Expand description
A filter for PartialJson
to determine which items to deserialize.
Fields§
§level: u32
§group: Option<u32>
§parse_object_values: bool
§ignore_list_entries: bool
Implementations§
Source§impl JsonPart
impl JsonPart
Sourcepub fn level(level: u32) -> Self
pub fn level(level: u32) -> Self
The level determines at which depth to deserialize data:
0
- the full JSON is parsed as a single value oncedone
is called.1
- all entries inside of the root group are deserialized individually.2
- only entries inside of a group found directly within the root.3
- …
A group is an object or a list, both will increase the depth, but entries may be parsed from either or both.
Sourcepub fn group(self, index: u32) -> Self
pub fn group(self, index: u32) -> Self
Deserialize only entries found within the group with the given index.
To deserialize only entries inside of the first list found within the root object:
JsonPart::level(2).group(0);
Sourcepub fn parse_object_values(self) -> Self
pub fn parse_object_values(self) -> Self
Parse object values as if they were list entries, ignoring the keys.
This influences the index counted by JsonPart::group
, now also counting objects.
JsonPart::level(2).parse_object_values();
Sourcepub fn ignore_list_entries(self) -> Self
pub fn ignore_list_entries(self) -> Self
Do not parse list entries and use JsonPart::parse_object_values
instead.
This influences the index counted by JsonPart::group
, now only counting objects.
JsonPart::level(2).ignore_list_entries();
Trait Implementations§
impl Copy for JsonPart
impl Eq for JsonPart
impl StructuralPartialEq for JsonPart
Auto Trait Implementations§
impl Freeze for JsonPart
impl RefUnwindSafe for JsonPart
impl Send for JsonPart
impl Sync for JsonPart
impl Unpin for JsonPart
impl UnwindSafe for JsonPart
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