Skip to main content

get_fragment

Function get_fragment 

Source
pub fn get_fragment(config_json: &str, code_or_id: &str) -> Result<Value>
Expand description

Get a fragment by code or ID

§Arguments

  • config_json - Configuration JSON string
  • code_or_id - Fragment code or ID to search for

§Returns

Returns the fragment JSON object on success

§Example

use sz_configtool_lib::fragments;

let config = r#"{"G2_CONFIG": {"CFG_ERFRAG": [{"ERFRAG_ID": 1, "ERFRAG_CODE": "TEST"}]}}"#;
let fragment = fragments::get_fragment(config, "TEST").unwrap();