rust runtime
build / build (push) Failing after 1m8s

This commit is contained in:
2026-07-17 23:12:44 -06:00
parent 85d34883a6
commit 8f46f744b5
10 changed files with 1951 additions and 10 deletions
+1
View File
@@ -0,0 +1 @@
target/
+1865
View File
File diff suppressed because it is too large Load Diff
+9
View File
@@ -0,0 +1,9 @@
[package]
name = "gyehoek-runtime"
version = "0.1.0"
edition = "2024"
[dependencies]
clap = { version = "4.6.1", features = ["derive"] }
clio = { version = "0.3.5", features = ["clap-parse"] }
wasmtime = "46.0.1"
+12
View File
@@ -0,0 +1,12 @@
{ rustPlatform
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "gyehoek-runtime";
version = "0.1.0";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
doCheck = true;
})
+5
View File
@@ -0,0 +1,5 @@
use wasmtime::*;
pub fn say_hi (_caller : Caller<'_, u32>) {
println! ("hiiii~")
}
+35
View File
@@ -0,0 +1,35 @@
mod gyehoek;
use std::io;
use std::io::Read;
use clio::*;
use clap::Parser;
use wasmtime::*;
/// A runtime for Gyehoek scheme.
#[derive(Parser, Debug)]
#[command(name = "gyehoek", version, about, long_about = None)]
struct Args {
/// Input file
#[clap(value_parser)]
input: Input,
}
fn read<R : Read> (mut rdr : R) -> io::Result<Vec<u8>> {
let mut buf = vec! [];
rdr.read_to_end (&mut buf)?;
Ok (buf)
}
pub fn main () -> wasmtime::Result<()> {
let args = Args::parse ();
let engine = Engine::default ();
let module = Module::new (&engine, read (args.input)?)?;
let mut linker = Linker::new (&engine);
linker.func_wrap ("gyehoek", "say-hi", gyehoek::say_hi)?;
let mut store : Store<u32> = Store::new (&engine, 4);
let instance = linker.instantiate (&mut store, &module)?;
let main = instance.get_typed_func::<(),()> (&mut store, "main")?;
main.call (&mut store, ())?;
Ok (())
}
+6
View File
@@ -0,0 +1,6 @@
(module
(import "gyehoek" "say-hi" (func $say-hi))
(func (export "main")
(call $say-hi)
(call $say-hi)
(call $say-hi)))