tree-mumu 0.1.0-rc.2

Creates Linux `tree`-style renderings of MuMu values
Documentation
// src/register/to_string.rs
//
// Registrar for `tree:to_string(options, data)`.

use std::sync::{Arc, Mutex};

use mumu::parser::interpreter::{Interpreter, DynamicFnInfo};
use mumu::parser::types::{FunctionValue, Value};

pub fn register_tree_to_string(interp: &mut Interpreter) {
    let f = Arc::new(Mutex::new(|interp: &mut Interpreter, args: Vec<Value>| {
        crate::share::to_string::to_string_bridge(interp, args)
    }));
    // Pure: it just returns a string.
    let info = DynamicFnInfo::new(f, true);
    interp.register_dynamic_function_ex("tree:to_string", info);

    interp.set_variable(
        "tree:to_string",
        Value::Function(Box::new(FunctionValue::Named("tree:to_string".to_string()))),
    );
}