File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
unity-native-plugin-tester/src Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ impl crate::interface::UnityInterfaceID for TesterContextGraphics {
4141}
4242
4343extern "system" fn get_renderer ( ) -> UnityGfxRenderer {
44- unsafe { crate :: interface:: get_unity_interface :: < TesterContextGraphics > ( ) . unwrap ( ) . renderer ( ) }
44+ unsafe { crate :: interface:: get_unity_interface :: < TesterContextGraphics > ( ) . renderer ( ) }
4545}
4646
4747extern "system" fn register_device_event_callback ( _: IUnityGraphicsDeviceEventCallback ) { }
Original file line number Diff line number Diff line change @@ -132,20 +132,20 @@ pub unsafe fn get_unity_interfaces() -> &'static TesterContextInterfaces {
132132 }
133133}
134134
135- pub unsafe fn get_unity_interface < T : UnityInterfaceBase + UnityInterfaceID + ' static > ( ) -> Option < Rc < T > >
135+ pub unsafe fn get_unity_interface < T : UnityInterfaceBase + UnityInterfaceID + ' static > ( ) -> Rc < T >
136136{
137137 unsafe {
138138 let interface_rc = get_unity_interfaces ( )
139- . get_interface ( T :: get_interface_guid ( ) ) ? ;
139+ . get_interface ( T :: get_interface_guid ( ) ) . unwrap ( ) ;
140140
141141 // Rcの中身をダウンキャストして新しいRcを作成
142142 let any_ref = interface_rc. as_any ( ) ;
143143 if any_ref. is :: < T > ( ) {
144144 // unsafeなポインタ操作を使ってRc<T>を作成
145145 let ptr = Rc :: as_ptr ( & interface_rc) as * const T ;
146- Some ( Rc :: from_raw ( ptr) )
146+ Rc :: from_raw ( ptr)
147147 } else {
148- None
148+ panic ! ( "interface is not T" ) ;
149149 }
150150 }
151151}
You can’t perform that action at this time.
0 commit comments