1
- use objc2_sys:: BOOL ;
2
-
3
1
use crate :: { Encode , Encoding , RefEncode } ;
4
2
use core:: fmt;
5
3
@@ -15,35 +13,35 @@ use core::fmt;
15
13
// something that is not 0 or 1 into the Bool?
16
14
#[ derive( Copy , Clone , Default , Ord , PartialOrd , Eq , PartialEq , Hash ) ]
17
15
pub struct Bool {
18
- value : BOOL ,
16
+ value : objc2_sys :: BOOL ,
19
17
}
20
18
21
19
impl Bool {
22
20
/// The equivalent of [`true`] for Objective-C's `BOOL` type.
23
- pub const YES : Self = Self :: new ( true ) ;
21
+ pub const YES : Self = Self :: from_raw ( objc2_sys :: YES ) ;
24
22
25
23
/// The equivalent of [`false`] for Objective-C's `BOOL` type.
26
- pub const NO : Self = Self :: new ( false ) ;
24
+ pub const NO : Self = Self :: from_raw ( objc2_sys :: NO ) ;
27
25
28
26
/// Creates an Objective-C boolean from a Rust boolean.
29
27
#[ inline]
30
28
pub const fn new ( value : bool ) -> Self {
31
29
// true as u8 => 1
32
30
// false as u8 => 0
33
- let value = value as BOOL ;
31
+ let value = value as objc2_sys :: BOOL ;
34
32
Self { value }
35
33
}
36
34
37
35
/// Creates this from a boolean value received from a raw Objective-C API.
38
36
#[ inline]
39
- pub const fn from_raw ( value : BOOL ) -> Self {
37
+ pub const fn from_raw ( value : objc2_sys :: BOOL ) -> Self {
40
38
Self { value }
41
39
}
42
40
43
41
/// Retrieves the inner `objc2_sys` boolean type, to be used in raw
44
42
/// Objective-C APIs.
45
43
#[ inline]
46
- pub const fn as_raw ( self ) -> BOOL {
44
+ pub const fn as_raw ( self ) -> objc2_sys :: BOOL {
47
45
self . value
48
46
}
49
47
@@ -85,7 +83,7 @@ impl fmt::Debug for Bool {
85
83
}
86
84
87
85
unsafe impl Encode for Bool {
88
- const ENCODING : Encoding < ' static > = BOOL :: ENCODING ;
86
+ const ENCODING : Encoding < ' static > = objc2_sys :: BOOL :: ENCODING ;
89
87
}
90
88
91
89
unsafe impl RefEncode for Bool {
0 commit comments