Files
revive/crates/llvm-context/src/polkavm/metadata_hash.rs
T
xermicus 336fc63f1d rename target to polkavm
Signed-off-by: xermicus <cyrill@parity.io>
2024-05-02 08:47:44 +02:00

30 lines
719 B
Rust

//! The metadata hash mode.
use std::str::FromStr;
use serde::Deserialize;
use serde::Serialize;
/// The metadata hash mode.
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
pub enum MetadataHash {
/// Do not include bytecode hash.
#[serde(rename = "none")]
None,
/// The default keccak256 hash.
#[serde(rename = "keccak256")]
Keccak256,
}
impl FromStr for MetadataHash {
type Err = anyhow::Error;
fn from_str(string: &str) -> Result<Self, Self::Err> {
match string {
"none" => Ok(Self::None),
"keccak256" => Ok(Self::Keccak256),
_ => anyhow::bail!("Unknown bytecode hash mode: `{}`", string),
}
}
}