engage/generated/unity_engine/
jsonutility.rs1#[cfg(feature = "unity_engine-jsonutility-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/unity_engine/jsonutility/JsonUtility.md"))]
11 #[::unity::class(namespace = "UnityEngine", name = "JsonUtility")]
12 #[parent(crate::system::object::Object)]
13 pub struct JsonUtility {}
14}
15
16#[cfg(feature = "unity_engine-jsonutility-types")]
17pub use __types::*;
18
19#[cfg(feature = "unity_engine-jsonutility")]
20impl JsonUtility {
21 #[doc = "`ToJsonInternal(crate::system::object::Object, bool)` overload"]
22 pub fn to_json_internal(
23 obj: impl ::core::convert::Into<crate::system::object::Object>,
24 pretty_print: impl ::core::convert::Into<bool>,
25 ) -> ::unity::Il2CppString {
26 unsafe {
27 ::unity::il2cpp_call!((::unity::module_base()+0x3f469b0usize)as*mut u8, ::unity::Il2CppString;
28(crate::system::object::Object)::core::convert::Into::into(obj),(bool)::core::convert::Into::into(pretty_print))
29 }
30 }
31
32 #[doc = "`FromJsonInternal(::unity::Il2CppString, crate::system::object::Object, ::unity::SystemType)` overload"]
33 pub fn from_json_internal(
34 json: impl ::core::convert::Into<::unity::Il2CppString>,
35 object_to_overwrite: impl ::core::convert::Into<crate::system::object::Object>,
36 r#type: impl ::core::convert::Into<::unity::SystemType>,
37 ) -> crate::system::object::Object {
38 unsafe {
39 ::unity::il2cpp_call!((::unity::module_base()+0x3f46a00usize)as*mut u8,crate::system::object::Object;
40(::unity::Il2CppString)::core::convert::Into::into(json),(crate::system::object::Object)::core::convert::Into::into(object_to_overwrite),(::unity::SystemType)::core::convert::Into::into(r#type))
41 }
42 }
43
44 #[doc = "`ToJson(crate::system::object::Object)` overload"]
45 pub fn to_json(obj: impl ::core::convert::Into<crate::system::object::Object>) -> ::unity::Il2CppString {
46 unsafe {
47 ::unity::il2cpp_call!((::unity::module_base()+0x3f46a60usize)as*mut u8, ::unity::Il2CppString;
48(crate::system::object::Object)::core::convert::Into::into(obj))
49 }
50 }
51
52 #[doc = "`ToJson(crate::system::object::Object, bool)` overload"]
53 pub fn to_json_2(
54 obj: impl ::core::convert::Into<crate::system::object::Object>,
55 pretty_print: impl ::core::convert::Into<bool>,
56 ) -> ::unity::Il2CppString {
57 unsafe {
58 ::unity::il2cpp_call!((::unity::module_base()+0x3f46a70usize)as*mut u8, ::unity::Il2CppString;
59(crate::system::object::Object)::core::convert::Into::into(obj),(bool)::core::convert::Into::into(pretty_print))
60 }
61 }
62
63 pub fn from_json<M0: ::unity::IlType + ::core::marker::Copy + ::unity::ClassIdentity>(
64 json: impl ::core::convert::Into<::unity::Il2CppString>,
65 ) -> M0 {
66 static OPEN: ::std::sync::LazyLock<::unity::Il2CppResult<&'static ::unity::il2cpp::MethodInfo>> =
67 ::std::sync::LazyLock::new(|| ::unity::lookup::method_info_on_class(<JsonUtility as ::unity::ClassIdentity>::class(), "FromJson", 1));
68 #[allow(clippy::type_complexity)]
69 static CACHE: ::std::sync::OnceLock<::std::sync::Mutex<::std::collections::HashMap<usize, &'static ::unity::il2cpp::MethodInfo>>> =
70 ::std::sync::OnceLock::new();
71 let _ = true;
72 let __open: &'static ::unity::il2cpp::MethodInfo = match &*OPEN {
73 ::core::result::Result::Ok(mi) => *mi,
74 ::core::result::Result::Err(e) => {
75 panic!(
76 "method lookup failed: {}
77::{}
78: {}
79",
80 <JsonUtility as ::unity::ClassIdentity>::NAME,
81 "FromJson",
82 e
83 )
84 },
85 };
86 let __cache = CACHE.get_or_init(|| ::std::sync::Mutex::new(::std::collections::HashMap::new()));
87 let __key: usize = <M0 as ::unity::IlType>::il_type() as *const _ as usize;
88 let __inflated: &'static ::unity::il2cpp::MethodInfo = {
89 let mut __guard = __cache.lock().unwrap();
90 *__guard
91 .entry(__key)
92 .or_insert_with(|| ::unity::il2cpp::generic::create_generic_method_info(__open, &[<M0 as ::unity::IlType>::il_type()]))
93 };
94 unsafe {
95 let __f: extern "C" fn(::unity::Il2CppString, ::unity::OptionalMethod) -> M0 = ::core::mem::transmute(__inflated.method_ptr);
96 let __mi_opaque: &'static () = &*(__inflated as *const _ as *const ());
97 __f(::core::convert::Into::into(json), ::core::option::Option::Some(__mi_opaque))
98 }
99 }
100
101 #[doc = "`FromJson(::unity::Il2CppString, ::unity::SystemType)` overload"]
102 pub fn from_json_2(
103 json: impl ::core::convert::Into<::unity::Il2CppString>,
104 r#type: impl ::core::convert::Into<::unity::SystemType>,
105 ) -> crate::system::object::Object {
106 unsafe {
107 ::unity::il2cpp_call!((::unity::module_base()+0x3f46bf0usize)as*mut u8,crate::system::object::Object;
108(::unity::Il2CppString)::core::convert::Into::into(json),(::unity::SystemType)::core::convert::Into::into(r#type))
109 }
110 }
111}
112
113#[cfg(feature = "unity_engine-jsonutility")]
114impl JsonUtility {
115 pub fn to_json_internal_method_info() -> &'static ::unity::il2cpp::MethodInfo {
116 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[0]
117 }
118
119 pub fn from_json_internal_method_info() -> &'static ::unity::il2cpp::MethodInfo {
120 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[1]
121 }
122
123 pub fn to_json_method_info() -> &'static ::unity::il2cpp::MethodInfo {
124 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[2]
125 }
126
127 pub fn to_json_2_method_info() -> &'static ::unity::il2cpp::MethodInfo {
128 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[3]
129 }
130
131 pub fn from_json_2_method_info() -> &'static ::unity::il2cpp::MethodInfo {
132 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[5]
133 }
134}
135
136#[cfg(feature = "unity_engine-jsonutility")]
137#[doc(hidden)]
138pub mod prelude {
139 pub use super::{IJsonUtility, JsonUtility};
140 pub use crate::system::object::IObject;
141 #[cfg(feature = "system-object")]
142 pub use crate::system::object::IObjectMethods;
143}