blink_runtime 0.1.0

Runtime lib for creating plugins for blink
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::sync::Arc;

pub use blink_core::{BlinkValue, Env, Value};
use parking_lot::RwLock;
pub fn register_fn(
    env: &mut Env,
    name: &str,
    f: fn(Vec<BlinkValue>) -> Result<BlinkValue, String>,
) {
    let node = blink_core::LispNode {
        value: Value::NativeFunc(f),
        pos: None,
    };
    env.set(name, BlinkValue(Arc::new(RwLock::new(node))));
}