pub struct StdLib;
Expand description
Standard library function implementations
Implementations§
Source§impl StdLib
impl StdLib
Sourcepub fn dispatch(
&self,
func_name: &str,
args: &[JsonnetValue],
) -> Result<JsonnetValue>
pub fn dispatch( &self, func_name: &str, args: &[JsonnetValue], ) -> Result<JsonnetValue>
Dispatches a standard library function call.
Sourcepub fn ai_http_get(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn ai_http_get(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
ai.httpGet(url, headers?) - HTTP GET request
Sourcepub fn ai_http_post(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn ai_http_post(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
ai.httpPost(url, body, headers?) - HTTP POST request
Sourcepub fn ai_call_model(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn ai_call_model(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
ai.callModel(model, prompt, options?) - Call AI model
Sourcepub fn tool_execute(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn tool_execute(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
tool.execute(name, args) - Execute external tool
Sourcepub fn memory_get(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn memory_get(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
memory.get(key) - Get value from memory
Sourcepub fn memory_set(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn memory_set(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
memory.set(key, value) - Set value in memory
Sourcepub fn agent_create(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn agent_create(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
agent.create(config) - Create AI agent
Sourcepub fn std_ext_var(&self, args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn std_ext_var(&self, args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.extVar(name) - Get external variable
Sourcepub fn std_manifest_json(&self, args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn std_manifest_json(&self, args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.manifestJson(value, indent?) - JSON manifest with optional indentation
Sourcepub fn length(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn length(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.length(x) - returns length of array, string, or object
Sourcepub fn to_string(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn to_string(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.toString(x) - converts value to string
Sourcepub fn join(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn join(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.join(sep, arr) - joins array elements with separator
Sourcepub fn substr(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn substr(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.substr(s, from, len) - extracts substring
Sourcepub fn split(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn split(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.split(str, sep) - splits string by separator
Sourcepub fn starts_with(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn starts_with(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.startsWith(str, prefix) - checks if string starts with prefix
Sourcepub fn ends_with(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn ends_with(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.endsWith(str, suffix) - checks if string ends with suffix
Sourcepub fn string_chars(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn string_chars(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.stringChars(str) - splits string into array of characters
Sourcepub fn ascii_lower(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn ascii_lower(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.asciiLower(str) - converts ASCII characters to lowercase
Sourcepub fn ascii_upper(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn ascii_upper(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.asciiUpper(str) - converts ASCII characters to uppercase
Sourcepub fn flat_map(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn flat_map(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.flatMap(func, arr) - apply function to each element and flatten result
Sourcepub fn map_with_index(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn map_with_index(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.mapWithIndex(func, arr) - map array with index
Sourcepub fn lstrip_chars(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn lstrip_chars(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.lstripChars(str, chars) - strip characters from left
Sourcepub fn rstrip_chars(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn rstrip_chars(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.rstripChars(str, chars) - strip characters from right
Sourcepub fn strip_chars(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn strip_chars(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.stripChars(str, chars) - strip characters from both sides
Sourcepub fn find_substr(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn find_substr(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.findSubstr(pat, str) - find all positions of substring
Sourcepub fn repeat(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn repeat(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.repeat(what, count) - repeat value or array
Sourcepub fn set(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn set(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.set(arr) - remove duplicates from array
Sourcepub fn set_member(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn set_member(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.setMember(x, arr) - check if x is in the set arr
Sourcepub fn set_inter(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn set_inter(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.setInter(a, b) - intersection of two sets
Sourcepub fn set_union(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn set_union(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.setUnion(a, b) - union of two sets
Sourcepub fn set_diff(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
pub fn set_diff(args: Vec<JsonnetValue>) -> Result<JsonnetValue>
std.setDiff(a, b) - difference of two sets (a - b)
Sourcepub fn call_function(
name: &str,
args: Vec<JsonnetValue>,
) -> Result<JsonnetValue>
pub fn call_function( name: &str, args: Vec<JsonnetValue>, ) -> Result<JsonnetValue>
Call a standard library function (static method)