[][src]Struct json_keypath_iter::StyleBuilder

pub struct StyleBuilder<'a> { /* fields omitted */ }

Builder to customise path styling

Implementations

impl<'a> StyleBuilder<'a>[src]

pub fn new() -> Self[src]

pub fn default_object_key_prefix(self) -> Self[src]

Clears the currently specified object key prefix value

pub fn object_key_prefix(self, value: &'a str) -> Self[src]

Sets the object key prefix value

use serde_json::json;
use json_keypath_iter::{Style, StyleBuilder, Iterator, Element};

let style: Style = StyleBuilder::new()
    .object_key_prefix(">>>")
    .build();
let value = json!({"apple": [1, true, "three"]});
let iter = Iterator::new(&value).use_style(style);
let items: Vec<_> = iter.collect();

assert_eq!(items[0], Element { path: ">>>apple\"][0]".into(), indices: vec![0], value: &json!(1), });

pub fn default_object_key_suffix(self) -> Self[src]

Clears the currently specified object key suffix value

pub fn object_key_suffix(self, value: &'a str) -> Self[src]

Sets the object key suffix value

use serde_json::json;
use json_keypath_iter::{Style, StyleBuilder, Iterator, Element};

let style: Style = StyleBuilder::new()
    .object_key_suffix("$$$")
    .build();
let value = json!({"apple": [1, true, "three"]});
let iter = Iterator::new(&value).use_style(style);
let items: Vec<_> = iter.collect();

assert_eq!(items[0], Element { path: "[\"apple$$$[0]".into(), indices: vec![0], value: &json!(1), });

pub fn default_object_keys_in_path(self) -> Self[src]

Clears whether to show or hide object key values in the Element path

pub fn show_object_keys_in_path(self) -> Self[src]

Sets the object key values to be visible in the Element path

use serde_json::json;
use json_keypath_iter::{Style, StyleBuilder, Iterator, Element};

let style: Style = StyleBuilder::new()
    .show_object_keys_in_path()
    .build();
let value = json!({"apple": [1, true, "three"]});
let iter = Iterator::new(&value).use_style(style);
let items: Vec<_> = iter.collect();

assert_eq!(items[0], Element { path: "[\"apple\"][0]".into(), indices: vec![0], value: &json!(1), });

pub fn hide_object_keys_in_path(self) -> Self[src]

Sets the object key values to be hidden in the Element path

use serde_json::json;
use json_keypath_iter::{Style, StyleBuilder, Iterator, Element};

let style: Style = StyleBuilder::new()
    .hide_object_keys_in_path()
    .build();
let value = json!({"apple": [1, true, "three"]});
let iter = Iterator::new(&value).use_style(style);
let items: Vec<_> = iter.collect();

assert_eq!(items[0], Element { path: "[\"\"][0]".into(), indices: vec![0], value: &json!(1), });

pub fn default_object_parents(self) -> Self[src]

Clears whether to skip or include values that are objects in the set of yielded values

pub fn skip_object_parents(self) -> Self[src]

Sets values that are objects to be yielded by the Iterator

use serde_json::json;
use json_keypath_iter::{Style, StyleBuilder, Iterator, Element};

let style: Style = StyleBuilder::new()
    .skip_object_parents()
    .build();
let value = json!({"apple": [1, true, "three"]});
let iter = Iterator::new(&value).use_style(style);
let items: Vec<_> = iter.collect();

assert_eq!(items[0], Element { path: "[\"apple\"][0]".into(), indices: vec![0], value: &json!(1), });

pub fn include_object_parents(self) -> Self[src]

Prevents values that are objects from being yielded by the Iterator

use serde_json::json;
use json_keypath_iter::{Style, StyleBuilder, Iterator, Element};

let style: Style = StyleBuilder::new()
    .include_object_parents()
    .build();
let value = json!({"apple": [1, true, "three"]});
let iter = Iterator::new(&value).use_style(style);
let items: Vec<_> = iter.collect();

assert_eq!(items[0], Element { path: "".into(), indices: vec![], value: &json!({"apple": [1, true, "three"]}), });

pub fn default_array_key_prefix(self) -> Self[src]

Clears the currently specified array_key_prefix value

pub fn array_key_prefix(self, value: &'a str) -> Self[src]

Sets the array_key_prefix value

use serde_json::json;
use json_keypath_iter::{Style, StyleBuilder, Iterator, Element};

let style: Style = StyleBuilder::new()
    .array_key_prefix(":::")
    .build();
let value = json!({"apple": [1, true, "three"]});
let iter = Iterator::new(&value).use_style(style);
let items: Vec<_> = iter.collect();

assert_eq!(items[0], Element { path: "[\"apple\"]:::0]".into(), indices: vec![0], value: &json!(1), });

pub fn default_array_key_suffix(self) -> Self[src]

Clears the currently specified array key suffix value

pub fn array_key_suffix(self, value: &'a str) -> Self[src]

Sets the array key suffix value

use serde_json::json;
use json_keypath_iter::{Style, StyleBuilder, Iterator, Element};

let style: Style = StyleBuilder::new()
    .array_key_suffix("!!!")
    .build();
let value = json!({"apple": [1, true, "three"]});
let iter = Iterator::new(&value).use_style(style);
let items: Vec<_> = iter.collect();

assert_eq!(items[0], Element { path: "[\"apple\"][0!!!".into(), indices: vec![0], value: &json!(1), });

pub fn default_array_keys_in_path(self) -> Self[src]

Clears whether to show or hide array key values in the Element path

pub fn show_array_keys_in_path(self) -> Self[src]

Sets the array key values to be visible in the Element path

use serde_json::json;
use json_keypath_iter::{Style, StyleBuilder, Iterator, Element};

let style: Style = StyleBuilder::new()
    .show_array_keys_in_path()
    .build();
let value = json!({"apple": [1, true, "three"]});
let iter = Iterator::new(&value).use_style(style);
let items: Vec<_> = iter.collect();

assert_eq!(items[0], Element { path: "[\"apple\"][0]".into(), indices: vec![0], value: &json!(1), });

pub fn hide_array_keys_in_path(self) -> Self[src]

Sets the array key values to be hidden in the Element path

use serde_json::json;
use json_keypath_iter::{Style, StyleBuilder, Iterator, Element};

let style: Style = StyleBuilder::new()
    .hide_array_keys_in_path()
    .build();
let value = json!({"apple": [1, true, "three"]});
let iter = Iterator::new(&value).use_style(style);
let items: Vec<_> = iter.collect();

assert_eq!(items[0], Element { path: "[\"apple\"][]".into(), indices: vec![0], value: &json!(1), });

pub fn default_array_parents(self) -> Self[src]

Clears whether to skip or include values that are arrays in the set of yielded values

pub fn skip_array_parents(self) -> Self[src]

Sets values that are arrays to be yielded by the Iterator

use serde_json::json;
use json_keypath_iter::{Style, StyleBuilder, Iterator, Element};

let style: Style = StyleBuilder::new()
    .skip_array_parents()
    .build();
let value = json!({"apple": [1, true, "three"]});
let iter = Iterator::new(&value).use_style(style);
let items: Vec<_> = iter.collect();

assert_eq!(items[0], Element { path: "[\"apple\"][0]".into(), indices: vec![0], value: &json!(1), });

pub fn include_array_parents(self) -> Self[src]

Prevents values that are arrays from being yielded by the Iterator

use serde_json::json;
use json_keypath_iter::{Style, StyleBuilder, Iterator, Element};

let style: Style = StyleBuilder::new()
    .include_array_parents()
    .build();
let value = json!({"apple": [1, true, "three"]});
let iter = Iterator::new(&value).use_style(style);
let items: Vec<_> = iter.collect();

assert_eq!(items[0], Element { path: "[\"apple\"]".into(), indices: vec![], value: &json!([1, true, "three"]), });

pub fn build(&self) -> Style<'a>[src]

Builds a value Style with defaults for any value not specified or previously cleared out

Trait Implementations

impl<'a> From<PresetStyle> for StyleBuilder<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for StyleBuilder<'a>

impl<'a> Send for StyleBuilder<'a>

impl<'a> Sync for StyleBuilder<'a>

impl<'a> Unpin for StyleBuilder<'a>

impl<'a> UnwindSafe for StyleBuilder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.