11use std:: ops:: { Deref , DerefMut } ;
22use std:: os:: raw:: c_char;
3- use std:: sync:: { Once , ONCE_INIT } ;
3+ use std:: sync:: Once ;
44
55use crate :: declare:: { ClassDecl , ProtocolDecl } ;
66use crate :: runtime:: { Class , Object , Protocol , Sel , self } ;
@@ -55,7 +55,7 @@ unsafe impl Encode for CustomStruct {
5555}
5656
5757pub fn custom_class ( ) -> & ' static Class {
58- static REGISTER_CUSTOM_CLASS : Once = ONCE_INIT ;
58+ static REGISTER_CUSTOM_CLASS : Once = Once :: new ( ) ;
5959
6060 REGISTER_CUSTOM_CLASS . call_once ( || {
6161 // The runtime will call this method, so it has to be implemented
@@ -114,7 +114,7 @@ pub fn custom_class() -> &'static Class {
114114}
115115
116116pub fn custom_protocol ( ) -> & ' static Protocol {
117- static REGISTER_CUSTOM_PROTOCOL : Once = ONCE_INIT ;
117+ static REGISTER_CUSTOM_PROTOCOL : Once = Once :: new ( ) ;
118118
119119 REGISTER_CUSTOM_PROTOCOL . call_once ( || {
120120 let mut decl = ProtocolDecl :: new ( "CustomProtocol" ) . unwrap ( ) ;
@@ -130,7 +130,7 @@ pub fn custom_protocol() -> &'static Protocol {
130130}
131131
132132pub fn custom_subprotocol ( ) -> & ' static Protocol {
133- static REGISTER_CUSTOM_SUBPROTOCOL : Once = ONCE_INIT ;
133+ static REGISTER_CUSTOM_SUBPROTOCOL : Once = Once :: new ( ) ;
134134
135135 REGISTER_CUSTOM_SUBPROTOCOL . call_once ( || {
136136 let super_proto = custom_protocol ( ) ;
@@ -150,7 +150,7 @@ pub fn custom_object() -> CustomObject {
150150}
151151
152152pub fn custom_subclass ( ) -> & ' static Class {
153- static REGISTER_CUSTOM_SUBCLASS : Once = ONCE_INIT ;
153+ static REGISTER_CUSTOM_SUBCLASS : Once = Once :: new ( ) ;
154154
155155 REGISTER_CUSTOM_SUBCLASS . call_once ( || {
156156 let superclass = custom_class ( ) ;
0 commit comments