Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the serialize + deserialize traits to structs used by ExecutionResult #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ num-rational = { version = "0.4", default-features = false, features = ["num-big
num-traits = { version = "0.2.8", default-features = false }
region = { version = "3.0", optional = true }
downcast-rs = { version = "1.2", default-features = false }
serde = { version = "1.0.188", features = ["derive"] }

[dev-dependencies]
rand = "0.8.2"
Expand Down
4 changes: 3 additions & 1 deletion core/src/nan_preserving_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use core::{
ops::{Add, Div, Mul, Neg, Rem, Sub},
};
use num_traits::float::FloatCore;
use serde::Deserialize;
use serde::Serialize;

macro_rules! impl_binop {
($for:ident, $is:ident, $op:ident, $func_name:ident) => {
Expand Down Expand Up @@ -32,7 +34,7 @@ macro_rules! float {
);
};
($for:ident, $rep:ident, $is:ident, $sign_bit:expr) => {
#[derive(Copy, Clone)]
#[derive(Copy, Clone, Deserialize, Serialize)]
pub struct $for($rep);

impl_binop!($for, $is, Add, add);
Expand Down
3 changes: 2 additions & 1 deletion core/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::{
};
use core::{f32, fmt, fmt::Display, i32, i64, u32, u64};
use parity_wasm::elements as pwasm;
use serde::{Deserialize, Serialize};

/// Type of a value.
///
Expand Down Expand Up @@ -64,7 +65,7 @@ impl ValueType {
///
/// There is no distinction between signed and unsigned integer types. Instead, integers are
/// interpreted by respective operations as either unsigned or signed in two’s complement representation.
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum Value {
/// Value of 32-bit signed or unsigned integer.
I32(i32),
Expand Down