1
1
// Certain casts are required only on Windows. Inform Clippy to ignore them.
2
2
#![ allow( clippy:: unnecessary_cast) ]
3
3
4
- use crate :: error:: { PtError , PtErrorCode } ;
5
4
use bitflags:: bitflags;
6
5
use libipt_sys:: {
7
6
pt_status_flag_pts_eos, pt_status_flag_pts_event_pending, pt_status_flag_pts_ip_suppressed,
@@ -11,29 +10,16 @@ bitflags! {
11
10
/// Status flags for various IntelPT actions
12
11
#[ derive( Debug , Clone , Copy ) ]
13
12
pub struct Status : u32 {
14
- /// There is no more trace data available.
15
- const EOS = pt_status_flag_pts_eos as u32 ;
16
13
/// There is an event pending.
17
14
const EVENT_PENDING = pt_status_flag_pts_event_pending as u32 ;
18
15
/// The address has been suppressed.
19
16
const IP_SUPRESSED = pt_status_flag_pts_ip_suppressed as u32 ;
17
+ /// There is no more trace data available.
18
+ const EOS = pt_status_flag_pts_eos as u32 ;
20
19
}
21
20
}
22
21
23
22
impl Status {
24
- pub ( crate ) fn from_bits_or_pterror ( pt_status : u32 ) -> Result < Self , PtError > {
25
- Status :: from_bits ( pt_status) . ok_or ( PtError :: new (
26
- PtErrorCode :: Internal ,
27
- "Unknown state returned by libipt, failed to convert to Status" ,
28
- ) )
29
- }
30
-
31
- /// There is no more trace data available.
32
- #[ must_use]
33
- pub const fn eos ( & self ) -> bool {
34
- self . contains ( Status :: EOS )
35
- }
36
-
37
23
/// There is an event pending.
38
24
#[ must_use]
39
25
pub const fn event_pending ( & self ) -> bool {
@@ -45,4 +31,10 @@ impl Status {
45
31
pub const fn ip_supressed ( & self ) -> bool {
46
32
self . contains ( Status :: IP_SUPRESSED )
47
33
}
34
+
35
+ /// There is no more trace data available.
36
+ #[ must_use]
37
+ pub const fn eos ( & self ) -> bool {
38
+ self . contains ( Status :: EOS )
39
+ }
48
40
}
0 commit comments