mirror of
https://github.com/fluencelabs/interface-types
synced 2024-12-04 15:20:20 +00:00
feat(interface-types) Rename from_values
to from_interface_values
.
This commit is contained in:
parent
d8c4d8fa83
commit
93abfd3d55
@ -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,
|
||||
|
@ -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<T, Error>
|
||||
pub fn from_interface_values<'a, T>(values: &'a [InterfaceValue]) -> Result<T, Error>
|
||||
where
|
||||
T: Deserialize<'a>,
|
||||
{
|
||||
@ -475,7 +475,7 @@ mod tests {
|
||||
type Error = Error;
|
||||
|
||||
fn try_from(value: Vec<InterfaceValue>) -> Result<Self, Self::Error> {
|
||||
from_values(&value)
|
||||
from_interface_values(&value)
|
||||
}
|
||||
}
|
||||
|
||||
@ -483,7 +483,7 @@ mod tests {
|
||||
type Error = Error;
|
||||
|
||||
fn try_from(value: &Vec<InterfaceValue>) -> Result<Self, Self::Error> {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user