Skip to main content

engage/generated/moon_sharp/interpreter/
extension_methods.rs

1// @generated by il2cpp-bindgen — do not edit by hand.
2
3#[cfg(feature = "moon_sharp-interpreter-extension_methods-types")]
4mod __types {
5    #[allow(unused_imports)] use ::unity::prelude::*;
6
7    use super::*;
8    use crate::system::object::{IObject, Object};
9
10    #[doc=include_str!(concat!(env!("CARGO_MANIFEST_DIR"),"/","docs/moon_sharp/interpreter/extension_methods/Extension_Methods.md"))]
11    #[::unity::class(namespace = "MoonSharp.Interpreter", name = "Extension_Methods")]
12    #[parent(crate::system::object::Object)]
13    pub struct Extension_Methods {}
14}
15
16#[cfg(feature = "moon_sharp-interpreter-extension_methods-types")]
17pub use __types::*;
18
19#[cfg(feature = "moon_sharp-interpreter-extension_methods")]
20impl Extension_Methods {
21    pub fn get_or_default<
22        M0: ::unity::IlType + ::core::marker::Copy + ::unity::ClassIdentity,
23        M1: ::unity::IlType + ::core::marker::Copy + ::unity::ClassIdentity,
24    >(
25        dictionary: impl ::core::convert::Into<crate::system::collections::generic::dictionary_2::Dictionary_2<M0, M1>>,
26        key: impl ::core::convert::Into<M0>,
27    ) -> M1 {
28        static OPEN: ::std::sync::LazyLock<::unity::Il2CppResult<&'static ::unity::il2cpp::MethodInfo>> = ::std::sync::LazyLock::new(|| {
29            ::unity::lookup::method_info_on_class(<Extension_Methods as ::unity::ClassIdentity>::class(), "GetOrDefault", 2)
30        });
31        #[allow(clippy::type_complexity)]
32        static CACHE: ::std::sync::OnceLock<::std::sync::Mutex<::std::collections::HashMap<usize, &'static ::unity::il2cpp::MethodInfo>>> =
33            ::std::sync::OnceLock::new();
34        let _ = true;
35        let __open: &'static ::unity::il2cpp::MethodInfo = match &*OPEN {
36            ::core::result::Result::Ok(mi) => *mi,
37            ::core::result::Result::Err(e) => {
38                panic!(
39                    "method lookup failed: {}
40::{}
41: {}
42",
43                    <Extension_Methods as ::unity::ClassIdentity>::NAME,
44                    "GetOrDefault",
45                    e
46                )
47            },
48        };
49        let __cache = CACHE.get_or_init(|| ::std::sync::Mutex::new(::std::collections::HashMap::new()));
50        let __key: usize = (<M0 as ::unity::IlType>::il_type() as *const _ as usize) ^ (<M1 as ::unity::IlType>::il_type() as *const _ as usize);
51        let __inflated: &'static ::unity::il2cpp::MethodInfo = {
52            let mut __guard = __cache.lock().unwrap();
53            *__guard.entry(__key).or_insert_with(|| {
54                ::unity::il2cpp::generic::create_generic_method_info(__open, &[
55                    <M0 as ::unity::IlType>::il_type(),
56                    <M1 as ::unity::IlType>::il_type(),
57                ])
58            })
59        };
60        unsafe {
61            let __f: extern "C" fn(crate::system::collections::generic::dictionary_2::Dictionary_2<M0, M1>, M0, ::unity::OptionalMethod) -> M1 =
62                ::core::mem::transmute(__inflated.method_ptr);
63            let __mi_opaque: &'static () = &*(__inflated as *const _ as *const ());
64            __f(
65                ::core::convert::Into::into(dictionary),
66                ::core::convert::Into::into(key),
67                ::core::option::Option::Some(__mi_opaque),
68            )
69        }
70    }
71
72    pub fn get_or_create<
73        M0: ::unity::IlType + ::core::marker::Copy + ::unity::ClassIdentity,
74        M1: ::unity::IlType + ::core::marker::Copy + ::unity::ClassIdentity,
75    >(
76        dictionary: impl ::core::convert::Into<crate::system::collections::generic::dictionary_2::Dictionary_2<M0, M1>>,
77        key: impl ::core::convert::Into<M0>,
78        creator: impl ::core::convert::Into<crate::system::func_1::Func_1<M1>>,
79    ) -> M1 {
80        static OPEN: ::std::sync::LazyLock<::unity::Il2CppResult<&'static ::unity::il2cpp::MethodInfo>> = ::std::sync::LazyLock::new(|| {
81            ::unity::lookup::method_info_on_class(<Extension_Methods as ::unity::ClassIdentity>::class(), "GetOrCreate", 3)
82        });
83        #[allow(clippy::type_complexity)]
84        static CACHE: ::std::sync::OnceLock<::std::sync::Mutex<::std::collections::HashMap<usize, &'static ::unity::il2cpp::MethodInfo>>> =
85            ::std::sync::OnceLock::new();
86        let _ = true;
87        let __open: &'static ::unity::il2cpp::MethodInfo = match &*OPEN {
88            ::core::result::Result::Ok(mi) => *mi,
89            ::core::result::Result::Err(e) => {
90                panic!(
91                    "method lookup failed: {}
92::{}
93: {}
94",
95                    <Extension_Methods as ::unity::ClassIdentity>::NAME,
96                    "GetOrCreate",
97                    e
98                )
99            },
100        };
101        let __cache = CACHE.get_or_init(|| ::std::sync::Mutex::new(::std::collections::HashMap::new()));
102        let __key: usize = (<M0 as ::unity::IlType>::il_type() as *const _ as usize) ^ (<M1 as ::unity::IlType>::il_type() as *const _ as usize);
103        let __inflated: &'static ::unity::il2cpp::MethodInfo = {
104            let mut __guard = __cache.lock().unwrap();
105            *__guard.entry(__key).or_insert_with(|| {
106                ::unity::il2cpp::generic::create_generic_method_info(__open, &[
107                    <M0 as ::unity::IlType>::il_type(),
108                    <M1 as ::unity::IlType>::il_type(),
109                ])
110            })
111        };
112        unsafe {
113            let __f: extern "C" fn(
114                crate::system::collections::generic::dictionary_2::Dictionary_2<M0, M1>,
115                M0,
116                crate::system::func_1::Func_1<M1>,
117                ::unity::OptionalMethod,
118            ) -> M1 = ::core::mem::transmute(__inflated.method_ptr);
119            let __mi_opaque: &'static () = &*(__inflated as *const _ as *const ());
120            __f(
121                ::core::convert::Into::into(dictionary),
122                ::core::convert::Into::into(key),
123                ::core::convert::Into::into(creator),
124                ::core::option::Option::Some(__mi_opaque),
125            )
126        }
127    }
128}
129
130#[cfg(feature = "moon_sharp-interpreter-extension_methods")]
131#[doc(hidden)]
132pub mod prelude {
133    pub use super::{Extension_Methods, IExtension_Methods};
134    pub use crate::system::object::IObject;
135    #[cfg(feature = "system-object")]
136    pub use crate::system::object::IObjectMethods;
137}