message: buck2: starlark: implement FromStr for ProfileMode
  Summary: So that we can parse it out of a buck config.
diff: * limitations under the License.
  */
  +use std::str::FromStr;
  +
  use gazebo::dupe::Dupe;
  /// How to profile starlark code.
  @@ -37,3 +39,18 @@ pub enum ProfileMode {
  /// [flamegraph.pl](https://github.com/brendangregg/FlameGraph/blob/master/flamegraph.pl).
  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)),
  + }
  + }
  +}
  