pub trait ArrayOperations {
// Required methods
fn array_insert(
&mut self,
path: &str,
index: usize,
value: OperationValue,
) -> Result<()>;
fn array_remove(&mut self, path: &str, index: usize) -> Result<()>;
fn array_replace(
&mut self,
path: &str,
index: usize,
value: OperationValue,
) -> Result<()>;
fn array_len(&self, path: &str) -> Result<usize>;
fn array_build(
&mut self,
path: &str,
elements: Vec<OperationValue>,
) -> Result<()>;
fn array_filter(
&mut self,
path: &str,
predicate: &FilterPredicate,
) -> Result<()>;
fn array_map(
&mut self,
path: &str,
transform: &TransformFunction,
) -> Result<()>;
fn array_reduce(
&mut self,
path: &str,
initial: OperationValue,
reducer: &ReduceFunction,
) -> Result<OperationValue>;
}Expand description
Array operations trait - operations on JSON arrays
Required Methods§
Sourcefn array_insert(
&mut self,
path: &str,
index: usize,
value: OperationValue,
) -> Result<()>
fn array_insert( &mut self, path: &str, index: usize, value: OperationValue, ) -> Result<()>
Insert value at index in array at path
§Errors
Returns an error if the path is not an array or index is out of bounds
Sourcefn array_remove(&mut self, path: &str, index: usize) -> Result<()>
fn array_remove(&mut self, path: &str, index: usize) -> Result<()>
Remove element at index from array at path
§Errors
Returns an error if the path is not an array or index is out of bounds
Sourcefn array_replace(
&mut self,
path: &str,
index: usize,
value: OperationValue,
) -> Result<()>
fn array_replace( &mut self, path: &str, index: usize, value: OperationValue, ) -> Result<()>
Replace element at index in array at path
§Errors
Returns an error if the path is not an array or index is out of bounds