1
1
use std:: ops:: { Deref , DerefMut } ;
2
2
use std:: os:: raw:: c_char;
3
- use std:: sync:: { Once , ONCE_INIT } ;
3
+ use std:: sync:: Once ;
4
4
5
5
use crate :: declare:: { ClassDecl , ProtocolDecl } ;
6
6
use crate :: runtime:: { Class , Object , Protocol , Sel , self } ;
@@ -55,7 +55,7 @@ unsafe impl Encode for CustomStruct {
55
55
}
56
56
57
57
pub fn custom_class ( ) -> & ' static Class {
58
- static REGISTER_CUSTOM_CLASS : Once = ONCE_INIT ;
58
+ static REGISTER_CUSTOM_CLASS : Once = Once :: new ( ) ;
59
59
60
60
REGISTER_CUSTOM_CLASS . call_once ( || {
61
61
// The runtime will call this method, so it has to be implemented
@@ -114,7 +114,7 @@ pub fn custom_class() -> &'static Class {
114
114
}
115
115
116
116
pub fn custom_protocol ( ) -> & ' static Protocol {
117
- static REGISTER_CUSTOM_PROTOCOL : Once = ONCE_INIT ;
117
+ static REGISTER_CUSTOM_PROTOCOL : Once = Once :: new ( ) ;
118
118
119
119
REGISTER_CUSTOM_PROTOCOL . call_once ( || {
120
120
let mut decl = ProtocolDecl :: new ( "CustomProtocol" ) . unwrap ( ) ;
@@ -130,7 +130,7 @@ pub fn custom_protocol() -> &'static Protocol {
130
130
}
131
131
132
132
pub fn custom_subprotocol ( ) -> & ' static Protocol {
133
- static REGISTER_CUSTOM_SUBPROTOCOL : Once = ONCE_INIT ;
133
+ static REGISTER_CUSTOM_SUBPROTOCOL : Once = Once :: new ( ) ;
134
134
135
135
REGISTER_CUSTOM_SUBPROTOCOL . call_once ( || {
136
136
let super_proto = custom_protocol ( ) ;
@@ -150,7 +150,7 @@ pub fn custom_object() -> CustomObject {
150
150
}
151
151
152
152
pub fn custom_subclass ( ) -> & ' static Class {
153
- static REGISTER_CUSTOM_SUBCLASS : Once = ONCE_INIT ;
153
+ static REGISTER_CUSTOM_SUBCLASS : Once = Once :: new ( ) ;
154
154
155
155
REGISTER_CUSTOM_SUBCLASS . call_once ( || {
156
156
let superclass = custom_class ( ) ;
0 commit comments