mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-29 19:27:56 +00:00
336fc63f1d
Signed-off-by: xermicus <cyrill@parity.io>
30 lines
719 B
Rust
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),
|
|
}
|
|
}
|
|
}
|