engage/generated/unity_engine/
textasset.rs1#[cfg(feature = "unity_engine-textasset-types")]
4mod __types {
5 #[allow(unused_imports)] use ::unity::prelude::*;
6
7 use super::*;
8 use crate::{
9 system::{
10 object::{IObject, Object},
11 r#enum::{Enum, IEnum},
12 valuetype::{IValueType, ValueType},
13 },
14 unity_engine::object_2::{IObject_2, Object_2},
15 };
16
17 #[doc=include_str!(concat!(env!("CARGO_MANIFEST_DIR"),"/","docs/unity_engine/textasset/TextAsset_EncodingUtility.md"))]
18 #[::unity::class(namespace = "UnityEngine", name = "TextAsset.EncodingUtility")]
19 #[parent(crate::system::object::Object)]
20 pub struct TextAsset_EncodingUtility {
21 #[static_field]
22 #[rename(name = "targetEncoding")]
23 pub target_encoding: ::unity::IlInstance,
24 }
25
26 #[doc=include_str!(concat!(env!("CARGO_MANIFEST_DIR"),"/","docs/unity_engine/textasset/TextAsset_CreateOptions.md"))]
27 #[repr(C)]
28 #[derive(::core::clone::Clone, ::core::marker::Copy, ::core::fmt::Debug, ::core::cmp::PartialEq, ::core::cmp::Eq)]
29 pub struct TextAsset_CreateOptions {
30 pub value: i32,
31 }
32 impl ::unity::ClassIdentity for TextAsset_CreateOptions {
33 const NAME: &'static str = "TextAsset.CreateOptions";
34 const NAMESPACE: &'static str = "UnityEngine";
35
36 fn class() -> ::unity::Class {
37 static CACHE: ::std::sync::OnceLock<::unity::Class> = ::std::sync::OnceLock::new();
38 *CACHE.get_or_init(|| ::unity::Class::lookup(Self::NAMESPACE, Self::NAME))
39 }
40 }
41 impl ::unity::IlType for TextAsset_CreateOptions {
42 fn il_type() -> &'static ::unity::il2cpp::Il2CppType {
43 &<Self as ::unity::ClassIdentity>::class().raw()._1.byval_arg
44 }
45 }
46 impl TextAsset_CreateOptions {
47 pub fn none() -> Self {
48 Self { value: 0 }
49 }
50
51 pub fn create_native_object() -> Self {
52 Self { value: 1 }
53 }
54 }
55
56 #[doc=include_str!(concat!(env!("CARGO_MANIFEST_DIR"),"/","docs/unity_engine/textasset/TextAsset.md"))]
57 #[::unity::class(namespace = "UnityEngine", name = "TextAsset")]
58 #[parent(crate::unity_engine::object_2::Object_2)]
59 pub struct TextAsset {}
60}
61
62#[cfg(feature = "unity_engine-textasset-types")]
63pub use __types::*;
64
65#[cfg(feature = "unity_engine-textasset")]
66impl TextAsset_EncodingUtility {
67 #[doc = "`.cctor()` overload"]
68 pub fn cctor() -> () {
69 unsafe {
70 ::unity::il2cpp_call!((::unity::module_base()+0x379e800usize)as*mut u8,();
71 )
72 }
73 }
74}
75
76#[cfg(feature = "unity_engine-textasset")]
77impl TextAsset_EncodingUtility {
78 pub fn cctor_method_info() -> &'static ::unity::il2cpp::MethodInfo {
79 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[0]
80 }
81}
82
83#[cfg(feature = "unity_engine-textasset")]
84impl TextAsset {
85 #[doc = "`Internal_CreateInstance(crate::unity_engine::textasset::TextAsset, ::unity::Il2CppString)` overload"]
86 pub fn internal_create_instance(
87 self_: impl ::core::convert::Into<crate::unity_engine::textasset::TextAsset>,
88 text: impl ::core::convert::Into<::unity::Il2CppString>,
89 ) -> () {
90 unsafe {
91 ::unity::il2cpp_call!((::unity::module_base()+0x3788cf0usize)as*mut u8,();
92(crate::unity_engine::textasset::TextAsset)::core::convert::Into::into(self_),(::unity::Il2CppString)::core::convert::Into::into(text))
93 }
94 }
95
96 #[doc = "`DecodeString(::unity::Array<u8>)` overload"]
97 pub fn decode_string(bytes: impl ::core::convert::Into<::unity::Array<u8>>) -> ::unity::Il2CppString {
98 unsafe {
99 ::unity::il2cpp_call!((::unity::module_base()+0x3788d90usize)as*mut u8, ::unity::Il2CppString;
100(::unity::Array<u8>)::core::convert::Into::into(bytes))
101 }
102 }
103}
104
105#[cfg(feature = "unity_engine-textasset")]
106pub trait ITextAssetMethods: ITextAsset {
107 #[doc = "`get_bytes()` overload"]
108 fn get_bytes(self) -> ::unity::Array<u8> {
109 unsafe {
110 let __receiver = <TextAsset as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
111 ::unity::il2cpp_call!((::unity::module_base()+0x3788c50usize)as*mut u8, ::unity::Array<u8> ;
112(TextAsset)__receiver)
113 }
114 }
115 #[doc = "`GetPreviewBytes(i32)` overload"]
116 fn get_preview_bytes(self, max_byte_count: impl ::core::convert::Into<i32>) -> ::unity::Array<u8> {
117 unsafe {
118 let __receiver = <TextAsset as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
119 ::unity::il2cpp_call!((::unity::module_base()+0x3788ca0usize)as*mut u8, ::unity::Array<u8> ;
120(TextAsset)__receiver,(i32)::core::convert::Into::into(max_byte_count))
121 }
122 }
123 #[doc = "`get_text()` overload"]
124 fn get_text(self) -> ::unity::Il2CppString {
125 unsafe {
126 let __receiver = <TextAsset as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
127 ::unity::il2cpp_call!((::unity::module_base()+0x3788d40usize)as*mut u8, ::unity::Il2CppString;
128(TextAsset)__receiver)
129 }
130 }
131 #[doc = "`ToString()` overload"]
132 fn to_string(self) -> ::unity::Il2CppString {
133 unsafe {
134 let __receiver = <TextAsset as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
135 {
136 let __vt = ::unity::Cast::get_class(__receiver).raw().get_vtable();
137 let __vi = *__vt.get(3usize).unwrap_or_else(|| {
138 panic!(
139 "unity: virtual slot {}
140 out of range (vtable len {}
141) on the runtime class behind {}
142 (method `{}
143`)",
144 3usize,
145 __vt.len(),
146 <TextAsset as ::unity::ClassIdentity>::NAME,
147 "ToString",
148 )
149 });
150 let __inner: extern "C" fn(TextAsset, ::unity::OptionalMethod) -> ::unity::Il2CppString = ::core::mem::transmute(__vi.method_ptr);
151 let __mi: ::unity::OptionalMethod = ::core::option::Option::Some(&*(__vi.method_info as *const ::unity::MethodInfo as *const ()));
152 __inner(__receiver, __mi)
153 }
154 }
155 }
156 #[doc = "`.ctor()` overload"]
157 fn ctor(self) -> () {
158 unsafe {
159 let __receiver = <TextAsset as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
160 ::unity::il2cpp_call!((::unity::module_base()+0x37890c0usize)as*mut u8,();
161(TextAsset)__receiver)
162 }
163 }
164 #[doc = "`.ctor(::unity::Il2CppString)` overload"]
165 fn ctor_2(self, text: impl ::core::convert::Into<::unity::Il2CppString>) -> () {
166 unsafe {
167 let __receiver = <TextAsset as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
168 ::unity::il2cpp_call!((::unity::module_base()+0x3789230usize)as*mut u8,();
169(TextAsset)__receiver,(::unity::Il2CppString)::core::convert::Into::into(text))
170 }
171 }
172 #[doc = "`.ctor(crate::unity_engine::textasset::TextAsset_CreateOptions, ::unity::Il2CppString)` overload"]
173 fn ctor_3(
174 self,
175 options: impl ::core::convert::Into<crate::unity_engine::textasset::TextAsset_CreateOptions>,
176 text: impl ::core::convert::Into<::unity::Il2CppString>,
177 ) -> () {
178 unsafe {
179 let __receiver = <TextAsset as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
180 ::unity::il2cpp_call!((::unity::module_base()+0x3789160usize)as*mut u8,();
181(TextAsset)__receiver,(crate::unity_engine::textasset::TextAsset_CreateOptions)::core::convert::Into::into(options),(::unity::Il2CppString)::core::convert::Into::into(text))
182 }
183 }
184 #[doc = "`GetPreview(i32)` overload"]
185 fn get_preview(self, max_chars: impl ::core::convert::Into<i32>) -> ::unity::Il2CppString {
186 unsafe {
187 let __receiver = <TextAsset as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
188 ::unity::il2cpp_call!((::unity::module_base()+0x37892d0usize)as*mut u8, ::unity::Il2CppString;
189(TextAsset)__receiver,(i32)::core::convert::Into::into(max_chars))
190 }
191 }
192}
193
194#[cfg(feature = "unity_engine-textasset")]
195impl<__T: ITextAsset> ITextAssetMethods for __T {}
196
197#[cfg(feature = "unity_engine-textasset")]
198impl TextAsset {
199 pub fn get_bytes_method_info() -> &'static ::unity::il2cpp::MethodInfo {
200 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[0]
201 }
202
203 pub fn get_preview_bytes_method_info() -> &'static ::unity::il2cpp::MethodInfo {
204 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[1]
205 }
206
207 pub fn internal_create_instance_method_info() -> &'static ::unity::il2cpp::MethodInfo {
208 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[2]
209 }
210
211 pub fn get_text_method_info() -> &'static ::unity::il2cpp::MethodInfo {
212 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[3]
213 }
214
215 pub fn to_string_method_info() -> &'static ::unity::il2cpp::MethodInfo {
216 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[4]
217 }
218
219 pub fn ctor_method_info() -> &'static ::unity::il2cpp::MethodInfo {
220 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[5]
221 }
222
223 pub fn ctor_2_method_info() -> &'static ::unity::il2cpp::MethodInfo {
224 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[6]
225 }
226
227 pub fn ctor_3_method_info() -> &'static ::unity::il2cpp::MethodInfo {
228 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[7]
229 }
230
231 pub fn get_preview_method_info() -> &'static ::unity::il2cpp::MethodInfo {
232 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[8]
233 }
234
235 pub fn decode_string_method_info() -> &'static ::unity::il2cpp::MethodInfo {
236 <Self as ::unity::ClassIdentity>::class().raw().get_methods()[9]
237 }
238}
239
240#[cfg(feature = "unity_engine-textasset")]
241impl TextAsset {
242 #[doc = "Direct (non-virtual) call to `TextAsset`'s own `ToString`. Bypasses the vtable, so it won't hit an override/patch — use it for base calls."]
243 pub unsafe fn to_string(this: impl ::core::convert::Into<::unity::IlInstance>) -> ::unity::Il2CppString {
244 let __mi = Self::to_string_method_info();
245 let __inner: extern "C" fn(::unity::IlInstance, ::unity::OptionalMethod) -> ::unity::Il2CppString = ::core::mem::transmute(__mi.method_ptr);
246 __inner(this.into(), ::core::option::Option::None)
247 }
248}
249
250#[cfg(feature = "unity_engine-textasset")]
251impl TextAsset {
252 #[doc = "`.ctor()` — no args"]
253 pub fn new() -> Self {
254 let this = <Self as ::unity::FromIlInstance>::instantiate().unwrap_or_else(|| {
255 panic!(
256 "{}
257::{}
258 failed to instantiate",
259 ::core::stringify!(TextAsset),
260 ::core::stringify!(new),
261 )
262 });
263 <Self as ITextAssetMethods>::ctor(this);
264 this
265 }
266
267 #[doc = "`.ctor(::unity::Il2CppString)` — overload selector"]
268 pub fn new_2(text: ::unity::Il2CppString) -> Self {
269 let this = <Self as ::unity::FromIlInstance>::instantiate().unwrap_or_else(|| {
270 panic!(
271 "{}
272::{}
273 failed to instantiate",
274 ::core::stringify!(TextAsset),
275 ::core::stringify!(new_2),
276 )
277 });
278 <Self as ITextAssetMethods>::ctor_2(this, text);
279 this
280 }
281
282 #[doc = "`.ctor(crate::unity_engine::textasset::TextAsset_CreateOptions, ::unity::Il2CppString)` — overload selector"]
283 pub fn new_3(options: crate::unity_engine::textasset::TextAsset_CreateOptions, text: ::unity::Il2CppString) -> Self {
284 let this = <Self as ::unity::FromIlInstance>::instantiate().unwrap_or_else(|| {
285 panic!(
286 "{}
287::{}
288 failed to instantiate",
289 ::core::stringify!(TextAsset),
290 ::core::stringify!(new_3),
291 )
292 });
293 <Self as ITextAssetMethods>::ctor_3(this, options, text);
294 this
295 }
296}
297
298#[cfg(feature = "unity_engine-textasset")]
299#[doc(hidden)]
300pub mod prelude {
301 pub use super::{ITextAsset, ITextAssetMethods, ITextAsset_EncodingUtility, TextAsset, TextAsset_CreateOptions, TextAsset_EncodingUtility};
302 #[cfg(feature = "system-object")]
303 pub use crate::system::object::IObjectMethods;
304 #[cfg(feature = "system-enum")]
305 pub use crate::system::r#enum::IEnumMethods;
306 #[cfg(feature = "system-valuetype")]
307 pub use crate::system::valuetype::IValueTypeMethods;
308 #[cfg(feature = "unity_engine-object_2")]
309 pub use crate::unity_engine::object_2::IObject_2Methods;
310 pub use crate::{
311 system::{object::IObject, r#enum::IEnum, valuetype::IValueType},
312 unity_engine::object_2::IObject_2,
313 };
314}