ValueReader

Trait ValueReader 

Source
pub trait ValueReader {
    // Provided methods
    fn get_str<'tr>(&'tr self, rhs: &'tr str) -> &'tr str { ... }
    fn get_string(&self, rhs: String) -> String { ... }
    fn get_i64(&self, rhs: i64) -> i64 { ... }
    fn get_f64(&self, rhs: f64) -> f64 { ... }
    fn get_bool(&self, rhs: bool) -> bool { ... }
}
Expand description

Extend method to read Value, and support operator | rhs_default. The default implementation just return rhs without any treatment. It is dependent for concrete Value type how extract value from node.

Provided Methods§

Source

fn get_str<'tr>(&'tr self, rhs: &'tr str) -> &'tr str

Support operator | "" or some default &str. Usually return slice refers to string held in node if possible.

Source

fn get_string(&self, rhs: String) -> String

Support operator | String. For json pointer it would return stringfy of node except already string.

Source

fn get_i64(&self, rhs: i64) -> i64

Support operator | 0 or some default i64. For json pointer, it will also try to parse from string node.

Source

fn get_f64(&self, rhs: f64) -> f64

Support operator | 0.0 or some default f64. For json pointer, it will also try to parse from string node.

Source

fn get_bool(&self, rhs: bool) -> bool

Support operator | false. For json pointer, it will also try to parse from string node.

Implementations on Foreign Types§

Source§

impl ValueReader for Value

Source§

fn get_str<'tr>(&'tr self, rhs: &'tr str) -> &'tr str

operator | &str

Source§

fn get_string(&self, rhs: String) -> String

operator | String.

Source§

fn get_i64(&self, rhs: i64) -> i64

operator | i64.

Source§

fn get_f64(&self, rhs: f64) -> f64

operator | f64.

Source§

fn get_bool(&self, rhs: bool) -> bool

operator | bool.

Implementors§