fix(plugin): mismatch JSON format on get_zellij_version

* chore(wasm): comment on target of error

* fix(wasm): formatting the VERSION string

* refactor(wasm): simplify code

* chore: delete comments resolved

* feat(wasm): update write_object fn for generic
This commit is contained in:
Jae-Heon Ji 2021-12-01 05:01:03 +09:00 committed by GitHub
parent c3f838a906
commit 4e5717ec6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -313,7 +313,7 @@ fn host_get_plugin_ids(plugin_env: &PluginEnv) {
}
fn host_get_zellij_version(plugin_env: &PluginEnv) {
wasi_write_string(&plugin_env.wasi_env, VERSION);
wasi_write_object(&plugin_env.wasi_env, VERSION);
}
fn host_open_file(plugin_env: &PluginEnv) {
@ -397,7 +397,7 @@ pub fn wasi_write_string(wasi_env: &WasiEnv, buf: &str) {
writeln!(wasi_file, "{}\r", buf).unwrap();
}
pub fn wasi_write_object(wasi_env: &WasiEnv, object: &impl Serialize) {
pub fn wasi_write_object(wasi_env: &WasiEnv, object: &(impl Serialize + ?Sized)) {
wasi_write_string(wasi_env, &serde_json::to_string(&object).unwrap());
}