Skip to content

Commit

Permalink
Fixed some compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef-Mak committed Nov 1, 2023
1 parent 209135b commit cec85a5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions ext/src/ruby_api/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<'a> Global<'a> {
mutability: Mutability,
) -> Result<Self, Error> {
let wasm_type = value_type.to_val_type()?;
let wasm_default = default.to_wasm_val(wasm_type)?;
let wasm_default = default.to_wasm_val(wasm_type.clone())?;
let inner = GlobalImpl::new(
s.context_mut(),
GlobalType::new(wasm_type, mutability),
Expand Down Expand Up @@ -95,7 +95,7 @@ impl<'a> Global<'a> {
/// @def type
/// @return [Symbol] The Wasm type of the global‘s content.
pub fn type_(&self) -> Result<Symbol, Error> {
self.ty().map(|ty| (*ty.content()).to_sym())
self.ty().map(|ty| (ty.content()).clone().to_sym())
}

/// @yard
Expand Down Expand Up @@ -129,7 +129,7 @@ impl<'a> Global<'a> {
}

fn value_type(&self) -> Result<wasmtime::ValType, Error> {
self.ty().map(|ty| *ty.content())
self.ty().map(|ty| ty.content().clone())
}

fn retain_non_nil_extern_ref(&self, value: Value) -> Result<(), Error> {
Expand Down
2 changes: 1 addition & 1 deletion ext/src/ruby_api/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl Param {

fn to_wasmtime_val(&self) -> Result<wasmtime::Val, Error> {
self.val
.to_wasm_val(self.ty)
.to_wasm_val(self.ty.clone())
.map_err(|error| match error.error_type() {
ErrorType::Error(class, msg) => {
Error::new(*class, format!("{} (param at index {})", msg, self.index))
Expand Down
2 changes: 1 addition & 1 deletion ext/src/ruby_api/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl<'a> Table<'a> {
let (min,) = kw.required;
let (max,) = kw.optional;
let wasm_type = value_type.to_val_type()?;
let wasm_default = default.to_wasm_val(wasm_type)?;
let wasm_default = default.to_wasm_val(wasm_type.clone())?;

let inner = TableImpl::new(
s.context_mut(),
Expand Down
10 changes: 7 additions & 3 deletions ext/src/ruby_api/wasi_ctx_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,18 @@ impl WasiCtxBuilder {
if let Some(stdout) = inner.stdout.as_ref() {
match stdout {
WriteStream::Inherit => builder.inherit_stdout(),
WriteStream::Path(path) => builder.stdout(file_w(*path).map(wasi_file)?),
WriteStream::Path(path) => {
builder.stdout(file_w(ruby.get_inner(*path)).map(wasi_file)?)
}
};
}

if let Some(stderr) = inner.stderr.as_ref() {
match stderr {
WriteStream::Inherit => builder.inherit_stderr(),
WriteStream::Path(path) => builder.stderr(file_w(*path).map(wasi_file)?),
WriteStream::Path(path) => {
builder.stderr(file_w(ruby.get_inner(*path)).map(wasi_file)?)
}
};
}

Expand All @@ -235,7 +239,7 @@ impl WasiCtxBuilder {
}

if let Some(env_hash) = inner.env.as_ref() {
let env_vec: Vec<(String, String)> = env_hash.to_vec()?;
let env_vec: Vec<(String, String)> = ruby.get_inner(*env_hash).to_vec()?;
builder.envs(&env_vec).map_err(|e| error!("{}", e))?;
}

Expand Down

0 comments on commit cec85a5

Please sign in to comment.