Function chewdata::updater::tera_helpers::function::string::base64_encode
source · pub fn base64_encode(args: &HashMap<String, Value>) -> Result<Value>
Expand description
Returns encoded base64 string.
§Arguments
value
- A string slice to encode.config
- Possible configuration:standard_no_pad
|url_safe
|url_safe_no_pad
|standard
§Examples
use std::collections::HashMap;
use serde_json::value::Value;
use chewdata::updater::tera_helpers::function::string::base64_encode;
let mut args = HashMap::new();
args.insert("value".to_string(), Value::String("my_test".to_string()));
let value = base64_encode(&args).unwrap();
assert_eq!("bXlfdGVzdA==", value.as_str().unwrap());