JsonApplicable

Trait JsonApplicable 

Source
pub trait JsonApplicable {
    // Required method
    fn apply_json(&self, json: &mut JsonValue, key: &str) -> bool;
}
Expand description

Trait for types that can be applied to a JSON object conditionally

Required Methods§

Source

fn apply_json(&self, json: &mut JsonValue, key: &str) -> bool

Apply a value to a JSON object with the specified key only if it meets some condition (usually non-empty or defined)

§Arguments
  • json - The JSON object to modify
  • key - The key to set in the JSON object
§Returns

true if the value was applied, false otherwise

Implementations on Foreign Types§

Source§

impl JsonApplicable for &str

Source§

fn apply_json(&self, json: &mut JsonValue, key: &str) -> bool

Source§

impl JsonApplicable for Option<&str>

Source§

fn apply_json(&self, json: &mut JsonValue, key: &str) -> bool

Source§

impl JsonApplicable for Option<bool>

Source§

fn apply_json(&self, json: &mut JsonValue, key: &str) -> bool

Source§

impl JsonApplicable for Option<String>

Source§

fn apply_json(&self, json: &mut JsonValue, key: &str) -> bool

Source§

impl JsonApplicable for u16

Source§

fn apply_json(&self, json: &mut JsonValue, key: &str) -> bool

Source§

impl JsonApplicable for u32

Source§

fn apply_json(&self, json: &mut JsonValue, key: &str) -> bool

Source§

impl JsonApplicable for String

Source§

fn apply_json(&self, json: &mut JsonValue, key: &str) -> bool

Implementors§