Function truncate

Source
pub fn truncate(req: &Request) -> Result<String, TransformError>
Examples found in repository?
examples/usage.rs (line 114)
100fn truncate_string() {
101    let sample_json = r#"{"hello": "world"}"#;
102
103    let req = transform::Request {
104        path: "hello".to_string(),
105        data: sample_json.into(),
106        value: "".to_string(), // default
107        truncate_options: Some(TruncateOptions {
108            length: 3,
109            truncate_type: TruncateType::Chars,
110        }),
111        extract_options: None,
112    };
113
114    let updated_json = transform::truncate(&req).unwrap();
115
116    println!(
117        "Input JSON: {} || Result JSON: {}",
118        sample_json, updated_json,
119    )
120}