Check for minimal sdk version (#68)

This commit is contained in:
vms
2021-03-16 13:51:59 +03:00
committed by GitHub
parent 5effdcba72
commit 0d1e3c7848
46 changed files with 729 additions and 244 deletions

View File

@ -25,12 +25,16 @@ use wasmer_wit::{
};
use wasmer_wit::ToBytes;
use std::path::PathBuf;
use std::path::Path;
/// Embed provided WIT to a Wasm file by path.
pub fn embed_text_wit(in_wasm_path: PathBuf, out_wasm_path: PathBuf, wit: &str) -> Result<()> {
pub fn embed_text_wit<I, O>(in_wasm_path: I, out_wasm_path: O, wit: &str) -> Result<()>
where
I: AsRef<Path>,
O: AsRef<Path>,
{
let module = ModuleConfig::new()
.parse_file(&in_wasm_path)
.parse_file(in_wasm_path)
.map_err(WITParserError::CorruptedWasmFile)?;
let buffer = Buffer::new(wit)?;
@ -38,7 +42,7 @@ pub fn embed_text_wit(in_wasm_path: PathBuf, out_wasm_path: PathBuf, wit: &str)
let mut module = embed_wit(module, &ast);
module
.emit_wasm_file(&out_wasm_path)
.emit_wasm_file(out_wasm_path)
.map_err(WITParserError::WasmEmitError)?;
Ok(())