engage/generated/system/collections/generic/
collectionextensions.rs1#[cfg(feature = "system-collections-generic-collectionextensions-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/system/collections/generic/collectionextensions/CollectionExtensions.md"))]
11 #[::unity::class(namespace = "System.Collections.Generic", name = "CollectionExtensions")]
12 #[parent(crate::system::object::Object)]
13 pub struct CollectionExtensions {}
14}
15
16#[cfg(feature = "system-collections-generic-collectionextensions-types")]
17pub use __types::*;
18
19#[cfg(feature = "system-collections-generic-collectionextensions")]
20impl CollectionExtensions {
21 pub fn get_value_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::ireadonlydictionary_2::IReadOnlyDictionary_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(<CollectionExtensions as ::unity::ClassIdentity>::class(), "GetValueOrDefault", 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 <CollectionExtensions as ::unity::ClassIdentity>::NAME,
44 "GetValueOrDefault",
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(
62 crate::system::collections::generic::ireadonlydictionary_2::IReadOnlyDictionary_2<M0, M1>,
63 M0,
64 ::unity::OptionalMethod,
65 ) -> M1 = ::core::mem::transmute(__inflated.method_ptr);
66 let __mi_opaque: &'static () = &*(__inflated as *const _ as *const ());
67 __f(
68 ::core::convert::Into::into(dictionary),
69 ::core::convert::Into::into(key),
70 ::core::option::Option::Some(__mi_opaque),
71 )
72 }
73 }
74
75 pub fn get_value_or_default_2<
76 M0: ::unity::IlType + ::core::marker::Copy + ::unity::ClassIdentity,
77 M1: ::unity::IlType + ::core::marker::Copy + ::unity::ClassIdentity,
78 >(
79 dictionary: impl ::core::convert::Into<crate::system::collections::generic::ireadonlydictionary_2::IReadOnlyDictionary_2<M0, M1>>,
80 key: impl ::core::convert::Into<M0>,
81 default_value: impl ::core::convert::Into<M1>,
82 ) -> M1 {
83 static OPEN: ::std::sync::LazyLock<::unity::Il2CppResult<&'static ::unity::il2cpp::MethodInfo>> = ::std::sync::LazyLock::new(|| {
84 ::unity::lookup::method_info_on_class(<CollectionExtensions as ::unity::ClassIdentity>::class(), "GetValueOrDefault", 3)
85 });
86 #[allow(clippy::type_complexity)]
87 static CACHE: ::std::sync::OnceLock<::std::sync::Mutex<::std::collections::HashMap<usize, &'static ::unity::il2cpp::MethodInfo>>> =
88 ::std::sync::OnceLock::new();
89 let _ = true;
90 let __open: &'static ::unity::il2cpp::MethodInfo = match &*OPEN {
91 ::core::result::Result::Ok(mi) => *mi,
92 ::core::result::Result::Err(e) => {
93 panic!(
94 "method lookup failed: {}
95::{}
96: {}
97",
98 <CollectionExtensions as ::unity::ClassIdentity>::NAME,
99 "GetValueOrDefault",
100 e
101 )
102 },
103 };
104 let __cache = CACHE.get_or_init(|| ::std::sync::Mutex::new(::std::collections::HashMap::new()));
105 let __key: usize = (<M0 as ::unity::IlType>::il_type() as *const _ as usize) ^ (<M1 as ::unity::IlType>::il_type() as *const _ as usize);
106 let __inflated: &'static ::unity::il2cpp::MethodInfo = {
107 let mut __guard = __cache.lock().unwrap();
108 *__guard.entry(__key).or_insert_with(|| {
109 ::unity::il2cpp::generic::create_generic_method_info(__open, &[
110 <M0 as ::unity::IlType>::il_type(),
111 <M1 as ::unity::IlType>::il_type(),
112 ])
113 })
114 };
115 unsafe {
116 let __f: extern "C" fn(
117 crate::system::collections::generic::ireadonlydictionary_2::IReadOnlyDictionary_2<M0, M1>,
118 M0,
119 M1,
120 ::unity::OptionalMethod,
121 ) -> M1 = ::core::mem::transmute(__inflated.method_ptr);
122 let __mi_opaque: &'static () = &*(__inflated as *const _ as *const ());
123 __f(
124 ::core::convert::Into::into(dictionary),
125 ::core::convert::Into::into(key),
126 ::core::convert::Into::into(default_value),
127 ::core::option::Option::Some(__mi_opaque),
128 )
129 }
130 }
131}
132
133#[cfg(feature = "system-collections-generic-collectionextensions")]
134#[doc(hidden)]
135pub mod prelude {
136 pub use super::{CollectionExtensions, ICollectionExtensions};
137 pub use crate::system::object::IObject;
138 #[cfg(feature = "system-object")]
139 pub use crate::system::object::IObjectMethods;
140}