Skip to main content

ArrayOperations

Trait ArrayOperations 

Source
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§

Source

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

Source

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

Source

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

Source

fn array_len(&self, path: &str) -> Result<usize>

Get array length at path

§Errors

Returns an error if the path is not an array

Source

fn array_build( &mut self, path: &str, elements: Vec<OperationValue>, ) -> Result<()>

Build array from elements

§Errors

Returns an error if the array cannot be created at the path

Source

fn array_filter( &mut self, path: &str, predicate: &FilterPredicate, ) -> Result<()>

Filter array elements

§Errors

Returns an error if the path is not an array or predicate fails

Source

fn array_map(&mut self, path: &str, transform: &TransformFunction) -> Result<()>

Map over array elements

§Errors

Returns an error if the path is not an array or transform fails

Source

fn array_reduce( &mut self, path: &str, initial: OperationValue, reducer: &ReduceFunction, ) -> Result<OperationValue>

Reduce array to single value

§Errors

Returns an error if the path is not an array or reducer fails

Implementors§

Source§

impl ArrayOperations for fionn_ops::dson_impl::SimdDsonProcessor

Source§

impl ArrayOperations for fionn_ops::processor::simd_dson::SimdDsonProcessor