From 93abfd3d558fc59d5e5d11e7d3ae3c0c6fbdf833 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Thu, 2 Apr 2020 13:56:20 +0200 Subject: [PATCH] feat(interface-types) Rename `from_values` to `from_interface_values`. --- src/interpreter/instructions/records.rs | 4 ++-- src/interpreter/wasm/serde.rs | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/interpreter/instructions/records.rs b/src/interpreter/instructions/records.rs index 9a248e8..5ed388f 100644 --- a/src/interpreter/instructions/records.rs +++ b/src/interpreter/instructions/records.rs @@ -221,7 +221,7 @@ mod tests { use crate::interpreter::{ instructions::tests::{Export, Instance, LocalImport, Memory, MemoryView}, stack::Stackable, - wasm::values::{from_values, InterfaceType, InterfaceValue}, + wasm::values::{from_interface_values, InterfaceType, InterfaceValue}, Instruction, Interpreter, }; use serde::Deserialize; @@ -263,7 +263,7 @@ mod tests { y: i64, } - let record: T = from_values(stack.as_slice()).unwrap(); + let record: T = from_interface_values(stack.as_slice()).unwrap(); assert_eq!( record, diff --git a/src/interpreter/wasm/serde.rs b/src/interpreter/wasm/serde.rs index 7064a8f..1e5ac5d 100644 --- a/src/interpreter/wasm/serde.rs +++ b/src/interpreter/wasm/serde.rs @@ -16,7 +16,7 @@ use std::{ }; /// Deserialize a set of `InterfaceValue`s to a type `T` that -/// implements `Deserialize`. +/// implements the `Deserialize` trait. /// /// This is not a requirement to use WIT, but Serde provides an even /// nicer API to the user to rebuild its complex types from WIT @@ -27,7 +27,7 @@ use std::{ /// ```rust /// use wasmer_interface_types::interpreter::wasm::values::{ /// InterfaceValue, -/// from_values, +/// from_interface_values, /// }; /// use serde::Deserialize; /// @@ -46,7 +46,7 @@ use std::{ /// InterfaceValue::Record(vec![InterfaceValue::I32(1), InterfaceValue::I64(2)]), /// InterfaceValue::F32(3.), /// ]; -/// let t: T = from_values(&values).unwrap(); +/// let t: T = from_interface_values(&values).unwrap(); /// /// assert_eq!( /// t, @@ -57,7 +57,7 @@ use std::{ /// } /// ); /// ``` -pub fn from_values<'a, T>(values: &'a [InterfaceValue]) -> Result +pub fn from_interface_values<'a, T>(values: &'a [InterfaceValue]) -> Result where T: Deserialize<'a>, { @@ -475,7 +475,7 @@ mod tests { type Error = Error; fn try_from(value: Vec) -> Result { - from_values(&value) + from_interface_values(&value) } } @@ -483,7 +483,7 @@ mod tests { type Error = Error; fn try_from(value: &Vec) -> Result { - from_values(value) + from_interface_values(value) } } }; @@ -640,7 +640,7 @@ mod tests { }; let v = vec![InterfaceValue::String("foo".to_string())]; - let input: S = from_values(&v).unwrap(); + let input: S = from_interface_values(&v).unwrap(); let output = S { x: "foo" }; assert_eq!(input, output);