Skip to main content

atlas_rpcx_bindings/bindings/
program_parser.rs

1// Generated by `wit-bindgen` 0.36.0. DO NOT EDIT!
2// Options used:
3//   * std_feature
4//   * runtime_path: "wit_bindgen_rt"
5//   * additional derives ["serde::Serialize", "serde::Deserialize"]
6//   * with "atlas:accounts/types@0.1.0" = "crate::bindings::accounts_db::atlas::accounts::types"
7//   * default-bindings-module: "atlas"
8//   * export-macro-name: _export_program_parser
9//   * pub-export-macro
10use crate::bindings::accounts_db::atlas::accounts::types as __with_name0;
11pub type AtlasAccount = __with_name0::AtlasAccount;
12pub type AccountResponse = atlas::program::types::AccountResponse;
13pub type InstructionResponse = atlas::program::types::InstructionResponse;
14pub type AtlasInstruction = atlas::program::types::AtlasInstruction;
15pub type ProgramMetadata = atlas::program::types::ProgramMetadata;
16#[doc(hidden)]
17#[allow(non_snake_case)]
18pub unsafe fn _export_get_program_metadata_cabi<T: Guest>(
19    arg0: i32,
20    arg1: *mut u8,
21    arg2: usize,
22    arg3: *mut u8,
23    arg4: usize,
24    arg5: i64,
25    arg6: *mut u8,
26    arg7: usize,
27) -> *mut u8 {
28    #[cfg(target_arch = "wasm32")]
29    _rt::run_ctors_once();
30    let result3 = T::get_program_metadata(match arg0 {
31        0 => None,
32        1 => {
33            let e = {
34                let len0 = arg2;
35                let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0);
36                let len1 = arg4;
37                let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1);
38                let len2 = arg7;
39                __with_name0::AtlasAccount {
40                    owner: _rt::string_lift(bytes0),
41                    key: _rt::string_lift(bytes1),
42                    lamports: arg5 as u64,
43                    data: _rt::Vec::from_raw_parts(arg6.cast(), len2, len2),
44                }
45            };
46            Some(e)
47        }
48        _ => _rt::invalid_enum_discriminant(),
49    });
50    let ptr4 = _RET_AREA.0.as_mut_ptr().cast::<u8>();
51    match result3 {
52        Some(e) => {
53            *ptr4.add(0).cast::<u8>() = (1i32) as u8;
54            let atlas::program::types::ProgramMetadata {
55                name: name5,
56                program_id: program_id5,
57                project_url: project_url5,
58                contacts: contacts5,
59                policy: policy5,
60                source_code: source_code5,
61                encryption: encryption5,
62                auditors: auditors5,
63                acknowledgements: acknowledgements5,
64                custom_metadata: custom_metadata5,
65            } = e;
66            match name5 {
67                Some(e) => {
68                    *ptr4.add(4).cast::<u8>() = (1i32) as u8;
69                    let vec6 = (e.into_bytes()).into_boxed_slice();
70                    let ptr6 = vec6.as_ptr().cast::<u8>();
71                    let len6 = vec6.len();
72                    ::core::mem::forget(vec6);
73                    *ptr4.add(12).cast::<usize>() = len6;
74                    *ptr4.add(8).cast::<*mut u8>() = ptr6.cast_mut();
75                }
76                None => {
77                    *ptr4.add(4).cast::<u8>() = (0i32) as u8;
78                }
79            };
80            match program_id5 {
81                Some(e) => {
82                    *ptr4.add(16).cast::<u8>() = (1i32) as u8;
83                    let vec7 = (e.into_bytes()).into_boxed_slice();
84                    let ptr7 = vec7.as_ptr().cast::<u8>();
85                    let len7 = vec7.len();
86                    ::core::mem::forget(vec7);
87                    *ptr4.add(24).cast::<usize>() = len7;
88                    *ptr4.add(20).cast::<*mut u8>() = ptr7.cast_mut();
89                }
90                None => {
91                    *ptr4.add(16).cast::<u8>() = (0i32) as u8;
92                }
93            };
94            match project_url5 {
95                Some(e) => {
96                    *ptr4.add(28).cast::<u8>() = (1i32) as u8;
97                    let vec8 = (e.into_bytes()).into_boxed_slice();
98                    let ptr8 = vec8.as_ptr().cast::<u8>();
99                    let len8 = vec8.len();
100                    ::core::mem::forget(vec8);
101                    *ptr4.add(36).cast::<usize>() = len8;
102                    *ptr4.add(32).cast::<*mut u8>() = ptr8.cast_mut();
103                }
104                None => {
105                    *ptr4.add(28).cast::<u8>() = (0i32) as u8;
106                }
107            };
108            match contacts5 {
109                Some(e) => {
110                    *ptr4.add(40).cast::<u8>() = (1i32) as u8;
111                    let vec9 = (e.into_bytes()).into_boxed_slice();
112                    let ptr9 = vec9.as_ptr().cast::<u8>();
113                    let len9 = vec9.len();
114                    ::core::mem::forget(vec9);
115                    *ptr4.add(48).cast::<usize>() = len9;
116                    *ptr4.add(44).cast::<*mut u8>() = ptr9.cast_mut();
117                }
118                None => {
119                    *ptr4.add(40).cast::<u8>() = (0i32) as u8;
120                }
121            };
122            match policy5 {
123                Some(e) => {
124                    *ptr4.add(52).cast::<u8>() = (1i32) as u8;
125                    let vec10 = (e.into_bytes()).into_boxed_slice();
126                    let ptr10 = vec10.as_ptr().cast::<u8>();
127                    let len10 = vec10.len();
128                    ::core::mem::forget(vec10);
129                    *ptr4.add(60).cast::<usize>() = len10;
130                    *ptr4.add(56).cast::<*mut u8>() = ptr10.cast_mut();
131                }
132                None => {
133                    *ptr4.add(52).cast::<u8>() = (0i32) as u8;
134                }
135            };
136            match source_code5 {
137                Some(e) => {
138                    *ptr4.add(64).cast::<u8>() = (1i32) as u8;
139                    let vec11 = (e.into_bytes()).into_boxed_slice();
140                    let ptr11 = vec11.as_ptr().cast::<u8>();
141                    let len11 = vec11.len();
142                    ::core::mem::forget(vec11);
143                    *ptr4.add(72).cast::<usize>() = len11;
144                    *ptr4.add(68).cast::<*mut u8>() = ptr11.cast_mut();
145                }
146                None => {
147                    *ptr4.add(64).cast::<u8>() = (0i32) as u8;
148                }
149            };
150            match encryption5 {
151                Some(e) => {
152                    *ptr4.add(76).cast::<u8>() = (1i32) as u8;
153                    let vec12 = (e.into_bytes()).into_boxed_slice();
154                    let ptr12 = vec12.as_ptr().cast::<u8>();
155                    let len12 = vec12.len();
156                    ::core::mem::forget(vec12);
157                    *ptr4.add(84).cast::<usize>() = len12;
158                    *ptr4.add(80).cast::<*mut u8>() = ptr12.cast_mut();
159                }
160                None => {
161                    *ptr4.add(76).cast::<u8>() = (0i32) as u8;
162                }
163            };
164            match auditors5 {
165                Some(e) => {
166                    *ptr4.add(88).cast::<u8>() = (1i32) as u8;
167                    let vec13 = (e.into_bytes()).into_boxed_slice();
168                    let ptr13 = vec13.as_ptr().cast::<u8>();
169                    let len13 = vec13.len();
170                    ::core::mem::forget(vec13);
171                    *ptr4.add(96).cast::<usize>() = len13;
172                    *ptr4.add(92).cast::<*mut u8>() = ptr13.cast_mut();
173                }
174                None => {
175                    *ptr4.add(88).cast::<u8>() = (0i32) as u8;
176                }
177            };
178            match acknowledgements5 {
179                Some(e) => {
180                    *ptr4.add(100).cast::<u8>() = (1i32) as u8;
181                    let vec14 = (e.into_bytes()).into_boxed_slice();
182                    let ptr14 = vec14.as_ptr().cast::<u8>();
183                    let len14 = vec14.len();
184                    ::core::mem::forget(vec14);
185                    *ptr4.add(108).cast::<usize>() = len14;
186                    *ptr4.add(104).cast::<*mut u8>() = ptr14.cast_mut();
187                }
188                None => {
189                    *ptr4.add(100).cast::<u8>() = (0i32) as u8;
190                }
191            };
192            match custom_metadata5 {
193                Some(e) => {
194                    *ptr4.add(112).cast::<u8>() = (1i32) as u8;
195                    let vec15 = (e.into_bytes()).into_boxed_slice();
196                    let ptr15 = vec15.as_ptr().cast::<u8>();
197                    let len15 = vec15.len();
198                    ::core::mem::forget(vec15);
199                    *ptr4.add(120).cast::<usize>() = len15;
200                    *ptr4.add(116).cast::<*mut u8>() = ptr15.cast_mut();
201                }
202                None => {
203                    *ptr4.add(112).cast::<u8>() = (0i32) as u8;
204                }
205            };
206        }
207        None => {
208            *ptr4.add(0).cast::<u8>() = (0i32) as u8;
209        }
210    };
211    ptr4
212}
213#[doc(hidden)]
214#[allow(non_snake_case)]
215pub unsafe fn __post_return_get_program_metadata<T: Guest>(arg0: *mut u8) {
216    let l0 = i32::from(*arg0.add(0).cast::<u8>());
217    match l0 {
218        0 => {}
219        _ => {
220            let l1 = i32::from(*arg0.add(4).cast::<u8>());
221            match l1 {
222                0 => {}
223                _ => {
224                    let l2 = *arg0.add(8).cast::<*mut u8>();
225                    let l3 = *arg0.add(12).cast::<usize>();
226                    _rt::cabi_dealloc(l2, l3, 1);
227                }
228            }
229            let l4 = i32::from(*arg0.add(16).cast::<u8>());
230            match l4 {
231                0 => {}
232                _ => {
233                    let l5 = *arg0.add(20).cast::<*mut u8>();
234                    let l6 = *arg0.add(24).cast::<usize>();
235                    _rt::cabi_dealloc(l5, l6, 1);
236                }
237            }
238            let l7 = i32::from(*arg0.add(28).cast::<u8>());
239            match l7 {
240                0 => {}
241                _ => {
242                    let l8 = *arg0.add(32).cast::<*mut u8>();
243                    let l9 = *arg0.add(36).cast::<usize>();
244                    _rt::cabi_dealloc(l8, l9, 1);
245                }
246            }
247            let l10 = i32::from(*arg0.add(40).cast::<u8>());
248            match l10 {
249                0 => {}
250                _ => {
251                    let l11 = *arg0.add(44).cast::<*mut u8>();
252                    let l12 = *arg0.add(48).cast::<usize>();
253                    _rt::cabi_dealloc(l11, l12, 1);
254                }
255            }
256            let l13 = i32::from(*arg0.add(52).cast::<u8>());
257            match l13 {
258                0 => {}
259                _ => {
260                    let l14 = *arg0.add(56).cast::<*mut u8>();
261                    let l15 = *arg0.add(60).cast::<usize>();
262                    _rt::cabi_dealloc(l14, l15, 1);
263                }
264            }
265            let l16 = i32::from(*arg0.add(64).cast::<u8>());
266            match l16 {
267                0 => {}
268                _ => {
269                    let l17 = *arg0.add(68).cast::<*mut u8>();
270                    let l18 = *arg0.add(72).cast::<usize>();
271                    _rt::cabi_dealloc(l17, l18, 1);
272                }
273            }
274            let l19 = i32::from(*arg0.add(76).cast::<u8>());
275            match l19 {
276                0 => {}
277                _ => {
278                    let l20 = *arg0.add(80).cast::<*mut u8>();
279                    let l21 = *arg0.add(84).cast::<usize>();
280                    _rt::cabi_dealloc(l20, l21, 1);
281                }
282            }
283            let l22 = i32::from(*arg0.add(88).cast::<u8>());
284            match l22 {
285                0 => {}
286                _ => {
287                    let l23 = *arg0.add(92).cast::<*mut u8>();
288                    let l24 = *arg0.add(96).cast::<usize>();
289                    _rt::cabi_dealloc(l23, l24, 1);
290                }
291            }
292            let l25 = i32::from(*arg0.add(100).cast::<u8>());
293            match l25 {
294                0 => {}
295                _ => {
296                    let l26 = *arg0.add(104).cast::<*mut u8>();
297                    let l27 = *arg0.add(108).cast::<usize>();
298                    _rt::cabi_dealloc(l26, l27, 1);
299                }
300            }
301            let l28 = i32::from(*arg0.add(112).cast::<u8>());
302            match l28 {
303                0 => {}
304                _ => {
305                    let l29 = *arg0.add(116).cast::<*mut u8>();
306                    let l30 = *arg0.add(120).cast::<usize>();
307                    _rt::cabi_dealloc(l29, l30, 1);
308                }
309            }
310        }
311    }
312}
313#[doc(hidden)]
314#[allow(non_snake_case)]
315pub unsafe fn _export_parse_accounts_cabi<T: Guest>(
316    arg0: i32,
317    arg1: *mut u8,
318    arg2: usize,
319    arg3: *mut u8,
320    arg4: usize,
321    arg5: i64,
322    arg6: *mut u8,
323    arg7: usize,
324    arg8: *mut u8,
325    arg9: usize,
326    arg10: *mut u8,
327    arg11: usize,
328) -> *mut u8 {
329    #[cfg(target_arch = "wasm32")]
330    _rt::run_ctors_once();
331    let base13 = arg8;
332    let len13 = arg9;
333    let mut result13 = _rt::Vec::with_capacity(len13);
334    for i in 0..len13 {
335        let base = base13.add(i * 32);
336        let e13 = {
337            let l3 = *base.add(0).cast::<*mut u8>();
338            let l4 = *base.add(4).cast::<usize>();
339            let len5 = l4;
340            let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5);
341            let l6 = *base.add(8).cast::<*mut u8>();
342            let l7 = *base.add(12).cast::<usize>();
343            let len8 = l7;
344            let bytes8 = _rt::Vec::from_raw_parts(l6.cast(), len8, len8);
345            let l9 = *base.add(16).cast::<i64>();
346            let l10 = *base.add(24).cast::<*mut u8>();
347            let l11 = *base.add(28).cast::<usize>();
348            let len12 = l11;
349            __with_name0::AtlasAccount {
350                owner: _rt::string_lift(bytes5),
351                key: _rt::string_lift(bytes8),
352                lamports: l9 as u64,
353                data: _rt::Vec::from_raw_parts(l10.cast(), len12, len12),
354            }
355        };
356        result13.push(e13);
357    }
358    _rt::cabi_dealloc(base13, len13 * 32, 8);
359    let len14 = arg11;
360    let bytes14 = _rt::Vec::from_raw_parts(arg10.cast(), len14, len14);
361    let result15 = T::parse_accounts(
362        match arg0 {
363            0 => None,
364            1 => {
365                let e = {
366                    let len0 = arg2;
367                    let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0);
368                    let len1 = arg4;
369                    let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1);
370                    let len2 = arg7;
371                    __with_name0::AtlasAccount {
372                        owner: _rt::string_lift(bytes0),
373                        key: _rt::string_lift(bytes1),
374                        lamports: arg5 as u64,
375                        data: _rt::Vec::from_raw_parts(arg6.cast(), len2, len2),
376                    }
377                };
378                Some(e)
379            }
380            _ => _rt::invalid_enum_discriminant(),
381        },
382        result13,
383        _rt::string_lift(bytes14),
384    );
385    let ptr16 = _RET_AREA.0.as_mut_ptr().cast::<u8>();
386    match result15 {
387        Ok(e) => {
388            *ptr16.add(0).cast::<u8>() = (0i32) as u8;
389            let vec21 = e;
390            let len21 = vec21.len();
391            let layout21 = _rt::alloc::Layout::from_size_align_unchecked(vec21.len() * 40, 8);
392            let result21 = if layout21.size() != 0 {
393                let ptr = _rt::alloc::alloc(layout21).cast::<u8>();
394                if ptr.is_null() {
395                    _rt::alloc::handle_alloc_error(layout21);
396                }
397                ptr
398            } else {
399                ::core::ptr::null_mut()
400            };
401            for (i, e) in vec21.into_iter().enumerate() {
402                let base = result21.add(i * 40);
403                {
404                    match e {
405                        Ok(e) => {
406                            *base.add(0).cast::<u8>() = (0i32) as u8;
407                            let atlas::program::types::AccountResponse {
408                                name: name17,
409                                discriminator: discriminator17,
410                                value: value17,
411                            } = e;
412                            let vec18 = (name17.into_bytes()).into_boxed_slice();
413                            let ptr18 = vec18.as_ptr().cast::<u8>();
414                            let len18 = vec18.len();
415                            ::core::mem::forget(vec18);
416                            *base.add(12).cast::<usize>() = len18;
417                            *base.add(8).cast::<*mut u8>() = ptr18.cast_mut();
418                            match discriminator17 {
419                                Some(e) => {
420                                    *base.add(16).cast::<u8>() = (1i32) as u8;
421                                    *base.add(24).cast::<i64>() = _rt::as_i64(e);
422                                }
423                                None => {
424                                    *base.add(16).cast::<u8>() = (0i32) as u8;
425                                }
426                            };
427                            let vec19 = (value17.into_bytes()).into_boxed_slice();
428                            let ptr19 = vec19.as_ptr().cast::<u8>();
429                            let len19 = vec19.len();
430                            ::core::mem::forget(vec19);
431                            *base.add(36).cast::<usize>() = len19;
432                            *base.add(32).cast::<*mut u8>() = ptr19.cast_mut();
433                        }
434                        Err(e) => {
435                            *base.add(0).cast::<u8>() = (1i32) as u8;
436                            let vec20 = (e.into_bytes()).into_boxed_slice();
437                            let ptr20 = vec20.as_ptr().cast::<u8>();
438                            let len20 = vec20.len();
439                            ::core::mem::forget(vec20);
440                            *base.add(12).cast::<usize>() = len20;
441                            *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
442                        }
443                    };
444                }
445            }
446            *ptr16.add(8).cast::<usize>() = len21;
447            *ptr16.add(4).cast::<*mut u8>() = result21;
448        }
449        Err(e) => {
450            *ptr16.add(0).cast::<u8>() = (1i32) as u8;
451            let vec22 = (e.into_bytes()).into_boxed_slice();
452            let ptr22 = vec22.as_ptr().cast::<u8>();
453            let len22 = vec22.len();
454            ::core::mem::forget(vec22);
455            *ptr16.add(8).cast::<usize>() = len22;
456            *ptr16.add(4).cast::<*mut u8>() = ptr22.cast_mut();
457        }
458    };
459    ptr16
460}
461#[doc(hidden)]
462#[allow(non_snake_case)]
463pub unsafe fn __post_return_parse_accounts<T: Guest>(arg0: *mut u8) {
464    let l0 = i32::from(*arg0.add(0).cast::<u8>());
465    match l0 {
466        0 => {
467            let l1 = *arg0.add(4).cast::<*mut u8>();
468            let l2 = *arg0.add(8).cast::<usize>();
469            let base10 = l1;
470            let len10 = l2;
471            for i in 0..len10 {
472                let base = base10.add(i * 40);
473                {
474                    let l3 = i32::from(*base.add(0).cast::<u8>());
475                    match l3 {
476                        0 => {
477                            let l4 = *base.add(8).cast::<*mut u8>();
478                            let l5 = *base.add(12).cast::<usize>();
479                            _rt::cabi_dealloc(l4, l5, 1);
480                            let l6 = *base.add(32).cast::<*mut u8>();
481                            let l7 = *base.add(36).cast::<usize>();
482                            _rt::cabi_dealloc(l6, l7, 1);
483                        }
484                        _ => {
485                            let l8 = *base.add(8).cast::<*mut u8>();
486                            let l9 = *base.add(12).cast::<usize>();
487                            _rt::cabi_dealloc(l8, l9, 1);
488                        }
489                    }
490                }
491            }
492            _rt::cabi_dealloc(base10, len10 * 40, 8);
493        }
494        _ => {
495            let l11 = *arg0.add(4).cast::<*mut u8>();
496            let l12 = *arg0.add(8).cast::<usize>();
497            _rt::cabi_dealloc(l11, l12, 1);
498        }
499    }
500}
501#[doc(hidden)]
502#[allow(non_snake_case)]
503pub unsafe fn _export_parse_instructions_cabi<T: Guest>(
504    arg0: i32,
505    arg1: *mut u8,
506    arg2: usize,
507    arg3: *mut u8,
508    arg4: usize,
509    arg5: i64,
510    arg6: *mut u8,
511    arg7: usize,
512    arg8: *mut u8,
513    arg9: usize,
514    arg10: *mut u8,
515    arg11: usize,
516) -> *mut u8 {
517    #[cfg(target_arch = "wasm32")]
518    _rt::run_ctors_once();
519    let base12 = arg8;
520    let len12 = arg9;
521    let mut result12 = _rt::Vec::with_capacity(len12);
522    for i in 0..len12 {
523        let base = base12.add(i * 16);
524        let e12 = {
525            let l3 = *base.add(0).cast::<*mut u8>();
526            let l4 = *base.add(4).cast::<usize>();
527            let base8 = l3;
528            let len8 = l4;
529            let mut result8 = _rt::Vec::with_capacity(len8);
530            for i in 0..len8 {
531                let base = base8.add(i * 8);
532                let e8 = {
533                    let l5 = *base.add(0).cast::<*mut u8>();
534                    let l6 = *base.add(4).cast::<usize>();
535                    let len7 = l6;
536                    let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7);
537                    _rt::string_lift(bytes7)
538                };
539                result8.push(e8);
540            }
541            _rt::cabi_dealloc(base8, len8 * 8, 4);
542            let l9 = *base.add(8).cast::<*mut u8>();
543            let l10 = *base.add(12).cast::<usize>();
544            let len11 = l10;
545            atlas::program::types::AtlasInstruction {
546                accounts: result8,
547                data: _rt::Vec::from_raw_parts(l9.cast(), len11, len11),
548            }
549        };
550        result12.push(e12);
551    }
552    _rt::cabi_dealloc(base12, len12 * 16, 4);
553    let len13 = arg11;
554    let bytes13 = _rt::Vec::from_raw_parts(arg10.cast(), len13, len13);
555    let result14 = T::parse_instructions(
556        match arg0 {
557            0 => None,
558            1 => {
559                let e = {
560                    let len0 = arg2;
561                    let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0);
562                    let len1 = arg4;
563                    let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1);
564                    let len2 = arg7;
565                    __with_name0::AtlasAccount {
566                        owner: _rt::string_lift(bytes0),
567                        key: _rt::string_lift(bytes1),
568                        lamports: arg5 as u64,
569                        data: _rt::Vec::from_raw_parts(arg6.cast(), len2, len2),
570                    }
571                };
572                Some(e)
573            }
574            _ => _rt::invalid_enum_discriminant(),
575        },
576        result12,
577        _rt::string_lift(bytes13),
578    );
579    let ptr15 = _RET_AREA.0.as_mut_ptr().cast::<u8>();
580    match result14 {
581        Ok(e) => {
582            *ptr15.add(0).cast::<u8>() = (0i32) as u8;
583            let vec24 = e;
584            let len24 = vec24.len();
585            let layout24 = _rt::alloc::Layout::from_size_align_unchecked(vec24.len() * 48, 8);
586            let result24 = if layout24.size() != 0 {
587                let ptr = _rt::alloc::alloc(layout24).cast::<u8>();
588                if ptr.is_null() {
589                    _rt::alloc::handle_alloc_error(layout24);
590                }
591                ptr
592            } else {
593                ::core::ptr::null_mut()
594            };
595            for (i, e) in vec24.into_iter().enumerate() {
596                let base = result24.add(i * 48);
597                {
598                    match e {
599                        Ok(e) => {
600                            *base.add(0).cast::<u8>() = (0i32) as u8;
601                            let atlas::program::types::InstructionResponse {
602                                name: name16,
603                                discriminator: discriminator16,
604                                accounts: accounts16,
605                                value: value16,
606                            } = e;
607                            let vec17 = (name16.into_bytes()).into_boxed_slice();
608                            let ptr17 = vec17.as_ptr().cast::<u8>();
609                            let len17 = vec17.len();
610                            ::core::mem::forget(vec17);
611                            *base.add(12).cast::<usize>() = len17;
612                            *base.add(8).cast::<*mut u8>() = ptr17.cast_mut();
613                            match discriminator16 {
614                                Some(e) => {
615                                    *base.add(16).cast::<u8>() = (1i32) as u8;
616                                    *base.add(24).cast::<i64>() = _rt::as_i64(e);
617                                }
618                                None => {
619                                    *base.add(16).cast::<u8>() = (0i32) as u8;
620                                }
621                            };
622                            let vec21 = accounts16;
623                            let len21 = vec21.len();
624                            let layout21 =
625                                _rt::alloc::Layout::from_size_align_unchecked(vec21.len() * 16, 4);
626                            let result21 = if layout21.size() != 0 {
627                                let ptr = _rt::alloc::alloc(layout21).cast::<u8>();
628                                if ptr.is_null() {
629                                    _rt::alloc::handle_alloc_error(layout21);
630                                }
631                                ptr
632                            } else {
633                                ::core::ptr::null_mut()
634                            };
635                            for (i, e) in vec21.into_iter().enumerate() {
636                                let base = result21.add(i * 16);
637                                {
638                                    let atlas::program::types::AccountMetaTags {
639                                        key: key18,
640                                        name: name18,
641                                    } = e;
642                                    let vec19 = (key18.into_bytes()).into_boxed_slice();
643                                    let ptr19 = vec19.as_ptr().cast::<u8>();
644                                    let len19 = vec19.len();
645                                    ::core::mem::forget(vec19);
646                                    *base.add(4).cast::<usize>() = len19;
647                                    *base.add(0).cast::<*mut u8>() = ptr19.cast_mut();
648                                    let vec20 = (name18.into_bytes()).into_boxed_slice();
649                                    let ptr20 = vec20.as_ptr().cast::<u8>();
650                                    let len20 = vec20.len();
651                                    ::core::mem::forget(vec20);
652                                    *base.add(12).cast::<usize>() = len20;
653                                    *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
654                                }
655                            }
656                            *base.add(36).cast::<usize>() = len21;
657                            *base.add(32).cast::<*mut u8>() = result21;
658                            let vec22 = (value16.into_bytes()).into_boxed_slice();
659                            let ptr22 = vec22.as_ptr().cast::<u8>();
660                            let len22 = vec22.len();
661                            ::core::mem::forget(vec22);
662                            *base.add(44).cast::<usize>() = len22;
663                            *base.add(40).cast::<*mut u8>() = ptr22.cast_mut();
664                        }
665                        Err(e) => {
666                            *base.add(0).cast::<u8>() = (1i32) as u8;
667                            let vec23 = (e.into_bytes()).into_boxed_slice();
668                            let ptr23 = vec23.as_ptr().cast::<u8>();
669                            let len23 = vec23.len();
670                            ::core::mem::forget(vec23);
671                            *base.add(12).cast::<usize>() = len23;
672                            *base.add(8).cast::<*mut u8>() = ptr23.cast_mut();
673                        }
674                    };
675                }
676            }
677            *ptr15.add(8).cast::<usize>() = len24;
678            *ptr15.add(4).cast::<*mut u8>() = result24;
679        }
680        Err(e) => {
681            *ptr15.add(0).cast::<u8>() = (1i32) as u8;
682            let vec25 = (e.into_bytes()).into_boxed_slice();
683            let ptr25 = vec25.as_ptr().cast::<u8>();
684            let len25 = vec25.len();
685            ::core::mem::forget(vec25);
686            *ptr15.add(8).cast::<usize>() = len25;
687            *ptr15.add(4).cast::<*mut u8>() = ptr25.cast_mut();
688        }
689    };
690    ptr15
691}
692#[doc(hidden)]
693#[allow(non_snake_case)]
694pub unsafe fn __post_return_parse_instructions<T: Guest>(arg0: *mut u8) {
695    let l0 = i32::from(*arg0.add(0).cast::<u8>());
696    match l0 {
697        0 => {
698            let l1 = *arg0.add(4).cast::<*mut u8>();
699            let l2 = *arg0.add(8).cast::<usize>();
700            let base17 = l1;
701            let len17 = l2;
702            for i in 0..len17 {
703                let base = base17.add(i * 48);
704                {
705                    let l3 = i32::from(*base.add(0).cast::<u8>());
706                    match l3 {
707                        0 => {
708                            let l4 = *base.add(8).cast::<*mut u8>();
709                            let l5 = *base.add(12).cast::<usize>();
710                            _rt::cabi_dealloc(l4, l5, 1);
711                            let l6 = *base.add(32).cast::<*mut u8>();
712                            let l7 = *base.add(36).cast::<usize>();
713                            let base12 = l6;
714                            let len12 = l7;
715                            for i in 0..len12 {
716                                let base = base12.add(i * 16);
717                                {
718                                    let l8 = *base.add(0).cast::<*mut u8>();
719                                    let l9 = *base.add(4).cast::<usize>();
720                                    _rt::cabi_dealloc(l8, l9, 1);
721                                    let l10 = *base.add(8).cast::<*mut u8>();
722                                    let l11 = *base.add(12).cast::<usize>();
723                                    _rt::cabi_dealloc(l10, l11, 1);
724                                }
725                            }
726                            _rt::cabi_dealloc(base12, len12 * 16, 4);
727                            let l13 = *base.add(40).cast::<*mut u8>();
728                            let l14 = *base.add(44).cast::<usize>();
729                            _rt::cabi_dealloc(l13, l14, 1);
730                        }
731                        _ => {
732                            let l15 = *base.add(8).cast::<*mut u8>();
733                            let l16 = *base.add(12).cast::<usize>();
734                            _rt::cabi_dealloc(l15, l16, 1);
735                        }
736                    }
737                }
738            }
739            _rt::cabi_dealloc(base17, len17 * 48, 8);
740        }
741        _ => {
742            let l18 = *arg0.add(4).cast::<*mut u8>();
743            let l19 = *arg0.add(8).cast::<usize>();
744            _rt::cabi_dealloc(l18, l19, 1);
745        }
746    }
747}
748#[doc(hidden)]
749#[allow(non_snake_case)]
750pub unsafe fn _export_parse_error_cabi<T: Guest>(
751    arg0: i32,
752    arg1: *mut u8,
753    arg2: usize,
754    arg3: *mut u8,
755    arg4: usize,
756    arg5: i64,
757    arg6: *mut u8,
758    arg7: usize,
759    arg8: i64,
760    arg9: *mut u8,
761    arg10: usize,
762) -> *mut u8 {
763    #[cfg(target_arch = "wasm32")]
764    _rt::run_ctors_once();
765    let len3 = arg10;
766    let bytes3 = _rt::Vec::from_raw_parts(arg9.cast(), len3, len3);
767    let result4 = T::parse_error(
768        match arg0 {
769            0 => None,
770            1 => {
771                let e = {
772                    let len0 = arg2;
773                    let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0);
774                    let len1 = arg4;
775                    let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1);
776                    let len2 = arg7;
777                    __with_name0::AtlasAccount {
778                        owner: _rt::string_lift(bytes0),
779                        key: _rt::string_lift(bytes1),
780                        lamports: arg5 as u64,
781                        data: _rt::Vec::from_raw_parts(arg6.cast(), len2, len2),
782                    }
783                };
784                Some(e)
785            }
786            _ => _rt::invalid_enum_discriminant(),
787        },
788        arg8 as u64,
789        _rt::string_lift(bytes3),
790    );
791    let ptr5 = _RET_AREA.0.as_mut_ptr().cast::<u8>();
792    match result4 {
793        Some(e) => {
794            *ptr5.add(0).cast::<u8>() = (1i32) as u8;
795            let vec6 = (e.into_bytes()).into_boxed_slice();
796            let ptr6 = vec6.as_ptr().cast::<u8>();
797            let len6 = vec6.len();
798            ::core::mem::forget(vec6);
799            *ptr5.add(8).cast::<usize>() = len6;
800            *ptr5.add(4).cast::<*mut u8>() = ptr6.cast_mut();
801        }
802        None => {
803            *ptr5.add(0).cast::<u8>() = (0i32) as u8;
804        }
805    };
806    ptr5
807}
808#[doc(hidden)]
809#[allow(non_snake_case)]
810pub unsafe fn __post_return_parse_error<T: Guest>(arg0: *mut u8) {
811    let l0 = i32::from(*arg0.add(0).cast::<u8>());
812    match l0 {
813        0 => {}
814        _ => {
815            let l1 = *arg0.add(4).cast::<*mut u8>();
816            let l2 = *arg0.add(8).cast::<usize>();
817            _rt::cabi_dealloc(l1, l2, 1);
818        }
819    }
820}
821#[doc(hidden)]
822#[allow(non_snake_case)]
823pub unsafe fn _export_parse_logs_cabi<T: Guest>(
824    arg0: i32,
825    arg1: *mut u8,
826    arg2: usize,
827    arg3: *mut u8,
828    arg4: usize,
829    arg5: i64,
830    arg6: *mut u8,
831    arg7: usize,
832    arg8: *mut u8,
833    arg9: usize,
834    arg10: *mut u8,
835    arg11: usize,
836) -> *mut u8 {
837    #[cfg(target_arch = "wasm32")]
838    _rt::run_ctors_once();
839    let base6 = arg8;
840    let len6 = arg9;
841    let mut result6 = _rt::Vec::with_capacity(len6);
842    for i in 0..len6 {
843        let base = base6.add(i * 8);
844        let e6 = {
845            let l3 = *base.add(0).cast::<*mut u8>();
846            let l4 = *base.add(4).cast::<usize>();
847            let len5 = l4;
848            let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5);
849            _rt::string_lift(bytes5)
850        };
851        result6.push(e6);
852    }
853    _rt::cabi_dealloc(base6, len6 * 8, 4);
854    let len7 = arg11;
855    let bytes7 = _rt::Vec::from_raw_parts(arg10.cast(), len7, len7);
856    let result8 = T::parse_logs(
857        match arg0 {
858            0 => None,
859            1 => {
860                let e = {
861                    let len0 = arg2;
862                    let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0);
863                    let len1 = arg4;
864                    let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1);
865                    let len2 = arg7;
866                    __with_name0::AtlasAccount {
867                        owner: _rt::string_lift(bytes0),
868                        key: _rt::string_lift(bytes1),
869                        lamports: arg5 as u64,
870                        data: _rt::Vec::from_raw_parts(arg6.cast(), len2, len2),
871                    }
872                };
873                Some(e)
874            }
875            _ => _rt::invalid_enum_discriminant(),
876        },
877        result6,
878        _rt::string_lift(bytes7),
879    );
880    let ptr9 = _RET_AREA.0.as_mut_ptr().cast::<u8>();
881    match result8 {
882        Ok(e) => {
883            *ptr9.add(0).cast::<u8>() = (0i32) as u8;
884            let vec11 = e;
885            let len11 = vec11.len();
886            let layout11 = _rt::alloc::Layout::from_size_align_unchecked(vec11.len() * 8, 4);
887            let result11 = if layout11.size() != 0 {
888                let ptr = _rt::alloc::alloc(layout11).cast::<u8>();
889                if ptr.is_null() {
890                    _rt::alloc::handle_alloc_error(layout11);
891                }
892                ptr
893            } else {
894                ::core::ptr::null_mut()
895            };
896            for (i, e) in vec11.into_iter().enumerate() {
897                let base = result11.add(i * 8);
898                {
899                    let vec10 = (e.into_bytes()).into_boxed_slice();
900                    let ptr10 = vec10.as_ptr().cast::<u8>();
901                    let len10 = vec10.len();
902                    ::core::mem::forget(vec10);
903                    *base.add(4).cast::<usize>() = len10;
904                    *base.add(0).cast::<*mut u8>() = ptr10.cast_mut();
905                }
906            }
907            *ptr9.add(8).cast::<usize>() = len11;
908            *ptr9.add(4).cast::<*mut u8>() = result11;
909        }
910        Err(e) => {
911            *ptr9.add(0).cast::<u8>() = (1i32) as u8;
912            let vec12 = (e.into_bytes()).into_boxed_slice();
913            let ptr12 = vec12.as_ptr().cast::<u8>();
914            let len12 = vec12.len();
915            ::core::mem::forget(vec12);
916            *ptr9.add(8).cast::<usize>() = len12;
917            *ptr9.add(4).cast::<*mut u8>() = ptr12.cast_mut();
918        }
919    };
920    ptr9
921}
922#[doc(hidden)]
923#[allow(non_snake_case)]
924pub unsafe fn __post_return_parse_logs<T: Guest>(arg0: *mut u8) {
925    let l0 = i32::from(*arg0.add(0).cast::<u8>());
926    match l0 {
927        0 => {
928            let l1 = *arg0.add(4).cast::<*mut u8>();
929            let l2 = *arg0.add(8).cast::<usize>();
930            let base5 = l1;
931            let len5 = l2;
932            for i in 0..len5 {
933                let base = base5.add(i * 8);
934                {
935                    let l3 = *base.add(0).cast::<*mut u8>();
936                    let l4 = *base.add(4).cast::<usize>();
937                    _rt::cabi_dealloc(l3, l4, 1);
938                }
939            }
940            _rt::cabi_dealloc(base5, len5 * 8, 4);
941        }
942        _ => {
943            let l6 = *arg0.add(4).cast::<*mut u8>();
944            let l7 = *arg0.add(8).cast::<usize>();
945            _rt::cabi_dealloc(l6, l7, 1);
946        }
947    }
948}
949pub trait Guest {
950    /// Returns a program metadata record.
951    fn get_program_metadata(idl: Option<AtlasAccount>) -> Option<ProgramMetadata>;
952    /// Parse a list of program owned accounts.
953    fn parse_accounts(
954        idl: Option<AtlasAccount>,
955        accounts: _rt::Vec<AtlasAccount>,
956        params: _rt::String,
957    ) -> Result<_rt::Vec<Result<AccountResponse, _rt::String>>, _rt::String>;
958    /// Parse a list of instructions and add metadata to each instruction as human readable context.
959    fn parse_instructions(
960        idl: Option<AtlasAccount>,
961        instructions: _rt::Vec<AtlasInstruction>,
962        params: _rt::String,
963    ) -> Result<_rt::Vec<Result<InstructionResponse, _rt::String>>, _rt::String>;
964    /// Parse a program error code into a human readable string.
965    fn parse_error(
966        idl: Option<AtlasAccount>,
967        error_code: u64,
968        params: _rt::String,
969    ) -> Option<_rt::String>;
970    /// Parse a list of logs and add metadata to each log as human readable context.
971    fn parse_logs(
972        idl: Option<AtlasAccount>,
973        logs: _rt::Vec<_rt::String>,
974        params: _rt::String,
975    ) -> Result<_rt::Vec<_rt::String>, _rt::String>;
976}
977#[doc(hidden)]
978#[macro_export]
979macro_rules! __export_world_program_parser_cabi {
980    ($ty:ident with_types_in $($path_to_types:tt)*) => {
981        const _ : () = { #[export_name = "get-program-metadata"] unsafe extern "C" fn
982        export_get_program_metadata(arg0 : i32, arg1 : * mut u8, arg2 : usize, arg3 : *
983        mut u8, arg4 : usize, arg5 : i64, arg6 : * mut u8, arg7 : usize,) -> * mut u8 {
984        $($path_to_types)*:: _export_get_program_metadata_cabi::<$ty > (arg0, arg1, arg2,
985        arg3, arg4, arg5, arg6, arg7) } #[export_name = "cabi_post_get-program-metadata"]
986        unsafe extern "C" fn _post_return_get_program_metadata(arg0 : * mut u8,) {
987        $($path_to_types)*:: __post_return_get_program_metadata::<$ty > (arg0) }
988        #[export_name = "parse-accounts"] unsafe extern "C" fn export_parse_accounts(arg0
989        : i32, arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize, arg5 : i64,
990        arg6 : * mut u8, arg7 : usize, arg8 : * mut u8, arg9 : usize, arg10 : * mut u8,
991        arg11 : usize,) -> * mut u8 { $($path_to_types)*::
992        _export_parse_accounts_cabi::<$ty > (arg0, arg1, arg2, arg3, arg4, arg5, arg6,
993        arg7, arg8, arg9, arg10, arg11) } #[export_name = "cabi_post_parse-accounts"]
994        unsafe extern "C" fn _post_return_parse_accounts(arg0 : * mut u8,) {
995        $($path_to_types)*:: __post_return_parse_accounts::<$ty > (arg0) } #[export_name
996        = "parse-instructions"] unsafe extern "C" fn export_parse_instructions(arg0 :
997        i32, arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize, arg5 : i64,
998        arg6 : * mut u8, arg7 : usize, arg8 : * mut u8, arg9 : usize, arg10 : * mut u8,
999        arg11 : usize,) -> * mut u8 { $($path_to_types)*::
1000        _export_parse_instructions_cabi::<$ty > (arg0, arg1, arg2, arg3, arg4, arg5,
1001        arg6, arg7, arg8, arg9, arg10, arg11) } #[export_name =
1002        "cabi_post_parse-instructions"] unsafe extern "C" fn
1003        _post_return_parse_instructions(arg0 : * mut u8,) { $($path_to_types)*::
1004        __post_return_parse_instructions::<$ty > (arg0) } #[export_name = "parse-error"]
1005        unsafe extern "C" fn export_parse_error(arg0 : i32, arg1 : * mut u8, arg2 :
1006        usize, arg3 : * mut u8, arg4 : usize, arg5 : i64, arg6 : * mut u8, arg7 : usize,
1007        arg8 : i64, arg9 : * mut u8, arg10 : usize,) -> * mut u8 { $($path_to_types)*::
1008        _export_parse_error_cabi::<$ty > (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7,
1009        arg8, arg9, arg10) } #[export_name = "cabi_post_parse-error"] unsafe extern "C"
1010        fn _post_return_parse_error(arg0 : * mut u8,) { $($path_to_types)*::
1011        __post_return_parse_error::<$ty > (arg0) } #[export_name = "parse-logs"] unsafe
1012        extern "C" fn export_parse_logs(arg0 : i32, arg1 : * mut u8, arg2 : usize, arg3 :
1013        * mut u8, arg4 : usize, arg5 : i64, arg6 : * mut u8, arg7 : usize, arg8 : * mut
1014        u8, arg9 : usize, arg10 : * mut u8, arg11 : usize,) -> * mut u8 {
1015        $($path_to_types)*:: _export_parse_logs_cabi::<$ty > (arg0, arg1, arg2, arg3,
1016        arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) } #[export_name =
1017        "cabi_post_parse-logs"] unsafe extern "C" fn _post_return_parse_logs(arg0 : * mut
1018        u8,) { $($path_to_types)*:: __post_return_parse_logs::<$ty > (arg0) } };
1019    };
1020}
1021#[doc(hidden)]
1022pub use __export_world_program_parser_cabi;
1023#[repr(align(4))]
1024struct _RetArea([::core::mem::MaybeUninit<u8>; 124]);
1025static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 124]);
1026#[rustfmt::skip]
1027#[allow(dead_code, clippy::all)]
1028pub mod atlas {
1029    pub mod program {
1030        #[allow(dead_code, clippy::all)]
1031        pub mod types {
1032            #[used]
1033            #[doc(hidden)]
1034            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
1035            use super::super::super::_rt;
1036            /// An on-chain instruction.
1037            #[derive(Clone, serde::Deserialize, serde::Serialize)]
1038            pub struct AtlasInstruction {
1039                /// The accounts used by the instruction as a list of base58 encoded Pubkeys.
1040                pub accounts: _rt::Vec<_rt::String>,
1041                /// The data for the instruction as a list of bytes.
1042                pub data: _rt::Vec<u8>,
1043            }
1044            impl ::core::fmt::Debug for AtlasInstruction {
1045                fn fmt(
1046                    &self,
1047                    f: &mut ::core::fmt::Formatter<'_>,
1048                ) -> ::core::fmt::Result {
1049                    f.debug_struct("AtlasInstruction")
1050                        .field("accounts", &self.accounts)
1051                        .field("data", &self.data)
1052                        .finish()
1053                }
1054            }
1055            /// A response from the IDL parser.
1056            #[derive(Clone, serde::Deserialize, serde::Serialize)]
1057            pub struct AccountResponse {
1058                /// The name of the account.
1059                pub name: _rt::String,
1060                /// Optional key to lookup the account's schema
1061                pub discriminator: Option<u64>,
1062                /// Must be JSON, the RPC server will sanitize
1063                pub value: _rt::String,
1064            }
1065            impl ::core::fmt::Debug for AccountResponse {
1066                fn fmt(
1067                    &self,
1068                    f: &mut ::core::fmt::Formatter<'_>,
1069                ) -> ::core::fmt::Result {
1070                    f.debug_struct("AccountResponse")
1071                        .field("name", &self.name)
1072                        .field("discriminator", &self.discriminator)
1073                        .field("value", &self.value)
1074                        .finish()
1075                }
1076            }
1077            /// A tag for an account.
1078            #[derive(Clone, serde::Deserialize, serde::Serialize)]
1079            pub struct AccountMetaTags {
1080                /// The key of the account as a base58 encoded Pubkey.
1081                pub key: _rt::String,
1082                /// The name of the account in camelCase.
1083                pub name: _rt::String,
1084            }
1085            impl ::core::fmt::Debug for AccountMetaTags {
1086                fn fmt(
1087                    &self,
1088                    f: &mut ::core::fmt::Formatter<'_>,
1089                ) -> ::core::fmt::Result {
1090                    f.debug_struct("AccountMetaTags")
1091                        .field("key", &self.key)
1092                        .field("name", &self.name)
1093                        .finish()
1094                }
1095            }
1096            /// A response from the IDL parser.
1097            #[derive(Clone, serde::Deserialize, serde::Serialize)]
1098            pub struct InstructionResponse {
1099                /// The name of the instruction.
1100                pub name: _rt::String,
1101                /// Optional key to lookup the account's schema
1102                pub discriminator: Option<u64>,
1103                /// Labels supplied by the program
1104                pub accounts: _rt::Vec<AccountMetaTags>,
1105                /// Must be JSON, the RPC server will sanitize
1106                pub value: _rt::String,
1107            }
1108            impl ::core::fmt::Debug for InstructionResponse {
1109                fn fmt(
1110                    &self,
1111                    f: &mut ::core::fmt::Formatter<'_>,
1112                ) -> ::core::fmt::Result {
1113                    f.debug_struct("InstructionResponse")
1114                        .field("name", &self.name)
1115                        .field("discriminator", &self.discriminator)
1116                        .field("accounts", &self.accounts)
1117                        .field("value", &self.value)
1118                        .finish()
1119                }
1120            }
1121            /// A metadata record for a program.
1122            #[derive(Clone, serde::Deserialize, serde::Serialize)]
1123            pub struct ProgramMetadata {
1124                pub name: Option<_rt::String>,
1125                pub program_id: Option<_rt::String>,
1126                pub project_url: Option<_rt::String>,
1127                pub contacts: Option<_rt::String>,
1128                pub policy: Option<_rt::String>,
1129                pub source_code: Option<_rt::String>,
1130                pub encryption: Option<_rt::String>,
1131                pub auditors: Option<_rt::String>,
1132                pub acknowledgements: Option<_rt::String>,
1133                pub custom_metadata: Option<_rt::String>,
1134            }
1135            impl ::core::fmt::Debug for ProgramMetadata {
1136                fn fmt(
1137                    &self,
1138                    f: &mut ::core::fmt::Formatter<'_>,
1139                ) -> ::core::fmt::Result {
1140                    f.debug_struct("ProgramMetadata")
1141                        .field("name", &self.name)
1142                        .field("program-id", &self.program_id)
1143                        .field("project-url", &self.project_url)
1144                        .field("contacts", &self.contacts)
1145                        .field("policy", &self.policy)
1146                        .field("source-code", &self.source_code)
1147                        .field("encryption", &self.encryption)
1148                        .field("auditors", &self.auditors)
1149                        .field("acknowledgements", &self.acknowledgements)
1150                        .field("custom-metadata", &self.custom_metadata)
1151                        .finish()
1152                }
1153            }
1154        }
1155    }
1156}
1157#[rustfmt::skip]
1158mod _rt {
1159    pub use alloc_crate::vec::Vec;
1160    pub use alloc_crate::string::String;
1161    #[cfg(target_arch = "wasm32")]
1162    pub fn run_ctors_once() {
1163        wit_bindgen_rt::run_ctors_once();
1164    }
1165    pub unsafe fn string_lift(bytes: Vec<u8>) -> String {
1166        if cfg!(debug_assertions) {
1167            String::from_utf8(bytes).unwrap()
1168        } else {
1169            String::from_utf8_unchecked(bytes)
1170        }
1171    }
1172    pub unsafe fn invalid_enum_discriminant<T>() -> T {
1173        if cfg!(debug_assertions) {
1174            panic!("invalid enum discriminant")
1175        } else {
1176            core::hint::unreachable_unchecked()
1177        }
1178    }
1179    pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) {
1180        if size == 0 {
1181            return;
1182        }
1183        let layout = alloc::Layout::from_size_align_unchecked(size, align);
1184        alloc::dealloc(ptr, layout);
1185    }
1186    pub fn as_i64<T: AsI64>(t: T) -> i64 {
1187        t.as_i64()
1188    }
1189    pub trait AsI64 {
1190        fn as_i64(self) -> i64;
1191    }
1192    impl<T: Copy + AsI64> AsI64 for &T {
1193        fn as_i64(self) -> i64 {
1194            (*self).as_i64()
1195        }
1196    }
1197    impl AsI64 for i64 {
1198        #[inline]
1199        fn as_i64(self) -> i64 {
1200            self
1201        }
1202    }
1203    impl AsI64 for u64 {
1204        #[inline]
1205        fn as_i64(self) -> i64 {
1206            self as i64
1207        }
1208    }
1209    pub use alloc_crate::alloc;
1210    extern crate alloc as alloc_crate;
1211}
1212/// Generates `#[no_mangle]` functions to export the specified type as the
1213/// root implementation of all generated traits.
1214///
1215/// For more information see the documentation of `wit_bindgen::generate!`.
1216///
1217/// ```rust
1218/// # macro_rules! _export_program_parser{ ($($t:tt)*) => (); }
1219/// # trait Guest {}
1220/// struct MyType;
1221///
1222/// impl Guest for MyType {
1223///     // ...
1224/// }
1225///
1226/// _export_program_parser!(MyType);
1227/// ```
1228#[allow(unused_macros)]
1229#[doc(hidden)]
1230#[macro_export]
1231macro_rules! __export_program_parser_impl {
1232    ($ty:ident) => {
1233        atlas::_export_program_parser!($ty with_types_in atlas);
1234    };
1235    ($ty:ident with_types_in $($path_to_types_root:tt)*) => {
1236        $($path_to_types_root)*:: __export_world_program_parser_cabi!($ty with_types_in
1237        $($path_to_types_root)*); const _ : () = { #[cfg(target_arch = "wasm32")]
1238        #[link_section =
1239        "component-type:wit-bindgen:0.36.0:atlas:program@0.1.0:program-parser:imports and exports"]
1240        #[doc(hidden)] pub static __WIT_BINDGEN_COMPONENT_TYPE : [u8; 1196] = *
1241        b"\
1242\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xa7\x08\x01A\x02\x01\
1243A'\x01B\x03\x01p}\x01r\x04\x05owners\x03keys\x08lamportsw\x04data\0\x04\0\x0datl\
1244as-account\x03\0\x01\x03\0\x1aatlas:accounts/types@0.1.0\x05\0\x02\x03\0\0\x0dat\
1245las-account\x03\0\x0datlas-account\x03\0\x01\x01B\x0f\x01ps\x01p}\x01r\x02\x08ac\
1246counts\0\x04data\x01\x04\0\x11atlas-instruction\x03\0\x02\x01kw\x01r\x03\x04name\
1247s\x0ddiscriminator\x04\x05values\x04\0\x10account-response\x03\0\x05\x01r\x02\x03\
1248keys\x04names\x04\0\x11account-meta-tags\x03\0\x07\x01p\x08\x01r\x04\x04names\x0d\
1249discriminator\x04\x08accounts\x09\x05values\x04\0\x14instruction-response\x03\0\x0a\
1250\x01ks\x01r\x0a\x04name\x0c\x0aprogram-id\x0c\x0bproject-url\x0c\x08contacts\x0c\
1251\x06policy\x0c\x0bsource-code\x0c\x0aencryption\x0c\x08auditors\x0c\x10acknowled\
1252gements\x0c\x0fcustom-metadata\x0c\x04\0\x10program-metadata\x03\0\x0d\x03\0\x19\
1253atlas:program/types@0.1.0\x05\x03\x02\x03\0\x01\x11account-meta-tags\x03\0\x11ac\
1254count-meta-tags\x03\0\x04\x02\x03\0\x01\x10account-response\x03\0\x10account-res\
1255ponse\x03\0\x06\x02\x03\0\x01\x14instruction-response\x03\0\x14instruction-respo\
1256nse\x03\0\x08\x02\x03\0\x01\x11atlas-instruction\x03\0\x11atlas-instruction\x03\0\
1257\x0a\x02\x03\0\x01\x10program-metadata\x03\0\x10program-metadata\x03\0\x0c\x01k\x02\
1258\x01k\x0d\x01@\x01\x03idl\x0e\0\x0f\x04\0\x14get-program-metadata\x01\x10\x01p\x02\
1259\x01j\x01\x07\x01s\x01p\x12\x01j\x01\x13\x01s\x01@\x03\x03idl\x0e\x08accounts\x11\
1260\x06paramss\0\x14\x04\0\x0eparse-accounts\x01\x15\x01p\x0b\x01j\x01\x09\x01s\x01\
1261p\x17\x01j\x01\x18\x01s\x01@\x03\x03idl\x0e\x0cinstructions\x16\x06paramss\0\x19\
1262\x04\0\x12parse-instructions\x01\x1a\x01ks\x01@\x03\x03idl\x0e\x0aerror-codew\x06\
1263paramss\0\x1b\x04\0\x0bparse-error\x01\x1c\x01ps\x01j\x01\x1d\x01s\x01@\x03\x03i\
1264dl\x0e\x04logs\x1d\x06paramss\0\x1e\x04\0\x0aparse-logs\x01\x1f\x04\0\"atlas:pro\
1265gram/program-parser@0.1.0\x04\0\x0b\x14\x01\0\x0eprogram-parser\x03\0\0\0G\x09pr\
1266oducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.220.0\x10wit-bindgen-rust\x06\
12670.36.0";
1268        };
1269    };
1270}
1271#[doc(inline)]
1272pub use __export_program_parser_impl as _export_program_parser;
1273#[cfg(target_arch = "wasm32")]
1274#[link_section = "component-type:wit-bindgen:0.36.0:atlas:program@0.1.0:program-parser-with-all-of-its-exports-removed:encoded world"]
1275#[doc(hidden)]
1276pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 984] = *b"\
1277\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xb3\x06\x01A\x02\x01\
1278A\x10\x01B\x03\x01p}\x01r\x04\x05owners\x03keys\x08lamportsw\x04data\0\x04\0\x0d\
1279atlas-account\x03\0\x01\x03\0\x1aatlas:accounts/types@0.1.0\x05\0\x02\x03\0\0\x0d\
1280atlas-account\x03\0\x0datlas-account\x03\0\x01\x01B\x0f\x01ps\x01p}\x01r\x02\x08\
1281accounts\0\x04data\x01\x04\0\x11atlas-instruction\x03\0\x02\x01kw\x01r\x03\x04na\
1282mes\x0ddiscriminator\x04\x05values\x04\0\x10account-response\x03\0\x05\x01r\x02\x03\
1283keys\x04names\x04\0\x11account-meta-tags\x03\0\x07\x01p\x08\x01r\x04\x04names\x0d\
1284discriminator\x04\x08accounts\x09\x05values\x04\0\x14instruction-response\x03\0\x0a\
1285\x01ks\x01r\x0a\x04name\x0c\x0aprogram-id\x0c\x0bproject-url\x0c\x08contacts\x0c\
1286\x06policy\x0c\x0bsource-code\x0c\x0aencryption\x0c\x08auditors\x0c\x10acknowled\
1287gements\x0c\x0fcustom-metadata\x0c\x04\0\x10program-metadata\x03\0\x0d\x03\0\x19\
1288atlas:program/types@0.1.0\x05\x03\x02\x03\0\x01\x11account-meta-tags\x03\0\x11ac\
1289count-meta-tags\x03\0\x04\x02\x03\0\x01\x10account-response\x03\0\x10account-res\
1290ponse\x03\0\x06\x02\x03\0\x01\x14instruction-response\x03\0\x14instruction-respo\
1291nse\x03\0\x08\x02\x03\0\x01\x11atlas-instruction\x03\0\x11atlas-instruction\x03\0\
1292\x0a\x02\x03\0\x01\x10program-metadata\x03\0\x10program-metadata\x03\0\x0c\x04\0\
1293Batlas:program/program-parser-with-all-of-its-exports-removed@0.1.0\x04\0\x0b4\x01\
1294\0.program-parser-with-all-of-its-exports-removed\x03\0\0\0G\x09producers\x01\x0c\
1295processed-by\x02\x0dwit-component\x070.220.0\x10wit-bindgen-rust\x060.36.0";
1296#[inline(never)]
1297#[doc(hidden)]
1298pub fn __link_custom_section_describing_imports() {
1299    wit_bindgen_rt::maybe_link_cabi_realloc();
1300}