Skip to content

Commit

Permalink
Add Display trait to Env
Browse files Browse the repository at this point in the history
Summary:
This diff adds the Display trait to the Enum type in the hostcaps crate.

Useful in code pattern like this
```
other_env => Err(anyhow!("{} not supported", other_env)),
```

Reviewed By: mrkmndz

Differential Revision: D63728571

fbshipit-source-id: fbd4f9a7b90ef237c5fb8167dddd36965a4be6eb
  • Loading branch information
George Giorgidze authored and facebook-github-bot committed Oct 2, 2024
1 parent d130075 commit b56255c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions shed/hostcaps/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ rust_library(
},
crate_root = "src/lib.rs",
deps = [
"fbsource//third-party/rust:derive_more",
"fbsource//third-party/rust:once_cell",
"//common/rust/fbwhoami:fbwhoami",
],
Expand Down
1 change: 1 addition & 0 deletions shed/hostcaps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ name = "test_hostcaps"
path = "src/bin/test.rs"

[dependencies]
derive_more = { version = "1.0.0", features = ["full"] }
once_cell = "1.12"

[lints]
Expand Down
2 changes: 2 additions & 0 deletions shed/hostcaps/src/facebook.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.

use derive_more::Display;
use fbwhoami::FbWhoAmI;

#[derive(PartialEq)]
#[derive(Display)]
#[repr(u8)]
pub enum Env {
Prod = 0,
Expand Down

0 comments on commit b56255c

Please sign in to comment.