pub trait ValueExt {
// Required methods
fn jmespath_type(&self) -> JmespathType;
fn is_truthy(&self) -> bool;
fn get_field(&self, name: &str) -> Value;
fn get_index(&self, idx: usize) -> Value;
fn get_negative_index(&self, idx: usize) -> Value;
fn slice(
&self,
start: Option<i32>,
stop: Option<i32>,
step: i32,
) -> Option<Vec<Value>>;
fn compare(&self, comparator: &Comparator, other: &Value) -> Option<bool>;
fn is_expref(&self) -> bool;
}Expand description
Extension trait providing JMESPath operations on serde_json::Value.
Required Methods§
Sourcefn jmespath_type(&self) -> JmespathType
fn jmespath_type(&self) -> JmespathType
Returns the JMESPath type name.
Sourcefn is_truthy(&self) -> bool
fn is_truthy(&self) -> bool
Returns true if the value is “truthy” per the JMESPath spec.
nullis falsyfalseis falsy""(empty string) is falsy[](empty array) is falsy{}(empty object) is falsy- Everything else is truthy
Sourcefn get_field(&self, name: &str) -> Value
fn get_field(&self, name: &str) -> Value
Extracts a named field from an object; returns Value::Null if not found.
Sourcefn get_index(&self, idx: usize) -> Value
fn get_index(&self, idx: usize) -> Value
Extracts an element by positive index; returns Value::Null if out of range.
Sourcefn get_negative_index(&self, idx: usize) -> Value
fn get_negative_index(&self, idx: usize) -> Value
Extracts an element by negative index (counting from end).
Sourcefn slice(
&self,
start: Option<i32>,
stop: Option<i32>,
step: i32,
) -> Option<Vec<Value>>
fn slice( &self, start: Option<i32>, stop: Option<i32>, step: i32, ) -> Option<Vec<Value>>
Slices an array with start/stop/step, per the JMESPath spec.
Returns None if the value is not an array.