Skip to main content

add_feature

Function add_feature 

Source
pub fn add_feature(
    config_json: &str,
    params: AddFeatureParams<'_>,
) -> Result<String>
Expand description

Add a new feature to the configuration

§Arguments

  • config_json - JSON configuration string
  • params - Feature parameters (feature, element_list required; others optional)

§Returns

Modified configuration JSON string

§Example

use sz_configtool_lib::features::{add_feature, AddFeatureParams};
use serde_json::json;

let config = r#"{"G2_CONFIG":{"CFG_FTYPE":[],...}}"#;
let elements = json!([{"element": "NAME"}]);
let result = add_feature(config, AddFeatureParams {
    feature: "PERSON",
    element_list: &elements,
    class: Some("IDENTITY"),
    behavior: Some("FM"),
    ..Default::default()
})?;