Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.
use super::funejson::Value; ← the fune runtime: the JSON value the test vectors use; fune build keeps it only where a signature takes one
/// Text as UTF-8 bytes. A Rust string is already UTF-8, so this is its bytes
/// as integers; a lone surrogate, which TypeScript and Python turn into
/// U+FFFD, cannot occur in a `&str`.
pub fn utf8_encode(text: &str) -> Vec<i64> {
text.as_bytes().iter().map(|&b| b as i64).collect()
}
pub fn fune_vector(args: &[Value]) -> Value {
let text = match &args[0] {
Value::Str(s) => s.as_str(),
_ => panic!("text must be a string"),
};
Value::Arr(utf8_encode(text).into_iter().map(Value::Int).collect())
}