Skip to content

Commit

Permalink
remove deprecated enum-pritive-derive
Browse files Browse the repository at this point in the history
replaced by num_enum
  • Loading branch information
Wenzel committed Feb 12, 2024
1 parent 1b66fcb commit 73bb9a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ libloading = "0.8.1"
log = "0.4.20"
xenctrl-sys = "0.1.1"
xenvmevent-sys = "0.1.3"
enum-primitive-derive = "0.3.0"
num_enum = "0.7.2"
num-traits = "0.2.17"

[package.metadata.release]
Expand Down
8 changes: 3 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ mod macros;
use log::debug;

use self::consts::PAGE_SIZE;
use enum_primitive_derive::Primitive;
use libxenctrl::LibXenCtrl;
use num_traits::FromPrimitive;
use num_enum::{IntoPrimitive, TryFromPrimitive};
use std::{
alloc::{alloc_zeroed, Layout},
convert::{From, TryFrom, TryInto},
Expand Down Expand Up @@ -91,7 +90,7 @@ impl From<XenPageAccess> for xenmem_access_t {
}
}

#[derive(Primitive, Debug, Copy, Clone, PartialEq)]
#[derive(TryFromPrimitive, IntoPrimitive, Debug, Copy, Clone, PartialEq)]
#[repr(u32)]
pub enum XenCr {
Cr0 = VM_EVENT_X86_CR0,
Expand Down Expand Up @@ -470,8 +469,7 @@ impl XenControl {
unsafe {
ev_type = match req.reason {
VM_EVENT_REASON_WRITE_CTRLREG => XenEventType::Cr {
cr_type: XenCr::from_i32(req.u.write_ctrlreg.index.try_into().unwrap())
.unwrap(),
cr_type: XenCr::try_from(req.u.write_ctrlreg.index).unwrap(),
new: req.u.write_ctrlreg.new_value,
old: req.u.write_ctrlreg.old_value,
},
Expand Down

0 comments on commit 73bb9a0

Please sign in to comment.