Skip to main content

engage/generated/unity_engine/
coroutine.rs

1// @generated by il2cpp-bindgen — do not edit by hand.
2
3#[cfg(feature = "unity_engine-coroutine-types")]
4mod __types {
5    #[allow(unused_imports)] use ::unity::prelude::*;
6
7    use super::*;
8    use crate::{
9        system::object::{IObject, Object},
10        unity_engine::yieldinstruction::{IYieldInstruction, YieldInstruction},
11    };
12
13    #[doc=include_str!(concat!(env!("CARGO_MANIFEST_DIR"),"/","docs/unity_engine/coroutine/Coroutine.md"))]
14    #[::unity::class(namespace = "UnityEngine", name = "Coroutine")]
15    #[parent(crate::unity_engine::yieldinstruction::YieldInstruction)]
16    pub struct Coroutine {
17        #[offset(16)]
18        #[rename(name = "m_Ptr")]
19        pub m_ptr: ::unity::IntPtr,
20    }
21}
22
23#[cfg(feature = "unity_engine-coroutine-types")]
24pub use __types::*;
25
26#[cfg(feature = "unity_engine-coroutine")]
27impl Coroutine {
28    #[doc = "`ReleaseCoroutine(::unity::IntPtr)` overload"]
29    pub fn release_coroutine(ptr: impl ::core::convert::Into<::unity::IntPtr>) -> () {
30        unsafe {
31            ::unity::il2cpp_call!((::unity::module_base()+0x2c47540usize)as*mut u8,();
32(::unity::IntPtr)::core::convert::Into::into(ptr))
33        }
34    }
35}
36
37#[cfg(feature = "unity_engine-coroutine")]
38pub trait ICoroutineMethods: ICoroutine {
39    #[doc = "`.ctor()` overload"]
40    fn ctor(self) -> () {
41        unsafe {
42            let __receiver = <Coroutine as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
43            ::unity::il2cpp_call!((::unity::module_base()+0x2c47490usize)as*mut u8,();
44(Coroutine)__receiver)
45        }
46    }
47    #[doc = "`Finalize()` overload"]
48    fn finalize(self) -> () {
49        unsafe {
50            let __receiver = <Coroutine as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
51            {
52                let __vt = ::unity::Cast::get_class(__receiver).raw().get_vtable();
53                let __vi = *__vt.get(1usize).unwrap_or_else(|| {
54                    panic!(
55                        "unity: virtual slot {}
56 out of range (vtable len {}
57) on the runtime class behind {}
58 (method `{}
59`)",
60                        1usize,
61                        __vt.len(),
62                        <Coroutine as ::unity::ClassIdentity>::NAME,
63                        "Finalize",
64                    )
65                });
66                let __inner: extern "C" fn(Coroutine, ::unity::OptionalMethod) -> () = ::core::mem::transmute(__vi.method_ptr);
67                let __mi: ::unity::OptionalMethod = ::core::option::Option::Some(&*(__vi.method_info as *const ::unity::MethodInfo as *const ()));
68                __inner(__receiver, __mi)
69            }
70        }
71    }
72}
73
74#[cfg(feature = "unity_engine-coroutine")]
75impl<__T: ICoroutine> ICoroutineMethods for __T {}
76
77#[cfg(feature = "unity_engine-coroutine")]
78impl Coroutine {
79    pub fn ctor_method_info() -> &'static ::unity::il2cpp::MethodInfo {
80        <Self as ::unity::ClassIdentity>::class().raw().get_methods()[0]
81    }
82
83    pub fn finalize_method_info() -> &'static ::unity::il2cpp::MethodInfo {
84        <Self as ::unity::ClassIdentity>::class().raw().get_methods()[1]
85    }
86
87    pub fn release_coroutine_method_info() -> &'static ::unity::il2cpp::MethodInfo {
88        <Self as ::unity::ClassIdentity>::class().raw().get_methods()[2]
89    }
90}
91
92#[cfg(feature = "unity_engine-coroutine")]
93impl Coroutine {
94    #[doc = "Direct (non-virtual) call to `Coroutine`'s own `Finalize`. Bypasses the vtable, so it won't hit an override/patch — use it for base calls."]
95    pub unsafe fn finalize(this: impl ::core::convert::Into<::unity::IlInstance>) -> () {
96        let __mi = Self::finalize_method_info();
97        let __inner: extern "C" fn(::unity::IlInstance, ::unity::OptionalMethod) -> () = ::core::mem::transmute(__mi.method_ptr);
98        __inner(this.into(), ::core::option::Option::None)
99    }
100}
101
102#[cfg(feature = "unity_engine-coroutine")]
103impl Coroutine {
104    #[doc = "`.ctor()` — no args"]
105    pub fn new() -> Self {
106        let this = <Self as ::unity::FromIlInstance>::instantiate().unwrap_or_else(|| {
107            panic!(
108                "{}
109::{}
110 failed to instantiate",
111                ::core::stringify!(Coroutine),
112                ::core::stringify!(new),
113            )
114        });
115        <Self as ICoroutineMethods>::ctor(this);
116        this
117    }
118}
119
120#[cfg(feature = "unity_engine-coroutine")]
121#[doc(hidden)]
122pub mod prelude {
123    pub use super::{Coroutine, ICoroutine, ICoroutineMethods};
124    #[cfg(feature = "system-object")]
125    pub use crate::system::object::IObjectMethods;
126    #[cfg(feature = "unity_engine-yieldinstruction")]
127    pub use crate::unity_engine::yieldinstruction::IYieldInstructionMethods;
128    pub use crate::{system::object::IObject, unity_engine::yieldinstruction::IYieldInstruction};
129}