// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Conflux Foundation. All rights reserved.
// Conflux is free software and distributed under GNU General Public License.
// See http://www.gnu.org/licenses/
use serde::{Deserialize, Serialize};
use std::fmt;
#[derive(Clone, Hash, Eq, PartialEq, Serialize, Deserialize)]
pub struct Module {
#[serde(with = "serde_bytes")]
code: Vec<u8>,
}
impl Module {
pub fn new(code: Vec<u8>) -> Module { Module { code } }
pub fn code(&self) -> &[u8] { &self.code }
}
impl fmt::Debug for Module {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Module")
.field("code", &hex::encode(&self.code))
.finish()
}
}