proteus 0.5.0

Proteus is intended to make dynamic transformation of data using serde serializable, deserialize using JSON and a JSON transformation syntax similar to Javascript JSON syntax. It also supports registering custom Actions to be used in the syntax.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Action trait and definitions.

use crate::errors::Error;
use serde_json::Value;
use std::borrow::Cow;
use std::fmt::Debug;

/// An action represents an operation to be carried out on a serde_json::Value object.
#[typetag::serde(tag = "type")]
pub trait Action: Send + Sync + Debug {
    fn apply<'a>(
        &'a self,
        source: &'a Value,
        destination: &mut Value,
    ) -> Result<Option<Cow<'a, Value>>, Error>;
}