File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,22 @@ use std::str::Utf8Error;
9
9
#[ derive( Debug ) ]
10
10
pub enum PointerError {
11
11
#[ allow( missing_docs) ] // Obviously, the name is the ref doc.
12
- NulPointer ,
12
+ Null ,
13
+ /// A pointer that was not previously lent to the FFI user.
14
+ Invalid ,
13
15
/// Trying to convert to `&str` a C string which content is not valid UTF-8.
14
16
Utf8Error ( Utf8Error ) ,
15
17
}
16
18
17
19
impl std:: fmt:: Display for PointerError {
18
20
fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> std:: fmt:: Result {
19
21
match * self {
20
- Self :: NulPointer => {
22
+ Self :: Null => {
21
23
write ! ( f, "dereference a null pointer will produce a crash" )
22
24
}
25
+ Self :: Invalid => {
26
+ write ! ( f, "dereference a unknown pointer could produce a crash" )
27
+ }
23
28
Self :: Utf8Error ( ..) => {
24
29
write ! ( f, "the provided C string is not a valid UTF-8 string" )
25
30
}
@@ -30,7 +35,8 @@ impl std::fmt::Display for PointerError {
30
35
impl std:: error:: Error for PointerError {
31
36
fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
32
37
match * self {
33
- Self :: NulPointer => None ,
38
+ Self :: Null => None ,
39
+ Self :: Invalid => None ,
34
40
Self :: Utf8Error ( ref e) => Some ( e) ,
35
41
}
36
42
}
You can’t perform that action at this time.
0 commit comments