MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / create_serde_module

Function create_serde_module

aiscript-vm/src/stdlib/serde.rs:11–28  ·  view source on GitHub ↗
(ctx: Context)

Source from the content-addressed store, hash-verified

9};
10
11pub fn create_serde_module(ctx: Context) -> ModuleKind {
12 let name = ctx.intern(b"std.serde");
13
14 let exports = [
15 ("from_str", Value::NativeFunction(NativeFn(serde_from_str))),
16 ("to_str", Value::NativeFunction(NativeFn(serde_to_str))),
17 (
18 "from_file",
19 Value::NativeFunction(NativeFn(serde_from_file)),
20 ),
21 ("to_file", Value::NativeFunction(NativeFn(serde_to_file))),
22 ]
23 .into_iter()
24 .map(|(name, f)| (ctx.intern_static(name), f))
25 .collect();
26
27 ModuleKind::Native { name, exports }
28}
29
30fn serde_from_str<'gc>(
31 state: &mut State<'gc>,

Callers 1

init_stdlibMethod · 0.85

Calls 3

NativeFnClass · 0.85
internMethod · 0.45
intern_staticMethod · 0.45

Tested by

no test coverage detected