mirror of
https://github.com/fluencelabs/marine.git
synced 2025-06-27 05:31:41 +00:00
Check for minimal sdk version (#68)
This commit is contained in:
@ -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(())
|
||||
|
Reference in New Issue
Block a user