Skip to content

Commit 5a1b7a9

Browse files
committed
pldm: Derive FromPrimitive for CCode
Signed-off-by: Matt Johnston <[email protected]>
1 parent 8da2b72 commit 5a1b7a9

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pldm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ categories = ["network-programming", "embedded", "hardware-support"]
1010
[dependencies]
1111
mctp = { workspace = true }
1212
num-traits = { version = "0.2", default-features = false }
13+
num-derive = { version = "0.4", default-features = false }
1314

1415
[features]
1516
default = ["std"]

pldm/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//! used to construct higher-level PLDM messaging applications.
1515
1616
use core::fmt::{self, Debug};
17+
use num_derive::FromPrimitive;
1718

1819
use mctp::MsgIC;
1920

@@ -124,7 +125,7 @@ pub type Result<T> = core::result::Result<T, PldmError>;
124125
#[allow(missing_docs)]
125126
#[repr(u8)]
126127
#[allow(non_camel_case_types)]
127-
#[derive(Debug, PartialEq)]
128+
#[derive(Debug, PartialEq, FromPrimitive)]
128129
pub enum CCode {
129130
SUCCESS = 0,
130131
ERROR = 1,

0 commit comments

Comments
 (0)