11
11
use crate :: TagType ;
12
12
use core:: slice;
13
13
use core:: str;
14
+ use core:: str:: Utf8Error ;
14
15
15
16
const RSDPV1_LENGTH : usize = 20 ;
16
17
@@ -31,8 +32,8 @@ impl RsdpV1Tag {
31
32
/// The "RSD PTR " marker singature.
32
33
///
33
34
/// This is originally a 8-byte C string (not null terminated!) that must contain "RSD PTR "
34
- pub fn signature ( & self ) -> Option < & str > {
35
- str:: from_utf8 ( & self . signature ) . ok ( )
35
+ pub fn signature ( & self ) -> Result < & str , Utf8Error > {
36
+ str:: from_utf8 ( & self . signature )
36
37
}
37
38
38
39
/// Validation of the RSDPv1 checksum
@@ -46,8 +47,8 @@ impl RsdpV1Tag {
46
47
}
47
48
48
49
/// An OEM-supplied string that identifies the OEM.
49
- pub fn oem_id ( & self ) -> Option < & str > {
50
- str:: from_utf8 ( & self . oem_id ) . ok ( )
50
+ pub fn oem_id ( & self ) -> Result < & str , Utf8Error > {
51
+ str:: from_utf8 ( & self . oem_id )
51
52
}
52
53
53
54
/// The revision of the ACPI.
@@ -79,11 +80,11 @@ pub struct RsdpV2Tag {
79
80
}
80
81
81
82
impl RsdpV2Tag {
82
- /// The "RSD PTR " marker singature .
83
+ /// The "RSD PTR " marker signature .
83
84
///
84
85
/// This is originally a 8-byte C string (not null terminated!) that must contain "RSD PTR ".
85
- pub fn signature ( & self ) -> Option < & str > {
86
- str:: from_utf8 ( & self . signature ) . ok ( )
86
+ pub fn signature ( & self ) -> Result < & str , Utf8Error > {
87
+ str:: from_utf8 ( & self . signature )
87
88
}
88
89
89
90
/// Validation of the RSDPv2 extended checksum
@@ -98,8 +99,8 @@ impl RsdpV2Tag {
98
99
}
99
100
100
101
/// An OEM-supplied string that identifies the OEM.
101
- pub fn oem_id ( & self ) -> Option < & str > {
102
- str:: from_utf8 ( & self . oem_id ) . ok ( )
102
+ pub fn oem_id ( & self ) -> Result < & str , Utf8Error > {
103
+ str:: from_utf8 ( & self . oem_id )
103
104
}
104
105
105
106
/// The revision of the ACPI.
0 commit comments