use std::str::FromStr;
use gazebo::dupe::Dupe;
#[derive(Debug, PartialEq, Eq, Hash, Clone, Dupe)]
pub enum ProfileMode {
Heap,
HeapFlame,
Stmt,
Bytecode,
BytecodePairs,
Flame,
}
impl FromStr for ProfileMode {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"heap" => Ok(Self::Heap),
"heap-flame" => Ok(Self::HeapFlame),
"stmt" => Ok(Self::Stmt),
"bytecode" => Ok(Self::Bytecode),
"bytecode-pairs" => Ok(Self::BytecodePairs),
s => Err(anyhow::anyhow!("Invalid ProfileMode: `{}`", s)),
}
}
}