1use jrsonnet_evaluator::{2 error::Result,3 function::builtin,4 stdlib::manifest::{escape_string_json, JsonFormat, YamlFormat},5 typed::Any,6 IStr,7};89#[builtin]10pub fn builtin_escape_string_json(str_: IStr) -> Result<String> {11 Ok(escape_string_json(&str_))12}1314#[builtin]15pub fn builtin_manifest_json_ex(16 value: Any,17 indent: IStr,18 newline: Option<IStr>,19 key_val_sep: Option<IStr>,20 #[cfg(feature = "exp-preserve-order")] preserve_order: Option<bool>,21) -> Result<String> {22 let newline = newline.as_deref().unwrap_or("\n");23 let key_val_sep = key_val_sep.as_deref().unwrap_or(": ");24 value.0.manifest(JsonFormat::std_to_json(25 indent.to_string(),26 newline,27 key_val_sep,28 #[cfg(feature = "exp-preserve-order")]29 preserve_order.unwrap_or(false),30 ))31}3233#[builtin]34pub fn builtin_manifest_yaml_doc(35 value: Any,36 indent_array_in_object: Option<bool>,37 quote_keys: Option<bool>,38 #[cfg(feature = "exp-preserve-order")] preserve_order: Option<bool>,39) -> Result<String> {40 value.0.manifest(YamlFormat::std_to_yaml(41 indent_array_in_object.unwrap_or(false),42 quote_keys.unwrap_or(true),43 #[cfg(feature = "exp-preserve-order")]44 preserve_order.unwrap_or(false),45 ))46}