golem_rust/bindings.rs
1// Generated by `wit-bindgen` 0.36.0. DO NOT EDIT!
2// Options used:
3// * runtime_path: "wit_bindgen_rt"
4#[rustfmt::skip]
5#[allow(dead_code, clippy::all)]
6pub mod golem {
7 pub mod api {
8 /// The Golem host API provides low level access to Golem specific features such as promises and control over
9 /// the durability and transactional guarantees the executor provides.
10 #[allow(dead_code, clippy::all)]
11 pub mod host {
12 #[used]
13 #[doc(hidden)]
14 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
15 use super::super::super::_rt;
16 pub type Uri = super::super::super::golem::rpc::types::Uri;
17 pub type Duration = super::super::super::wasi::clocks::monotonic_clock::Duration;
18 /// An index into the persistent log storing all performed operations of a worker
19 pub type OplogIndex = u64;
20 /// Represents a Golem component's version
21 pub type ComponentVersion = u64;
22 /// UUID
23 #[repr(C)]
24 #[derive(Clone, Copy)]
25 pub struct Uuid {
26 pub high_bits: u64,
27 pub low_bits: u64,
28 }
29 impl ::core::fmt::Debug for Uuid {
30 fn fmt(
31 &self,
32 f: &mut ::core::fmt::Formatter<'_>,
33 ) -> ::core::fmt::Result {
34 f.debug_struct("Uuid")
35 .field("high-bits", &self.high_bits)
36 .field("low-bits", &self.low_bits)
37 .finish()
38 }
39 }
40 /// Represents a Golem component
41 #[repr(C)]
42 #[derive(Clone, Copy)]
43 pub struct ComponentId {
44 pub uuid: Uuid,
45 }
46 impl ::core::fmt::Debug for ComponentId {
47 fn fmt(
48 &self,
49 f: &mut ::core::fmt::Formatter<'_>,
50 ) -> ::core::fmt::Result {
51 f.debug_struct("ComponentId").field("uuid", &self.uuid).finish()
52 }
53 }
54 /// Represents a Golem worker
55 #[derive(Clone)]
56 pub struct WorkerId {
57 pub component_id: ComponentId,
58 pub worker_name: _rt::String,
59 }
60 impl ::core::fmt::Debug for WorkerId {
61 fn fmt(
62 &self,
63 f: &mut ::core::fmt::Formatter<'_>,
64 ) -> ::core::fmt::Result {
65 f.debug_struct("WorkerId")
66 .field("component-id", &self.component_id)
67 .field("worker-name", &self.worker_name)
68 .finish()
69 }
70 }
71 /// A promise ID is a value that can be passed to an external Golem API to complete that promise
72 /// from an arbitrary external source, while Golem workers can await for this completion.
73 #[derive(Clone)]
74 pub struct PromiseId {
75 pub worker_id: WorkerId,
76 pub oplog_idx: OplogIndex,
77 }
78 impl ::core::fmt::Debug for PromiseId {
79 fn fmt(
80 &self,
81 f: &mut ::core::fmt::Formatter<'_>,
82 ) -> ::core::fmt::Result {
83 f.debug_struct("PromiseId")
84 .field("worker-id", &self.worker_id)
85 .field("oplog-idx", &self.oplog_idx)
86 .finish()
87 }
88 }
89 /// Represents a Golem Cloud account
90 #[derive(Clone)]
91 pub struct AccountId {
92 pub value: _rt::String,
93 }
94 impl ::core::fmt::Debug for AccountId {
95 fn fmt(
96 &self,
97 f: &mut ::core::fmt::Formatter<'_>,
98 ) -> ::core::fmt::Result {
99 f.debug_struct("AccountId").field("value", &self.value).finish()
100 }
101 }
102 /// Configures how the executor retries failures
103 #[repr(C)]
104 #[derive(Clone, Copy)]
105 pub struct RetryPolicy {
106 /// The maximum number of retries before the worker becomes permanently failed
107 pub max_attempts: u32,
108 /// The minimum delay between retries (applied to the first retry)
109 pub min_delay: Duration,
110 /// The maximum delay between retries
111 pub max_delay: Duration,
112 /// Multiplier applied to the delay on each retry to implement exponential backoff
113 pub multiplier: f64,
114 /// The maximum amount of jitter to add to the delay
115 pub max_jitter_factor: Option<f64>,
116 }
117 impl ::core::fmt::Debug for RetryPolicy {
118 fn fmt(
119 &self,
120 f: &mut ::core::fmt::Formatter<'_>,
121 ) -> ::core::fmt::Result {
122 f.debug_struct("RetryPolicy")
123 .field("max-attempts", &self.max_attempts)
124 .field("min-delay", &self.min_delay)
125 .field("max-delay", &self.max_delay)
126 .field("multiplier", &self.multiplier)
127 .field("max-jitter-factor", &self.max_jitter_factor)
128 .finish()
129 }
130 }
131 /// Configurable persistence level for workers
132 #[derive(Clone, Copy)]
133 pub enum PersistenceLevel {
134 PersistNothing,
135 PersistRemoteSideEffects,
136 Smart,
137 }
138 impl ::core::fmt::Debug for PersistenceLevel {
139 fn fmt(
140 &self,
141 f: &mut ::core::fmt::Formatter<'_>,
142 ) -> ::core::fmt::Result {
143 match self {
144 PersistenceLevel::PersistNothing => {
145 f.debug_tuple("PersistenceLevel::PersistNothing").finish()
146 }
147 PersistenceLevel::PersistRemoteSideEffects => {
148 f.debug_tuple("PersistenceLevel::PersistRemoteSideEffects")
149 .finish()
150 }
151 PersistenceLevel::Smart => {
152 f.debug_tuple("PersistenceLevel::Smart").finish()
153 }
154 }
155 }
156 }
157 /// Describes how to update a worker to a different component version
158 #[repr(u8)]
159 #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
160 pub enum UpdateMode {
161 /// Automatic update tries to recover the worker using the new component version
162 /// and may fail if there is a divergence.
163 Automatic,
164 /// Manual, snapshot-based update uses a user-defined implementation of the `save-snapshot` interface
165 /// to store the worker's state, and a user-defined implementation of the `load-snapshot` interface to
166 /// load it into the new version.
167 SnapshotBased,
168 }
169 impl ::core::fmt::Debug for UpdateMode {
170 fn fmt(
171 &self,
172 f: &mut ::core::fmt::Formatter<'_>,
173 ) -> ::core::fmt::Result {
174 match self {
175 UpdateMode::Automatic => {
176 f.debug_tuple("UpdateMode::Automatic").finish()
177 }
178 UpdateMode::SnapshotBased => {
179 f.debug_tuple("UpdateMode::SnapshotBased").finish()
180 }
181 }
182 }
183 }
184 impl UpdateMode {
185 #[doc(hidden)]
186 pub unsafe fn _lift(val: u8) -> UpdateMode {
187 if !cfg!(debug_assertions) {
188 return ::core::mem::transmute(val);
189 }
190 match val {
191 0 => UpdateMode::Automatic,
192 1 => UpdateMode::SnapshotBased,
193 _ => panic!("invalid enum discriminant"),
194 }
195 }
196 }
197 #[repr(u8)]
198 #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
199 pub enum FilterComparator {
200 Equal,
201 NotEqual,
202 GreaterEqual,
203 Greater,
204 LessEqual,
205 Less,
206 }
207 impl ::core::fmt::Debug for FilterComparator {
208 fn fmt(
209 &self,
210 f: &mut ::core::fmt::Formatter<'_>,
211 ) -> ::core::fmt::Result {
212 match self {
213 FilterComparator::Equal => {
214 f.debug_tuple("FilterComparator::Equal").finish()
215 }
216 FilterComparator::NotEqual => {
217 f.debug_tuple("FilterComparator::NotEqual").finish()
218 }
219 FilterComparator::GreaterEqual => {
220 f.debug_tuple("FilterComparator::GreaterEqual").finish()
221 }
222 FilterComparator::Greater => {
223 f.debug_tuple("FilterComparator::Greater").finish()
224 }
225 FilterComparator::LessEqual => {
226 f.debug_tuple("FilterComparator::LessEqual").finish()
227 }
228 FilterComparator::Less => {
229 f.debug_tuple("FilterComparator::Less").finish()
230 }
231 }
232 }
233 }
234 impl FilterComparator {
235 #[doc(hidden)]
236 pub unsafe fn _lift(val: u8) -> FilterComparator {
237 if !cfg!(debug_assertions) {
238 return ::core::mem::transmute(val);
239 }
240 match val {
241 0 => FilterComparator::Equal,
242 1 => FilterComparator::NotEqual,
243 2 => FilterComparator::GreaterEqual,
244 3 => FilterComparator::Greater,
245 4 => FilterComparator::LessEqual,
246 5 => FilterComparator::Less,
247 _ => panic!("invalid enum discriminant"),
248 }
249 }
250 }
251 #[repr(u8)]
252 #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
253 pub enum StringFilterComparator {
254 Equal,
255 NotEqual,
256 Like,
257 NotLike,
258 }
259 impl ::core::fmt::Debug for StringFilterComparator {
260 fn fmt(
261 &self,
262 f: &mut ::core::fmt::Formatter<'_>,
263 ) -> ::core::fmt::Result {
264 match self {
265 StringFilterComparator::Equal => {
266 f.debug_tuple("StringFilterComparator::Equal").finish()
267 }
268 StringFilterComparator::NotEqual => {
269 f.debug_tuple("StringFilterComparator::NotEqual").finish()
270 }
271 StringFilterComparator::Like => {
272 f.debug_tuple("StringFilterComparator::Like").finish()
273 }
274 StringFilterComparator::NotLike => {
275 f.debug_tuple("StringFilterComparator::NotLike").finish()
276 }
277 }
278 }
279 }
280 impl StringFilterComparator {
281 #[doc(hidden)]
282 pub unsafe fn _lift(val: u8) -> StringFilterComparator {
283 if !cfg!(debug_assertions) {
284 return ::core::mem::transmute(val);
285 }
286 match val {
287 0 => StringFilterComparator::Equal,
288 1 => StringFilterComparator::NotEqual,
289 2 => StringFilterComparator::Like,
290 3 => StringFilterComparator::NotLike,
291 _ => panic!("invalid enum discriminant"),
292 }
293 }
294 }
295 #[repr(u8)]
296 #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
297 pub enum WorkerStatus {
298 /// The worker is running an invoked function
299 Running,
300 /// The worker is ready to run an invoked function
301 Idle,
302 /// An invocation is active but waiting for something (sleeping, waiting for a promise)
303 Suspended,
304 /// The last invocation was interrupted but will be resumed
305 Interrupted,
306 /// The last invocation failed and a retry was scheduled
307 Retrying,
308 /// The last invocation failed and the worker can no longer be used
309 Failed,
310 /// The worker exited after a successful invocation and can no longer be invoked
311 Exited,
312 }
313 impl ::core::fmt::Debug for WorkerStatus {
314 fn fmt(
315 &self,
316 f: &mut ::core::fmt::Formatter<'_>,
317 ) -> ::core::fmt::Result {
318 match self {
319 WorkerStatus::Running => {
320 f.debug_tuple("WorkerStatus::Running").finish()
321 }
322 WorkerStatus::Idle => {
323 f.debug_tuple("WorkerStatus::Idle").finish()
324 }
325 WorkerStatus::Suspended => {
326 f.debug_tuple("WorkerStatus::Suspended").finish()
327 }
328 WorkerStatus::Interrupted => {
329 f.debug_tuple("WorkerStatus::Interrupted").finish()
330 }
331 WorkerStatus::Retrying => {
332 f.debug_tuple("WorkerStatus::Retrying").finish()
333 }
334 WorkerStatus::Failed => {
335 f.debug_tuple("WorkerStatus::Failed").finish()
336 }
337 WorkerStatus::Exited => {
338 f.debug_tuple("WorkerStatus::Exited").finish()
339 }
340 }
341 }
342 }
343 impl WorkerStatus {
344 #[doc(hidden)]
345 pub unsafe fn _lift(val: u8) -> WorkerStatus {
346 if !cfg!(debug_assertions) {
347 return ::core::mem::transmute(val);
348 }
349 match val {
350 0 => WorkerStatus::Running,
351 1 => WorkerStatus::Idle,
352 2 => WorkerStatus::Suspended,
353 3 => WorkerStatus::Interrupted,
354 4 => WorkerStatus::Retrying,
355 5 => WorkerStatus::Failed,
356 6 => WorkerStatus::Exited,
357 _ => panic!("invalid enum discriminant"),
358 }
359 }
360 }
361 #[derive(Clone)]
362 pub struct WorkerNameFilter {
363 pub comparator: StringFilterComparator,
364 pub value: _rt::String,
365 }
366 impl ::core::fmt::Debug for WorkerNameFilter {
367 fn fmt(
368 &self,
369 f: &mut ::core::fmt::Formatter<'_>,
370 ) -> ::core::fmt::Result {
371 f.debug_struct("WorkerNameFilter")
372 .field("comparator", &self.comparator)
373 .field("value", &self.value)
374 .finish()
375 }
376 }
377 #[repr(C)]
378 #[derive(Clone, Copy)]
379 pub struct WorkerStatusFilter {
380 pub comparator: FilterComparator,
381 pub value: WorkerStatus,
382 }
383 impl ::core::fmt::Debug for WorkerStatusFilter {
384 fn fmt(
385 &self,
386 f: &mut ::core::fmt::Formatter<'_>,
387 ) -> ::core::fmt::Result {
388 f.debug_struct("WorkerStatusFilter")
389 .field("comparator", &self.comparator)
390 .field("value", &self.value)
391 .finish()
392 }
393 }
394 #[repr(C)]
395 #[derive(Clone, Copy)]
396 pub struct WorkerVersionFilter {
397 pub comparator: FilterComparator,
398 pub value: u64,
399 }
400 impl ::core::fmt::Debug for WorkerVersionFilter {
401 fn fmt(
402 &self,
403 f: &mut ::core::fmt::Formatter<'_>,
404 ) -> ::core::fmt::Result {
405 f.debug_struct("WorkerVersionFilter")
406 .field("comparator", &self.comparator)
407 .field("value", &self.value)
408 .finish()
409 }
410 }
411 #[repr(C)]
412 #[derive(Clone, Copy)]
413 pub struct WorkerCreatedAtFilter {
414 pub comparator: FilterComparator,
415 pub value: u64,
416 }
417 impl ::core::fmt::Debug for WorkerCreatedAtFilter {
418 fn fmt(
419 &self,
420 f: &mut ::core::fmt::Formatter<'_>,
421 ) -> ::core::fmt::Result {
422 f.debug_struct("WorkerCreatedAtFilter")
423 .field("comparator", &self.comparator)
424 .field("value", &self.value)
425 .finish()
426 }
427 }
428 #[derive(Clone)]
429 pub struct WorkerEnvFilter {
430 pub name: _rt::String,
431 pub comparator: StringFilterComparator,
432 pub value: _rt::String,
433 }
434 impl ::core::fmt::Debug for WorkerEnvFilter {
435 fn fmt(
436 &self,
437 f: &mut ::core::fmt::Formatter<'_>,
438 ) -> ::core::fmt::Result {
439 f.debug_struct("WorkerEnvFilter")
440 .field("name", &self.name)
441 .field("comparator", &self.comparator)
442 .field("value", &self.value)
443 .finish()
444 }
445 }
446 #[derive(Clone)]
447 pub enum WorkerPropertyFilter {
448 Name(WorkerNameFilter),
449 Status(WorkerStatusFilter),
450 Version(WorkerVersionFilter),
451 CreatedAt(WorkerCreatedAtFilter),
452 Env(WorkerEnvFilter),
453 }
454 impl ::core::fmt::Debug for WorkerPropertyFilter {
455 fn fmt(
456 &self,
457 f: &mut ::core::fmt::Formatter<'_>,
458 ) -> ::core::fmt::Result {
459 match self {
460 WorkerPropertyFilter::Name(e) => {
461 f.debug_tuple("WorkerPropertyFilter::Name").field(e).finish()
462 }
463 WorkerPropertyFilter::Status(e) => {
464 f.debug_tuple("WorkerPropertyFilter::Status")
465 .field(e)
466 .finish()
467 }
468 WorkerPropertyFilter::Version(e) => {
469 f.debug_tuple("WorkerPropertyFilter::Version")
470 .field(e)
471 .finish()
472 }
473 WorkerPropertyFilter::CreatedAt(e) => {
474 f.debug_tuple("WorkerPropertyFilter::CreatedAt")
475 .field(e)
476 .finish()
477 }
478 WorkerPropertyFilter::Env(e) => {
479 f.debug_tuple("WorkerPropertyFilter::Env").field(e).finish()
480 }
481 }
482 }
483 }
484 #[derive(Clone)]
485 pub struct WorkerAllFilter {
486 pub filters: _rt::Vec<WorkerPropertyFilter>,
487 }
488 impl ::core::fmt::Debug for WorkerAllFilter {
489 fn fmt(
490 &self,
491 f: &mut ::core::fmt::Formatter<'_>,
492 ) -> ::core::fmt::Result {
493 f.debug_struct("WorkerAllFilter")
494 .field("filters", &self.filters)
495 .finish()
496 }
497 }
498 #[derive(Clone)]
499 pub struct WorkerAnyFilter {
500 pub filters: _rt::Vec<WorkerAllFilter>,
501 }
502 impl ::core::fmt::Debug for WorkerAnyFilter {
503 fn fmt(
504 &self,
505 f: &mut ::core::fmt::Formatter<'_>,
506 ) -> ::core::fmt::Result {
507 f.debug_struct("WorkerAnyFilter")
508 .field("filters", &self.filters)
509 .finish()
510 }
511 }
512 #[derive(Clone)]
513 pub struct WorkerMetadata {
514 pub worker_id: WorkerId,
515 pub args: _rt::Vec<_rt::String>,
516 pub env: _rt::Vec<(_rt::String, _rt::String)>,
517 pub status: WorkerStatus,
518 pub component_version: u64,
519 pub retry_count: u64,
520 }
521 impl ::core::fmt::Debug for WorkerMetadata {
522 fn fmt(
523 &self,
524 f: &mut ::core::fmt::Formatter<'_>,
525 ) -> ::core::fmt::Result {
526 f.debug_struct("WorkerMetadata")
527 .field("worker-id", &self.worker_id)
528 .field("args", &self.args)
529 .field("env", &self.env)
530 .field("status", &self.status)
531 .field("component-version", &self.component_version)
532 .field("retry-count", &self.retry_count)
533 .finish()
534 }
535 }
536 #[derive(Debug)]
537 #[repr(transparent)]
538 pub struct GetWorkers {
539 handle: _rt::Resource<GetWorkers>,
540 }
541 impl GetWorkers {
542 #[doc(hidden)]
543 pub unsafe fn from_handle(handle: u32) -> Self {
544 Self {
545 handle: _rt::Resource::from_handle(handle),
546 }
547 }
548 #[doc(hidden)]
549 pub fn take_handle(&self) -> u32 {
550 _rt::Resource::take_handle(&self.handle)
551 }
552 #[doc(hidden)]
553 pub fn handle(&self) -> u32 {
554 _rt::Resource::handle(&self.handle)
555 }
556 }
557 unsafe impl _rt::WasmResource for GetWorkers {
558 #[inline]
559 unsafe fn drop(_handle: u32) {
560 #[cfg(not(target_arch = "wasm32"))]
561 unreachable!();
562 #[cfg(target_arch = "wasm32")]
563 {
564 #[link(wasm_import_module = "golem:api/host@1.1.5")]
565 extern "C" {
566 #[link_name = "[resource-drop]get-workers"]
567 fn drop(_: u32);
568 }
569 drop(_handle);
570 }
571 }
572 }
573 /// Target parameter for the `revert-worker` operation
574 #[derive(Clone, Copy)]
575 pub enum RevertWorkerTarget {
576 /// Revert to a specific oplog index. The given index will be the last one to be kept.
577 RevertToOplogIndex(OplogIndex),
578 /// Revert the last N invocations.
579 RevertLastInvocations(u64),
580 }
581 impl ::core::fmt::Debug for RevertWorkerTarget {
582 fn fmt(
583 &self,
584 f: &mut ::core::fmt::Formatter<'_>,
585 ) -> ::core::fmt::Result {
586 match self {
587 RevertWorkerTarget::RevertToOplogIndex(e) => {
588 f.debug_tuple("RevertWorkerTarget::RevertToOplogIndex")
589 .field(e)
590 .finish()
591 }
592 RevertWorkerTarget::RevertLastInvocations(e) => {
593 f.debug_tuple("RevertWorkerTarget::RevertLastInvocations")
594 .field(e)
595 .finish()
596 }
597 }
598 }
599 }
600 impl GetWorkers {
601 #[allow(unused_unsafe, clippy::all)]
602 pub fn new(
603 component_id: ComponentId,
604 filter: Option<&WorkerAnyFilter>,
605 precise: bool,
606 ) -> Self {
607 unsafe {
608 let mut cleanup_list = _rt::Vec::new();
609 let ComponentId { uuid: uuid0 } = component_id;
610 let Uuid { high_bits: high_bits1, low_bits: low_bits1 } = uuid0;
611 let (result14_0, result14_1, result14_2) = match filter {
612 Some(e) => {
613 let WorkerAnyFilter { filters: filters2 } = e;
614 let vec13 = filters2;
615 let len13 = vec13.len();
616 let layout13 = _rt::alloc::Layout::from_size_align_unchecked(
617 vec13.len() * 8,
618 4,
619 );
620 let result13 = if layout13.size() != 0 {
621 let ptr = _rt::alloc::alloc(layout13).cast::<u8>();
622 if ptr.is_null() {
623 _rt::alloc::handle_alloc_error(layout13);
624 }
625 ptr
626 } else {
627 ::core::ptr::null_mut()
628 };
629 for (i, e) in vec13.into_iter().enumerate() {
630 let base = result13.add(i * 8);
631 {
632 let WorkerAllFilter { filters: filters3 } = e;
633 let vec12 = filters3;
634 let len12 = vec12.len();
635 let layout12 = _rt::alloc::Layout::from_size_align_unchecked(
636 vec12.len() * 32,
637 8,
638 );
639 let result12 = if layout12.size() != 0 {
640 let ptr = _rt::alloc::alloc(layout12).cast::<u8>();
641 if ptr.is_null() {
642 _rt::alloc::handle_alloc_error(layout12);
643 }
644 ptr
645 } else {
646 ::core::ptr::null_mut()
647 };
648 for (i, e) in vec12.into_iter().enumerate() {
649 let base = result12.add(i * 32);
650 {
651 match e {
652 WorkerPropertyFilter::Name(e) => {
653 *base.add(0).cast::<u8>() = (0i32) as u8;
654 let WorkerNameFilter {
655 comparator: comparator4,
656 value: value4,
657 } = e;
658 *base.add(8).cast::<u8>() = (comparator4.clone() as i32)
659 as u8;
660 let vec5 = value4;
661 let ptr5 = vec5.as_ptr().cast::<u8>();
662 let len5 = vec5.len();
663 *base.add(16).cast::<usize>() = len5;
664 *base.add(12).cast::<*mut u8>() = ptr5.cast_mut();
665 }
666 WorkerPropertyFilter::Status(e) => {
667 *base.add(0).cast::<u8>() = (1i32) as u8;
668 let WorkerStatusFilter {
669 comparator: comparator6,
670 value: value6,
671 } = e;
672 *base.add(8).cast::<u8>() = (comparator6.clone() as i32)
673 as u8;
674 *base.add(9).cast::<u8>() = (value6.clone() as i32) as u8;
675 }
676 WorkerPropertyFilter::Version(e) => {
677 *base.add(0).cast::<u8>() = (2i32) as u8;
678 let WorkerVersionFilter {
679 comparator: comparator7,
680 value: value7,
681 } = e;
682 *base.add(8).cast::<u8>() = (comparator7.clone() as i32)
683 as u8;
684 *base.add(16).cast::<i64>() = _rt::as_i64(value7);
685 }
686 WorkerPropertyFilter::CreatedAt(e) => {
687 *base.add(0).cast::<u8>() = (3i32) as u8;
688 let WorkerCreatedAtFilter {
689 comparator: comparator8,
690 value: value8,
691 } = e;
692 *base.add(8).cast::<u8>() = (comparator8.clone() as i32)
693 as u8;
694 *base.add(16).cast::<i64>() = _rt::as_i64(value8);
695 }
696 WorkerPropertyFilter::Env(e) => {
697 *base.add(0).cast::<u8>() = (4i32) as u8;
698 let WorkerEnvFilter {
699 name: name9,
700 comparator: comparator9,
701 value: value9,
702 } = e;
703 let vec10 = name9;
704 let ptr10 = vec10.as_ptr().cast::<u8>();
705 let len10 = vec10.len();
706 *base.add(12).cast::<usize>() = len10;
707 *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
708 *base.add(16).cast::<u8>() = (comparator9.clone() as i32)
709 as u8;
710 let vec11 = value9;
711 let ptr11 = vec11.as_ptr().cast::<u8>();
712 let len11 = vec11.len();
713 *base.add(24).cast::<usize>() = len11;
714 *base.add(20).cast::<*mut u8>() = ptr11.cast_mut();
715 }
716 }
717 }
718 }
719 *base.add(4).cast::<usize>() = len12;
720 *base.add(0).cast::<*mut u8>() = result12;
721 cleanup_list.extend_from_slice(&[(result12, layout12)]);
722 }
723 }
724 cleanup_list.extend_from_slice(&[(result13, layout13)]);
725 (1i32, result13, len13)
726 }
727 None => (0i32, ::core::ptr::null_mut(), 0usize),
728 };
729 #[cfg(target_arch = "wasm32")]
730 #[link(wasm_import_module = "golem:api/host@1.1.5")]
731 extern "C" {
732 #[link_name = "[constructor]get-workers"]
733 fn wit_import(
734 _: i64,
735 _: i64,
736 _: i32,
737 _: *mut u8,
738 _: usize,
739 _: i32,
740 ) -> i32;
741 }
742 #[cfg(not(target_arch = "wasm32"))]
743 fn wit_import(
744 _: i64,
745 _: i64,
746 _: i32,
747 _: *mut u8,
748 _: usize,
749 _: i32,
750 ) -> i32 {
751 unreachable!()
752 }
753 let ret = wit_import(
754 _rt::as_i64(high_bits1),
755 _rt::as_i64(low_bits1),
756 result14_0,
757 result14_1,
758 result14_2,
759 match &precise {
760 true => 1,
761 false => 0,
762 },
763 );
764 for (ptr, layout) in cleanup_list {
765 if layout.size() != 0 {
766 _rt::alloc::dealloc(ptr.cast(), layout);
767 }
768 }
769 GetWorkers::from_handle(ret as u32)
770 }
771 }
772 }
773 impl GetWorkers {
774 #[allow(unused_unsafe, clippy::all)]
775 pub fn get_next(&self) -> Option<_rt::Vec<WorkerMetadata>> {
776 unsafe {
777 #[repr(align(4))]
778 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
779 let mut ret_area = RetArea(
780 [::core::mem::MaybeUninit::uninit(); 12],
781 );
782 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
783 #[cfg(target_arch = "wasm32")]
784 #[link(wasm_import_module = "golem:api/host@1.1.5")]
785 extern "C" {
786 #[link_name = "[method]get-workers.get-next"]
787 fn wit_import(_: i32, _: *mut u8);
788 }
789 #[cfg(not(target_arch = "wasm32"))]
790 fn wit_import(_: i32, _: *mut u8) {
791 unreachable!()
792 }
793 wit_import((self).handle() as i32, ptr0);
794 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
795 match l1 {
796 0 => None,
797 1 => {
798 let e = {
799 let l2 = *ptr0.add(4).cast::<*mut u8>();
800 let l3 = *ptr0.add(8).cast::<usize>();
801 let base27 = l2;
802 let len27 = l3;
803 let mut result27 = _rt::Vec::with_capacity(len27);
804 for i in 0..len27 {
805 let base = base27.add(i * 64);
806 let e27 = {
807 let l4 = *base.add(0).cast::<i64>();
808 let l5 = *base.add(8).cast::<i64>();
809 let l6 = *base.add(16).cast::<*mut u8>();
810 let l7 = *base.add(20).cast::<usize>();
811 let len8 = l7;
812 let bytes8 = _rt::Vec::from_raw_parts(
813 l6.cast(),
814 len8,
815 len8,
816 );
817 let l9 = *base.add(24).cast::<*mut u8>();
818 let l10 = *base.add(28).cast::<usize>();
819 let base14 = l9;
820 let len14 = l10;
821 let mut result14 = _rt::Vec::with_capacity(len14);
822 for i in 0..len14 {
823 let base = base14.add(i * 8);
824 let e14 = {
825 let l11 = *base.add(0).cast::<*mut u8>();
826 let l12 = *base.add(4).cast::<usize>();
827 let len13 = l12;
828 let bytes13 = _rt::Vec::from_raw_parts(
829 l11.cast(),
830 len13,
831 len13,
832 );
833 _rt::string_lift(bytes13)
834 };
835 result14.push(e14);
836 }
837 _rt::cabi_dealloc(base14, len14 * 8, 4);
838 let l15 = *base.add(32).cast::<*mut u8>();
839 let l16 = *base.add(36).cast::<usize>();
840 let base23 = l15;
841 let len23 = l16;
842 let mut result23 = _rt::Vec::with_capacity(len23);
843 for i in 0..len23 {
844 let base = base23.add(i * 16);
845 let e23 = {
846 let l17 = *base.add(0).cast::<*mut u8>();
847 let l18 = *base.add(4).cast::<usize>();
848 let len19 = l18;
849 let bytes19 = _rt::Vec::from_raw_parts(
850 l17.cast(),
851 len19,
852 len19,
853 );
854 let l20 = *base.add(8).cast::<*mut u8>();
855 let l21 = *base.add(12).cast::<usize>();
856 let len22 = l21;
857 let bytes22 = _rt::Vec::from_raw_parts(
858 l20.cast(),
859 len22,
860 len22,
861 );
862 (_rt::string_lift(bytes19), _rt::string_lift(bytes22))
863 };
864 result23.push(e23);
865 }
866 _rt::cabi_dealloc(base23, len23 * 16, 4);
867 let l24 = i32::from(*base.add(40).cast::<u8>());
868 let l25 = *base.add(48).cast::<i64>();
869 let l26 = *base.add(56).cast::<i64>();
870 WorkerMetadata {
871 worker_id: WorkerId {
872 component_id: ComponentId {
873 uuid: Uuid {
874 high_bits: l4 as u64,
875 low_bits: l5 as u64,
876 },
877 },
878 worker_name: _rt::string_lift(bytes8),
879 },
880 args: result14,
881 env: result23,
882 status: WorkerStatus::_lift(l24 as u8),
883 component_version: l25 as u64,
884 retry_count: l26 as u64,
885 }
886 };
887 result27.push(e27);
888 }
889 _rt::cabi_dealloc(base27, len27 * 64, 8);
890 result27
891 };
892 Some(e)
893 }
894 _ => _rt::invalid_enum_discriminant(),
895 }
896 }
897 }
898 }
899 #[allow(unused_unsafe, clippy::all)]
900 /// Create a new promise
901 pub fn create_promise() -> PromiseId {
902 unsafe {
903 #[repr(align(8))]
904 struct RetArea([::core::mem::MaybeUninit<u8>; 32]);
905 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 32]);
906 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
907 #[cfg(target_arch = "wasm32")]
908 #[link(wasm_import_module = "golem:api/host@1.1.5")]
909 extern "C" {
910 #[link_name = "create-promise"]
911 fn wit_import(_: *mut u8);
912 }
913 #[cfg(not(target_arch = "wasm32"))]
914 fn wit_import(_: *mut u8) {
915 unreachable!()
916 }
917 wit_import(ptr0);
918 let l1 = *ptr0.add(0).cast::<i64>();
919 let l2 = *ptr0.add(8).cast::<i64>();
920 let l3 = *ptr0.add(16).cast::<*mut u8>();
921 let l4 = *ptr0.add(20).cast::<usize>();
922 let len5 = l4;
923 let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5);
924 let l6 = *ptr0.add(24).cast::<i64>();
925 PromiseId {
926 worker_id: WorkerId {
927 component_id: ComponentId {
928 uuid: Uuid {
929 high_bits: l1 as u64,
930 low_bits: l2 as u64,
931 },
932 },
933 worker_name: _rt::string_lift(bytes5),
934 },
935 oplog_idx: l6 as u64,
936 }
937 }
938 }
939 #[allow(unused_unsafe, clippy::all)]
940 /// Suspends execution until the given promise gets completed, and returns the payload passed to
941 /// the promise completion.
942 pub fn await_promise(promise_id: &PromiseId) -> _rt::Vec<u8> {
943 unsafe {
944 #[repr(align(4))]
945 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
946 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
947 let PromiseId { worker_id: worker_id0, oplog_idx: oplog_idx0 } = promise_id;
948 let WorkerId {
949 component_id: component_id1,
950 worker_name: worker_name1,
951 } = worker_id0;
952 let ComponentId { uuid: uuid2 } = component_id1;
953 let Uuid { high_bits: high_bits3, low_bits: low_bits3 } = uuid2;
954 let vec4 = worker_name1;
955 let ptr4 = vec4.as_ptr().cast::<u8>();
956 let len4 = vec4.len();
957 let ptr5 = ret_area.0.as_mut_ptr().cast::<u8>();
958 #[cfg(target_arch = "wasm32")]
959 #[link(wasm_import_module = "golem:api/host@1.1.5")]
960 extern "C" {
961 #[link_name = "await-promise"]
962 fn wit_import(
963 _: i64,
964 _: i64,
965 _: *mut u8,
966 _: usize,
967 _: i64,
968 _: *mut u8,
969 );
970 }
971 #[cfg(not(target_arch = "wasm32"))]
972 fn wit_import(
973 _: i64,
974 _: i64,
975 _: *mut u8,
976 _: usize,
977 _: i64,
978 _: *mut u8,
979 ) {
980 unreachable!()
981 }
982 wit_import(
983 _rt::as_i64(high_bits3),
984 _rt::as_i64(low_bits3),
985 ptr4.cast_mut(),
986 len4,
987 _rt::as_i64(oplog_idx0),
988 ptr5,
989 );
990 let l6 = *ptr5.add(0).cast::<*mut u8>();
991 let l7 = *ptr5.add(4).cast::<usize>();
992 let len8 = l7;
993 _rt::Vec::from_raw_parts(l6.cast(), len8, len8)
994 }
995 }
996 #[allow(unused_unsafe, clippy::all)]
997 /// Checks whether the given promise is completed. If not, it returns None. If the promise is completed,
998 /// it returns the payload passed to the promise completion.
999 pub fn poll_promise(promise_id: &PromiseId) -> Option<_rt::Vec<u8>> {
1000 unsafe {
1001 #[repr(align(4))]
1002 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
1003 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]);
1004 let PromiseId { worker_id: worker_id0, oplog_idx: oplog_idx0 } = promise_id;
1005 let WorkerId {
1006 component_id: component_id1,
1007 worker_name: worker_name1,
1008 } = worker_id0;
1009 let ComponentId { uuid: uuid2 } = component_id1;
1010 let Uuid { high_bits: high_bits3, low_bits: low_bits3 } = uuid2;
1011 let vec4 = worker_name1;
1012 let ptr4 = vec4.as_ptr().cast::<u8>();
1013 let len4 = vec4.len();
1014 let ptr5 = ret_area.0.as_mut_ptr().cast::<u8>();
1015 #[cfg(target_arch = "wasm32")]
1016 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1017 extern "C" {
1018 #[link_name = "poll-promise"]
1019 fn wit_import(
1020 _: i64,
1021 _: i64,
1022 _: *mut u8,
1023 _: usize,
1024 _: i64,
1025 _: *mut u8,
1026 );
1027 }
1028 #[cfg(not(target_arch = "wasm32"))]
1029 fn wit_import(
1030 _: i64,
1031 _: i64,
1032 _: *mut u8,
1033 _: usize,
1034 _: i64,
1035 _: *mut u8,
1036 ) {
1037 unreachable!()
1038 }
1039 wit_import(
1040 _rt::as_i64(high_bits3),
1041 _rt::as_i64(low_bits3),
1042 ptr4.cast_mut(),
1043 len4,
1044 _rt::as_i64(oplog_idx0),
1045 ptr5,
1046 );
1047 let l6 = i32::from(*ptr5.add(0).cast::<u8>());
1048 match l6 {
1049 0 => None,
1050 1 => {
1051 let e = {
1052 let l7 = *ptr5.add(4).cast::<*mut u8>();
1053 let l8 = *ptr5.add(8).cast::<usize>();
1054 let len9 = l8;
1055 _rt::Vec::from_raw_parts(l7.cast(), len9, len9)
1056 };
1057 Some(e)
1058 }
1059 _ => _rt::invalid_enum_discriminant(),
1060 }
1061 }
1062 }
1063 #[allow(unused_unsafe, clippy::all)]
1064 /// Completes the given promise with the given payload. Returns true if the promise was completed, false
1065 /// if the promise was already completed. The payload is passed to the worker that is awaiting the promise.
1066 pub fn complete_promise(promise_id: &PromiseId, data: &[u8]) -> bool {
1067 unsafe {
1068 let PromiseId { worker_id: worker_id0, oplog_idx: oplog_idx0 } = promise_id;
1069 let WorkerId {
1070 component_id: component_id1,
1071 worker_name: worker_name1,
1072 } = worker_id0;
1073 let ComponentId { uuid: uuid2 } = component_id1;
1074 let Uuid { high_bits: high_bits3, low_bits: low_bits3 } = uuid2;
1075 let vec4 = worker_name1;
1076 let ptr4 = vec4.as_ptr().cast::<u8>();
1077 let len4 = vec4.len();
1078 let vec5 = data;
1079 let ptr5 = vec5.as_ptr().cast::<u8>();
1080 let len5 = vec5.len();
1081 #[cfg(target_arch = "wasm32")]
1082 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1083 extern "C" {
1084 #[link_name = "complete-promise"]
1085 fn wit_import(
1086 _: i64,
1087 _: i64,
1088 _: *mut u8,
1089 _: usize,
1090 _: i64,
1091 _: *mut u8,
1092 _: usize,
1093 ) -> i32;
1094 }
1095 #[cfg(not(target_arch = "wasm32"))]
1096 fn wit_import(
1097 _: i64,
1098 _: i64,
1099 _: *mut u8,
1100 _: usize,
1101 _: i64,
1102 _: *mut u8,
1103 _: usize,
1104 ) -> i32 {
1105 unreachable!()
1106 }
1107 let ret = wit_import(
1108 _rt::as_i64(high_bits3),
1109 _rt::as_i64(low_bits3),
1110 ptr4.cast_mut(),
1111 len4,
1112 _rt::as_i64(oplog_idx0),
1113 ptr5.cast_mut(),
1114 len5,
1115 );
1116 _rt::bool_lift(ret as u8)
1117 }
1118 }
1119 #[allow(unused_unsafe, clippy::all)]
1120 /// Deletes the given promise
1121 pub fn delete_promise(promise_id: &PromiseId) {
1122 unsafe {
1123 let PromiseId { worker_id: worker_id0, oplog_idx: oplog_idx0 } = promise_id;
1124 let WorkerId {
1125 component_id: component_id1,
1126 worker_name: worker_name1,
1127 } = worker_id0;
1128 let ComponentId { uuid: uuid2 } = component_id1;
1129 let Uuid { high_bits: high_bits3, low_bits: low_bits3 } = uuid2;
1130 let vec4 = worker_name1;
1131 let ptr4 = vec4.as_ptr().cast::<u8>();
1132 let len4 = vec4.len();
1133 #[cfg(target_arch = "wasm32")]
1134 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1135 extern "C" {
1136 #[link_name = "delete-promise"]
1137 fn wit_import(_: i64, _: i64, _: *mut u8, _: usize, _: i64);
1138 }
1139 #[cfg(not(target_arch = "wasm32"))]
1140 fn wit_import(_: i64, _: i64, _: *mut u8, _: usize, _: i64) {
1141 unreachable!()
1142 }
1143 wit_import(
1144 _rt::as_i64(high_bits3),
1145 _rt::as_i64(low_bits3),
1146 ptr4.cast_mut(),
1147 len4,
1148 _rt::as_i64(oplog_idx0),
1149 );
1150 }
1151 }
1152 #[allow(unused_unsafe, clippy::all)]
1153 /// Returns the current position in the persistent op log
1154 pub fn get_oplog_index() -> OplogIndex {
1155 unsafe {
1156 #[cfg(target_arch = "wasm32")]
1157 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1158 extern "C" {
1159 #[link_name = "get-oplog-index"]
1160 fn wit_import() -> i64;
1161 }
1162 #[cfg(not(target_arch = "wasm32"))]
1163 fn wit_import() -> i64 {
1164 unreachable!()
1165 }
1166 let ret = wit_import();
1167 ret as u64
1168 }
1169 }
1170 #[allow(unused_unsafe, clippy::all)]
1171 /// Makes the current worker travel back in time and continue execution from the given position in the persistent
1172 /// op log.
1173 pub fn set_oplog_index(oplog_idx: OplogIndex) {
1174 unsafe {
1175 #[cfg(target_arch = "wasm32")]
1176 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1177 extern "C" {
1178 #[link_name = "set-oplog-index"]
1179 fn wit_import(_: i64);
1180 }
1181 #[cfg(not(target_arch = "wasm32"))]
1182 fn wit_import(_: i64) {
1183 unreachable!()
1184 }
1185 wit_import(_rt::as_i64(oplog_idx));
1186 }
1187 }
1188 #[allow(unused_unsafe, clippy::all)]
1189 /// Blocks the execution until the oplog has been written to at least the specified number of replicas,
1190 /// or the maximum number of replicas if the requested number is higher.
1191 pub fn oplog_commit(replicas: u8) {
1192 unsafe {
1193 #[cfg(target_arch = "wasm32")]
1194 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1195 extern "C" {
1196 #[link_name = "oplog-commit"]
1197 fn wit_import(_: i32);
1198 }
1199 #[cfg(not(target_arch = "wasm32"))]
1200 fn wit_import(_: i32) {
1201 unreachable!()
1202 }
1203 wit_import(_rt::as_i32(&replicas));
1204 }
1205 }
1206 #[allow(unused_unsafe, clippy::all)]
1207 /// Marks the beginning of an atomic operation.
1208 /// In case of a failure within the region selected by `mark-begin-operation` and `mark-end-operation`
1209 /// the whole region will be reexecuted on retry.
1210 /// The end of the region is when `mark-end-operation` is called with the returned oplog-index.
1211 pub fn mark_begin_operation() -> OplogIndex {
1212 unsafe {
1213 #[cfg(target_arch = "wasm32")]
1214 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1215 extern "C" {
1216 #[link_name = "mark-begin-operation"]
1217 fn wit_import() -> i64;
1218 }
1219 #[cfg(not(target_arch = "wasm32"))]
1220 fn wit_import() -> i64 {
1221 unreachable!()
1222 }
1223 let ret = wit_import();
1224 ret as u64
1225 }
1226 }
1227 #[allow(unused_unsafe, clippy::all)]
1228 /// Commits this atomic operation. After `mark-end-operation` is called for a given index, further calls
1229 /// with the same parameter will do nothing.
1230 pub fn mark_end_operation(begin: OplogIndex) {
1231 unsafe {
1232 #[cfg(target_arch = "wasm32")]
1233 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1234 extern "C" {
1235 #[link_name = "mark-end-operation"]
1236 fn wit_import(_: i64);
1237 }
1238 #[cfg(not(target_arch = "wasm32"))]
1239 fn wit_import(_: i64) {
1240 unreachable!()
1241 }
1242 wit_import(_rt::as_i64(begin));
1243 }
1244 }
1245 #[allow(unused_unsafe, clippy::all)]
1246 /// Gets the current retry policy associated with the worker
1247 pub fn get_retry_policy() -> RetryPolicy {
1248 unsafe {
1249 #[repr(align(8))]
1250 struct RetArea([::core::mem::MaybeUninit<u8>; 48]);
1251 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 48]);
1252 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
1253 #[cfg(target_arch = "wasm32")]
1254 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1255 extern "C" {
1256 #[link_name = "get-retry-policy"]
1257 fn wit_import(_: *mut u8);
1258 }
1259 #[cfg(not(target_arch = "wasm32"))]
1260 fn wit_import(_: *mut u8) {
1261 unreachable!()
1262 }
1263 wit_import(ptr0);
1264 let l1 = *ptr0.add(0).cast::<i32>();
1265 let l2 = *ptr0.add(8).cast::<i64>();
1266 let l3 = *ptr0.add(16).cast::<i64>();
1267 let l4 = *ptr0.add(24).cast::<f64>();
1268 let l5 = i32::from(*ptr0.add(32).cast::<u8>());
1269 RetryPolicy {
1270 max_attempts: l1 as u32,
1271 min_delay: l2 as u64,
1272 max_delay: l3 as u64,
1273 multiplier: l4,
1274 max_jitter_factor: match l5 {
1275 0 => None,
1276 1 => {
1277 let e = {
1278 let l6 = *ptr0.add(40).cast::<f64>();
1279 l6
1280 };
1281 Some(e)
1282 }
1283 _ => _rt::invalid_enum_discriminant(),
1284 },
1285 }
1286 }
1287 }
1288 #[allow(unused_unsafe, clippy::all)]
1289 /// Overrides the current retry policy associated with the worker. Following this call, `get-retry-policy` will return the
1290 /// new retry policy.
1291 pub fn set_retry_policy(new_retry_policy: RetryPolicy) {
1292 unsafe {
1293 let RetryPolicy {
1294 max_attempts: max_attempts0,
1295 min_delay: min_delay0,
1296 max_delay: max_delay0,
1297 multiplier: multiplier0,
1298 max_jitter_factor: max_jitter_factor0,
1299 } = new_retry_policy;
1300 let (result1_0, result1_1) = match max_jitter_factor0 {
1301 Some(e) => (1i32, _rt::as_f64(e)),
1302 None => (0i32, 0.0f64),
1303 };
1304 #[cfg(target_arch = "wasm32")]
1305 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1306 extern "C" {
1307 #[link_name = "set-retry-policy"]
1308 fn wit_import(_: i32, _: i64, _: i64, _: f64, _: i32, _: f64);
1309 }
1310 #[cfg(not(target_arch = "wasm32"))]
1311 fn wit_import(_: i32, _: i64, _: i64, _: f64, _: i32, _: f64) {
1312 unreachable!()
1313 }
1314 wit_import(
1315 _rt::as_i32(max_attempts0),
1316 _rt::as_i64(min_delay0),
1317 _rt::as_i64(max_delay0),
1318 _rt::as_f64(multiplier0),
1319 result1_0,
1320 result1_1,
1321 );
1322 }
1323 }
1324 #[allow(unused_unsafe, clippy::all)]
1325 /// Gets the worker's current persistence level.
1326 pub fn get_oplog_persistence_level() -> PersistenceLevel {
1327 unsafe {
1328 #[cfg(target_arch = "wasm32")]
1329 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1330 extern "C" {
1331 #[link_name = "get-oplog-persistence-level"]
1332 fn wit_import() -> i32;
1333 }
1334 #[cfg(not(target_arch = "wasm32"))]
1335 fn wit_import() -> i32 {
1336 unreachable!()
1337 }
1338 let ret = wit_import();
1339 let v0 = match ret {
1340 0 => PersistenceLevel::PersistNothing,
1341 1 => PersistenceLevel::PersistRemoteSideEffects,
1342 n => {
1343 debug_assert_eq!(n, 2, "invalid enum discriminant");
1344 PersistenceLevel::Smart
1345 }
1346 };
1347 v0
1348 }
1349 }
1350 #[allow(unused_unsafe, clippy::all)]
1351 /// Sets the worker's current persistence level. This can increase the performance of execution in cases where durable
1352 /// execution is not required.
1353 pub fn set_oplog_persistence_level(new_persistence_level: PersistenceLevel) {
1354 unsafe {
1355 let result0 = match new_persistence_level {
1356 PersistenceLevel::PersistNothing => 0i32,
1357 PersistenceLevel::PersistRemoteSideEffects => 1i32,
1358 PersistenceLevel::Smart => 2i32,
1359 };
1360 #[cfg(target_arch = "wasm32")]
1361 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1362 extern "C" {
1363 #[link_name = "set-oplog-persistence-level"]
1364 fn wit_import(_: i32);
1365 }
1366 #[cfg(not(target_arch = "wasm32"))]
1367 fn wit_import(_: i32) {
1368 unreachable!()
1369 }
1370 wit_import(result0);
1371 }
1372 }
1373 #[allow(unused_unsafe, clippy::all)]
1374 /// Gets the current idempotence mode. See `set-idempotence-mode` for details.
1375 pub fn get_idempotence_mode() -> bool {
1376 unsafe {
1377 #[cfg(target_arch = "wasm32")]
1378 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1379 extern "C" {
1380 #[link_name = "get-idempotence-mode"]
1381 fn wit_import() -> i32;
1382 }
1383 #[cfg(not(target_arch = "wasm32"))]
1384 fn wit_import() -> i32 {
1385 unreachable!()
1386 }
1387 let ret = wit_import();
1388 _rt::bool_lift(ret as u8)
1389 }
1390 }
1391 #[allow(unused_unsafe, clippy::all)]
1392 /// Sets the current idempotence mode. The default is true.
1393 /// True means side-effects are treated idempotent and Golem guarantees at-least-once semantics.
1394 /// In case of false the executor provides at-most-once semantics, failing the worker in case it is
1395 /// not known if the side effect was already executed.
1396 pub fn set_idempotence_mode(idempotent: bool) {
1397 unsafe {
1398 #[cfg(target_arch = "wasm32")]
1399 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1400 extern "C" {
1401 #[link_name = "set-idempotence-mode"]
1402 fn wit_import(_: i32);
1403 }
1404 #[cfg(not(target_arch = "wasm32"))]
1405 fn wit_import(_: i32) {
1406 unreachable!()
1407 }
1408 wit_import(
1409 match &idempotent {
1410 true => 1,
1411 false => 0,
1412 },
1413 );
1414 }
1415 }
1416 #[allow(unused_unsafe, clippy::all)]
1417 /// Generates an idempotency key. This operation will never be replayed —
1418 /// i.e. not only is this key generated, but it is persisted and committed, such that the key can be used in third-party systems (e.g. payment processing)
1419 /// to introduce idempotence.
1420 pub fn generate_idempotency_key() -> Uuid {
1421 unsafe {
1422 #[repr(align(8))]
1423 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
1424 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]);
1425 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
1426 #[cfg(target_arch = "wasm32")]
1427 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1428 extern "C" {
1429 #[link_name = "generate-idempotency-key"]
1430 fn wit_import(_: *mut u8);
1431 }
1432 #[cfg(not(target_arch = "wasm32"))]
1433 fn wit_import(_: *mut u8) {
1434 unreachable!()
1435 }
1436 wit_import(ptr0);
1437 let l1 = *ptr0.add(0).cast::<i64>();
1438 let l2 = *ptr0.add(8).cast::<i64>();
1439 Uuid {
1440 high_bits: l1 as u64,
1441 low_bits: l2 as u64,
1442 }
1443 }
1444 }
1445 #[allow(unused_unsafe, clippy::all)]
1446 /// Initiates an update attempt for the given worker. The function returns immediately once the request has been processed,
1447 /// not waiting for the worker to get updated.
1448 pub fn update_worker(
1449 worker_id: &WorkerId,
1450 target_version: ComponentVersion,
1451 mode: UpdateMode,
1452 ) {
1453 unsafe {
1454 let WorkerId {
1455 component_id: component_id0,
1456 worker_name: worker_name0,
1457 } = worker_id;
1458 let ComponentId { uuid: uuid1 } = component_id0;
1459 let Uuid { high_bits: high_bits2, low_bits: low_bits2 } = uuid1;
1460 let vec3 = worker_name0;
1461 let ptr3 = vec3.as_ptr().cast::<u8>();
1462 let len3 = vec3.len();
1463 #[cfg(target_arch = "wasm32")]
1464 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1465 extern "C" {
1466 #[link_name = "update-worker"]
1467 fn wit_import(
1468 _: i64,
1469 _: i64,
1470 _: *mut u8,
1471 _: usize,
1472 _: i64,
1473 _: i32,
1474 );
1475 }
1476 #[cfg(not(target_arch = "wasm32"))]
1477 fn wit_import(_: i64, _: i64, _: *mut u8, _: usize, _: i64, _: i32) {
1478 unreachable!()
1479 }
1480 wit_import(
1481 _rt::as_i64(high_bits2),
1482 _rt::as_i64(low_bits2),
1483 ptr3.cast_mut(),
1484 len3,
1485 _rt::as_i64(target_version),
1486 mode.clone() as i32,
1487 );
1488 }
1489 }
1490 #[allow(unused_unsafe, clippy::all)]
1491 /// Get current worker metadata
1492 pub fn get_self_metadata() -> WorkerMetadata {
1493 unsafe {
1494 #[repr(align(8))]
1495 struct RetArea([::core::mem::MaybeUninit<u8>; 64]);
1496 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 64]);
1497 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
1498 #[cfg(target_arch = "wasm32")]
1499 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1500 extern "C" {
1501 #[link_name = "get-self-metadata"]
1502 fn wit_import(_: *mut u8);
1503 }
1504 #[cfg(not(target_arch = "wasm32"))]
1505 fn wit_import(_: *mut u8) {
1506 unreachable!()
1507 }
1508 wit_import(ptr0);
1509 let l1 = *ptr0.add(0).cast::<i64>();
1510 let l2 = *ptr0.add(8).cast::<i64>();
1511 let l3 = *ptr0.add(16).cast::<*mut u8>();
1512 let l4 = *ptr0.add(20).cast::<usize>();
1513 let len5 = l4;
1514 let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5);
1515 let l6 = *ptr0.add(24).cast::<*mut u8>();
1516 let l7 = *ptr0.add(28).cast::<usize>();
1517 let base11 = l6;
1518 let len11 = l7;
1519 let mut result11 = _rt::Vec::with_capacity(len11);
1520 for i in 0..len11 {
1521 let base = base11.add(i * 8);
1522 let e11 = {
1523 let l8 = *base.add(0).cast::<*mut u8>();
1524 let l9 = *base.add(4).cast::<usize>();
1525 let len10 = l9;
1526 let bytes10 = _rt::Vec::from_raw_parts(
1527 l8.cast(),
1528 len10,
1529 len10,
1530 );
1531 _rt::string_lift(bytes10)
1532 };
1533 result11.push(e11);
1534 }
1535 _rt::cabi_dealloc(base11, len11 * 8, 4);
1536 let l12 = *ptr0.add(32).cast::<*mut u8>();
1537 let l13 = *ptr0.add(36).cast::<usize>();
1538 let base20 = l12;
1539 let len20 = l13;
1540 let mut result20 = _rt::Vec::with_capacity(len20);
1541 for i in 0..len20 {
1542 let base = base20.add(i * 16);
1543 let e20 = {
1544 let l14 = *base.add(0).cast::<*mut u8>();
1545 let l15 = *base.add(4).cast::<usize>();
1546 let len16 = l15;
1547 let bytes16 = _rt::Vec::from_raw_parts(
1548 l14.cast(),
1549 len16,
1550 len16,
1551 );
1552 let l17 = *base.add(8).cast::<*mut u8>();
1553 let l18 = *base.add(12).cast::<usize>();
1554 let len19 = l18;
1555 let bytes19 = _rt::Vec::from_raw_parts(
1556 l17.cast(),
1557 len19,
1558 len19,
1559 );
1560 (_rt::string_lift(bytes16), _rt::string_lift(bytes19))
1561 };
1562 result20.push(e20);
1563 }
1564 _rt::cabi_dealloc(base20, len20 * 16, 4);
1565 let l21 = i32::from(*ptr0.add(40).cast::<u8>());
1566 let l22 = *ptr0.add(48).cast::<i64>();
1567 let l23 = *ptr0.add(56).cast::<i64>();
1568 WorkerMetadata {
1569 worker_id: WorkerId {
1570 component_id: ComponentId {
1571 uuid: Uuid {
1572 high_bits: l1 as u64,
1573 low_bits: l2 as u64,
1574 },
1575 },
1576 worker_name: _rt::string_lift(bytes5),
1577 },
1578 args: result11,
1579 env: result20,
1580 status: WorkerStatus::_lift(l21 as u8),
1581 component_version: l22 as u64,
1582 retry_count: l23 as u64,
1583 }
1584 }
1585 }
1586 #[allow(unused_unsafe, clippy::all)]
1587 /// Get worker metadata
1588 pub fn get_worker_metadata(worker_id: &WorkerId) -> Option<WorkerMetadata> {
1589 unsafe {
1590 #[repr(align(8))]
1591 struct RetArea([::core::mem::MaybeUninit<u8>; 72]);
1592 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 72]);
1593 let WorkerId {
1594 component_id: component_id0,
1595 worker_name: worker_name0,
1596 } = worker_id;
1597 let ComponentId { uuid: uuid1 } = component_id0;
1598 let Uuid { high_bits: high_bits2, low_bits: low_bits2 } = uuid1;
1599 let vec3 = worker_name0;
1600 let ptr3 = vec3.as_ptr().cast::<u8>();
1601 let len3 = vec3.len();
1602 let ptr4 = ret_area.0.as_mut_ptr().cast::<u8>();
1603 #[cfg(target_arch = "wasm32")]
1604 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1605 extern "C" {
1606 #[link_name = "get-worker-metadata"]
1607 fn wit_import(_: i64, _: i64, _: *mut u8, _: usize, _: *mut u8);
1608 }
1609 #[cfg(not(target_arch = "wasm32"))]
1610 fn wit_import(_: i64, _: i64, _: *mut u8, _: usize, _: *mut u8) {
1611 unreachable!()
1612 }
1613 wit_import(
1614 _rt::as_i64(high_bits2),
1615 _rt::as_i64(low_bits2),
1616 ptr3.cast_mut(),
1617 len3,
1618 ptr4,
1619 );
1620 let l5 = i32::from(*ptr4.add(0).cast::<u8>());
1621 match l5 {
1622 0 => None,
1623 1 => {
1624 let e = {
1625 let l6 = *ptr4.add(8).cast::<i64>();
1626 let l7 = *ptr4.add(16).cast::<i64>();
1627 let l8 = *ptr4.add(24).cast::<*mut u8>();
1628 let l9 = *ptr4.add(28).cast::<usize>();
1629 let len10 = l9;
1630 let bytes10 = _rt::Vec::from_raw_parts(
1631 l8.cast(),
1632 len10,
1633 len10,
1634 );
1635 let l11 = *ptr4.add(32).cast::<*mut u8>();
1636 let l12 = *ptr4.add(36).cast::<usize>();
1637 let base16 = l11;
1638 let len16 = l12;
1639 let mut result16 = _rt::Vec::with_capacity(len16);
1640 for i in 0..len16 {
1641 let base = base16.add(i * 8);
1642 let e16 = {
1643 let l13 = *base.add(0).cast::<*mut u8>();
1644 let l14 = *base.add(4).cast::<usize>();
1645 let len15 = l14;
1646 let bytes15 = _rt::Vec::from_raw_parts(
1647 l13.cast(),
1648 len15,
1649 len15,
1650 );
1651 _rt::string_lift(bytes15)
1652 };
1653 result16.push(e16);
1654 }
1655 _rt::cabi_dealloc(base16, len16 * 8, 4);
1656 let l17 = *ptr4.add(40).cast::<*mut u8>();
1657 let l18 = *ptr4.add(44).cast::<usize>();
1658 let base25 = l17;
1659 let len25 = l18;
1660 let mut result25 = _rt::Vec::with_capacity(len25);
1661 for i in 0..len25 {
1662 let base = base25.add(i * 16);
1663 let e25 = {
1664 let l19 = *base.add(0).cast::<*mut u8>();
1665 let l20 = *base.add(4).cast::<usize>();
1666 let len21 = l20;
1667 let bytes21 = _rt::Vec::from_raw_parts(
1668 l19.cast(),
1669 len21,
1670 len21,
1671 );
1672 let l22 = *base.add(8).cast::<*mut u8>();
1673 let l23 = *base.add(12).cast::<usize>();
1674 let len24 = l23;
1675 let bytes24 = _rt::Vec::from_raw_parts(
1676 l22.cast(),
1677 len24,
1678 len24,
1679 );
1680 (_rt::string_lift(bytes21), _rt::string_lift(bytes24))
1681 };
1682 result25.push(e25);
1683 }
1684 _rt::cabi_dealloc(base25, len25 * 16, 4);
1685 let l26 = i32::from(*ptr4.add(48).cast::<u8>());
1686 let l27 = *ptr4.add(56).cast::<i64>();
1687 let l28 = *ptr4.add(64).cast::<i64>();
1688 WorkerMetadata {
1689 worker_id: WorkerId {
1690 component_id: ComponentId {
1691 uuid: Uuid {
1692 high_bits: l6 as u64,
1693 low_bits: l7 as u64,
1694 },
1695 },
1696 worker_name: _rt::string_lift(bytes10),
1697 },
1698 args: result16,
1699 env: result25,
1700 status: WorkerStatus::_lift(l26 as u8),
1701 component_version: l27 as u64,
1702 retry_count: l28 as u64,
1703 }
1704 };
1705 Some(e)
1706 }
1707 _ => _rt::invalid_enum_discriminant(),
1708 }
1709 }
1710 }
1711 #[allow(unused_unsafe, clippy::all)]
1712 /// Fork a worker to another worker at a given oplog index
1713 pub fn fork_worker(
1714 source_worker_id: &WorkerId,
1715 target_worker_id: &WorkerId,
1716 oplog_idx_cut_off: OplogIndex,
1717 ) {
1718 unsafe {
1719 let WorkerId {
1720 component_id: component_id0,
1721 worker_name: worker_name0,
1722 } = source_worker_id;
1723 let ComponentId { uuid: uuid1 } = component_id0;
1724 let Uuid { high_bits: high_bits2, low_bits: low_bits2 } = uuid1;
1725 let vec3 = worker_name0;
1726 let ptr3 = vec3.as_ptr().cast::<u8>();
1727 let len3 = vec3.len();
1728 let WorkerId {
1729 component_id: component_id4,
1730 worker_name: worker_name4,
1731 } = target_worker_id;
1732 let ComponentId { uuid: uuid5 } = component_id4;
1733 let Uuid { high_bits: high_bits6, low_bits: low_bits6 } = uuid5;
1734 let vec7 = worker_name4;
1735 let ptr7 = vec7.as_ptr().cast::<u8>();
1736 let len7 = vec7.len();
1737 #[cfg(target_arch = "wasm32")]
1738 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1739 extern "C" {
1740 #[link_name = "fork-worker"]
1741 fn wit_import(
1742 _: i64,
1743 _: i64,
1744 _: *mut u8,
1745 _: usize,
1746 _: i64,
1747 _: i64,
1748 _: *mut u8,
1749 _: usize,
1750 _: i64,
1751 );
1752 }
1753 #[cfg(not(target_arch = "wasm32"))]
1754 fn wit_import(
1755 _: i64,
1756 _: i64,
1757 _: *mut u8,
1758 _: usize,
1759 _: i64,
1760 _: i64,
1761 _: *mut u8,
1762 _: usize,
1763 _: i64,
1764 ) {
1765 unreachable!()
1766 }
1767 wit_import(
1768 _rt::as_i64(high_bits2),
1769 _rt::as_i64(low_bits2),
1770 ptr3.cast_mut(),
1771 len3,
1772 _rt::as_i64(high_bits6),
1773 _rt::as_i64(low_bits6),
1774 ptr7.cast_mut(),
1775 len7,
1776 _rt::as_i64(oplog_idx_cut_off),
1777 );
1778 }
1779 }
1780 #[allow(unused_unsafe, clippy::all)]
1781 /// Revert a worker to a previous state
1782 pub fn revert_worker(
1783 worker_id: &WorkerId,
1784 revert_target: RevertWorkerTarget,
1785 ) {
1786 unsafe {
1787 let WorkerId {
1788 component_id: component_id0,
1789 worker_name: worker_name0,
1790 } = worker_id;
1791 let ComponentId { uuid: uuid1 } = component_id0;
1792 let Uuid { high_bits: high_bits2, low_bits: low_bits2 } = uuid1;
1793 let vec3 = worker_name0;
1794 let ptr3 = vec3.as_ptr().cast::<u8>();
1795 let len3 = vec3.len();
1796 let (result4_0, result4_1) = match revert_target {
1797 RevertWorkerTarget::RevertToOplogIndex(e) => {
1798 (0i32, _rt::as_i64(e))
1799 }
1800 RevertWorkerTarget::RevertLastInvocations(e) => {
1801 (1i32, _rt::as_i64(e))
1802 }
1803 };
1804 #[cfg(target_arch = "wasm32")]
1805 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1806 extern "C" {
1807 #[link_name = "revert-worker"]
1808 fn wit_import(
1809 _: i64,
1810 _: i64,
1811 _: *mut u8,
1812 _: usize,
1813 _: i32,
1814 _: i64,
1815 );
1816 }
1817 #[cfg(not(target_arch = "wasm32"))]
1818 fn wit_import(_: i64, _: i64, _: *mut u8, _: usize, _: i32, _: i64) {
1819 unreachable!()
1820 }
1821 wit_import(
1822 _rt::as_i64(high_bits2),
1823 _rt::as_i64(low_bits2),
1824 ptr3.cast_mut(),
1825 len3,
1826 result4_0,
1827 result4_1,
1828 );
1829 }
1830 }
1831 #[allow(unused_unsafe, clippy::all)]
1832 /// Get the component-id for a given component reference.
1833 /// Returns none when no component with the specified reference exists.
1834 /// The syntax of the component reference is implementation dependent.
1835 ///
1836 /// Golem OSS: "{component_name}"
1837 /// Golem Cloud:
1838 /// 1: "{component_name}" -> will resolve in current account and project
1839 /// 2: "{project_name}/{component_name}" -> will resolve in current account
1840 /// 3: "{account_id}/{project_name}/{component_name}"
1841 pub fn resolve_component_id(
1842 component_reference: &str,
1843 ) -> Option<ComponentId> {
1844 unsafe {
1845 #[repr(align(8))]
1846 struct RetArea([::core::mem::MaybeUninit<u8>; 24]);
1847 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 24]);
1848 let vec0 = component_reference;
1849 let ptr0 = vec0.as_ptr().cast::<u8>();
1850 let len0 = vec0.len();
1851 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
1852 #[cfg(target_arch = "wasm32")]
1853 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1854 extern "C" {
1855 #[link_name = "resolve-component-id"]
1856 fn wit_import(_: *mut u8, _: usize, _: *mut u8);
1857 }
1858 #[cfg(not(target_arch = "wasm32"))]
1859 fn wit_import(_: *mut u8, _: usize, _: *mut u8) {
1860 unreachable!()
1861 }
1862 wit_import(ptr0.cast_mut(), len0, ptr1);
1863 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
1864 match l2 {
1865 0 => None,
1866 1 => {
1867 let e = {
1868 let l3 = *ptr1.add(8).cast::<i64>();
1869 let l4 = *ptr1.add(16).cast::<i64>();
1870 ComponentId {
1871 uuid: Uuid {
1872 high_bits: l3 as u64,
1873 low_bits: l4 as u64,
1874 },
1875 }
1876 };
1877 Some(e)
1878 }
1879 _ => _rt::invalid_enum_discriminant(),
1880 }
1881 }
1882 }
1883 #[allow(unused_unsafe, clippy::all)]
1884 /// Get the worker-id for a given component and worker name.
1885 /// Returns none when no component for the specified reference exists.
1886 pub fn resolve_worker_id(
1887 component_reference: &str,
1888 worker_name: &str,
1889 ) -> Option<WorkerId> {
1890 unsafe {
1891 #[repr(align(8))]
1892 struct RetArea([::core::mem::MaybeUninit<u8>; 32]);
1893 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 32]);
1894 let vec0 = component_reference;
1895 let ptr0 = vec0.as_ptr().cast::<u8>();
1896 let len0 = vec0.len();
1897 let vec1 = worker_name;
1898 let ptr1 = vec1.as_ptr().cast::<u8>();
1899 let len1 = vec1.len();
1900 let ptr2 = ret_area.0.as_mut_ptr().cast::<u8>();
1901 #[cfg(target_arch = "wasm32")]
1902 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1903 extern "C" {
1904 #[link_name = "resolve-worker-id"]
1905 fn wit_import(
1906 _: *mut u8,
1907 _: usize,
1908 _: *mut u8,
1909 _: usize,
1910 _: *mut u8,
1911 );
1912 }
1913 #[cfg(not(target_arch = "wasm32"))]
1914 fn wit_import(
1915 _: *mut u8,
1916 _: usize,
1917 _: *mut u8,
1918 _: usize,
1919 _: *mut u8,
1920 ) {
1921 unreachable!()
1922 }
1923 wit_import(ptr0.cast_mut(), len0, ptr1.cast_mut(), len1, ptr2);
1924 let l3 = i32::from(*ptr2.add(0).cast::<u8>());
1925 match l3 {
1926 0 => None,
1927 1 => {
1928 let e = {
1929 let l4 = *ptr2.add(8).cast::<i64>();
1930 let l5 = *ptr2.add(16).cast::<i64>();
1931 let l6 = *ptr2.add(24).cast::<*mut u8>();
1932 let l7 = *ptr2.add(28).cast::<usize>();
1933 let len8 = l7;
1934 let bytes8 = _rt::Vec::from_raw_parts(
1935 l6.cast(),
1936 len8,
1937 len8,
1938 );
1939 WorkerId {
1940 component_id: ComponentId {
1941 uuid: Uuid {
1942 high_bits: l4 as u64,
1943 low_bits: l5 as u64,
1944 },
1945 },
1946 worker_name: _rt::string_lift(bytes8),
1947 }
1948 };
1949 Some(e)
1950 }
1951 _ => _rt::invalid_enum_discriminant(),
1952 }
1953 }
1954 }
1955 #[allow(unused_unsafe, clippy::all)]
1956 /// Get the worker-id for a given component and worker name.
1957 /// Returns none when no component for the specified component-reference or no worker with the specified worker-name exists.
1958 pub fn resolve_worker_id_strict(
1959 component_reference: &str,
1960 worker_name: &str,
1961 ) -> Option<WorkerId> {
1962 unsafe {
1963 #[repr(align(8))]
1964 struct RetArea([::core::mem::MaybeUninit<u8>; 32]);
1965 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 32]);
1966 let vec0 = component_reference;
1967 let ptr0 = vec0.as_ptr().cast::<u8>();
1968 let len0 = vec0.len();
1969 let vec1 = worker_name;
1970 let ptr1 = vec1.as_ptr().cast::<u8>();
1971 let len1 = vec1.len();
1972 let ptr2 = ret_area.0.as_mut_ptr().cast::<u8>();
1973 #[cfg(target_arch = "wasm32")]
1974 #[link(wasm_import_module = "golem:api/host@1.1.5")]
1975 extern "C" {
1976 #[link_name = "resolve-worker-id-strict"]
1977 fn wit_import(
1978 _: *mut u8,
1979 _: usize,
1980 _: *mut u8,
1981 _: usize,
1982 _: *mut u8,
1983 );
1984 }
1985 #[cfg(not(target_arch = "wasm32"))]
1986 fn wit_import(
1987 _: *mut u8,
1988 _: usize,
1989 _: *mut u8,
1990 _: usize,
1991 _: *mut u8,
1992 ) {
1993 unreachable!()
1994 }
1995 wit_import(ptr0.cast_mut(), len0, ptr1.cast_mut(), len1, ptr2);
1996 let l3 = i32::from(*ptr2.add(0).cast::<u8>());
1997 match l3 {
1998 0 => None,
1999 1 => {
2000 let e = {
2001 let l4 = *ptr2.add(8).cast::<i64>();
2002 let l5 = *ptr2.add(16).cast::<i64>();
2003 let l6 = *ptr2.add(24).cast::<*mut u8>();
2004 let l7 = *ptr2.add(28).cast::<usize>();
2005 let len8 = l7;
2006 let bytes8 = _rt::Vec::from_raw_parts(
2007 l6.cast(),
2008 len8,
2009 len8,
2010 );
2011 WorkerId {
2012 component_id: ComponentId {
2013 uuid: Uuid {
2014 high_bits: l4 as u64,
2015 low_bits: l5 as u64,
2016 },
2017 },
2018 worker_name: _rt::string_lift(bytes8),
2019 }
2020 };
2021 Some(e)
2022 }
2023 _ => _rt::invalid_enum_discriminant(),
2024 }
2025 }
2026 }
2027 #[allow(unused_unsafe, clippy::all)]
2028 /// Construct an uri for a given worker id.
2029 pub fn worker_uri(worker_id: &WorkerId) -> Uri {
2030 unsafe {
2031 #[repr(align(4))]
2032 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
2033 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
2034 let WorkerId {
2035 component_id: component_id0,
2036 worker_name: worker_name0,
2037 } = worker_id;
2038 let ComponentId { uuid: uuid1 } = component_id0;
2039 let Uuid { high_bits: high_bits2, low_bits: low_bits2 } = uuid1;
2040 let vec3 = worker_name0;
2041 let ptr3 = vec3.as_ptr().cast::<u8>();
2042 let len3 = vec3.len();
2043 let ptr4 = ret_area.0.as_mut_ptr().cast::<u8>();
2044 #[cfg(target_arch = "wasm32")]
2045 #[link(wasm_import_module = "golem:api/host@1.1.5")]
2046 extern "C" {
2047 #[link_name = "worker-uri"]
2048 fn wit_import(_: i64, _: i64, _: *mut u8, _: usize, _: *mut u8);
2049 }
2050 #[cfg(not(target_arch = "wasm32"))]
2051 fn wit_import(_: i64, _: i64, _: *mut u8, _: usize, _: *mut u8) {
2052 unreachable!()
2053 }
2054 wit_import(
2055 _rt::as_i64(high_bits2),
2056 _rt::as_i64(low_bits2),
2057 ptr3.cast_mut(),
2058 len3,
2059 ptr4,
2060 );
2061 let l5 = *ptr4.add(0).cast::<*mut u8>();
2062 let l6 = *ptr4.add(4).cast::<usize>();
2063 let len7 = l6;
2064 let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7);
2065 super::super::super::golem::rpc::types::Uri {
2066 value: _rt::string_lift(bytes7),
2067 }
2068 }
2069 }
2070 }
2071 /// Invocation context support
2072 #[allow(dead_code, clippy::all)]
2073 pub mod context {
2074 #[used]
2075 #[doc(hidden)]
2076 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
2077 use super::super::super::_rt;
2078 pub type Datetime = super::super::super::wasi::clocks::wall_clock::Datetime;
2079 /// Represents a unit of work or operation
2080 #[derive(Debug)]
2081 #[repr(transparent)]
2082 pub struct Span {
2083 handle: _rt::Resource<Span>,
2084 }
2085 impl Span {
2086 #[doc(hidden)]
2087 pub unsafe fn from_handle(handle: u32) -> Self {
2088 Self {
2089 handle: _rt::Resource::from_handle(handle),
2090 }
2091 }
2092 #[doc(hidden)]
2093 pub fn take_handle(&self) -> u32 {
2094 _rt::Resource::take_handle(&self.handle)
2095 }
2096 #[doc(hidden)]
2097 pub fn handle(&self) -> u32 {
2098 _rt::Resource::handle(&self.handle)
2099 }
2100 }
2101 unsafe impl _rt::WasmResource for Span {
2102 #[inline]
2103 unsafe fn drop(_handle: u32) {
2104 #[cfg(not(target_arch = "wasm32"))]
2105 unreachable!();
2106 #[cfg(target_arch = "wasm32")]
2107 {
2108 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2109 extern "C" {
2110 #[link_name = "[resource-drop]span"]
2111 fn drop(_: u32);
2112 }
2113 drop(_handle);
2114 }
2115 }
2116 }
2117 /// Represents an invocation context wich allows querying the stack of attributes
2118 /// created by automatic and user-defined spans.
2119 #[derive(Debug)]
2120 #[repr(transparent)]
2121 pub struct InvocationContext {
2122 handle: _rt::Resource<InvocationContext>,
2123 }
2124 impl InvocationContext {
2125 #[doc(hidden)]
2126 pub unsafe fn from_handle(handle: u32) -> Self {
2127 Self {
2128 handle: _rt::Resource::from_handle(handle),
2129 }
2130 }
2131 #[doc(hidden)]
2132 pub fn take_handle(&self) -> u32 {
2133 _rt::Resource::take_handle(&self.handle)
2134 }
2135 #[doc(hidden)]
2136 pub fn handle(&self) -> u32 {
2137 _rt::Resource::handle(&self.handle)
2138 }
2139 }
2140 unsafe impl _rt::WasmResource for InvocationContext {
2141 #[inline]
2142 unsafe fn drop(_handle: u32) {
2143 #[cfg(not(target_arch = "wasm32"))]
2144 unreachable!();
2145 #[cfg(target_arch = "wasm32")]
2146 {
2147 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2148 extern "C" {
2149 #[link_name = "[resource-drop]invocation-context"]
2150 fn drop(_: u32);
2151 }
2152 drop(_handle);
2153 }
2154 }
2155 }
2156 /// Possible span attribute value types
2157 #[derive(Clone)]
2158 pub enum AttributeValue {
2159 /// A string value
2160 String(_rt::String),
2161 }
2162 impl ::core::fmt::Debug for AttributeValue {
2163 fn fmt(
2164 &self,
2165 f: &mut ::core::fmt::Formatter<'_>,
2166 ) -> ::core::fmt::Result {
2167 match self {
2168 AttributeValue::String(e) => {
2169 f.debug_tuple("AttributeValue::String").field(e).finish()
2170 }
2171 }
2172 }
2173 }
2174 /// An attribute of a span
2175 #[derive(Clone)]
2176 pub struct Attribute {
2177 pub key: _rt::String,
2178 pub value: AttributeValue,
2179 }
2180 impl ::core::fmt::Debug for Attribute {
2181 fn fmt(
2182 &self,
2183 f: &mut ::core::fmt::Formatter<'_>,
2184 ) -> ::core::fmt::Result {
2185 f.debug_struct("Attribute")
2186 .field("key", &self.key)
2187 .field("value", &self.value)
2188 .finish()
2189 }
2190 }
2191 /// A chain of attribute values, the first element representing the most recent value
2192 #[derive(Clone)]
2193 pub struct AttributeChain {
2194 pub key: _rt::String,
2195 pub values: _rt::Vec<AttributeValue>,
2196 }
2197 impl ::core::fmt::Debug for AttributeChain {
2198 fn fmt(
2199 &self,
2200 f: &mut ::core::fmt::Formatter<'_>,
2201 ) -> ::core::fmt::Result {
2202 f.debug_struct("AttributeChain")
2203 .field("key", &self.key)
2204 .field("values", &self.values)
2205 .finish()
2206 }
2207 }
2208 /// The trace represented by a 16 bytes hexadecimal string
2209 pub type TraceId = _rt::String;
2210 /// The span represented by a 8 bytes hexadecimal string
2211 pub type SpanId = _rt::String;
2212 #[allow(unused_unsafe, clippy::all)]
2213 /// Starts a new `span` with the given name, as a child of the current invocation context
2214 pub fn start_span(name: &str) -> Span {
2215 unsafe {
2216 let vec0 = name;
2217 let ptr0 = vec0.as_ptr().cast::<u8>();
2218 let len0 = vec0.len();
2219 #[cfg(target_arch = "wasm32")]
2220 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2221 extern "C" {
2222 #[link_name = "start-span"]
2223 fn wit_import(_: *mut u8, _: usize) -> i32;
2224 }
2225 #[cfg(not(target_arch = "wasm32"))]
2226 fn wit_import(_: *mut u8, _: usize) -> i32 {
2227 unreachable!()
2228 }
2229 let ret = wit_import(ptr0.cast_mut(), len0);
2230 Span::from_handle(ret as u32)
2231 }
2232 }
2233 #[allow(unused_unsafe, clippy::all)]
2234 /// Gets the current invocation context
2235 ///
2236 /// The function call captures the current context; if new spans are started, the returned `invocation-context` instance will not
2237 /// reflect that.
2238 pub fn current_context() -> InvocationContext {
2239 unsafe {
2240 #[cfg(target_arch = "wasm32")]
2241 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2242 extern "C" {
2243 #[link_name = "current-context"]
2244 fn wit_import() -> i32;
2245 }
2246 #[cfg(not(target_arch = "wasm32"))]
2247 fn wit_import() -> i32 {
2248 unreachable!()
2249 }
2250 let ret = wit_import();
2251 InvocationContext::from_handle(ret as u32)
2252 }
2253 }
2254 #[allow(unused_unsafe, clippy::all)]
2255 /// Allows or disallows forwarding of trace context headers in outgoing HTTP requests
2256 ///
2257 /// Returns the previous value of the setting
2258 pub fn allow_forwarding_trace_context_headers(allow: bool) -> bool {
2259 unsafe {
2260 #[cfg(target_arch = "wasm32")]
2261 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2262 extern "C" {
2263 #[link_name = "allow-forwarding-trace-context-headers"]
2264 fn wit_import(_: i32) -> i32;
2265 }
2266 #[cfg(not(target_arch = "wasm32"))]
2267 fn wit_import(_: i32) -> i32 {
2268 unreachable!()
2269 }
2270 let ret = wit_import(
2271 match &allow {
2272 true => 1,
2273 false => 0,
2274 },
2275 );
2276 _rt::bool_lift(ret as u8)
2277 }
2278 }
2279 impl Span {
2280 #[allow(unused_unsafe, clippy::all)]
2281 /// Gets the starting time of the span
2282 pub fn started_at(&self) -> Datetime {
2283 unsafe {
2284 #[repr(align(8))]
2285 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
2286 let mut ret_area = RetArea(
2287 [::core::mem::MaybeUninit::uninit(); 16],
2288 );
2289 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2290 #[cfg(target_arch = "wasm32")]
2291 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2292 extern "C" {
2293 #[link_name = "[method]span.started-at"]
2294 fn wit_import(_: i32, _: *mut u8);
2295 }
2296 #[cfg(not(target_arch = "wasm32"))]
2297 fn wit_import(_: i32, _: *mut u8) {
2298 unreachable!()
2299 }
2300 wit_import((self).handle() as i32, ptr0);
2301 let l1 = *ptr0.add(0).cast::<i64>();
2302 let l2 = *ptr0.add(8).cast::<i32>();
2303 super::super::super::wasi::clocks::wall_clock::Datetime {
2304 seconds: l1 as u64,
2305 nanoseconds: l2 as u32,
2306 }
2307 }
2308 }
2309 }
2310 impl Span {
2311 #[allow(unused_unsafe, clippy::all)]
2312 /// Set an attribute on the span
2313 pub fn set_attribute(&self, name: &str, value: &AttributeValue) {
2314 unsafe {
2315 let vec0 = name;
2316 let ptr0 = vec0.as_ptr().cast::<u8>();
2317 let len0 = vec0.len();
2318 let (result2_0, result2_1, result2_2) = match value {
2319 AttributeValue::String(e) => {
2320 let vec1 = e;
2321 let ptr1 = vec1.as_ptr().cast::<u8>();
2322 let len1 = vec1.len();
2323 (0i32, ptr1.cast_mut(), len1)
2324 }
2325 };
2326 #[cfg(target_arch = "wasm32")]
2327 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2328 extern "C" {
2329 #[link_name = "[method]span.set-attribute"]
2330 fn wit_import(
2331 _: i32,
2332 _: *mut u8,
2333 _: usize,
2334 _: i32,
2335 _: *mut u8,
2336 _: usize,
2337 );
2338 }
2339 #[cfg(not(target_arch = "wasm32"))]
2340 fn wit_import(
2341 _: i32,
2342 _: *mut u8,
2343 _: usize,
2344 _: i32,
2345 _: *mut u8,
2346 _: usize,
2347 ) {
2348 unreachable!()
2349 }
2350 wit_import(
2351 (self).handle() as i32,
2352 ptr0.cast_mut(),
2353 len0,
2354 result2_0,
2355 result2_1,
2356 result2_2,
2357 );
2358 }
2359 }
2360 }
2361 impl Span {
2362 #[allow(unused_unsafe, clippy::all)]
2363 /// Set multiple attributes on the span
2364 pub fn set_attributes(&self, attributes: &[Attribute]) {
2365 unsafe {
2366 let vec3 = attributes;
2367 let len3 = vec3.len();
2368 let layout3 = _rt::alloc::Layout::from_size_align_unchecked(
2369 vec3.len() * 20,
2370 4,
2371 );
2372 let result3 = if layout3.size() != 0 {
2373 let ptr = _rt::alloc::alloc(layout3).cast::<u8>();
2374 if ptr.is_null() {
2375 _rt::alloc::handle_alloc_error(layout3);
2376 }
2377 ptr
2378 } else {
2379 ::core::ptr::null_mut()
2380 };
2381 for (i, e) in vec3.into_iter().enumerate() {
2382 let base = result3.add(i * 20);
2383 {
2384 let Attribute { key: key0, value: value0 } = e;
2385 let vec1 = key0;
2386 let ptr1 = vec1.as_ptr().cast::<u8>();
2387 let len1 = vec1.len();
2388 *base.add(4).cast::<usize>() = len1;
2389 *base.add(0).cast::<*mut u8>() = ptr1.cast_mut();
2390 match value0 {
2391 AttributeValue::String(e) => {
2392 *base.add(8).cast::<u8>() = (0i32) as u8;
2393 let vec2 = e;
2394 let ptr2 = vec2.as_ptr().cast::<u8>();
2395 let len2 = vec2.len();
2396 *base.add(16).cast::<usize>() = len2;
2397 *base.add(12).cast::<*mut u8>() = ptr2.cast_mut();
2398 }
2399 }
2400 }
2401 }
2402 #[cfg(target_arch = "wasm32")]
2403 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2404 extern "C" {
2405 #[link_name = "[method]span.set-attributes"]
2406 fn wit_import(_: i32, _: *mut u8, _: usize);
2407 }
2408 #[cfg(not(target_arch = "wasm32"))]
2409 fn wit_import(_: i32, _: *mut u8, _: usize) {
2410 unreachable!()
2411 }
2412 wit_import((self).handle() as i32, result3, len3);
2413 if layout3.size() != 0 {
2414 _rt::alloc::dealloc(result3.cast(), layout3);
2415 }
2416 }
2417 }
2418 }
2419 impl Span {
2420 #[allow(unused_unsafe, clippy::all)]
2421 /// Early finishes the span; otherwise it will be finished when the resource is dropped
2422 pub fn finish(&self) {
2423 unsafe {
2424 #[cfg(target_arch = "wasm32")]
2425 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2426 extern "C" {
2427 #[link_name = "[method]span.finish"]
2428 fn wit_import(_: i32);
2429 }
2430 #[cfg(not(target_arch = "wasm32"))]
2431 fn wit_import(_: i32) {
2432 unreachable!()
2433 }
2434 wit_import((self).handle() as i32);
2435 }
2436 }
2437 }
2438 impl InvocationContext {
2439 #[allow(unused_unsafe, clippy::all)]
2440 /// Gets the current trace id
2441 pub fn trace_id(&self) -> TraceId {
2442 unsafe {
2443 #[repr(align(4))]
2444 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
2445 let mut ret_area = RetArea(
2446 [::core::mem::MaybeUninit::uninit(); 8],
2447 );
2448 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2449 #[cfg(target_arch = "wasm32")]
2450 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2451 extern "C" {
2452 #[link_name = "[method]invocation-context.trace-id"]
2453 fn wit_import(_: i32, _: *mut u8);
2454 }
2455 #[cfg(not(target_arch = "wasm32"))]
2456 fn wit_import(_: i32, _: *mut u8) {
2457 unreachable!()
2458 }
2459 wit_import((self).handle() as i32, ptr0);
2460 let l1 = *ptr0.add(0).cast::<*mut u8>();
2461 let l2 = *ptr0.add(4).cast::<usize>();
2462 let len3 = l2;
2463 let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3);
2464 _rt::string_lift(bytes3)
2465 }
2466 }
2467 }
2468 impl InvocationContext {
2469 #[allow(unused_unsafe, clippy::all)]
2470 /// Gets the current span id
2471 pub fn span_id(&self) -> SpanId {
2472 unsafe {
2473 #[repr(align(4))]
2474 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
2475 let mut ret_area = RetArea(
2476 [::core::mem::MaybeUninit::uninit(); 8],
2477 );
2478 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2479 #[cfg(target_arch = "wasm32")]
2480 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2481 extern "C" {
2482 #[link_name = "[method]invocation-context.span-id"]
2483 fn wit_import(_: i32, _: *mut u8);
2484 }
2485 #[cfg(not(target_arch = "wasm32"))]
2486 fn wit_import(_: i32, _: *mut u8) {
2487 unreachable!()
2488 }
2489 wit_import((self).handle() as i32, ptr0);
2490 let l1 = *ptr0.add(0).cast::<*mut u8>();
2491 let l2 = *ptr0.add(4).cast::<usize>();
2492 let len3 = l2;
2493 let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3);
2494 _rt::string_lift(bytes3)
2495 }
2496 }
2497 }
2498 impl InvocationContext {
2499 #[allow(unused_unsafe, clippy::all)]
2500 /// Gets the parent context, if any; allows recursive processing of the invocation context.
2501 ///
2502 /// Alternatively, the attribute query methods can return inherited values without having to
2503 /// traverse the stack manually.
2504 pub fn parent(&self) -> Option<InvocationContext> {
2505 unsafe {
2506 #[repr(align(4))]
2507 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
2508 let mut ret_area = RetArea(
2509 [::core::mem::MaybeUninit::uninit(); 8],
2510 );
2511 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2512 #[cfg(target_arch = "wasm32")]
2513 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2514 extern "C" {
2515 #[link_name = "[method]invocation-context.parent"]
2516 fn wit_import(_: i32, _: *mut u8);
2517 }
2518 #[cfg(not(target_arch = "wasm32"))]
2519 fn wit_import(_: i32, _: *mut u8) {
2520 unreachable!()
2521 }
2522 wit_import((self).handle() as i32, ptr0);
2523 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
2524 match l1 {
2525 0 => None,
2526 1 => {
2527 let e = {
2528 let l2 = *ptr0.add(4).cast::<i32>();
2529 InvocationContext::from_handle(l2 as u32)
2530 };
2531 Some(e)
2532 }
2533 _ => _rt::invalid_enum_discriminant(),
2534 }
2535 }
2536 }
2537 }
2538 impl InvocationContext {
2539 #[allow(unused_unsafe, clippy::all)]
2540 /// Gets the value of an attribute `key`. If `inherited` is true, the value is searched in the stack of spans,
2541 /// otherwise only in the current span.
2542 pub fn get_attribute(
2543 &self,
2544 key: &str,
2545 inherited: bool,
2546 ) -> Option<AttributeValue> {
2547 unsafe {
2548 #[repr(align(4))]
2549 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
2550 let mut ret_area = RetArea(
2551 [::core::mem::MaybeUninit::uninit(); 16],
2552 );
2553 let vec0 = key;
2554 let ptr0 = vec0.as_ptr().cast::<u8>();
2555 let len0 = vec0.len();
2556 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
2557 #[cfg(target_arch = "wasm32")]
2558 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2559 extern "C" {
2560 #[link_name = "[method]invocation-context.get-attribute"]
2561 fn wit_import(
2562 _: i32,
2563 _: *mut u8,
2564 _: usize,
2565 _: i32,
2566 _: *mut u8,
2567 );
2568 }
2569 #[cfg(not(target_arch = "wasm32"))]
2570 fn wit_import(_: i32, _: *mut u8, _: usize, _: i32, _: *mut u8) {
2571 unreachable!()
2572 }
2573 wit_import(
2574 (self).handle() as i32,
2575 ptr0.cast_mut(),
2576 len0,
2577 match &inherited {
2578 true => 1,
2579 false => 0,
2580 },
2581 ptr1,
2582 );
2583 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
2584 match l2 {
2585 0 => None,
2586 1 => {
2587 let e = {
2588 let l3 = i32::from(*ptr1.add(4).cast::<u8>());
2589 let v7 = match l3 {
2590 n => {
2591 debug_assert_eq!(n, 0, "invalid enum discriminant");
2592 let e7 = {
2593 let l4 = *ptr1.add(8).cast::<*mut u8>();
2594 let l5 = *ptr1.add(12).cast::<usize>();
2595 let len6 = l5;
2596 let bytes6 = _rt::Vec::from_raw_parts(
2597 l4.cast(),
2598 len6,
2599 len6,
2600 );
2601 _rt::string_lift(bytes6)
2602 };
2603 AttributeValue::String(e7)
2604 }
2605 };
2606 v7
2607 };
2608 Some(e)
2609 }
2610 _ => _rt::invalid_enum_discriminant(),
2611 }
2612 }
2613 }
2614 }
2615 impl InvocationContext {
2616 #[allow(unused_unsafe, clippy::all)]
2617 /// Gets all attributes of the current invocation context. If `inherited` is true, it returns the merged set of attributes, each
2618 /// key associated with the latest value found in the stack of spans.
2619 pub fn get_attributes(&self, inherited: bool) -> _rt::Vec<Attribute> {
2620 unsafe {
2621 #[repr(align(4))]
2622 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
2623 let mut ret_area = RetArea(
2624 [::core::mem::MaybeUninit::uninit(); 8],
2625 );
2626 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2627 #[cfg(target_arch = "wasm32")]
2628 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2629 extern "C" {
2630 #[link_name = "[method]invocation-context.get-attributes"]
2631 fn wit_import(_: i32, _: i32, _: *mut u8);
2632 }
2633 #[cfg(not(target_arch = "wasm32"))]
2634 fn wit_import(_: i32, _: i32, _: *mut u8) {
2635 unreachable!()
2636 }
2637 wit_import(
2638 (self).handle() as i32,
2639 match &inherited {
2640 true => 1,
2641 false => 0,
2642 },
2643 ptr0,
2644 );
2645 let l1 = *ptr0.add(0).cast::<*mut u8>();
2646 let l2 = *ptr0.add(4).cast::<usize>();
2647 let base11 = l1;
2648 let len11 = l2;
2649 let mut result11 = _rt::Vec::with_capacity(len11);
2650 for i in 0..len11 {
2651 let base = base11.add(i * 20);
2652 let e11 = {
2653 let l3 = *base.add(0).cast::<*mut u8>();
2654 let l4 = *base.add(4).cast::<usize>();
2655 let len5 = l4;
2656 let bytes5 = _rt::Vec::from_raw_parts(
2657 l3.cast(),
2658 len5,
2659 len5,
2660 );
2661 let l6 = i32::from(*base.add(8).cast::<u8>());
2662 let v10 = match l6 {
2663 n => {
2664 debug_assert_eq!(n, 0, "invalid enum discriminant");
2665 let e10 = {
2666 let l7 = *base.add(12).cast::<*mut u8>();
2667 let l8 = *base.add(16).cast::<usize>();
2668 let len9 = l8;
2669 let bytes9 = _rt::Vec::from_raw_parts(
2670 l7.cast(),
2671 len9,
2672 len9,
2673 );
2674 _rt::string_lift(bytes9)
2675 };
2676 AttributeValue::String(e10)
2677 }
2678 };
2679 Attribute {
2680 key: _rt::string_lift(bytes5),
2681 value: v10,
2682 }
2683 };
2684 result11.push(e11);
2685 }
2686 _rt::cabi_dealloc(base11, len11 * 20, 4);
2687 result11
2688 }
2689 }
2690 }
2691 impl InvocationContext {
2692 #[allow(unused_unsafe, clippy::all)]
2693 /// Gets the chain of attribute values associated with the given `key`. If the key does not exist in any of the
2694 /// spans in the invocation context, the list is empty. The chain's first element contains the most recent (innermost) value.
2695 pub fn get_attribute_chain(
2696 &self,
2697 key: &str,
2698 ) -> _rt::Vec<AttributeValue> {
2699 unsafe {
2700 #[repr(align(4))]
2701 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
2702 let mut ret_area = RetArea(
2703 [::core::mem::MaybeUninit::uninit(); 8],
2704 );
2705 let vec0 = key;
2706 let ptr0 = vec0.as_ptr().cast::<u8>();
2707 let len0 = vec0.len();
2708 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
2709 #[cfg(target_arch = "wasm32")]
2710 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2711 extern "C" {
2712 #[link_name = "[method]invocation-context.get-attribute-chain"]
2713 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
2714 }
2715 #[cfg(not(target_arch = "wasm32"))]
2716 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
2717 unreachable!()
2718 }
2719 wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
2720 let l2 = *ptr1.add(0).cast::<*mut u8>();
2721 let l3 = *ptr1.add(4).cast::<usize>();
2722 let base9 = l2;
2723 let len9 = l3;
2724 let mut result9 = _rt::Vec::with_capacity(len9);
2725 for i in 0..len9 {
2726 let base = base9.add(i * 12);
2727 let e9 = {
2728 let l4 = i32::from(*base.add(0).cast::<u8>());
2729 let v8 = match l4 {
2730 n => {
2731 debug_assert_eq!(n, 0, "invalid enum discriminant");
2732 let e8 = {
2733 let l5 = *base.add(4).cast::<*mut u8>();
2734 let l6 = *base.add(8).cast::<usize>();
2735 let len7 = l6;
2736 let bytes7 = _rt::Vec::from_raw_parts(
2737 l5.cast(),
2738 len7,
2739 len7,
2740 );
2741 _rt::string_lift(bytes7)
2742 };
2743 AttributeValue::String(e8)
2744 }
2745 };
2746 v8
2747 };
2748 result9.push(e9);
2749 }
2750 _rt::cabi_dealloc(base9, len9 * 12, 4);
2751 result9
2752 }
2753 }
2754 }
2755 impl InvocationContext {
2756 #[allow(unused_unsafe, clippy::all)]
2757 /// Gets all values of all attributes of the current invocation context.
2758 pub fn get_attribute_chains(&self) -> _rt::Vec<AttributeChain> {
2759 unsafe {
2760 #[repr(align(4))]
2761 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
2762 let mut ret_area = RetArea(
2763 [::core::mem::MaybeUninit::uninit(); 8],
2764 );
2765 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2766 #[cfg(target_arch = "wasm32")]
2767 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2768 extern "C" {
2769 #[link_name = "[method]invocation-context.get-attribute-chains"]
2770 fn wit_import(_: i32, _: *mut u8);
2771 }
2772 #[cfg(not(target_arch = "wasm32"))]
2773 fn wit_import(_: i32, _: *mut u8) {
2774 unreachable!()
2775 }
2776 wit_import((self).handle() as i32, ptr0);
2777 let l1 = *ptr0.add(0).cast::<*mut u8>();
2778 let l2 = *ptr0.add(4).cast::<usize>();
2779 let base14 = l1;
2780 let len14 = l2;
2781 let mut result14 = _rt::Vec::with_capacity(len14);
2782 for i in 0..len14 {
2783 let base = base14.add(i * 16);
2784 let e14 = {
2785 let l3 = *base.add(0).cast::<*mut u8>();
2786 let l4 = *base.add(4).cast::<usize>();
2787 let len5 = l4;
2788 let bytes5 = _rt::Vec::from_raw_parts(
2789 l3.cast(),
2790 len5,
2791 len5,
2792 );
2793 let l6 = *base.add(8).cast::<*mut u8>();
2794 let l7 = *base.add(12).cast::<usize>();
2795 let base13 = l6;
2796 let len13 = l7;
2797 let mut result13 = _rt::Vec::with_capacity(len13);
2798 for i in 0..len13 {
2799 let base = base13.add(i * 12);
2800 let e13 = {
2801 let l8 = i32::from(*base.add(0).cast::<u8>());
2802 let v12 = match l8 {
2803 n => {
2804 debug_assert_eq!(n, 0, "invalid enum discriminant");
2805 let e12 = {
2806 let l9 = *base.add(4).cast::<*mut u8>();
2807 let l10 = *base.add(8).cast::<usize>();
2808 let len11 = l10;
2809 let bytes11 = _rt::Vec::from_raw_parts(
2810 l9.cast(),
2811 len11,
2812 len11,
2813 );
2814 _rt::string_lift(bytes11)
2815 };
2816 AttributeValue::String(e12)
2817 }
2818 };
2819 v12
2820 };
2821 result13.push(e13);
2822 }
2823 _rt::cabi_dealloc(base13, len13 * 12, 4);
2824 AttributeChain {
2825 key: _rt::string_lift(bytes5),
2826 values: result13,
2827 }
2828 };
2829 result14.push(e14);
2830 }
2831 _rt::cabi_dealloc(base14, len14 * 16, 4);
2832 result14
2833 }
2834 }
2835 }
2836 impl InvocationContext {
2837 #[allow(unused_unsafe, clippy::all)]
2838 /// Gets the W3C Trace Context headers associated with the current invocation context
2839 pub fn trace_context_headers(
2840 &self,
2841 ) -> _rt::Vec<(_rt::String, _rt::String)> {
2842 unsafe {
2843 #[repr(align(4))]
2844 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
2845 let mut ret_area = RetArea(
2846 [::core::mem::MaybeUninit::uninit(); 8],
2847 );
2848 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2849 #[cfg(target_arch = "wasm32")]
2850 #[link(wasm_import_module = "golem:api/context@1.1.5")]
2851 extern "C" {
2852 #[link_name = "[method]invocation-context.trace-context-headers"]
2853 fn wit_import(_: i32, _: *mut u8);
2854 }
2855 #[cfg(not(target_arch = "wasm32"))]
2856 fn wit_import(_: i32, _: *mut u8) {
2857 unreachable!()
2858 }
2859 wit_import((self).handle() as i32, ptr0);
2860 let l1 = *ptr0.add(0).cast::<*mut u8>();
2861 let l2 = *ptr0.add(4).cast::<usize>();
2862 let base9 = l1;
2863 let len9 = l2;
2864 let mut result9 = _rt::Vec::with_capacity(len9);
2865 for i in 0..len9 {
2866 let base = base9.add(i * 16);
2867 let e9 = {
2868 let l3 = *base.add(0).cast::<*mut u8>();
2869 let l4 = *base.add(4).cast::<usize>();
2870 let len5 = l4;
2871 let bytes5 = _rt::Vec::from_raw_parts(
2872 l3.cast(),
2873 len5,
2874 len5,
2875 );
2876 let l6 = *base.add(8).cast::<*mut u8>();
2877 let l7 = *base.add(12).cast::<usize>();
2878 let len8 = l7;
2879 let bytes8 = _rt::Vec::from_raw_parts(
2880 l6.cast(),
2881 len8,
2882 len8,
2883 );
2884 (_rt::string_lift(bytes5), _rt::string_lift(bytes8))
2885 };
2886 result9.push(e9);
2887 }
2888 _rt::cabi_dealloc(base9, len9 * 16, 4);
2889 result9
2890 }
2891 }
2892 }
2893 }
2894 /// Host interface for enumerating and searching for worker oplogs
2895 #[allow(dead_code, clippy::all)]
2896 pub mod oplog {
2897 #[used]
2898 #[doc(hidden)]
2899 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
2900 use super::super::super::_rt;
2901 pub type Datetime = super::super::super::wasi::clocks::wall_clock::Datetime;
2902 pub type WitValue = super::super::super::golem::rpc::types::WitValue;
2903 pub type AccountId = super::super::super::golem::api::host::AccountId;
2904 pub type ComponentVersion = super::super::super::golem::api::host::ComponentVersion;
2905 pub type OplogIndex = super::super::super::golem::api::host::OplogIndex;
2906 pub type RetryPolicy = super::super::super::golem::api::host::RetryPolicy;
2907 pub type Uuid = super::super::super::golem::api::host::Uuid;
2908 pub type WorkerId = super::super::super::golem::api::host::WorkerId;
2909 pub type Attribute = super::super::super::golem::api::context::Attribute;
2910 pub type AttributeValue = super::super::super::golem::api::context::AttributeValue;
2911 pub type SpanId = super::super::super::golem::api::context::SpanId;
2912 pub type TraceId = super::super::super::golem::api::context::TraceId;
2913 #[derive(Clone, Copy)]
2914 pub enum WrappedFunctionType {
2915 /// The side-effect reads from the worker's local state (for example local file system,
2916 /// random generator, etc.)
2917 ReadLocal,
2918 /// The side-effect writes to the worker's local state (for example local file system)
2919 WriteLocal,
2920 /// The side-effect reads from external state (for example a key-value store)
2921 ReadRemote,
2922 /// The side-effect manipulates external state (for example an RPC call)
2923 WriteRemote,
2924 /// The side-effect manipulates external state through multiple invoked functions (for example
2925 /// a HTTP request where reading the response involves multiple host function calls)
2926 ///
2927 /// On the first invocation of the batch, the parameter should be `None` - this triggers
2928 /// writing a `BeginRemoteWrite` entry in the oplog. Followup invocations should contain
2929 /// this entry's index as the parameter. In batched remote writes it is the caller's responsibility
2930 /// to manually write an `EndRemoteWrite` entry (using `end_function`) when the operation is completed.
2931 WriteRemoteBatched(Option<OplogIndex>),
2932 }
2933 impl ::core::fmt::Debug for WrappedFunctionType {
2934 fn fmt(
2935 &self,
2936 f: &mut ::core::fmt::Formatter<'_>,
2937 ) -> ::core::fmt::Result {
2938 match self {
2939 WrappedFunctionType::ReadLocal => {
2940 f.debug_tuple("WrappedFunctionType::ReadLocal").finish()
2941 }
2942 WrappedFunctionType::WriteLocal => {
2943 f.debug_tuple("WrappedFunctionType::WriteLocal").finish()
2944 }
2945 WrappedFunctionType::ReadRemote => {
2946 f.debug_tuple("WrappedFunctionType::ReadRemote").finish()
2947 }
2948 WrappedFunctionType::WriteRemote => {
2949 f.debug_tuple("WrappedFunctionType::WriteRemote").finish()
2950 }
2951 WrappedFunctionType::WriteRemoteBatched(e) => {
2952 f.debug_tuple("WrappedFunctionType::WriteRemoteBatched")
2953 .field(e)
2954 .finish()
2955 }
2956 }
2957 }
2958 }
2959 #[derive(Clone)]
2960 pub struct PluginInstallationDescription {
2961 pub installation_id: Uuid,
2962 pub name: _rt::String,
2963 pub version: _rt::String,
2964 pub parameters: _rt::Vec<(_rt::String, _rt::String)>,
2965 }
2966 impl ::core::fmt::Debug for PluginInstallationDescription {
2967 fn fmt(
2968 &self,
2969 f: &mut ::core::fmt::Formatter<'_>,
2970 ) -> ::core::fmt::Result {
2971 f.debug_struct("PluginInstallationDescription")
2972 .field("installation-id", &self.installation_id)
2973 .field("name", &self.name)
2974 .field("version", &self.version)
2975 .field("parameters", &self.parameters)
2976 .finish()
2977 }
2978 }
2979 #[derive(Clone)]
2980 pub struct CreateParameters {
2981 pub timestamp: Datetime,
2982 pub worker_id: WorkerId,
2983 pub component_version: ComponentVersion,
2984 pub args: _rt::Vec<_rt::String>,
2985 pub env: _rt::Vec<(_rt::String, _rt::String)>,
2986 pub account_id: AccountId,
2987 pub parent: Option<WorkerId>,
2988 pub component_size: u64,
2989 pub initial_total_linear_memory_size: u64,
2990 pub initial_active_plugins: _rt::Vec<PluginInstallationDescription>,
2991 }
2992 impl ::core::fmt::Debug for CreateParameters {
2993 fn fmt(
2994 &self,
2995 f: &mut ::core::fmt::Formatter<'_>,
2996 ) -> ::core::fmt::Result {
2997 f.debug_struct("CreateParameters")
2998 .field("timestamp", &self.timestamp)
2999 .field("worker-id", &self.worker_id)
3000 .field("component-version", &self.component_version)
3001 .field("args", &self.args)
3002 .field("env", &self.env)
3003 .field("account-id", &self.account_id)
3004 .field("parent", &self.parent)
3005 .field("component-size", &self.component_size)
3006 .field(
3007 "initial-total-linear-memory-size",
3008 &self.initial_total_linear_memory_size,
3009 )
3010 .field("initial-active-plugins", &self.initial_active_plugins)
3011 .finish()
3012 }
3013 }
3014 #[derive(Clone)]
3015 pub struct ImportedFunctionInvokedParameters {
3016 pub timestamp: Datetime,
3017 pub function_name: _rt::String,
3018 pub request: WitValue,
3019 pub response: WitValue,
3020 pub wrapped_function_type: WrappedFunctionType,
3021 }
3022 impl ::core::fmt::Debug for ImportedFunctionInvokedParameters {
3023 fn fmt(
3024 &self,
3025 f: &mut ::core::fmt::Formatter<'_>,
3026 ) -> ::core::fmt::Result {
3027 f.debug_struct("ImportedFunctionInvokedParameters")
3028 .field("timestamp", &self.timestamp)
3029 .field("function-name", &self.function_name)
3030 .field("request", &self.request)
3031 .field("response", &self.response)
3032 .field("wrapped-function-type", &self.wrapped_function_type)
3033 .finish()
3034 }
3035 }
3036 #[derive(Clone)]
3037 pub struct LocalSpanData {
3038 pub span_id: SpanId,
3039 pub start: Datetime,
3040 pub parent: Option<SpanId>,
3041 /// Optionally an index of the exported-function-invoked-parameters's invocation-context field
3042 pub linked_context: Option<u64>,
3043 pub attributes: _rt::Vec<Attribute>,
3044 pub inherited: bool,
3045 }
3046 impl ::core::fmt::Debug for LocalSpanData {
3047 fn fmt(
3048 &self,
3049 f: &mut ::core::fmt::Formatter<'_>,
3050 ) -> ::core::fmt::Result {
3051 f.debug_struct("LocalSpanData")
3052 .field("span-id", &self.span_id)
3053 .field("start", &self.start)
3054 .field("parent", &self.parent)
3055 .field("linked-context", &self.linked_context)
3056 .field("attributes", &self.attributes)
3057 .field("inherited", &self.inherited)
3058 .finish()
3059 }
3060 }
3061 #[derive(Clone)]
3062 pub struct ExternalSpanData {
3063 pub span_id: SpanId,
3064 }
3065 impl ::core::fmt::Debug for ExternalSpanData {
3066 fn fmt(
3067 &self,
3068 f: &mut ::core::fmt::Formatter<'_>,
3069 ) -> ::core::fmt::Result {
3070 f.debug_struct("ExternalSpanData")
3071 .field("span-id", &self.span_id)
3072 .finish()
3073 }
3074 }
3075 #[derive(Clone)]
3076 pub enum SpanData {
3077 LocalSpan(LocalSpanData),
3078 ExternalSpan(ExternalSpanData),
3079 }
3080 impl ::core::fmt::Debug for SpanData {
3081 fn fmt(
3082 &self,
3083 f: &mut ::core::fmt::Formatter<'_>,
3084 ) -> ::core::fmt::Result {
3085 match self {
3086 SpanData::LocalSpan(e) => {
3087 f.debug_tuple("SpanData::LocalSpan").field(e).finish()
3088 }
3089 SpanData::ExternalSpan(e) => {
3090 f.debug_tuple("SpanData::ExternalSpan").field(e).finish()
3091 }
3092 }
3093 }
3094 }
3095 #[derive(Clone)]
3096 pub struct ExportedFunctionInvokedParameters {
3097 pub timestamp: Datetime,
3098 pub function_name: _rt::String,
3099 pub request: _rt::Vec<WitValue>,
3100 pub idempotency_key: _rt::String,
3101 pub trace_id: TraceId,
3102 pub trace_states: _rt::Vec<_rt::String>,
3103 /// The first one is the invocation context stack associated with the exported function invocation,
3104 /// and further stacks can be added that are referenced by the `linked-context` field of `local-span-data`
3105 pub invocation_context: _rt::Vec<_rt::Vec<SpanData>>,
3106 }
3107 impl ::core::fmt::Debug for ExportedFunctionInvokedParameters {
3108 fn fmt(
3109 &self,
3110 f: &mut ::core::fmt::Formatter<'_>,
3111 ) -> ::core::fmt::Result {
3112 f.debug_struct("ExportedFunctionInvokedParameters")
3113 .field("timestamp", &self.timestamp)
3114 .field("function-name", &self.function_name)
3115 .field("request", &self.request)
3116 .field("idempotency-key", &self.idempotency_key)
3117 .field("trace-id", &self.trace_id)
3118 .field("trace-states", &self.trace_states)
3119 .field("invocation-context", &self.invocation_context)
3120 .finish()
3121 }
3122 }
3123 #[derive(Clone)]
3124 pub struct ExportedFunctionCompletedParameters {
3125 pub timestamp: Datetime,
3126 pub response: WitValue,
3127 pub consumed_fuel: i64,
3128 }
3129 impl ::core::fmt::Debug for ExportedFunctionCompletedParameters {
3130 fn fmt(
3131 &self,
3132 f: &mut ::core::fmt::Formatter<'_>,
3133 ) -> ::core::fmt::Result {
3134 f.debug_struct("ExportedFunctionCompletedParameters")
3135 .field("timestamp", &self.timestamp)
3136 .field("response", &self.response)
3137 .field("consumed-fuel", &self.consumed_fuel)
3138 .finish()
3139 }
3140 }
3141 #[derive(Clone)]
3142 pub struct ErrorParameters {
3143 pub timestamp: Datetime,
3144 pub error: _rt::String,
3145 }
3146 impl ::core::fmt::Debug for ErrorParameters {
3147 fn fmt(
3148 &self,
3149 f: &mut ::core::fmt::Formatter<'_>,
3150 ) -> ::core::fmt::Result {
3151 f.debug_struct("ErrorParameters")
3152 .field("timestamp", &self.timestamp)
3153 .field("error", &self.error)
3154 .finish()
3155 }
3156 }
3157 #[repr(C)]
3158 #[derive(Clone, Copy)]
3159 pub struct JumpParameters {
3160 pub timestamp: Datetime,
3161 pub start: OplogIndex,
3162 pub end: OplogIndex,
3163 }
3164 impl ::core::fmt::Debug for JumpParameters {
3165 fn fmt(
3166 &self,
3167 f: &mut ::core::fmt::Formatter<'_>,
3168 ) -> ::core::fmt::Result {
3169 f.debug_struct("JumpParameters")
3170 .field("timestamp", &self.timestamp)
3171 .field("start", &self.start)
3172 .field("end", &self.end)
3173 .finish()
3174 }
3175 }
3176 #[repr(C)]
3177 #[derive(Clone, Copy)]
3178 pub struct ChangeRetryPolicyParameters {
3179 pub timestamp: Datetime,
3180 pub retry_policy: RetryPolicy,
3181 }
3182 impl ::core::fmt::Debug for ChangeRetryPolicyParameters {
3183 fn fmt(
3184 &self,
3185 f: &mut ::core::fmt::Formatter<'_>,
3186 ) -> ::core::fmt::Result {
3187 f.debug_struct("ChangeRetryPolicyParameters")
3188 .field("timestamp", &self.timestamp)
3189 .field("retry-policy", &self.retry_policy)
3190 .finish()
3191 }
3192 }
3193 #[repr(C)]
3194 #[derive(Clone, Copy)]
3195 pub struct EndAtomicRegionParameters {
3196 pub timestamp: Datetime,
3197 pub begin_index: OplogIndex,
3198 }
3199 impl ::core::fmt::Debug for EndAtomicRegionParameters {
3200 fn fmt(
3201 &self,
3202 f: &mut ::core::fmt::Formatter<'_>,
3203 ) -> ::core::fmt::Result {
3204 f.debug_struct("EndAtomicRegionParameters")
3205 .field("timestamp", &self.timestamp)
3206 .field("begin-index", &self.begin_index)
3207 .finish()
3208 }
3209 }
3210 #[repr(C)]
3211 #[derive(Clone, Copy)]
3212 pub struct EndRemoteWriteParameters {
3213 pub timestamp: Datetime,
3214 pub begin_index: OplogIndex,
3215 }
3216 impl ::core::fmt::Debug for EndRemoteWriteParameters {
3217 fn fmt(
3218 &self,
3219 f: &mut ::core::fmt::Formatter<'_>,
3220 ) -> ::core::fmt::Result {
3221 f.debug_struct("EndRemoteWriteParameters")
3222 .field("timestamp", &self.timestamp)
3223 .field("begin-index", &self.begin_index)
3224 .finish()
3225 }
3226 }
3227 #[derive(Clone)]
3228 pub struct ExportedFunctionInvocationParameters {
3229 pub idempotency_key: _rt::String,
3230 pub function_name: _rt::String,
3231 pub input: Option<_rt::Vec<WitValue>>,
3232 }
3233 impl ::core::fmt::Debug for ExportedFunctionInvocationParameters {
3234 fn fmt(
3235 &self,
3236 f: &mut ::core::fmt::Formatter<'_>,
3237 ) -> ::core::fmt::Result {
3238 f.debug_struct("ExportedFunctionInvocationParameters")
3239 .field("idempotency-key", &self.idempotency_key)
3240 .field("function-name", &self.function_name)
3241 .field("input", &self.input)
3242 .finish()
3243 }
3244 }
3245 #[derive(Clone)]
3246 pub enum WorkerInvocation {
3247 ExportedFunction(ExportedFunctionInvocationParameters),
3248 ManualUpdate(ComponentVersion),
3249 }
3250 impl ::core::fmt::Debug for WorkerInvocation {
3251 fn fmt(
3252 &self,
3253 f: &mut ::core::fmt::Formatter<'_>,
3254 ) -> ::core::fmt::Result {
3255 match self {
3256 WorkerInvocation::ExportedFunction(e) => {
3257 f.debug_tuple("WorkerInvocation::ExportedFunction")
3258 .field(e)
3259 .finish()
3260 }
3261 WorkerInvocation::ManualUpdate(e) => {
3262 f.debug_tuple("WorkerInvocation::ManualUpdate")
3263 .field(e)
3264 .finish()
3265 }
3266 }
3267 }
3268 }
3269 #[derive(Clone)]
3270 pub struct PendingWorkerInvocationParameters {
3271 pub timestamp: Datetime,
3272 pub invocation: WorkerInvocation,
3273 }
3274 impl ::core::fmt::Debug for PendingWorkerInvocationParameters {
3275 fn fmt(
3276 &self,
3277 f: &mut ::core::fmt::Formatter<'_>,
3278 ) -> ::core::fmt::Result {
3279 f.debug_struct("PendingWorkerInvocationParameters")
3280 .field("timestamp", &self.timestamp)
3281 .field("invocation", &self.invocation)
3282 .finish()
3283 }
3284 }
3285 #[derive(Clone)]
3286 pub enum UpdateDescription {
3287 /// Automatic update by replaying the oplog on the new version
3288 AutoUpdate,
3289 /// Custom update by loading a given snapshot on the new version
3290 SnapshotBased(_rt::Vec<u8>),
3291 }
3292 impl ::core::fmt::Debug for UpdateDescription {
3293 fn fmt(
3294 &self,
3295 f: &mut ::core::fmt::Formatter<'_>,
3296 ) -> ::core::fmt::Result {
3297 match self {
3298 UpdateDescription::AutoUpdate => {
3299 f.debug_tuple("UpdateDescription::AutoUpdate").finish()
3300 }
3301 UpdateDescription::SnapshotBased(e) => {
3302 f.debug_tuple("UpdateDescription::SnapshotBased")
3303 .field(e)
3304 .finish()
3305 }
3306 }
3307 }
3308 }
3309 #[derive(Clone)]
3310 pub struct PendingUpdateParameters {
3311 pub timestamp: Datetime,
3312 pub target_version: ComponentVersion,
3313 pub update_description: UpdateDescription,
3314 }
3315 impl ::core::fmt::Debug for PendingUpdateParameters {
3316 fn fmt(
3317 &self,
3318 f: &mut ::core::fmt::Formatter<'_>,
3319 ) -> ::core::fmt::Result {
3320 f.debug_struct("PendingUpdateParameters")
3321 .field("timestamp", &self.timestamp)
3322 .field("target-version", &self.target_version)
3323 .field("update-description", &self.update_description)
3324 .finish()
3325 }
3326 }
3327 #[derive(Clone)]
3328 pub struct SuccessfulUpdateParameters {
3329 pub timestamp: Datetime,
3330 pub target_version: ComponentVersion,
3331 pub new_component_size: u64,
3332 pub new_active_plugins: _rt::Vec<PluginInstallationDescription>,
3333 }
3334 impl ::core::fmt::Debug for SuccessfulUpdateParameters {
3335 fn fmt(
3336 &self,
3337 f: &mut ::core::fmt::Formatter<'_>,
3338 ) -> ::core::fmt::Result {
3339 f.debug_struct("SuccessfulUpdateParameters")
3340 .field("timestamp", &self.timestamp)
3341 .field("target-version", &self.target_version)
3342 .field("new-component-size", &self.new_component_size)
3343 .field("new-active-plugins", &self.new_active_plugins)
3344 .finish()
3345 }
3346 }
3347 #[derive(Clone)]
3348 pub struct FailedUpdateParameters {
3349 pub timestamp: Datetime,
3350 pub target_version: ComponentVersion,
3351 pub details: Option<_rt::String>,
3352 }
3353 impl ::core::fmt::Debug for FailedUpdateParameters {
3354 fn fmt(
3355 &self,
3356 f: &mut ::core::fmt::Formatter<'_>,
3357 ) -> ::core::fmt::Result {
3358 f.debug_struct("FailedUpdateParameters")
3359 .field("timestamp", &self.timestamp)
3360 .field("target-version", &self.target_version)
3361 .field("details", &self.details)
3362 .finish()
3363 }
3364 }
3365 #[repr(C)]
3366 #[derive(Clone, Copy)]
3367 pub struct GrowMemoryParameters {
3368 pub timestamp: Datetime,
3369 pub delta: u64,
3370 }
3371 impl ::core::fmt::Debug for GrowMemoryParameters {
3372 fn fmt(
3373 &self,
3374 f: &mut ::core::fmt::Formatter<'_>,
3375 ) -> ::core::fmt::Result {
3376 f.debug_struct("GrowMemoryParameters")
3377 .field("timestamp", &self.timestamp)
3378 .field("delta", &self.delta)
3379 .finish()
3380 }
3381 }
3382 pub type WorkerResourceId = u64;
3383 #[repr(C)]
3384 #[derive(Clone, Copy)]
3385 pub struct CreateResourceParameters {
3386 pub timestamp: Datetime,
3387 pub resource_id: WorkerResourceId,
3388 }
3389 impl ::core::fmt::Debug for CreateResourceParameters {
3390 fn fmt(
3391 &self,
3392 f: &mut ::core::fmt::Formatter<'_>,
3393 ) -> ::core::fmt::Result {
3394 f.debug_struct("CreateResourceParameters")
3395 .field("timestamp", &self.timestamp)
3396 .field("resource-id", &self.resource_id)
3397 .finish()
3398 }
3399 }
3400 #[repr(C)]
3401 #[derive(Clone, Copy)]
3402 pub struct DropResourceParameters {
3403 pub timestamp: Datetime,
3404 pub resource_id: WorkerResourceId,
3405 }
3406 impl ::core::fmt::Debug for DropResourceParameters {
3407 fn fmt(
3408 &self,
3409 f: &mut ::core::fmt::Formatter<'_>,
3410 ) -> ::core::fmt::Result {
3411 f.debug_struct("DropResourceParameters")
3412 .field("timestamp", &self.timestamp)
3413 .field("resource-id", &self.resource_id)
3414 .finish()
3415 }
3416 }
3417 #[derive(Clone)]
3418 pub struct DescribeResourceParameters {
3419 pub timestamp: Datetime,
3420 pub resource_id: WorkerResourceId,
3421 pub resource_name: _rt::String,
3422 pub resource_params: _rt::Vec<WitValue>,
3423 }
3424 impl ::core::fmt::Debug for DescribeResourceParameters {
3425 fn fmt(
3426 &self,
3427 f: &mut ::core::fmt::Formatter<'_>,
3428 ) -> ::core::fmt::Result {
3429 f.debug_struct("DescribeResourceParameters")
3430 .field("timestamp", &self.timestamp)
3431 .field("resource-id", &self.resource_id)
3432 .field("resource-name", &self.resource_name)
3433 .field("resource-params", &self.resource_params)
3434 .finish()
3435 }
3436 }
3437 #[repr(u8)]
3438 #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
3439 pub enum LogLevel {
3440 Stdout,
3441 Stderr,
3442 Trace,
3443 Debug,
3444 Info,
3445 Warn,
3446 Error,
3447 Critical,
3448 }
3449 impl ::core::fmt::Debug for LogLevel {
3450 fn fmt(
3451 &self,
3452 f: &mut ::core::fmt::Formatter<'_>,
3453 ) -> ::core::fmt::Result {
3454 match self {
3455 LogLevel::Stdout => f.debug_tuple("LogLevel::Stdout").finish(),
3456 LogLevel::Stderr => f.debug_tuple("LogLevel::Stderr").finish(),
3457 LogLevel::Trace => f.debug_tuple("LogLevel::Trace").finish(),
3458 LogLevel::Debug => f.debug_tuple("LogLevel::Debug").finish(),
3459 LogLevel::Info => f.debug_tuple("LogLevel::Info").finish(),
3460 LogLevel::Warn => f.debug_tuple("LogLevel::Warn").finish(),
3461 LogLevel::Error => f.debug_tuple("LogLevel::Error").finish(),
3462 LogLevel::Critical => {
3463 f.debug_tuple("LogLevel::Critical").finish()
3464 }
3465 }
3466 }
3467 }
3468 impl LogLevel {
3469 #[doc(hidden)]
3470 pub unsafe fn _lift(val: u8) -> LogLevel {
3471 if !cfg!(debug_assertions) {
3472 return ::core::mem::transmute(val);
3473 }
3474 match val {
3475 0 => LogLevel::Stdout,
3476 1 => LogLevel::Stderr,
3477 2 => LogLevel::Trace,
3478 3 => LogLevel::Debug,
3479 4 => LogLevel::Info,
3480 5 => LogLevel::Warn,
3481 6 => LogLevel::Error,
3482 7 => LogLevel::Critical,
3483 _ => panic!("invalid enum discriminant"),
3484 }
3485 }
3486 }
3487 #[derive(Clone)]
3488 pub struct LogParameters {
3489 pub timestamp: Datetime,
3490 pub level: LogLevel,
3491 pub context: _rt::String,
3492 pub message: _rt::String,
3493 }
3494 impl ::core::fmt::Debug for LogParameters {
3495 fn fmt(
3496 &self,
3497 f: &mut ::core::fmt::Formatter<'_>,
3498 ) -> ::core::fmt::Result {
3499 f.debug_struct("LogParameters")
3500 .field("timestamp", &self.timestamp)
3501 .field("level", &self.level)
3502 .field("context", &self.context)
3503 .field("message", &self.message)
3504 .finish()
3505 }
3506 }
3507 #[derive(Clone)]
3508 pub struct ActivatePluginParameters {
3509 pub timestamp: Datetime,
3510 pub plugin: PluginInstallationDescription,
3511 }
3512 impl ::core::fmt::Debug for ActivatePluginParameters {
3513 fn fmt(
3514 &self,
3515 f: &mut ::core::fmt::Formatter<'_>,
3516 ) -> ::core::fmt::Result {
3517 f.debug_struct("ActivatePluginParameters")
3518 .field("timestamp", &self.timestamp)
3519 .field("plugin", &self.plugin)
3520 .finish()
3521 }
3522 }
3523 #[derive(Clone)]
3524 pub struct DeactivatePluginParameters {
3525 pub timestamp: Datetime,
3526 pub plugin: PluginInstallationDescription,
3527 }
3528 impl ::core::fmt::Debug for DeactivatePluginParameters {
3529 fn fmt(
3530 &self,
3531 f: &mut ::core::fmt::Formatter<'_>,
3532 ) -> ::core::fmt::Result {
3533 f.debug_struct("DeactivatePluginParameters")
3534 .field("timestamp", &self.timestamp)
3535 .field("plugin", &self.plugin)
3536 .finish()
3537 }
3538 }
3539 #[repr(C)]
3540 #[derive(Clone, Copy)]
3541 pub struct RevertParameters {
3542 pub timestamp: Datetime,
3543 pub start: OplogIndex,
3544 pub end: OplogIndex,
3545 }
3546 impl ::core::fmt::Debug for RevertParameters {
3547 fn fmt(
3548 &self,
3549 f: &mut ::core::fmt::Formatter<'_>,
3550 ) -> ::core::fmt::Result {
3551 f.debug_struct("RevertParameters")
3552 .field("timestamp", &self.timestamp)
3553 .field("start", &self.start)
3554 .field("end", &self.end)
3555 .finish()
3556 }
3557 }
3558 #[derive(Clone)]
3559 pub struct CancelInvocationParameters {
3560 pub timestamp: Datetime,
3561 pub idempotency_key: _rt::String,
3562 }
3563 impl ::core::fmt::Debug for CancelInvocationParameters {
3564 fn fmt(
3565 &self,
3566 f: &mut ::core::fmt::Formatter<'_>,
3567 ) -> ::core::fmt::Result {
3568 f.debug_struct("CancelInvocationParameters")
3569 .field("timestamp", &self.timestamp)
3570 .field("idempotency-key", &self.idempotency_key)
3571 .finish()
3572 }
3573 }
3574 #[derive(Clone)]
3575 pub struct StartSpanParameters {
3576 pub timestamp: Datetime,
3577 pub span_id: SpanId,
3578 pub parent: Option<SpanId>,
3579 pub linked_context: Option<SpanId>,
3580 pub attributes: _rt::Vec<Attribute>,
3581 }
3582 impl ::core::fmt::Debug for StartSpanParameters {
3583 fn fmt(
3584 &self,
3585 f: &mut ::core::fmt::Formatter<'_>,
3586 ) -> ::core::fmt::Result {
3587 f.debug_struct("StartSpanParameters")
3588 .field("timestamp", &self.timestamp)
3589 .field("span-id", &self.span_id)
3590 .field("parent", &self.parent)
3591 .field("linked-context", &self.linked_context)
3592 .field("attributes", &self.attributes)
3593 .finish()
3594 }
3595 }
3596 #[derive(Clone)]
3597 pub struct FinishSpanParameters {
3598 pub timestamp: Datetime,
3599 pub span_id: SpanId,
3600 }
3601 impl ::core::fmt::Debug for FinishSpanParameters {
3602 fn fmt(
3603 &self,
3604 f: &mut ::core::fmt::Formatter<'_>,
3605 ) -> ::core::fmt::Result {
3606 f.debug_struct("FinishSpanParameters")
3607 .field("timestamp", &self.timestamp)
3608 .field("span-id", &self.span_id)
3609 .finish()
3610 }
3611 }
3612 #[derive(Clone)]
3613 pub struct SetSpanAttributeParameters {
3614 pub timestamp: Datetime,
3615 pub span_id: SpanId,
3616 pub key: _rt::String,
3617 pub value: AttributeValue,
3618 }
3619 impl ::core::fmt::Debug for SetSpanAttributeParameters {
3620 fn fmt(
3621 &self,
3622 f: &mut ::core::fmt::Formatter<'_>,
3623 ) -> ::core::fmt::Result {
3624 f.debug_struct("SetSpanAttributeParameters")
3625 .field("timestamp", &self.timestamp)
3626 .field("span-id", &self.span_id)
3627 .field("key", &self.key)
3628 .field("value", &self.value)
3629 .finish()
3630 }
3631 }
3632 #[derive(Clone)]
3633 pub enum OplogEntry {
3634 /// The initial worker oplog entry
3635 Create(CreateParameters),
3636 /// The worker invoked a host function
3637 ImportedFunctionInvoked(ImportedFunctionInvokedParameters),
3638 /// The worker has been invoked
3639 ExportedFunctionInvoked(ExportedFunctionInvokedParameters),
3640 /// The worker has completed an invocation
3641 ExportedFunctionCompleted(ExportedFunctionCompletedParameters),
3642 /// Worker suspended
3643 Suspend(Datetime),
3644 /// Worker failed
3645 Error(ErrorParameters),
3646 /// Marker entry added when get-oplog-index is called from the worker, to make the jumping behavior
3647 /// more predictable.
3648 NoOp(Datetime),
3649 /// The worker needs to recover up to the given target oplog index and continue running from
3650 /// the source oplog index from there
3651 /// `jump` is an oplog region representing that from the end of that region we want to go back to the start and
3652 /// ignore all recorded operations in between.
3653 Jump(JumpParameters),
3654 /// Indicates that the worker has been interrupted at this point.
3655 /// Only used to recompute the worker's (cached) status, has no effect on execution.
3656 Interrupted(Datetime),
3657 /// Indicates that the worker has been exited using WASI's exit function.
3658 Exited(Datetime),
3659 /// Overrides the worker's retry policy
3660 ChangeRetryPolicy(ChangeRetryPolicyParameters),
3661 /// Begins an atomic region. All oplog entries after `BeginAtomicRegion` are to be ignored during
3662 /// recovery except if there is a corresponding `EndAtomicRegion` entry.
3663 BeginAtomicRegion(Datetime),
3664 /// Ends an atomic region. All oplog entries between the corresponding `BeginAtomicRegion` and this
3665 /// entry are to be considered during recovery, and the begin/end markers can be removed during oplog
3666 /// compaction.
3667 EndAtomicRegion(EndAtomicRegionParameters),
3668 /// Begins a remote write operation. Only used when idempotence mode is off. In this case each
3669 /// remote write must be surrounded by a `BeginRemoteWrite` and `EndRemoteWrite` log pair and
3670 /// unfinished remote writes cannot be recovered.
3671 BeginRemoteWrite(Datetime),
3672 /// Marks the end of a remote write operation. Only used when idempotence mode is off.
3673 EndRemoteWrite(EndRemoteWriteParameters),
3674 /// An invocation request arrived while the worker was busy
3675 PendingWorkerInvocation(PendingWorkerInvocationParameters),
3676 /// An update request arrived and will be applied as soon the worker restarts
3677 PendingUpdate(PendingUpdateParameters),
3678 /// An update was successfully applied
3679 SuccessfulUpdate(SuccessfulUpdateParameters),
3680 /// An update failed to be applied
3681 FailedUpdate(FailedUpdateParameters),
3682 /// Increased total linear memory size
3683 GrowMemory(GrowMemoryParameters),
3684 /// Created a resource instance
3685 CreateResource(CreateResourceParameters),
3686 /// Dropped a resource instance
3687 DropResource(DropResourceParameters),
3688 /// Adds additional information for a created resource instance
3689 DescribeResource(DescribeResourceParameters),
3690 /// The worker emitted a log message
3691 Log(LogParameters),
3692 /// The worker's has been restarted, forgetting all its history
3693 Restart(Datetime),
3694 /// Activates a plugin
3695 ActivatePlugin(ActivatePluginParameters),
3696 /// Deactivates a plugin
3697 DeactivatePlugin(DeactivatePluginParameters),
3698 /// Revert a worker to a previous state
3699 Revert(RevertParameters),
3700 /// Cancel a pending invocation
3701 CancelInvocation(CancelInvocationParameters),
3702 /// Start a new span in the invocation context
3703 StartSpan(StartSpanParameters),
3704 /// Finish an open span in the invocation context
3705 FinishSpan(FinishSpanParameters),
3706 /// Set an attribute on an open span in the invocation context
3707 SetSpanAttribute(SetSpanAttributeParameters),
3708 }
3709 impl ::core::fmt::Debug for OplogEntry {
3710 fn fmt(
3711 &self,
3712 f: &mut ::core::fmt::Formatter<'_>,
3713 ) -> ::core::fmt::Result {
3714 match self {
3715 OplogEntry::Create(e) => {
3716 f.debug_tuple("OplogEntry::Create").field(e).finish()
3717 }
3718 OplogEntry::ImportedFunctionInvoked(e) => {
3719 f.debug_tuple("OplogEntry::ImportedFunctionInvoked")
3720 .field(e)
3721 .finish()
3722 }
3723 OplogEntry::ExportedFunctionInvoked(e) => {
3724 f.debug_tuple("OplogEntry::ExportedFunctionInvoked")
3725 .field(e)
3726 .finish()
3727 }
3728 OplogEntry::ExportedFunctionCompleted(e) => {
3729 f.debug_tuple("OplogEntry::ExportedFunctionCompleted")
3730 .field(e)
3731 .finish()
3732 }
3733 OplogEntry::Suspend(e) => {
3734 f.debug_tuple("OplogEntry::Suspend").field(e).finish()
3735 }
3736 OplogEntry::Error(e) => {
3737 f.debug_tuple("OplogEntry::Error").field(e).finish()
3738 }
3739 OplogEntry::NoOp(e) => {
3740 f.debug_tuple("OplogEntry::NoOp").field(e).finish()
3741 }
3742 OplogEntry::Jump(e) => {
3743 f.debug_tuple("OplogEntry::Jump").field(e).finish()
3744 }
3745 OplogEntry::Interrupted(e) => {
3746 f.debug_tuple("OplogEntry::Interrupted").field(e).finish()
3747 }
3748 OplogEntry::Exited(e) => {
3749 f.debug_tuple("OplogEntry::Exited").field(e).finish()
3750 }
3751 OplogEntry::ChangeRetryPolicy(e) => {
3752 f.debug_tuple("OplogEntry::ChangeRetryPolicy")
3753 .field(e)
3754 .finish()
3755 }
3756 OplogEntry::BeginAtomicRegion(e) => {
3757 f.debug_tuple("OplogEntry::BeginAtomicRegion")
3758 .field(e)
3759 .finish()
3760 }
3761 OplogEntry::EndAtomicRegion(e) => {
3762 f.debug_tuple("OplogEntry::EndAtomicRegion")
3763 .field(e)
3764 .finish()
3765 }
3766 OplogEntry::BeginRemoteWrite(e) => {
3767 f.debug_tuple("OplogEntry::BeginRemoteWrite")
3768 .field(e)
3769 .finish()
3770 }
3771 OplogEntry::EndRemoteWrite(e) => {
3772 f.debug_tuple("OplogEntry::EndRemoteWrite").field(e).finish()
3773 }
3774 OplogEntry::PendingWorkerInvocation(e) => {
3775 f.debug_tuple("OplogEntry::PendingWorkerInvocation")
3776 .field(e)
3777 .finish()
3778 }
3779 OplogEntry::PendingUpdate(e) => {
3780 f.debug_tuple("OplogEntry::PendingUpdate").field(e).finish()
3781 }
3782 OplogEntry::SuccessfulUpdate(e) => {
3783 f.debug_tuple("OplogEntry::SuccessfulUpdate")
3784 .field(e)
3785 .finish()
3786 }
3787 OplogEntry::FailedUpdate(e) => {
3788 f.debug_tuple("OplogEntry::FailedUpdate").field(e).finish()
3789 }
3790 OplogEntry::GrowMemory(e) => {
3791 f.debug_tuple("OplogEntry::GrowMemory").field(e).finish()
3792 }
3793 OplogEntry::CreateResource(e) => {
3794 f.debug_tuple("OplogEntry::CreateResource").field(e).finish()
3795 }
3796 OplogEntry::DropResource(e) => {
3797 f.debug_tuple("OplogEntry::DropResource").field(e).finish()
3798 }
3799 OplogEntry::DescribeResource(e) => {
3800 f.debug_tuple("OplogEntry::DescribeResource")
3801 .field(e)
3802 .finish()
3803 }
3804 OplogEntry::Log(e) => {
3805 f.debug_tuple("OplogEntry::Log").field(e).finish()
3806 }
3807 OplogEntry::Restart(e) => {
3808 f.debug_tuple("OplogEntry::Restart").field(e).finish()
3809 }
3810 OplogEntry::ActivatePlugin(e) => {
3811 f.debug_tuple("OplogEntry::ActivatePlugin").field(e).finish()
3812 }
3813 OplogEntry::DeactivatePlugin(e) => {
3814 f.debug_tuple("OplogEntry::DeactivatePlugin")
3815 .field(e)
3816 .finish()
3817 }
3818 OplogEntry::Revert(e) => {
3819 f.debug_tuple("OplogEntry::Revert").field(e).finish()
3820 }
3821 OplogEntry::CancelInvocation(e) => {
3822 f.debug_tuple("OplogEntry::CancelInvocation")
3823 .field(e)
3824 .finish()
3825 }
3826 OplogEntry::StartSpan(e) => {
3827 f.debug_tuple("OplogEntry::StartSpan").field(e).finish()
3828 }
3829 OplogEntry::FinishSpan(e) => {
3830 f.debug_tuple("OplogEntry::FinishSpan").field(e).finish()
3831 }
3832 OplogEntry::SetSpanAttribute(e) => {
3833 f.debug_tuple("OplogEntry::SetSpanAttribute")
3834 .field(e)
3835 .finish()
3836 }
3837 }
3838 }
3839 }
3840 #[derive(Debug)]
3841 #[repr(transparent)]
3842 pub struct GetOplog {
3843 handle: _rt::Resource<GetOplog>,
3844 }
3845 impl GetOplog {
3846 #[doc(hidden)]
3847 pub unsafe fn from_handle(handle: u32) -> Self {
3848 Self {
3849 handle: _rt::Resource::from_handle(handle),
3850 }
3851 }
3852 #[doc(hidden)]
3853 pub fn take_handle(&self) -> u32 {
3854 _rt::Resource::take_handle(&self.handle)
3855 }
3856 #[doc(hidden)]
3857 pub fn handle(&self) -> u32 {
3858 _rt::Resource::handle(&self.handle)
3859 }
3860 }
3861 unsafe impl _rt::WasmResource for GetOplog {
3862 #[inline]
3863 unsafe fn drop(_handle: u32) {
3864 #[cfg(not(target_arch = "wasm32"))]
3865 unreachable!();
3866 #[cfg(target_arch = "wasm32")]
3867 {
3868 #[link(wasm_import_module = "golem:api/oplog@1.1.5")]
3869 extern "C" {
3870 #[link_name = "[resource-drop]get-oplog"]
3871 fn drop(_: u32);
3872 }
3873 drop(_handle);
3874 }
3875 }
3876 }
3877 #[derive(Debug)]
3878 #[repr(transparent)]
3879 pub struct SearchOplog {
3880 handle: _rt::Resource<SearchOplog>,
3881 }
3882 impl SearchOplog {
3883 #[doc(hidden)]
3884 pub unsafe fn from_handle(handle: u32) -> Self {
3885 Self {
3886 handle: _rt::Resource::from_handle(handle),
3887 }
3888 }
3889 #[doc(hidden)]
3890 pub fn take_handle(&self) -> u32 {
3891 _rt::Resource::take_handle(&self.handle)
3892 }
3893 #[doc(hidden)]
3894 pub fn handle(&self) -> u32 {
3895 _rt::Resource::handle(&self.handle)
3896 }
3897 }
3898 unsafe impl _rt::WasmResource for SearchOplog {
3899 #[inline]
3900 unsafe fn drop(_handle: u32) {
3901 #[cfg(not(target_arch = "wasm32"))]
3902 unreachable!();
3903 #[cfg(target_arch = "wasm32")]
3904 {
3905 #[link(wasm_import_module = "golem:api/oplog@1.1.5")]
3906 extern "C" {
3907 #[link_name = "[resource-drop]search-oplog"]
3908 fn drop(_: u32);
3909 }
3910 drop(_handle);
3911 }
3912 }
3913 }
3914 impl GetOplog {
3915 #[allow(unused_unsafe, clippy::all)]
3916 pub fn new(worker_id: &WorkerId, start: OplogIndex) -> Self {
3917 unsafe {
3918 let super::super::super::golem::api::host::WorkerId {
3919 component_id: component_id0,
3920 worker_name: worker_name0,
3921 } = worker_id;
3922 let super::super::super::golem::api::host::ComponentId {
3923 uuid: uuid1,
3924 } = component_id0;
3925 let super::super::super::golem::api::host::Uuid {
3926 high_bits: high_bits2,
3927 low_bits: low_bits2,
3928 } = uuid1;
3929 let vec3 = worker_name0;
3930 let ptr3 = vec3.as_ptr().cast::<u8>();
3931 let len3 = vec3.len();
3932 #[cfg(target_arch = "wasm32")]
3933 #[link(wasm_import_module = "golem:api/oplog@1.1.5")]
3934 extern "C" {
3935 #[link_name = "[constructor]get-oplog"]
3936 fn wit_import(
3937 _: i64,
3938 _: i64,
3939 _: *mut u8,
3940 _: usize,
3941 _: i64,
3942 ) -> i32;
3943 }
3944 #[cfg(not(target_arch = "wasm32"))]
3945 fn wit_import(
3946 _: i64,
3947 _: i64,
3948 _: *mut u8,
3949 _: usize,
3950 _: i64,
3951 ) -> i32 {
3952 unreachable!()
3953 }
3954 let ret = wit_import(
3955 _rt::as_i64(high_bits2),
3956 _rt::as_i64(low_bits2),
3957 ptr3.cast_mut(),
3958 len3,
3959 _rt::as_i64(start),
3960 );
3961 GetOplog::from_handle(ret as u32)
3962 }
3963 }
3964 }
3965 impl GetOplog {
3966 #[allow(unused_unsafe, clippy::all)]
3967 pub fn get_next(&self) -> Option<_rt::Vec<OplogEntry>> {
3968 unsafe {
3969 #[repr(align(4))]
3970 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
3971 let mut ret_area = RetArea(
3972 [::core::mem::MaybeUninit::uninit(); 12],
3973 );
3974 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
3975 #[cfg(target_arch = "wasm32")]
3976 #[link(wasm_import_module = "golem:api/oplog@1.1.5")]
3977 extern "C" {
3978 #[link_name = "[method]get-oplog.get-next"]
3979 fn wit_import(_: i32, _: *mut u8);
3980 }
3981 #[cfg(not(target_arch = "wasm32"))]
3982 fn wit_import(_: i32, _: *mut u8) {
3983 unreachable!()
3984 }
3985 wit_import((self).handle() as i32, ptr0);
3986 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
3987 match l1 {
3988 0 => None,
3989 1 => {
3990 let e = {
3991 let l2 = *ptr0.add(4).cast::<*mut u8>();
3992 let l3 = *ptr0.add(8).cast::<usize>();
3993 let base621 = l2;
3994 let len621 = l3;
3995 let mut result621 = _rt::Vec::with_capacity(len621);
3996 for i in 0..len621 {
3997 let base = base621.add(i * 136);
3998 let e621 = {
3999 let l4 = i32::from(*base.add(0).cast::<u8>());
4000 let v620 = match l4 {
4001 0 => {
4002 let e620 = {
4003 let l5 = *base.add(8).cast::<i64>();
4004 let l6 = *base.add(16).cast::<i32>();
4005 let l7 = *base.add(24).cast::<i64>();
4006 let l8 = *base.add(32).cast::<i64>();
4007 let l9 = *base.add(40).cast::<*mut u8>();
4008 let l10 = *base.add(44).cast::<usize>();
4009 let len11 = l10;
4010 let bytes11 = _rt::Vec::from_raw_parts(
4011 l9.cast(),
4012 len11,
4013 len11,
4014 );
4015 let l12 = *base.add(48).cast::<i64>();
4016 let l13 = *base.add(56).cast::<*mut u8>();
4017 let l14 = *base.add(60).cast::<usize>();
4018 let base18 = l13;
4019 let len18 = l14;
4020 let mut result18 = _rt::Vec::with_capacity(len18);
4021 for i in 0..len18 {
4022 let base = base18.add(i * 8);
4023 let e18 = {
4024 let l15 = *base.add(0).cast::<*mut u8>();
4025 let l16 = *base.add(4).cast::<usize>();
4026 let len17 = l16;
4027 let bytes17 = _rt::Vec::from_raw_parts(
4028 l15.cast(),
4029 len17,
4030 len17,
4031 );
4032 _rt::string_lift(bytes17)
4033 };
4034 result18.push(e18);
4035 }
4036 _rt::cabi_dealloc(base18, len18 * 8, 4);
4037 let l19 = *base.add(64).cast::<*mut u8>();
4038 let l20 = *base.add(68).cast::<usize>();
4039 let base27 = l19;
4040 let len27 = l20;
4041 let mut result27 = _rt::Vec::with_capacity(len27);
4042 for i in 0..len27 {
4043 let base = base27.add(i * 16);
4044 let e27 = {
4045 let l21 = *base.add(0).cast::<*mut u8>();
4046 let l22 = *base.add(4).cast::<usize>();
4047 let len23 = l22;
4048 let bytes23 = _rt::Vec::from_raw_parts(
4049 l21.cast(),
4050 len23,
4051 len23,
4052 );
4053 let l24 = *base.add(8).cast::<*mut u8>();
4054 let l25 = *base.add(12).cast::<usize>();
4055 let len26 = l25;
4056 let bytes26 = _rt::Vec::from_raw_parts(
4057 l24.cast(),
4058 len26,
4059 len26,
4060 );
4061 (_rt::string_lift(bytes23), _rt::string_lift(bytes26))
4062 };
4063 result27.push(e27);
4064 }
4065 _rt::cabi_dealloc(base27, len27 * 16, 4);
4066 let l28 = *base.add(72).cast::<*mut u8>();
4067 let l29 = *base.add(76).cast::<usize>();
4068 let len30 = l29;
4069 let bytes30 = _rt::Vec::from_raw_parts(
4070 l28.cast(),
4071 len30,
4072 len30,
4073 );
4074 let l31 = i32::from(*base.add(80).cast::<u8>());
4075 let l37 = *base.add(112).cast::<i64>();
4076 let l38 = *base.add(120).cast::<i64>();
4077 let l39 = *base.add(128).cast::<*mut u8>();
4078 let l40 = *base.add(132).cast::<usize>();
4079 let base58 = l39;
4080 let len58 = l40;
4081 let mut result58 = _rt::Vec::with_capacity(len58);
4082 for i in 0..len58 {
4083 let base = base58.add(i * 40);
4084 let e58 = {
4085 let l41 = *base.add(0).cast::<i64>();
4086 let l42 = *base.add(8).cast::<i64>();
4087 let l43 = *base.add(16).cast::<*mut u8>();
4088 let l44 = *base.add(20).cast::<usize>();
4089 let len45 = l44;
4090 let bytes45 = _rt::Vec::from_raw_parts(
4091 l43.cast(),
4092 len45,
4093 len45,
4094 );
4095 let l46 = *base.add(24).cast::<*mut u8>();
4096 let l47 = *base.add(28).cast::<usize>();
4097 let len48 = l47;
4098 let bytes48 = _rt::Vec::from_raw_parts(
4099 l46.cast(),
4100 len48,
4101 len48,
4102 );
4103 let l49 = *base.add(32).cast::<*mut u8>();
4104 let l50 = *base.add(36).cast::<usize>();
4105 let base57 = l49;
4106 let len57 = l50;
4107 let mut result57 = _rt::Vec::with_capacity(len57);
4108 for i in 0..len57 {
4109 let base = base57.add(i * 16);
4110 let e57 = {
4111 let l51 = *base.add(0).cast::<*mut u8>();
4112 let l52 = *base.add(4).cast::<usize>();
4113 let len53 = l52;
4114 let bytes53 = _rt::Vec::from_raw_parts(
4115 l51.cast(),
4116 len53,
4117 len53,
4118 );
4119 let l54 = *base.add(8).cast::<*mut u8>();
4120 let l55 = *base.add(12).cast::<usize>();
4121 let len56 = l55;
4122 let bytes56 = _rt::Vec::from_raw_parts(
4123 l54.cast(),
4124 len56,
4125 len56,
4126 );
4127 (_rt::string_lift(bytes53), _rt::string_lift(bytes56))
4128 };
4129 result57.push(e57);
4130 }
4131 _rt::cabi_dealloc(base57, len57 * 16, 4);
4132 PluginInstallationDescription {
4133 installation_id: super::super::super::golem::api::host::Uuid {
4134 high_bits: l41 as u64,
4135 low_bits: l42 as u64,
4136 },
4137 name: _rt::string_lift(bytes45),
4138 version: _rt::string_lift(bytes48),
4139 parameters: result57,
4140 }
4141 };
4142 result58.push(e58);
4143 }
4144 _rt::cabi_dealloc(base58, len58 * 40, 8);
4145 CreateParameters {
4146 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
4147 seconds: l5 as u64,
4148 nanoseconds: l6 as u32,
4149 },
4150 worker_id: super::super::super::golem::api::host::WorkerId {
4151 component_id: super::super::super::golem::api::host::ComponentId {
4152 uuid: super::super::super::golem::api::host::Uuid {
4153 high_bits: l7 as u64,
4154 low_bits: l8 as u64,
4155 },
4156 },
4157 worker_name: _rt::string_lift(bytes11),
4158 },
4159 component_version: l12 as u64,
4160 args: result18,
4161 env: result27,
4162 account_id: super::super::super::golem::api::host::AccountId {
4163 value: _rt::string_lift(bytes30),
4164 },
4165 parent: match l31 {
4166 0 => None,
4167 1 => {
4168 let e = {
4169 let l32 = *base.add(88).cast::<i64>();
4170 let l33 = *base.add(96).cast::<i64>();
4171 let l34 = *base.add(104).cast::<*mut u8>();
4172 let l35 = *base.add(108).cast::<usize>();
4173 let len36 = l35;
4174 let bytes36 = _rt::Vec::from_raw_parts(
4175 l34.cast(),
4176 len36,
4177 len36,
4178 );
4179 super::super::super::golem::api::host::WorkerId {
4180 component_id: super::super::super::golem::api::host::ComponentId {
4181 uuid: super::super::super::golem::api::host::Uuid {
4182 high_bits: l32 as u64,
4183 low_bits: l33 as u64,
4184 },
4185 },
4186 worker_name: _rt::string_lift(bytes36),
4187 }
4188 };
4189 Some(e)
4190 }
4191 _ => _rt::invalid_enum_discriminant(),
4192 },
4193 component_size: l37 as u64,
4194 initial_total_linear_memory_size: l38 as u64,
4195 initial_active_plugins: result58,
4196 }
4197 };
4198 OplogEntry::Create(e620)
4199 }
4200 1 => {
4201 let e620 = {
4202 let l59 = *base.add(8).cast::<i64>();
4203 let l60 = *base.add(16).cast::<i32>();
4204 let l61 = *base.add(24).cast::<*mut u8>();
4205 let l62 = *base.add(28).cast::<usize>();
4206 let len63 = l62;
4207 let bytes63 = _rt::Vec::from_raw_parts(
4208 l61.cast(),
4209 len63,
4210 len63,
4211 );
4212 let l64 = *base.add(32).cast::<*mut u8>();
4213 let l65 = *base.add(36).cast::<usize>();
4214 let base111 = l64;
4215 let len111 = l65;
4216 let mut result111 = _rt::Vec::with_capacity(len111);
4217 for i in 0..len111 {
4218 let base = base111.add(i * 24);
4219 let e111 = {
4220 let l66 = i32::from(*base.add(0).cast::<u8>());
4221 use super::super::super::golem::rpc::types::WitNode as V110;
4222 let v110 = match l66 {
4223 0 => {
4224 let e110 = {
4225 let l67 = *base.add(8).cast::<*mut u8>();
4226 let l68 = *base.add(12).cast::<usize>();
4227 let len69 = l68;
4228 _rt::Vec::from_raw_parts(l67.cast(), len69, len69)
4229 };
4230 V110::RecordValue(e110)
4231 }
4232 1 => {
4233 let e110 = {
4234 let l70 = *base.add(8).cast::<i32>();
4235 let l71 = i32::from(*base.add(12).cast::<u8>());
4236 (
4237 l70 as u32,
4238 match l71 {
4239 0 => None,
4240 1 => {
4241 let e = {
4242 let l72 = *base.add(16).cast::<i32>();
4243 l72
4244 };
4245 Some(e)
4246 }
4247 _ => _rt::invalid_enum_discriminant(),
4248 },
4249 )
4250 };
4251 V110::VariantValue(e110)
4252 }
4253 2 => {
4254 let e110 = {
4255 let l73 = *base.add(8).cast::<i32>();
4256 l73 as u32
4257 };
4258 V110::EnumValue(e110)
4259 }
4260 3 => {
4261 let e110 = {
4262 let l74 = *base.add(8).cast::<*mut u8>();
4263 let l75 = *base.add(12).cast::<usize>();
4264 let base77 = l74;
4265 let len77 = l75;
4266 let mut result77 = _rt::Vec::with_capacity(len77);
4267 for i in 0..len77 {
4268 let base = base77.add(i * 1);
4269 let e77 = {
4270 let l76 = i32::from(*base.add(0).cast::<u8>());
4271 _rt::bool_lift(l76 as u8)
4272 };
4273 result77.push(e77);
4274 }
4275 _rt::cabi_dealloc(base77, len77 * 1, 1);
4276 result77
4277 };
4278 V110::FlagsValue(e110)
4279 }
4280 4 => {
4281 let e110 = {
4282 let l78 = *base.add(8).cast::<*mut u8>();
4283 let l79 = *base.add(12).cast::<usize>();
4284 let len80 = l79;
4285 _rt::Vec::from_raw_parts(l78.cast(), len80, len80)
4286 };
4287 V110::TupleValue(e110)
4288 }
4289 5 => {
4290 let e110 = {
4291 let l81 = *base.add(8).cast::<*mut u8>();
4292 let l82 = *base.add(12).cast::<usize>();
4293 let len83 = l82;
4294 _rt::Vec::from_raw_parts(l81.cast(), len83, len83)
4295 };
4296 V110::ListValue(e110)
4297 }
4298 6 => {
4299 let e110 = {
4300 let l84 = i32::from(*base.add(8).cast::<u8>());
4301 match l84 {
4302 0 => None,
4303 1 => {
4304 let e = {
4305 let l85 = *base.add(12).cast::<i32>();
4306 l85
4307 };
4308 Some(e)
4309 }
4310 _ => _rt::invalid_enum_discriminant(),
4311 }
4312 };
4313 V110::OptionValue(e110)
4314 }
4315 7 => {
4316 let e110 = {
4317 let l86 = i32::from(*base.add(8).cast::<u8>());
4318 match l86 {
4319 0 => {
4320 let e = {
4321 let l87 = i32::from(*base.add(12).cast::<u8>());
4322 match l87 {
4323 0 => None,
4324 1 => {
4325 let e = {
4326 let l88 = *base.add(16).cast::<i32>();
4327 l88
4328 };
4329 Some(e)
4330 }
4331 _ => _rt::invalid_enum_discriminant(),
4332 }
4333 };
4334 Ok(e)
4335 }
4336 1 => {
4337 let e = {
4338 let l89 = i32::from(*base.add(12).cast::<u8>());
4339 match l89 {
4340 0 => None,
4341 1 => {
4342 let e = {
4343 let l90 = *base.add(16).cast::<i32>();
4344 l90
4345 };
4346 Some(e)
4347 }
4348 _ => _rt::invalid_enum_discriminant(),
4349 }
4350 };
4351 Err(e)
4352 }
4353 _ => _rt::invalid_enum_discriminant(),
4354 }
4355 };
4356 V110::ResultValue(e110)
4357 }
4358 8 => {
4359 let e110 = {
4360 let l91 = i32::from(*base.add(8).cast::<u8>());
4361 l91 as u8
4362 };
4363 V110::PrimU8(e110)
4364 }
4365 9 => {
4366 let e110 = {
4367 let l92 = i32::from(*base.add(8).cast::<u16>());
4368 l92 as u16
4369 };
4370 V110::PrimU16(e110)
4371 }
4372 10 => {
4373 let e110 = {
4374 let l93 = *base.add(8).cast::<i32>();
4375 l93 as u32
4376 };
4377 V110::PrimU32(e110)
4378 }
4379 11 => {
4380 let e110 = {
4381 let l94 = *base.add(8).cast::<i64>();
4382 l94 as u64
4383 };
4384 V110::PrimU64(e110)
4385 }
4386 12 => {
4387 let e110 = {
4388 let l95 = i32::from(*base.add(8).cast::<i8>());
4389 l95 as i8
4390 };
4391 V110::PrimS8(e110)
4392 }
4393 13 => {
4394 let e110 = {
4395 let l96 = i32::from(*base.add(8).cast::<i16>());
4396 l96 as i16
4397 };
4398 V110::PrimS16(e110)
4399 }
4400 14 => {
4401 let e110 = {
4402 let l97 = *base.add(8).cast::<i32>();
4403 l97
4404 };
4405 V110::PrimS32(e110)
4406 }
4407 15 => {
4408 let e110 = {
4409 let l98 = *base.add(8).cast::<i64>();
4410 l98
4411 };
4412 V110::PrimS64(e110)
4413 }
4414 16 => {
4415 let e110 = {
4416 let l99 = *base.add(8).cast::<f32>();
4417 l99
4418 };
4419 V110::PrimFloat32(e110)
4420 }
4421 17 => {
4422 let e110 = {
4423 let l100 = *base.add(8).cast::<f64>();
4424 l100
4425 };
4426 V110::PrimFloat64(e110)
4427 }
4428 18 => {
4429 let e110 = {
4430 let l101 = *base.add(8).cast::<i32>();
4431 _rt::char_lift(l101 as u32)
4432 };
4433 V110::PrimChar(e110)
4434 }
4435 19 => {
4436 let e110 = {
4437 let l102 = i32::from(*base.add(8).cast::<u8>());
4438 _rt::bool_lift(l102 as u8)
4439 };
4440 V110::PrimBool(e110)
4441 }
4442 20 => {
4443 let e110 = {
4444 let l103 = *base.add(8).cast::<*mut u8>();
4445 let l104 = *base.add(12).cast::<usize>();
4446 let len105 = l104;
4447 let bytes105 = _rt::Vec::from_raw_parts(
4448 l103.cast(),
4449 len105,
4450 len105,
4451 );
4452 _rt::string_lift(bytes105)
4453 };
4454 V110::PrimString(e110)
4455 }
4456 n => {
4457 debug_assert_eq!(n, 21, "invalid enum discriminant");
4458 let e110 = {
4459 let l106 = *base.add(8).cast::<*mut u8>();
4460 let l107 = *base.add(12).cast::<usize>();
4461 let len108 = l107;
4462 let bytes108 = _rt::Vec::from_raw_parts(
4463 l106.cast(),
4464 len108,
4465 len108,
4466 );
4467 let l109 = *base.add(16).cast::<i64>();
4468 (
4469 super::super::super::golem::rpc::types::Uri {
4470 value: _rt::string_lift(bytes108),
4471 },
4472 l109 as u64,
4473 )
4474 };
4475 V110::Handle(e110)
4476 }
4477 };
4478 v110
4479 };
4480 result111.push(e111);
4481 }
4482 _rt::cabi_dealloc(base111, len111 * 24, 8);
4483 let l112 = *base.add(40).cast::<*mut u8>();
4484 let l113 = *base.add(44).cast::<usize>();
4485 let base159 = l112;
4486 let len159 = l113;
4487 let mut result159 = _rt::Vec::with_capacity(len159);
4488 for i in 0..len159 {
4489 let base = base159.add(i * 24);
4490 let e159 = {
4491 let l114 = i32::from(*base.add(0).cast::<u8>());
4492 use super::super::super::golem::rpc::types::WitNode as V158;
4493 let v158 = match l114 {
4494 0 => {
4495 let e158 = {
4496 let l115 = *base.add(8).cast::<*mut u8>();
4497 let l116 = *base.add(12).cast::<usize>();
4498 let len117 = l116;
4499 _rt::Vec::from_raw_parts(l115.cast(), len117, len117)
4500 };
4501 V158::RecordValue(e158)
4502 }
4503 1 => {
4504 let e158 = {
4505 let l118 = *base.add(8).cast::<i32>();
4506 let l119 = i32::from(*base.add(12).cast::<u8>());
4507 (
4508 l118 as u32,
4509 match l119 {
4510 0 => None,
4511 1 => {
4512 let e = {
4513 let l120 = *base.add(16).cast::<i32>();
4514 l120
4515 };
4516 Some(e)
4517 }
4518 _ => _rt::invalid_enum_discriminant(),
4519 },
4520 )
4521 };
4522 V158::VariantValue(e158)
4523 }
4524 2 => {
4525 let e158 = {
4526 let l121 = *base.add(8).cast::<i32>();
4527 l121 as u32
4528 };
4529 V158::EnumValue(e158)
4530 }
4531 3 => {
4532 let e158 = {
4533 let l122 = *base.add(8).cast::<*mut u8>();
4534 let l123 = *base.add(12).cast::<usize>();
4535 let base125 = l122;
4536 let len125 = l123;
4537 let mut result125 = _rt::Vec::with_capacity(len125);
4538 for i in 0..len125 {
4539 let base = base125.add(i * 1);
4540 let e125 = {
4541 let l124 = i32::from(*base.add(0).cast::<u8>());
4542 _rt::bool_lift(l124 as u8)
4543 };
4544 result125.push(e125);
4545 }
4546 _rt::cabi_dealloc(base125, len125 * 1, 1);
4547 result125
4548 };
4549 V158::FlagsValue(e158)
4550 }
4551 4 => {
4552 let e158 = {
4553 let l126 = *base.add(8).cast::<*mut u8>();
4554 let l127 = *base.add(12).cast::<usize>();
4555 let len128 = l127;
4556 _rt::Vec::from_raw_parts(l126.cast(), len128, len128)
4557 };
4558 V158::TupleValue(e158)
4559 }
4560 5 => {
4561 let e158 = {
4562 let l129 = *base.add(8).cast::<*mut u8>();
4563 let l130 = *base.add(12).cast::<usize>();
4564 let len131 = l130;
4565 _rt::Vec::from_raw_parts(l129.cast(), len131, len131)
4566 };
4567 V158::ListValue(e158)
4568 }
4569 6 => {
4570 let e158 = {
4571 let l132 = i32::from(*base.add(8).cast::<u8>());
4572 match l132 {
4573 0 => None,
4574 1 => {
4575 let e = {
4576 let l133 = *base.add(12).cast::<i32>();
4577 l133
4578 };
4579 Some(e)
4580 }
4581 _ => _rt::invalid_enum_discriminant(),
4582 }
4583 };
4584 V158::OptionValue(e158)
4585 }
4586 7 => {
4587 let e158 = {
4588 let l134 = i32::from(*base.add(8).cast::<u8>());
4589 match l134 {
4590 0 => {
4591 let e = {
4592 let l135 = i32::from(*base.add(12).cast::<u8>());
4593 match l135 {
4594 0 => None,
4595 1 => {
4596 let e = {
4597 let l136 = *base.add(16).cast::<i32>();
4598 l136
4599 };
4600 Some(e)
4601 }
4602 _ => _rt::invalid_enum_discriminant(),
4603 }
4604 };
4605 Ok(e)
4606 }
4607 1 => {
4608 let e = {
4609 let l137 = i32::from(*base.add(12).cast::<u8>());
4610 match l137 {
4611 0 => None,
4612 1 => {
4613 let e = {
4614 let l138 = *base.add(16).cast::<i32>();
4615 l138
4616 };
4617 Some(e)
4618 }
4619 _ => _rt::invalid_enum_discriminant(),
4620 }
4621 };
4622 Err(e)
4623 }
4624 _ => _rt::invalid_enum_discriminant(),
4625 }
4626 };
4627 V158::ResultValue(e158)
4628 }
4629 8 => {
4630 let e158 = {
4631 let l139 = i32::from(*base.add(8).cast::<u8>());
4632 l139 as u8
4633 };
4634 V158::PrimU8(e158)
4635 }
4636 9 => {
4637 let e158 = {
4638 let l140 = i32::from(*base.add(8).cast::<u16>());
4639 l140 as u16
4640 };
4641 V158::PrimU16(e158)
4642 }
4643 10 => {
4644 let e158 = {
4645 let l141 = *base.add(8).cast::<i32>();
4646 l141 as u32
4647 };
4648 V158::PrimU32(e158)
4649 }
4650 11 => {
4651 let e158 = {
4652 let l142 = *base.add(8).cast::<i64>();
4653 l142 as u64
4654 };
4655 V158::PrimU64(e158)
4656 }
4657 12 => {
4658 let e158 = {
4659 let l143 = i32::from(*base.add(8).cast::<i8>());
4660 l143 as i8
4661 };
4662 V158::PrimS8(e158)
4663 }
4664 13 => {
4665 let e158 = {
4666 let l144 = i32::from(*base.add(8).cast::<i16>());
4667 l144 as i16
4668 };
4669 V158::PrimS16(e158)
4670 }
4671 14 => {
4672 let e158 = {
4673 let l145 = *base.add(8).cast::<i32>();
4674 l145
4675 };
4676 V158::PrimS32(e158)
4677 }
4678 15 => {
4679 let e158 = {
4680 let l146 = *base.add(8).cast::<i64>();
4681 l146
4682 };
4683 V158::PrimS64(e158)
4684 }
4685 16 => {
4686 let e158 = {
4687 let l147 = *base.add(8).cast::<f32>();
4688 l147
4689 };
4690 V158::PrimFloat32(e158)
4691 }
4692 17 => {
4693 let e158 = {
4694 let l148 = *base.add(8).cast::<f64>();
4695 l148
4696 };
4697 V158::PrimFloat64(e158)
4698 }
4699 18 => {
4700 let e158 = {
4701 let l149 = *base.add(8).cast::<i32>();
4702 _rt::char_lift(l149 as u32)
4703 };
4704 V158::PrimChar(e158)
4705 }
4706 19 => {
4707 let e158 = {
4708 let l150 = i32::from(*base.add(8).cast::<u8>());
4709 _rt::bool_lift(l150 as u8)
4710 };
4711 V158::PrimBool(e158)
4712 }
4713 20 => {
4714 let e158 = {
4715 let l151 = *base.add(8).cast::<*mut u8>();
4716 let l152 = *base.add(12).cast::<usize>();
4717 let len153 = l152;
4718 let bytes153 = _rt::Vec::from_raw_parts(
4719 l151.cast(),
4720 len153,
4721 len153,
4722 );
4723 _rt::string_lift(bytes153)
4724 };
4725 V158::PrimString(e158)
4726 }
4727 n => {
4728 debug_assert_eq!(n, 21, "invalid enum discriminant");
4729 let e158 = {
4730 let l154 = *base.add(8).cast::<*mut u8>();
4731 let l155 = *base.add(12).cast::<usize>();
4732 let len156 = l155;
4733 let bytes156 = _rt::Vec::from_raw_parts(
4734 l154.cast(),
4735 len156,
4736 len156,
4737 );
4738 let l157 = *base.add(16).cast::<i64>();
4739 (
4740 super::super::super::golem::rpc::types::Uri {
4741 value: _rt::string_lift(bytes156),
4742 },
4743 l157 as u64,
4744 )
4745 };
4746 V158::Handle(e158)
4747 }
4748 };
4749 v158
4750 };
4751 result159.push(e159);
4752 }
4753 _rt::cabi_dealloc(base159, len159 * 24, 8);
4754 let l160 = i32::from(*base.add(48).cast::<u8>());
4755 let v163 = match l160 {
4756 0 => WrappedFunctionType::ReadLocal,
4757 1 => WrappedFunctionType::WriteLocal,
4758 2 => WrappedFunctionType::ReadRemote,
4759 3 => WrappedFunctionType::WriteRemote,
4760 n => {
4761 debug_assert_eq!(n, 4, "invalid enum discriminant");
4762 let e163 = {
4763 let l161 = i32::from(*base.add(56).cast::<u8>());
4764 match l161 {
4765 0 => None,
4766 1 => {
4767 let e = {
4768 let l162 = *base.add(64).cast::<i64>();
4769 l162 as u64
4770 };
4771 Some(e)
4772 }
4773 _ => _rt::invalid_enum_discriminant(),
4774 }
4775 };
4776 WrappedFunctionType::WriteRemoteBatched(e163)
4777 }
4778 };
4779 ImportedFunctionInvokedParameters {
4780 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
4781 seconds: l59 as u64,
4782 nanoseconds: l60 as u32,
4783 },
4784 function_name: _rt::string_lift(bytes63),
4785 request: super::super::super::golem::rpc::types::WitValue {
4786 nodes: result111,
4787 },
4788 response: super::super::super::golem::rpc::types::WitValue {
4789 nodes: result159,
4790 },
4791 wrapped_function_type: v163,
4792 }
4793 };
4794 OplogEntry::ImportedFunctionInvoked(e620)
4795 }
4796 2 => {
4797 let e620 = {
4798 let l164 = *base.add(8).cast::<i64>();
4799 let l165 = *base.add(16).cast::<i32>();
4800 let l166 = *base.add(24).cast::<*mut u8>();
4801 let l167 = *base.add(28).cast::<usize>();
4802 let len168 = l167;
4803 let bytes168 = _rt::Vec::from_raw_parts(
4804 l166.cast(),
4805 len168,
4806 len168,
4807 );
4808 let l169 = *base.add(32).cast::<*mut u8>();
4809 let l170 = *base.add(36).cast::<usize>();
4810 let base219 = l169;
4811 let len219 = l170;
4812 let mut result219 = _rt::Vec::with_capacity(len219);
4813 for i in 0..len219 {
4814 let base = base219.add(i * 8);
4815 let e219 = {
4816 let l171 = *base.add(0).cast::<*mut u8>();
4817 let l172 = *base.add(4).cast::<usize>();
4818 let base218 = l171;
4819 let len218 = l172;
4820 let mut result218 = _rt::Vec::with_capacity(len218);
4821 for i in 0..len218 {
4822 let base = base218.add(i * 24);
4823 let e218 = {
4824 let l173 = i32::from(*base.add(0).cast::<u8>());
4825 use super::super::super::golem::rpc::types::WitNode as V217;
4826 let v217 = match l173 {
4827 0 => {
4828 let e217 = {
4829 let l174 = *base.add(8).cast::<*mut u8>();
4830 let l175 = *base.add(12).cast::<usize>();
4831 let len176 = l175;
4832 _rt::Vec::from_raw_parts(l174.cast(), len176, len176)
4833 };
4834 V217::RecordValue(e217)
4835 }
4836 1 => {
4837 let e217 = {
4838 let l177 = *base.add(8).cast::<i32>();
4839 let l178 = i32::from(*base.add(12).cast::<u8>());
4840 (
4841 l177 as u32,
4842 match l178 {
4843 0 => None,
4844 1 => {
4845 let e = {
4846 let l179 = *base.add(16).cast::<i32>();
4847 l179
4848 };
4849 Some(e)
4850 }
4851 _ => _rt::invalid_enum_discriminant(),
4852 },
4853 )
4854 };
4855 V217::VariantValue(e217)
4856 }
4857 2 => {
4858 let e217 = {
4859 let l180 = *base.add(8).cast::<i32>();
4860 l180 as u32
4861 };
4862 V217::EnumValue(e217)
4863 }
4864 3 => {
4865 let e217 = {
4866 let l181 = *base.add(8).cast::<*mut u8>();
4867 let l182 = *base.add(12).cast::<usize>();
4868 let base184 = l181;
4869 let len184 = l182;
4870 let mut result184 = _rt::Vec::with_capacity(len184);
4871 for i in 0..len184 {
4872 let base = base184.add(i * 1);
4873 let e184 = {
4874 let l183 = i32::from(*base.add(0).cast::<u8>());
4875 _rt::bool_lift(l183 as u8)
4876 };
4877 result184.push(e184);
4878 }
4879 _rt::cabi_dealloc(base184, len184 * 1, 1);
4880 result184
4881 };
4882 V217::FlagsValue(e217)
4883 }
4884 4 => {
4885 let e217 = {
4886 let l185 = *base.add(8).cast::<*mut u8>();
4887 let l186 = *base.add(12).cast::<usize>();
4888 let len187 = l186;
4889 _rt::Vec::from_raw_parts(l185.cast(), len187, len187)
4890 };
4891 V217::TupleValue(e217)
4892 }
4893 5 => {
4894 let e217 = {
4895 let l188 = *base.add(8).cast::<*mut u8>();
4896 let l189 = *base.add(12).cast::<usize>();
4897 let len190 = l189;
4898 _rt::Vec::from_raw_parts(l188.cast(), len190, len190)
4899 };
4900 V217::ListValue(e217)
4901 }
4902 6 => {
4903 let e217 = {
4904 let l191 = i32::from(*base.add(8).cast::<u8>());
4905 match l191 {
4906 0 => None,
4907 1 => {
4908 let e = {
4909 let l192 = *base.add(12).cast::<i32>();
4910 l192
4911 };
4912 Some(e)
4913 }
4914 _ => _rt::invalid_enum_discriminant(),
4915 }
4916 };
4917 V217::OptionValue(e217)
4918 }
4919 7 => {
4920 let e217 = {
4921 let l193 = i32::from(*base.add(8).cast::<u8>());
4922 match l193 {
4923 0 => {
4924 let e = {
4925 let l194 = i32::from(*base.add(12).cast::<u8>());
4926 match l194 {
4927 0 => None,
4928 1 => {
4929 let e = {
4930 let l195 = *base.add(16).cast::<i32>();
4931 l195
4932 };
4933 Some(e)
4934 }
4935 _ => _rt::invalid_enum_discriminant(),
4936 }
4937 };
4938 Ok(e)
4939 }
4940 1 => {
4941 let e = {
4942 let l196 = i32::from(*base.add(12).cast::<u8>());
4943 match l196 {
4944 0 => None,
4945 1 => {
4946 let e = {
4947 let l197 = *base.add(16).cast::<i32>();
4948 l197
4949 };
4950 Some(e)
4951 }
4952 _ => _rt::invalid_enum_discriminant(),
4953 }
4954 };
4955 Err(e)
4956 }
4957 _ => _rt::invalid_enum_discriminant(),
4958 }
4959 };
4960 V217::ResultValue(e217)
4961 }
4962 8 => {
4963 let e217 = {
4964 let l198 = i32::from(*base.add(8).cast::<u8>());
4965 l198 as u8
4966 };
4967 V217::PrimU8(e217)
4968 }
4969 9 => {
4970 let e217 = {
4971 let l199 = i32::from(*base.add(8).cast::<u16>());
4972 l199 as u16
4973 };
4974 V217::PrimU16(e217)
4975 }
4976 10 => {
4977 let e217 = {
4978 let l200 = *base.add(8).cast::<i32>();
4979 l200 as u32
4980 };
4981 V217::PrimU32(e217)
4982 }
4983 11 => {
4984 let e217 = {
4985 let l201 = *base.add(8).cast::<i64>();
4986 l201 as u64
4987 };
4988 V217::PrimU64(e217)
4989 }
4990 12 => {
4991 let e217 = {
4992 let l202 = i32::from(*base.add(8).cast::<i8>());
4993 l202 as i8
4994 };
4995 V217::PrimS8(e217)
4996 }
4997 13 => {
4998 let e217 = {
4999 let l203 = i32::from(*base.add(8).cast::<i16>());
5000 l203 as i16
5001 };
5002 V217::PrimS16(e217)
5003 }
5004 14 => {
5005 let e217 = {
5006 let l204 = *base.add(8).cast::<i32>();
5007 l204
5008 };
5009 V217::PrimS32(e217)
5010 }
5011 15 => {
5012 let e217 = {
5013 let l205 = *base.add(8).cast::<i64>();
5014 l205
5015 };
5016 V217::PrimS64(e217)
5017 }
5018 16 => {
5019 let e217 = {
5020 let l206 = *base.add(8).cast::<f32>();
5021 l206
5022 };
5023 V217::PrimFloat32(e217)
5024 }
5025 17 => {
5026 let e217 = {
5027 let l207 = *base.add(8).cast::<f64>();
5028 l207
5029 };
5030 V217::PrimFloat64(e217)
5031 }
5032 18 => {
5033 let e217 = {
5034 let l208 = *base.add(8).cast::<i32>();
5035 _rt::char_lift(l208 as u32)
5036 };
5037 V217::PrimChar(e217)
5038 }
5039 19 => {
5040 let e217 = {
5041 let l209 = i32::from(*base.add(8).cast::<u8>());
5042 _rt::bool_lift(l209 as u8)
5043 };
5044 V217::PrimBool(e217)
5045 }
5046 20 => {
5047 let e217 = {
5048 let l210 = *base.add(8).cast::<*mut u8>();
5049 let l211 = *base.add(12).cast::<usize>();
5050 let len212 = l211;
5051 let bytes212 = _rt::Vec::from_raw_parts(
5052 l210.cast(),
5053 len212,
5054 len212,
5055 );
5056 _rt::string_lift(bytes212)
5057 };
5058 V217::PrimString(e217)
5059 }
5060 n => {
5061 debug_assert_eq!(n, 21, "invalid enum discriminant");
5062 let e217 = {
5063 let l213 = *base.add(8).cast::<*mut u8>();
5064 let l214 = *base.add(12).cast::<usize>();
5065 let len215 = l214;
5066 let bytes215 = _rt::Vec::from_raw_parts(
5067 l213.cast(),
5068 len215,
5069 len215,
5070 );
5071 let l216 = *base.add(16).cast::<i64>();
5072 (
5073 super::super::super::golem::rpc::types::Uri {
5074 value: _rt::string_lift(bytes215),
5075 },
5076 l216 as u64,
5077 )
5078 };
5079 V217::Handle(e217)
5080 }
5081 };
5082 v217
5083 };
5084 result218.push(e218);
5085 }
5086 _rt::cabi_dealloc(base218, len218 * 24, 8);
5087 super::super::super::golem::rpc::types::WitValue {
5088 nodes: result218,
5089 }
5090 };
5091 result219.push(e219);
5092 }
5093 _rt::cabi_dealloc(base219, len219 * 8, 4);
5094 let l220 = *base.add(40).cast::<*mut u8>();
5095 let l221 = *base.add(44).cast::<usize>();
5096 let len222 = l221;
5097 let bytes222 = _rt::Vec::from_raw_parts(
5098 l220.cast(),
5099 len222,
5100 len222,
5101 );
5102 let l223 = *base.add(48).cast::<*mut u8>();
5103 let l224 = *base.add(52).cast::<usize>();
5104 let len225 = l224;
5105 let bytes225 = _rt::Vec::from_raw_parts(
5106 l223.cast(),
5107 len225,
5108 len225,
5109 );
5110 let l226 = *base.add(56).cast::<*mut u8>();
5111 let l227 = *base.add(60).cast::<usize>();
5112 let base231 = l226;
5113 let len231 = l227;
5114 let mut result231 = _rt::Vec::with_capacity(len231);
5115 for i in 0..len231 {
5116 let base = base231.add(i * 8);
5117 let e231 = {
5118 let l228 = *base.add(0).cast::<*mut u8>();
5119 let l229 = *base.add(4).cast::<usize>();
5120 let len230 = l229;
5121 let bytes230 = _rt::Vec::from_raw_parts(
5122 l228.cast(),
5123 len230,
5124 len230,
5125 );
5126 _rt::string_lift(bytes230)
5127 };
5128 result231.push(e231);
5129 }
5130 _rt::cabi_dealloc(base231, len231 * 8, 4);
5131 let l232 = *base.add(64).cast::<*mut u8>();
5132 let l233 = *base.add(68).cast::<usize>();
5133 let base265 = l232;
5134 let len265 = l233;
5135 let mut result265 = _rt::Vec::with_capacity(len265);
5136 for i in 0..len265 {
5137 let base = base265.add(i * 8);
5138 let e265 = {
5139 let l234 = *base.add(0).cast::<*mut u8>();
5140 let l235 = *base.add(4).cast::<usize>();
5141 let base264 = l234;
5142 let len264 = l235;
5143 let mut result264 = _rt::Vec::with_capacity(len264);
5144 for i in 0..len264 {
5145 let base = base264.add(i * 80);
5146 let e264 = {
5147 let l236 = i32::from(*base.add(0).cast::<u8>());
5148 let v263 = match l236 {
5149 0 => {
5150 let e263 = {
5151 let l237 = *base.add(8).cast::<*mut u8>();
5152 let l238 = *base.add(12).cast::<usize>();
5153 let len239 = l238;
5154 let bytes239 = _rt::Vec::from_raw_parts(
5155 l237.cast(),
5156 len239,
5157 len239,
5158 );
5159 let l240 = *base.add(16).cast::<i64>();
5160 let l241 = *base.add(24).cast::<i32>();
5161 let l242 = i32::from(*base.add(32).cast::<u8>());
5162 let l246 = i32::from(*base.add(48).cast::<u8>());
5163 let l248 = *base.add(64).cast::<*mut u8>();
5164 let l249 = *base.add(68).cast::<usize>();
5165 let base258 = l248;
5166 let len258 = l249;
5167 let mut result258 = _rt::Vec::with_capacity(len258);
5168 for i in 0..len258 {
5169 let base = base258.add(i * 20);
5170 let e258 = {
5171 let l250 = *base.add(0).cast::<*mut u8>();
5172 let l251 = *base.add(4).cast::<usize>();
5173 let len252 = l251;
5174 let bytes252 = _rt::Vec::from_raw_parts(
5175 l250.cast(),
5176 len252,
5177 len252,
5178 );
5179 let l253 = i32::from(*base.add(8).cast::<u8>());
5180 use super::super::super::golem::api::context::AttributeValue as V257;
5181 let v257 = match l253 {
5182 n => {
5183 debug_assert_eq!(n, 0, "invalid enum discriminant");
5184 let e257 = {
5185 let l254 = *base.add(12).cast::<*mut u8>();
5186 let l255 = *base.add(16).cast::<usize>();
5187 let len256 = l255;
5188 let bytes256 = _rt::Vec::from_raw_parts(
5189 l254.cast(),
5190 len256,
5191 len256,
5192 );
5193 _rt::string_lift(bytes256)
5194 };
5195 V257::String(e257)
5196 }
5197 };
5198 super::super::super::golem::api::context::Attribute {
5199 key: _rt::string_lift(bytes252),
5200 value: v257,
5201 }
5202 };
5203 result258.push(e258);
5204 }
5205 _rt::cabi_dealloc(base258, len258 * 20, 4);
5206 let l259 = i32::from(*base.add(72).cast::<u8>());
5207 LocalSpanData {
5208 span_id: _rt::string_lift(bytes239),
5209 start: super::super::super::wasi::clocks::wall_clock::Datetime {
5210 seconds: l240 as u64,
5211 nanoseconds: l241 as u32,
5212 },
5213 parent: match l242 {
5214 0 => None,
5215 1 => {
5216 let e = {
5217 let l243 = *base.add(36).cast::<*mut u8>();
5218 let l244 = *base.add(40).cast::<usize>();
5219 let len245 = l244;
5220 let bytes245 = _rt::Vec::from_raw_parts(
5221 l243.cast(),
5222 len245,
5223 len245,
5224 );
5225 _rt::string_lift(bytes245)
5226 };
5227 Some(e)
5228 }
5229 _ => _rt::invalid_enum_discriminant(),
5230 },
5231 linked_context: match l246 {
5232 0 => None,
5233 1 => {
5234 let e = {
5235 let l247 = *base.add(56).cast::<i64>();
5236 l247 as u64
5237 };
5238 Some(e)
5239 }
5240 _ => _rt::invalid_enum_discriminant(),
5241 },
5242 attributes: result258,
5243 inherited: _rt::bool_lift(l259 as u8),
5244 }
5245 };
5246 SpanData::LocalSpan(e263)
5247 }
5248 n => {
5249 debug_assert_eq!(n, 1, "invalid enum discriminant");
5250 let e263 = {
5251 let l260 = *base.add(8).cast::<*mut u8>();
5252 let l261 = *base.add(12).cast::<usize>();
5253 let len262 = l261;
5254 let bytes262 = _rt::Vec::from_raw_parts(
5255 l260.cast(),
5256 len262,
5257 len262,
5258 );
5259 ExternalSpanData {
5260 span_id: _rt::string_lift(bytes262),
5261 }
5262 };
5263 SpanData::ExternalSpan(e263)
5264 }
5265 };
5266 v263
5267 };
5268 result264.push(e264);
5269 }
5270 _rt::cabi_dealloc(base264, len264 * 80, 8);
5271 result264
5272 };
5273 result265.push(e265);
5274 }
5275 _rt::cabi_dealloc(base265, len265 * 8, 4);
5276 ExportedFunctionInvokedParameters {
5277 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
5278 seconds: l164 as u64,
5279 nanoseconds: l165 as u32,
5280 },
5281 function_name: _rt::string_lift(bytes168),
5282 request: result219,
5283 idempotency_key: _rt::string_lift(bytes222),
5284 trace_id: _rt::string_lift(bytes225),
5285 trace_states: result231,
5286 invocation_context: result265,
5287 }
5288 };
5289 OplogEntry::ExportedFunctionInvoked(e620)
5290 }
5291 3 => {
5292 let e620 = {
5293 let l266 = *base.add(8).cast::<i64>();
5294 let l267 = *base.add(16).cast::<i32>();
5295 let l268 = *base.add(24).cast::<*mut u8>();
5296 let l269 = *base.add(28).cast::<usize>();
5297 let base315 = l268;
5298 let len315 = l269;
5299 let mut result315 = _rt::Vec::with_capacity(len315);
5300 for i in 0..len315 {
5301 let base = base315.add(i * 24);
5302 let e315 = {
5303 let l270 = i32::from(*base.add(0).cast::<u8>());
5304 use super::super::super::golem::rpc::types::WitNode as V314;
5305 let v314 = match l270 {
5306 0 => {
5307 let e314 = {
5308 let l271 = *base.add(8).cast::<*mut u8>();
5309 let l272 = *base.add(12).cast::<usize>();
5310 let len273 = l272;
5311 _rt::Vec::from_raw_parts(l271.cast(), len273, len273)
5312 };
5313 V314::RecordValue(e314)
5314 }
5315 1 => {
5316 let e314 = {
5317 let l274 = *base.add(8).cast::<i32>();
5318 let l275 = i32::from(*base.add(12).cast::<u8>());
5319 (
5320 l274 as u32,
5321 match l275 {
5322 0 => None,
5323 1 => {
5324 let e = {
5325 let l276 = *base.add(16).cast::<i32>();
5326 l276
5327 };
5328 Some(e)
5329 }
5330 _ => _rt::invalid_enum_discriminant(),
5331 },
5332 )
5333 };
5334 V314::VariantValue(e314)
5335 }
5336 2 => {
5337 let e314 = {
5338 let l277 = *base.add(8).cast::<i32>();
5339 l277 as u32
5340 };
5341 V314::EnumValue(e314)
5342 }
5343 3 => {
5344 let e314 = {
5345 let l278 = *base.add(8).cast::<*mut u8>();
5346 let l279 = *base.add(12).cast::<usize>();
5347 let base281 = l278;
5348 let len281 = l279;
5349 let mut result281 = _rt::Vec::with_capacity(len281);
5350 for i in 0..len281 {
5351 let base = base281.add(i * 1);
5352 let e281 = {
5353 let l280 = i32::from(*base.add(0).cast::<u8>());
5354 _rt::bool_lift(l280 as u8)
5355 };
5356 result281.push(e281);
5357 }
5358 _rt::cabi_dealloc(base281, len281 * 1, 1);
5359 result281
5360 };
5361 V314::FlagsValue(e314)
5362 }
5363 4 => {
5364 let e314 = {
5365 let l282 = *base.add(8).cast::<*mut u8>();
5366 let l283 = *base.add(12).cast::<usize>();
5367 let len284 = l283;
5368 _rt::Vec::from_raw_parts(l282.cast(), len284, len284)
5369 };
5370 V314::TupleValue(e314)
5371 }
5372 5 => {
5373 let e314 = {
5374 let l285 = *base.add(8).cast::<*mut u8>();
5375 let l286 = *base.add(12).cast::<usize>();
5376 let len287 = l286;
5377 _rt::Vec::from_raw_parts(l285.cast(), len287, len287)
5378 };
5379 V314::ListValue(e314)
5380 }
5381 6 => {
5382 let e314 = {
5383 let l288 = i32::from(*base.add(8).cast::<u8>());
5384 match l288 {
5385 0 => None,
5386 1 => {
5387 let e = {
5388 let l289 = *base.add(12).cast::<i32>();
5389 l289
5390 };
5391 Some(e)
5392 }
5393 _ => _rt::invalid_enum_discriminant(),
5394 }
5395 };
5396 V314::OptionValue(e314)
5397 }
5398 7 => {
5399 let e314 = {
5400 let l290 = i32::from(*base.add(8).cast::<u8>());
5401 match l290 {
5402 0 => {
5403 let e = {
5404 let l291 = i32::from(*base.add(12).cast::<u8>());
5405 match l291 {
5406 0 => None,
5407 1 => {
5408 let e = {
5409 let l292 = *base.add(16).cast::<i32>();
5410 l292
5411 };
5412 Some(e)
5413 }
5414 _ => _rt::invalid_enum_discriminant(),
5415 }
5416 };
5417 Ok(e)
5418 }
5419 1 => {
5420 let e = {
5421 let l293 = i32::from(*base.add(12).cast::<u8>());
5422 match l293 {
5423 0 => None,
5424 1 => {
5425 let e = {
5426 let l294 = *base.add(16).cast::<i32>();
5427 l294
5428 };
5429 Some(e)
5430 }
5431 _ => _rt::invalid_enum_discriminant(),
5432 }
5433 };
5434 Err(e)
5435 }
5436 _ => _rt::invalid_enum_discriminant(),
5437 }
5438 };
5439 V314::ResultValue(e314)
5440 }
5441 8 => {
5442 let e314 = {
5443 let l295 = i32::from(*base.add(8).cast::<u8>());
5444 l295 as u8
5445 };
5446 V314::PrimU8(e314)
5447 }
5448 9 => {
5449 let e314 = {
5450 let l296 = i32::from(*base.add(8).cast::<u16>());
5451 l296 as u16
5452 };
5453 V314::PrimU16(e314)
5454 }
5455 10 => {
5456 let e314 = {
5457 let l297 = *base.add(8).cast::<i32>();
5458 l297 as u32
5459 };
5460 V314::PrimU32(e314)
5461 }
5462 11 => {
5463 let e314 = {
5464 let l298 = *base.add(8).cast::<i64>();
5465 l298 as u64
5466 };
5467 V314::PrimU64(e314)
5468 }
5469 12 => {
5470 let e314 = {
5471 let l299 = i32::from(*base.add(8).cast::<i8>());
5472 l299 as i8
5473 };
5474 V314::PrimS8(e314)
5475 }
5476 13 => {
5477 let e314 = {
5478 let l300 = i32::from(*base.add(8).cast::<i16>());
5479 l300 as i16
5480 };
5481 V314::PrimS16(e314)
5482 }
5483 14 => {
5484 let e314 = {
5485 let l301 = *base.add(8).cast::<i32>();
5486 l301
5487 };
5488 V314::PrimS32(e314)
5489 }
5490 15 => {
5491 let e314 = {
5492 let l302 = *base.add(8).cast::<i64>();
5493 l302
5494 };
5495 V314::PrimS64(e314)
5496 }
5497 16 => {
5498 let e314 = {
5499 let l303 = *base.add(8).cast::<f32>();
5500 l303
5501 };
5502 V314::PrimFloat32(e314)
5503 }
5504 17 => {
5505 let e314 = {
5506 let l304 = *base.add(8).cast::<f64>();
5507 l304
5508 };
5509 V314::PrimFloat64(e314)
5510 }
5511 18 => {
5512 let e314 = {
5513 let l305 = *base.add(8).cast::<i32>();
5514 _rt::char_lift(l305 as u32)
5515 };
5516 V314::PrimChar(e314)
5517 }
5518 19 => {
5519 let e314 = {
5520 let l306 = i32::from(*base.add(8).cast::<u8>());
5521 _rt::bool_lift(l306 as u8)
5522 };
5523 V314::PrimBool(e314)
5524 }
5525 20 => {
5526 let e314 = {
5527 let l307 = *base.add(8).cast::<*mut u8>();
5528 let l308 = *base.add(12).cast::<usize>();
5529 let len309 = l308;
5530 let bytes309 = _rt::Vec::from_raw_parts(
5531 l307.cast(),
5532 len309,
5533 len309,
5534 );
5535 _rt::string_lift(bytes309)
5536 };
5537 V314::PrimString(e314)
5538 }
5539 n => {
5540 debug_assert_eq!(n, 21, "invalid enum discriminant");
5541 let e314 = {
5542 let l310 = *base.add(8).cast::<*mut u8>();
5543 let l311 = *base.add(12).cast::<usize>();
5544 let len312 = l311;
5545 let bytes312 = _rt::Vec::from_raw_parts(
5546 l310.cast(),
5547 len312,
5548 len312,
5549 );
5550 let l313 = *base.add(16).cast::<i64>();
5551 (
5552 super::super::super::golem::rpc::types::Uri {
5553 value: _rt::string_lift(bytes312),
5554 },
5555 l313 as u64,
5556 )
5557 };
5558 V314::Handle(e314)
5559 }
5560 };
5561 v314
5562 };
5563 result315.push(e315);
5564 }
5565 _rt::cabi_dealloc(base315, len315 * 24, 8);
5566 let l316 = *base.add(32).cast::<i64>();
5567 ExportedFunctionCompletedParameters {
5568 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
5569 seconds: l266 as u64,
5570 nanoseconds: l267 as u32,
5571 },
5572 response: super::super::super::golem::rpc::types::WitValue {
5573 nodes: result315,
5574 },
5575 consumed_fuel: l316,
5576 }
5577 };
5578 OplogEntry::ExportedFunctionCompleted(e620)
5579 }
5580 4 => {
5581 let e620 = {
5582 let l317 = *base.add(8).cast::<i64>();
5583 let l318 = *base.add(16).cast::<i32>();
5584 super::super::super::wasi::clocks::wall_clock::Datetime {
5585 seconds: l317 as u64,
5586 nanoseconds: l318 as u32,
5587 }
5588 };
5589 OplogEntry::Suspend(e620)
5590 }
5591 5 => {
5592 let e620 = {
5593 let l319 = *base.add(8).cast::<i64>();
5594 let l320 = *base.add(16).cast::<i32>();
5595 let l321 = *base.add(24).cast::<*mut u8>();
5596 let l322 = *base.add(28).cast::<usize>();
5597 let len323 = l322;
5598 let bytes323 = _rt::Vec::from_raw_parts(
5599 l321.cast(),
5600 len323,
5601 len323,
5602 );
5603 ErrorParameters {
5604 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
5605 seconds: l319 as u64,
5606 nanoseconds: l320 as u32,
5607 },
5608 error: _rt::string_lift(bytes323),
5609 }
5610 };
5611 OplogEntry::Error(e620)
5612 }
5613 6 => {
5614 let e620 = {
5615 let l324 = *base.add(8).cast::<i64>();
5616 let l325 = *base.add(16).cast::<i32>();
5617 super::super::super::wasi::clocks::wall_clock::Datetime {
5618 seconds: l324 as u64,
5619 nanoseconds: l325 as u32,
5620 }
5621 };
5622 OplogEntry::NoOp(e620)
5623 }
5624 7 => {
5625 let e620 = {
5626 let l326 = *base.add(8).cast::<i64>();
5627 let l327 = *base.add(16).cast::<i32>();
5628 let l328 = *base.add(24).cast::<i64>();
5629 let l329 = *base.add(32).cast::<i64>();
5630 JumpParameters {
5631 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
5632 seconds: l326 as u64,
5633 nanoseconds: l327 as u32,
5634 },
5635 start: l328 as u64,
5636 end: l329 as u64,
5637 }
5638 };
5639 OplogEntry::Jump(e620)
5640 }
5641 8 => {
5642 let e620 = {
5643 let l330 = *base.add(8).cast::<i64>();
5644 let l331 = *base.add(16).cast::<i32>();
5645 super::super::super::wasi::clocks::wall_clock::Datetime {
5646 seconds: l330 as u64,
5647 nanoseconds: l331 as u32,
5648 }
5649 };
5650 OplogEntry::Interrupted(e620)
5651 }
5652 9 => {
5653 let e620 = {
5654 let l332 = *base.add(8).cast::<i64>();
5655 let l333 = *base.add(16).cast::<i32>();
5656 super::super::super::wasi::clocks::wall_clock::Datetime {
5657 seconds: l332 as u64,
5658 nanoseconds: l333 as u32,
5659 }
5660 };
5661 OplogEntry::Exited(e620)
5662 }
5663 10 => {
5664 let e620 = {
5665 let l334 = *base.add(8).cast::<i64>();
5666 let l335 = *base.add(16).cast::<i32>();
5667 let l336 = *base.add(24).cast::<i32>();
5668 let l337 = *base.add(32).cast::<i64>();
5669 let l338 = *base.add(40).cast::<i64>();
5670 let l339 = *base.add(48).cast::<f64>();
5671 let l340 = i32::from(*base.add(56).cast::<u8>());
5672 ChangeRetryPolicyParameters {
5673 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
5674 seconds: l334 as u64,
5675 nanoseconds: l335 as u32,
5676 },
5677 retry_policy: super::super::super::golem::api::host::RetryPolicy {
5678 max_attempts: l336 as u32,
5679 min_delay: l337 as u64,
5680 max_delay: l338 as u64,
5681 multiplier: l339,
5682 max_jitter_factor: match l340 {
5683 0 => None,
5684 1 => {
5685 let e = {
5686 let l341 = *base.add(64).cast::<f64>();
5687 l341
5688 };
5689 Some(e)
5690 }
5691 _ => _rt::invalid_enum_discriminant(),
5692 },
5693 },
5694 }
5695 };
5696 OplogEntry::ChangeRetryPolicy(e620)
5697 }
5698 11 => {
5699 let e620 = {
5700 let l342 = *base.add(8).cast::<i64>();
5701 let l343 = *base.add(16).cast::<i32>();
5702 super::super::super::wasi::clocks::wall_clock::Datetime {
5703 seconds: l342 as u64,
5704 nanoseconds: l343 as u32,
5705 }
5706 };
5707 OplogEntry::BeginAtomicRegion(e620)
5708 }
5709 12 => {
5710 let e620 = {
5711 let l344 = *base.add(8).cast::<i64>();
5712 let l345 = *base.add(16).cast::<i32>();
5713 let l346 = *base.add(24).cast::<i64>();
5714 EndAtomicRegionParameters {
5715 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
5716 seconds: l344 as u64,
5717 nanoseconds: l345 as u32,
5718 },
5719 begin_index: l346 as u64,
5720 }
5721 };
5722 OplogEntry::EndAtomicRegion(e620)
5723 }
5724 13 => {
5725 let e620 = {
5726 let l347 = *base.add(8).cast::<i64>();
5727 let l348 = *base.add(16).cast::<i32>();
5728 super::super::super::wasi::clocks::wall_clock::Datetime {
5729 seconds: l347 as u64,
5730 nanoseconds: l348 as u32,
5731 }
5732 };
5733 OplogEntry::BeginRemoteWrite(e620)
5734 }
5735 14 => {
5736 let e620 = {
5737 let l349 = *base.add(8).cast::<i64>();
5738 let l350 = *base.add(16).cast::<i32>();
5739 let l351 = *base.add(24).cast::<i64>();
5740 EndRemoteWriteParameters {
5741 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
5742 seconds: l349 as u64,
5743 nanoseconds: l350 as u32,
5744 },
5745 begin_index: l351 as u64,
5746 }
5747 };
5748 OplogEntry::EndRemoteWrite(e620)
5749 }
5750 15 => {
5751 let e620 = {
5752 let l352 = *base.add(8).cast::<i64>();
5753 let l353 = *base.add(16).cast::<i32>();
5754 let l354 = i32::from(*base.add(24).cast::<u8>());
5755 let v414 = match l354 {
5756 0 => {
5757 let e414 = {
5758 let l355 = *base.add(32).cast::<*mut u8>();
5759 let l356 = *base.add(36).cast::<usize>();
5760 let len357 = l356;
5761 let bytes357 = _rt::Vec::from_raw_parts(
5762 l355.cast(),
5763 len357,
5764 len357,
5765 );
5766 let l358 = *base.add(40).cast::<*mut u8>();
5767 let l359 = *base.add(44).cast::<usize>();
5768 let len360 = l359;
5769 let bytes360 = _rt::Vec::from_raw_parts(
5770 l358.cast(),
5771 len360,
5772 len360,
5773 );
5774 let l361 = i32::from(*base.add(48).cast::<u8>());
5775 ExportedFunctionInvocationParameters {
5776 idempotency_key: _rt::string_lift(bytes357),
5777 function_name: _rt::string_lift(bytes360),
5778 input: match l361 {
5779 0 => None,
5780 1 => {
5781 let e = {
5782 let l362 = *base.add(52).cast::<*mut u8>();
5783 let l363 = *base.add(56).cast::<usize>();
5784 let base412 = l362;
5785 let len412 = l363;
5786 let mut result412 = _rt::Vec::with_capacity(len412);
5787 for i in 0..len412 {
5788 let base = base412.add(i * 8);
5789 let e412 = {
5790 let l364 = *base.add(0).cast::<*mut u8>();
5791 let l365 = *base.add(4).cast::<usize>();
5792 let base411 = l364;
5793 let len411 = l365;
5794 let mut result411 = _rt::Vec::with_capacity(len411);
5795 for i in 0..len411 {
5796 let base = base411.add(i * 24);
5797 let e411 = {
5798 let l366 = i32::from(*base.add(0).cast::<u8>());
5799 use super::super::super::golem::rpc::types::WitNode as V410;
5800 let v410 = match l366 {
5801 0 => {
5802 let e410 = {
5803 let l367 = *base.add(8).cast::<*mut u8>();
5804 let l368 = *base.add(12).cast::<usize>();
5805 let len369 = l368;
5806 _rt::Vec::from_raw_parts(l367.cast(), len369, len369)
5807 };
5808 V410::RecordValue(e410)
5809 }
5810 1 => {
5811 let e410 = {
5812 let l370 = *base.add(8).cast::<i32>();
5813 let l371 = i32::from(*base.add(12).cast::<u8>());
5814 (
5815 l370 as u32,
5816 match l371 {
5817 0 => None,
5818 1 => {
5819 let e = {
5820 let l372 = *base.add(16).cast::<i32>();
5821 l372
5822 };
5823 Some(e)
5824 }
5825 _ => _rt::invalid_enum_discriminant(),
5826 },
5827 )
5828 };
5829 V410::VariantValue(e410)
5830 }
5831 2 => {
5832 let e410 = {
5833 let l373 = *base.add(8).cast::<i32>();
5834 l373 as u32
5835 };
5836 V410::EnumValue(e410)
5837 }
5838 3 => {
5839 let e410 = {
5840 let l374 = *base.add(8).cast::<*mut u8>();
5841 let l375 = *base.add(12).cast::<usize>();
5842 let base377 = l374;
5843 let len377 = l375;
5844 let mut result377 = _rt::Vec::with_capacity(len377);
5845 for i in 0..len377 {
5846 let base = base377.add(i * 1);
5847 let e377 = {
5848 let l376 = i32::from(*base.add(0).cast::<u8>());
5849 _rt::bool_lift(l376 as u8)
5850 };
5851 result377.push(e377);
5852 }
5853 _rt::cabi_dealloc(base377, len377 * 1, 1);
5854 result377
5855 };
5856 V410::FlagsValue(e410)
5857 }
5858 4 => {
5859 let e410 = {
5860 let l378 = *base.add(8).cast::<*mut u8>();
5861 let l379 = *base.add(12).cast::<usize>();
5862 let len380 = l379;
5863 _rt::Vec::from_raw_parts(l378.cast(), len380, len380)
5864 };
5865 V410::TupleValue(e410)
5866 }
5867 5 => {
5868 let e410 = {
5869 let l381 = *base.add(8).cast::<*mut u8>();
5870 let l382 = *base.add(12).cast::<usize>();
5871 let len383 = l382;
5872 _rt::Vec::from_raw_parts(l381.cast(), len383, len383)
5873 };
5874 V410::ListValue(e410)
5875 }
5876 6 => {
5877 let e410 = {
5878 let l384 = i32::from(*base.add(8).cast::<u8>());
5879 match l384 {
5880 0 => None,
5881 1 => {
5882 let e = {
5883 let l385 = *base.add(12).cast::<i32>();
5884 l385
5885 };
5886 Some(e)
5887 }
5888 _ => _rt::invalid_enum_discriminant(),
5889 }
5890 };
5891 V410::OptionValue(e410)
5892 }
5893 7 => {
5894 let e410 = {
5895 let l386 = i32::from(*base.add(8).cast::<u8>());
5896 match l386 {
5897 0 => {
5898 let e = {
5899 let l387 = i32::from(*base.add(12).cast::<u8>());
5900 match l387 {
5901 0 => None,
5902 1 => {
5903 let e = {
5904 let l388 = *base.add(16).cast::<i32>();
5905 l388
5906 };
5907 Some(e)
5908 }
5909 _ => _rt::invalid_enum_discriminant(),
5910 }
5911 };
5912 Ok(e)
5913 }
5914 1 => {
5915 let e = {
5916 let l389 = i32::from(*base.add(12).cast::<u8>());
5917 match l389 {
5918 0 => None,
5919 1 => {
5920 let e = {
5921 let l390 = *base.add(16).cast::<i32>();
5922 l390
5923 };
5924 Some(e)
5925 }
5926 _ => _rt::invalid_enum_discriminant(),
5927 }
5928 };
5929 Err(e)
5930 }
5931 _ => _rt::invalid_enum_discriminant(),
5932 }
5933 };
5934 V410::ResultValue(e410)
5935 }
5936 8 => {
5937 let e410 = {
5938 let l391 = i32::from(*base.add(8).cast::<u8>());
5939 l391 as u8
5940 };
5941 V410::PrimU8(e410)
5942 }
5943 9 => {
5944 let e410 = {
5945 let l392 = i32::from(*base.add(8).cast::<u16>());
5946 l392 as u16
5947 };
5948 V410::PrimU16(e410)
5949 }
5950 10 => {
5951 let e410 = {
5952 let l393 = *base.add(8).cast::<i32>();
5953 l393 as u32
5954 };
5955 V410::PrimU32(e410)
5956 }
5957 11 => {
5958 let e410 = {
5959 let l394 = *base.add(8).cast::<i64>();
5960 l394 as u64
5961 };
5962 V410::PrimU64(e410)
5963 }
5964 12 => {
5965 let e410 = {
5966 let l395 = i32::from(*base.add(8).cast::<i8>());
5967 l395 as i8
5968 };
5969 V410::PrimS8(e410)
5970 }
5971 13 => {
5972 let e410 = {
5973 let l396 = i32::from(*base.add(8).cast::<i16>());
5974 l396 as i16
5975 };
5976 V410::PrimS16(e410)
5977 }
5978 14 => {
5979 let e410 = {
5980 let l397 = *base.add(8).cast::<i32>();
5981 l397
5982 };
5983 V410::PrimS32(e410)
5984 }
5985 15 => {
5986 let e410 = {
5987 let l398 = *base.add(8).cast::<i64>();
5988 l398
5989 };
5990 V410::PrimS64(e410)
5991 }
5992 16 => {
5993 let e410 = {
5994 let l399 = *base.add(8).cast::<f32>();
5995 l399
5996 };
5997 V410::PrimFloat32(e410)
5998 }
5999 17 => {
6000 let e410 = {
6001 let l400 = *base.add(8).cast::<f64>();
6002 l400
6003 };
6004 V410::PrimFloat64(e410)
6005 }
6006 18 => {
6007 let e410 = {
6008 let l401 = *base.add(8).cast::<i32>();
6009 _rt::char_lift(l401 as u32)
6010 };
6011 V410::PrimChar(e410)
6012 }
6013 19 => {
6014 let e410 = {
6015 let l402 = i32::from(*base.add(8).cast::<u8>());
6016 _rt::bool_lift(l402 as u8)
6017 };
6018 V410::PrimBool(e410)
6019 }
6020 20 => {
6021 let e410 = {
6022 let l403 = *base.add(8).cast::<*mut u8>();
6023 let l404 = *base.add(12).cast::<usize>();
6024 let len405 = l404;
6025 let bytes405 = _rt::Vec::from_raw_parts(
6026 l403.cast(),
6027 len405,
6028 len405,
6029 );
6030 _rt::string_lift(bytes405)
6031 };
6032 V410::PrimString(e410)
6033 }
6034 n => {
6035 debug_assert_eq!(n, 21, "invalid enum discriminant");
6036 let e410 = {
6037 let l406 = *base.add(8).cast::<*mut u8>();
6038 let l407 = *base.add(12).cast::<usize>();
6039 let len408 = l407;
6040 let bytes408 = _rt::Vec::from_raw_parts(
6041 l406.cast(),
6042 len408,
6043 len408,
6044 );
6045 let l409 = *base.add(16).cast::<i64>();
6046 (
6047 super::super::super::golem::rpc::types::Uri {
6048 value: _rt::string_lift(bytes408),
6049 },
6050 l409 as u64,
6051 )
6052 };
6053 V410::Handle(e410)
6054 }
6055 };
6056 v410
6057 };
6058 result411.push(e411);
6059 }
6060 _rt::cabi_dealloc(base411, len411 * 24, 8);
6061 super::super::super::golem::rpc::types::WitValue {
6062 nodes: result411,
6063 }
6064 };
6065 result412.push(e412);
6066 }
6067 _rt::cabi_dealloc(base412, len412 * 8, 4);
6068 result412
6069 };
6070 Some(e)
6071 }
6072 _ => _rt::invalid_enum_discriminant(),
6073 },
6074 }
6075 };
6076 WorkerInvocation::ExportedFunction(e414)
6077 }
6078 n => {
6079 debug_assert_eq!(n, 1, "invalid enum discriminant");
6080 let e414 = {
6081 let l413 = *base.add(32).cast::<i64>();
6082 l413 as u64
6083 };
6084 WorkerInvocation::ManualUpdate(e414)
6085 }
6086 };
6087 PendingWorkerInvocationParameters {
6088 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6089 seconds: l352 as u64,
6090 nanoseconds: l353 as u32,
6091 },
6092 invocation: v414,
6093 }
6094 };
6095 OplogEntry::PendingWorkerInvocation(e620)
6096 }
6097 16 => {
6098 let e620 = {
6099 let l415 = *base.add(8).cast::<i64>();
6100 let l416 = *base.add(16).cast::<i32>();
6101 let l417 = *base.add(24).cast::<i64>();
6102 let l418 = i32::from(*base.add(32).cast::<u8>());
6103 let v422 = match l418 {
6104 0 => UpdateDescription::AutoUpdate,
6105 n => {
6106 debug_assert_eq!(n, 1, "invalid enum discriminant");
6107 let e422 = {
6108 let l419 = *base.add(36).cast::<*mut u8>();
6109 let l420 = *base.add(40).cast::<usize>();
6110 let len421 = l420;
6111 _rt::Vec::from_raw_parts(l419.cast(), len421, len421)
6112 };
6113 UpdateDescription::SnapshotBased(e422)
6114 }
6115 };
6116 PendingUpdateParameters {
6117 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6118 seconds: l415 as u64,
6119 nanoseconds: l416 as u32,
6120 },
6121 target_version: l417 as u64,
6122 update_description: v422,
6123 }
6124 };
6125 OplogEntry::PendingUpdate(e620)
6126 }
6127 17 => {
6128 let e620 = {
6129 let l423 = *base.add(8).cast::<i64>();
6130 let l424 = *base.add(16).cast::<i32>();
6131 let l425 = *base.add(24).cast::<i64>();
6132 let l426 = *base.add(32).cast::<i64>();
6133 let l427 = *base.add(40).cast::<*mut u8>();
6134 let l428 = *base.add(44).cast::<usize>();
6135 let base446 = l427;
6136 let len446 = l428;
6137 let mut result446 = _rt::Vec::with_capacity(len446);
6138 for i in 0..len446 {
6139 let base = base446.add(i * 40);
6140 let e446 = {
6141 let l429 = *base.add(0).cast::<i64>();
6142 let l430 = *base.add(8).cast::<i64>();
6143 let l431 = *base.add(16).cast::<*mut u8>();
6144 let l432 = *base.add(20).cast::<usize>();
6145 let len433 = l432;
6146 let bytes433 = _rt::Vec::from_raw_parts(
6147 l431.cast(),
6148 len433,
6149 len433,
6150 );
6151 let l434 = *base.add(24).cast::<*mut u8>();
6152 let l435 = *base.add(28).cast::<usize>();
6153 let len436 = l435;
6154 let bytes436 = _rt::Vec::from_raw_parts(
6155 l434.cast(),
6156 len436,
6157 len436,
6158 );
6159 let l437 = *base.add(32).cast::<*mut u8>();
6160 let l438 = *base.add(36).cast::<usize>();
6161 let base445 = l437;
6162 let len445 = l438;
6163 let mut result445 = _rt::Vec::with_capacity(len445);
6164 for i in 0..len445 {
6165 let base = base445.add(i * 16);
6166 let e445 = {
6167 let l439 = *base.add(0).cast::<*mut u8>();
6168 let l440 = *base.add(4).cast::<usize>();
6169 let len441 = l440;
6170 let bytes441 = _rt::Vec::from_raw_parts(
6171 l439.cast(),
6172 len441,
6173 len441,
6174 );
6175 let l442 = *base.add(8).cast::<*mut u8>();
6176 let l443 = *base.add(12).cast::<usize>();
6177 let len444 = l443;
6178 let bytes444 = _rt::Vec::from_raw_parts(
6179 l442.cast(),
6180 len444,
6181 len444,
6182 );
6183 (_rt::string_lift(bytes441), _rt::string_lift(bytes444))
6184 };
6185 result445.push(e445);
6186 }
6187 _rt::cabi_dealloc(base445, len445 * 16, 4);
6188 PluginInstallationDescription {
6189 installation_id: super::super::super::golem::api::host::Uuid {
6190 high_bits: l429 as u64,
6191 low_bits: l430 as u64,
6192 },
6193 name: _rt::string_lift(bytes433),
6194 version: _rt::string_lift(bytes436),
6195 parameters: result445,
6196 }
6197 };
6198 result446.push(e446);
6199 }
6200 _rt::cabi_dealloc(base446, len446 * 40, 8);
6201 SuccessfulUpdateParameters {
6202 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6203 seconds: l423 as u64,
6204 nanoseconds: l424 as u32,
6205 },
6206 target_version: l425 as u64,
6207 new_component_size: l426 as u64,
6208 new_active_plugins: result446,
6209 }
6210 };
6211 OplogEntry::SuccessfulUpdate(e620)
6212 }
6213 18 => {
6214 let e620 = {
6215 let l447 = *base.add(8).cast::<i64>();
6216 let l448 = *base.add(16).cast::<i32>();
6217 let l449 = *base.add(24).cast::<i64>();
6218 let l450 = i32::from(*base.add(32).cast::<u8>());
6219 FailedUpdateParameters {
6220 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6221 seconds: l447 as u64,
6222 nanoseconds: l448 as u32,
6223 },
6224 target_version: l449 as u64,
6225 details: match l450 {
6226 0 => None,
6227 1 => {
6228 let e = {
6229 let l451 = *base.add(36).cast::<*mut u8>();
6230 let l452 = *base.add(40).cast::<usize>();
6231 let len453 = l452;
6232 let bytes453 = _rt::Vec::from_raw_parts(
6233 l451.cast(),
6234 len453,
6235 len453,
6236 );
6237 _rt::string_lift(bytes453)
6238 };
6239 Some(e)
6240 }
6241 _ => _rt::invalid_enum_discriminant(),
6242 },
6243 }
6244 };
6245 OplogEntry::FailedUpdate(e620)
6246 }
6247 19 => {
6248 let e620 = {
6249 let l454 = *base.add(8).cast::<i64>();
6250 let l455 = *base.add(16).cast::<i32>();
6251 let l456 = *base.add(24).cast::<i64>();
6252 GrowMemoryParameters {
6253 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6254 seconds: l454 as u64,
6255 nanoseconds: l455 as u32,
6256 },
6257 delta: l456 as u64,
6258 }
6259 };
6260 OplogEntry::GrowMemory(e620)
6261 }
6262 20 => {
6263 let e620 = {
6264 let l457 = *base.add(8).cast::<i64>();
6265 let l458 = *base.add(16).cast::<i32>();
6266 let l459 = *base.add(24).cast::<i64>();
6267 CreateResourceParameters {
6268 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6269 seconds: l457 as u64,
6270 nanoseconds: l458 as u32,
6271 },
6272 resource_id: l459 as u64,
6273 }
6274 };
6275 OplogEntry::CreateResource(e620)
6276 }
6277 21 => {
6278 let e620 = {
6279 let l460 = *base.add(8).cast::<i64>();
6280 let l461 = *base.add(16).cast::<i32>();
6281 let l462 = *base.add(24).cast::<i64>();
6282 DropResourceParameters {
6283 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6284 seconds: l460 as u64,
6285 nanoseconds: l461 as u32,
6286 },
6287 resource_id: l462 as u64,
6288 }
6289 };
6290 OplogEntry::DropResource(e620)
6291 }
6292 22 => {
6293 let e620 = {
6294 let l463 = *base.add(8).cast::<i64>();
6295 let l464 = *base.add(16).cast::<i32>();
6296 let l465 = *base.add(24).cast::<i64>();
6297 let l466 = *base.add(32).cast::<*mut u8>();
6298 let l467 = *base.add(36).cast::<usize>();
6299 let len468 = l467;
6300 let bytes468 = _rt::Vec::from_raw_parts(
6301 l466.cast(),
6302 len468,
6303 len468,
6304 );
6305 let l469 = *base.add(40).cast::<*mut u8>();
6306 let l470 = *base.add(44).cast::<usize>();
6307 let base519 = l469;
6308 let len519 = l470;
6309 let mut result519 = _rt::Vec::with_capacity(len519);
6310 for i in 0..len519 {
6311 let base = base519.add(i * 8);
6312 let e519 = {
6313 let l471 = *base.add(0).cast::<*mut u8>();
6314 let l472 = *base.add(4).cast::<usize>();
6315 let base518 = l471;
6316 let len518 = l472;
6317 let mut result518 = _rt::Vec::with_capacity(len518);
6318 for i in 0..len518 {
6319 let base = base518.add(i * 24);
6320 let e518 = {
6321 let l473 = i32::from(*base.add(0).cast::<u8>());
6322 use super::super::super::golem::rpc::types::WitNode as V517;
6323 let v517 = match l473 {
6324 0 => {
6325 let e517 = {
6326 let l474 = *base.add(8).cast::<*mut u8>();
6327 let l475 = *base.add(12).cast::<usize>();
6328 let len476 = l475;
6329 _rt::Vec::from_raw_parts(l474.cast(), len476, len476)
6330 };
6331 V517::RecordValue(e517)
6332 }
6333 1 => {
6334 let e517 = {
6335 let l477 = *base.add(8).cast::<i32>();
6336 let l478 = i32::from(*base.add(12).cast::<u8>());
6337 (
6338 l477 as u32,
6339 match l478 {
6340 0 => None,
6341 1 => {
6342 let e = {
6343 let l479 = *base.add(16).cast::<i32>();
6344 l479
6345 };
6346 Some(e)
6347 }
6348 _ => _rt::invalid_enum_discriminant(),
6349 },
6350 )
6351 };
6352 V517::VariantValue(e517)
6353 }
6354 2 => {
6355 let e517 = {
6356 let l480 = *base.add(8).cast::<i32>();
6357 l480 as u32
6358 };
6359 V517::EnumValue(e517)
6360 }
6361 3 => {
6362 let e517 = {
6363 let l481 = *base.add(8).cast::<*mut u8>();
6364 let l482 = *base.add(12).cast::<usize>();
6365 let base484 = l481;
6366 let len484 = l482;
6367 let mut result484 = _rt::Vec::with_capacity(len484);
6368 for i in 0..len484 {
6369 let base = base484.add(i * 1);
6370 let e484 = {
6371 let l483 = i32::from(*base.add(0).cast::<u8>());
6372 _rt::bool_lift(l483 as u8)
6373 };
6374 result484.push(e484);
6375 }
6376 _rt::cabi_dealloc(base484, len484 * 1, 1);
6377 result484
6378 };
6379 V517::FlagsValue(e517)
6380 }
6381 4 => {
6382 let e517 = {
6383 let l485 = *base.add(8).cast::<*mut u8>();
6384 let l486 = *base.add(12).cast::<usize>();
6385 let len487 = l486;
6386 _rt::Vec::from_raw_parts(l485.cast(), len487, len487)
6387 };
6388 V517::TupleValue(e517)
6389 }
6390 5 => {
6391 let e517 = {
6392 let l488 = *base.add(8).cast::<*mut u8>();
6393 let l489 = *base.add(12).cast::<usize>();
6394 let len490 = l489;
6395 _rt::Vec::from_raw_parts(l488.cast(), len490, len490)
6396 };
6397 V517::ListValue(e517)
6398 }
6399 6 => {
6400 let e517 = {
6401 let l491 = i32::from(*base.add(8).cast::<u8>());
6402 match l491 {
6403 0 => None,
6404 1 => {
6405 let e = {
6406 let l492 = *base.add(12).cast::<i32>();
6407 l492
6408 };
6409 Some(e)
6410 }
6411 _ => _rt::invalid_enum_discriminant(),
6412 }
6413 };
6414 V517::OptionValue(e517)
6415 }
6416 7 => {
6417 let e517 = {
6418 let l493 = i32::from(*base.add(8).cast::<u8>());
6419 match l493 {
6420 0 => {
6421 let e = {
6422 let l494 = i32::from(*base.add(12).cast::<u8>());
6423 match l494 {
6424 0 => None,
6425 1 => {
6426 let e = {
6427 let l495 = *base.add(16).cast::<i32>();
6428 l495
6429 };
6430 Some(e)
6431 }
6432 _ => _rt::invalid_enum_discriminant(),
6433 }
6434 };
6435 Ok(e)
6436 }
6437 1 => {
6438 let e = {
6439 let l496 = i32::from(*base.add(12).cast::<u8>());
6440 match l496 {
6441 0 => None,
6442 1 => {
6443 let e = {
6444 let l497 = *base.add(16).cast::<i32>();
6445 l497
6446 };
6447 Some(e)
6448 }
6449 _ => _rt::invalid_enum_discriminant(),
6450 }
6451 };
6452 Err(e)
6453 }
6454 _ => _rt::invalid_enum_discriminant(),
6455 }
6456 };
6457 V517::ResultValue(e517)
6458 }
6459 8 => {
6460 let e517 = {
6461 let l498 = i32::from(*base.add(8).cast::<u8>());
6462 l498 as u8
6463 };
6464 V517::PrimU8(e517)
6465 }
6466 9 => {
6467 let e517 = {
6468 let l499 = i32::from(*base.add(8).cast::<u16>());
6469 l499 as u16
6470 };
6471 V517::PrimU16(e517)
6472 }
6473 10 => {
6474 let e517 = {
6475 let l500 = *base.add(8).cast::<i32>();
6476 l500 as u32
6477 };
6478 V517::PrimU32(e517)
6479 }
6480 11 => {
6481 let e517 = {
6482 let l501 = *base.add(8).cast::<i64>();
6483 l501 as u64
6484 };
6485 V517::PrimU64(e517)
6486 }
6487 12 => {
6488 let e517 = {
6489 let l502 = i32::from(*base.add(8).cast::<i8>());
6490 l502 as i8
6491 };
6492 V517::PrimS8(e517)
6493 }
6494 13 => {
6495 let e517 = {
6496 let l503 = i32::from(*base.add(8).cast::<i16>());
6497 l503 as i16
6498 };
6499 V517::PrimS16(e517)
6500 }
6501 14 => {
6502 let e517 = {
6503 let l504 = *base.add(8).cast::<i32>();
6504 l504
6505 };
6506 V517::PrimS32(e517)
6507 }
6508 15 => {
6509 let e517 = {
6510 let l505 = *base.add(8).cast::<i64>();
6511 l505
6512 };
6513 V517::PrimS64(e517)
6514 }
6515 16 => {
6516 let e517 = {
6517 let l506 = *base.add(8).cast::<f32>();
6518 l506
6519 };
6520 V517::PrimFloat32(e517)
6521 }
6522 17 => {
6523 let e517 = {
6524 let l507 = *base.add(8).cast::<f64>();
6525 l507
6526 };
6527 V517::PrimFloat64(e517)
6528 }
6529 18 => {
6530 let e517 = {
6531 let l508 = *base.add(8).cast::<i32>();
6532 _rt::char_lift(l508 as u32)
6533 };
6534 V517::PrimChar(e517)
6535 }
6536 19 => {
6537 let e517 = {
6538 let l509 = i32::from(*base.add(8).cast::<u8>());
6539 _rt::bool_lift(l509 as u8)
6540 };
6541 V517::PrimBool(e517)
6542 }
6543 20 => {
6544 let e517 = {
6545 let l510 = *base.add(8).cast::<*mut u8>();
6546 let l511 = *base.add(12).cast::<usize>();
6547 let len512 = l511;
6548 let bytes512 = _rt::Vec::from_raw_parts(
6549 l510.cast(),
6550 len512,
6551 len512,
6552 );
6553 _rt::string_lift(bytes512)
6554 };
6555 V517::PrimString(e517)
6556 }
6557 n => {
6558 debug_assert_eq!(n, 21, "invalid enum discriminant");
6559 let e517 = {
6560 let l513 = *base.add(8).cast::<*mut u8>();
6561 let l514 = *base.add(12).cast::<usize>();
6562 let len515 = l514;
6563 let bytes515 = _rt::Vec::from_raw_parts(
6564 l513.cast(),
6565 len515,
6566 len515,
6567 );
6568 let l516 = *base.add(16).cast::<i64>();
6569 (
6570 super::super::super::golem::rpc::types::Uri {
6571 value: _rt::string_lift(bytes515),
6572 },
6573 l516 as u64,
6574 )
6575 };
6576 V517::Handle(e517)
6577 }
6578 };
6579 v517
6580 };
6581 result518.push(e518);
6582 }
6583 _rt::cabi_dealloc(base518, len518 * 24, 8);
6584 super::super::super::golem::rpc::types::WitValue {
6585 nodes: result518,
6586 }
6587 };
6588 result519.push(e519);
6589 }
6590 _rt::cabi_dealloc(base519, len519 * 8, 4);
6591 DescribeResourceParameters {
6592 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6593 seconds: l463 as u64,
6594 nanoseconds: l464 as u32,
6595 },
6596 resource_id: l465 as u64,
6597 resource_name: _rt::string_lift(bytes468),
6598 resource_params: result519,
6599 }
6600 };
6601 OplogEntry::DescribeResource(e620)
6602 }
6603 23 => {
6604 let e620 = {
6605 let l520 = *base.add(8).cast::<i64>();
6606 let l521 = *base.add(16).cast::<i32>();
6607 let l522 = i32::from(*base.add(24).cast::<u8>());
6608 let l523 = *base.add(28).cast::<*mut u8>();
6609 let l524 = *base.add(32).cast::<usize>();
6610 let len525 = l524;
6611 let bytes525 = _rt::Vec::from_raw_parts(
6612 l523.cast(),
6613 len525,
6614 len525,
6615 );
6616 let l526 = *base.add(36).cast::<*mut u8>();
6617 let l527 = *base.add(40).cast::<usize>();
6618 let len528 = l527;
6619 let bytes528 = _rt::Vec::from_raw_parts(
6620 l526.cast(),
6621 len528,
6622 len528,
6623 );
6624 LogParameters {
6625 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6626 seconds: l520 as u64,
6627 nanoseconds: l521 as u32,
6628 },
6629 level: LogLevel::_lift(l522 as u8),
6630 context: _rt::string_lift(bytes525),
6631 message: _rt::string_lift(bytes528),
6632 }
6633 };
6634 OplogEntry::Log(e620)
6635 }
6636 24 => {
6637 let e620 = {
6638 let l529 = *base.add(8).cast::<i64>();
6639 let l530 = *base.add(16).cast::<i32>();
6640 super::super::super::wasi::clocks::wall_clock::Datetime {
6641 seconds: l529 as u64,
6642 nanoseconds: l530 as u32,
6643 }
6644 };
6645 OplogEntry::Restart(e620)
6646 }
6647 25 => {
6648 let e620 = {
6649 let l531 = *base.add(8).cast::<i64>();
6650 let l532 = *base.add(16).cast::<i32>();
6651 let l533 = *base.add(24).cast::<i64>();
6652 let l534 = *base.add(32).cast::<i64>();
6653 let l535 = *base.add(40).cast::<*mut u8>();
6654 let l536 = *base.add(44).cast::<usize>();
6655 let len537 = l536;
6656 let bytes537 = _rt::Vec::from_raw_parts(
6657 l535.cast(),
6658 len537,
6659 len537,
6660 );
6661 let l538 = *base.add(48).cast::<*mut u8>();
6662 let l539 = *base.add(52).cast::<usize>();
6663 let len540 = l539;
6664 let bytes540 = _rt::Vec::from_raw_parts(
6665 l538.cast(),
6666 len540,
6667 len540,
6668 );
6669 let l541 = *base.add(56).cast::<*mut u8>();
6670 let l542 = *base.add(60).cast::<usize>();
6671 let base549 = l541;
6672 let len549 = l542;
6673 let mut result549 = _rt::Vec::with_capacity(len549);
6674 for i in 0..len549 {
6675 let base = base549.add(i * 16);
6676 let e549 = {
6677 let l543 = *base.add(0).cast::<*mut u8>();
6678 let l544 = *base.add(4).cast::<usize>();
6679 let len545 = l544;
6680 let bytes545 = _rt::Vec::from_raw_parts(
6681 l543.cast(),
6682 len545,
6683 len545,
6684 );
6685 let l546 = *base.add(8).cast::<*mut u8>();
6686 let l547 = *base.add(12).cast::<usize>();
6687 let len548 = l547;
6688 let bytes548 = _rt::Vec::from_raw_parts(
6689 l546.cast(),
6690 len548,
6691 len548,
6692 );
6693 (_rt::string_lift(bytes545), _rt::string_lift(bytes548))
6694 };
6695 result549.push(e549);
6696 }
6697 _rt::cabi_dealloc(base549, len549 * 16, 4);
6698 ActivatePluginParameters {
6699 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6700 seconds: l531 as u64,
6701 nanoseconds: l532 as u32,
6702 },
6703 plugin: PluginInstallationDescription {
6704 installation_id: super::super::super::golem::api::host::Uuid {
6705 high_bits: l533 as u64,
6706 low_bits: l534 as u64,
6707 },
6708 name: _rt::string_lift(bytes537),
6709 version: _rt::string_lift(bytes540),
6710 parameters: result549,
6711 },
6712 }
6713 };
6714 OplogEntry::ActivatePlugin(e620)
6715 }
6716 26 => {
6717 let e620 = {
6718 let l550 = *base.add(8).cast::<i64>();
6719 let l551 = *base.add(16).cast::<i32>();
6720 let l552 = *base.add(24).cast::<i64>();
6721 let l553 = *base.add(32).cast::<i64>();
6722 let l554 = *base.add(40).cast::<*mut u8>();
6723 let l555 = *base.add(44).cast::<usize>();
6724 let len556 = l555;
6725 let bytes556 = _rt::Vec::from_raw_parts(
6726 l554.cast(),
6727 len556,
6728 len556,
6729 );
6730 let l557 = *base.add(48).cast::<*mut u8>();
6731 let l558 = *base.add(52).cast::<usize>();
6732 let len559 = l558;
6733 let bytes559 = _rt::Vec::from_raw_parts(
6734 l557.cast(),
6735 len559,
6736 len559,
6737 );
6738 let l560 = *base.add(56).cast::<*mut u8>();
6739 let l561 = *base.add(60).cast::<usize>();
6740 let base568 = l560;
6741 let len568 = l561;
6742 let mut result568 = _rt::Vec::with_capacity(len568);
6743 for i in 0..len568 {
6744 let base = base568.add(i * 16);
6745 let e568 = {
6746 let l562 = *base.add(0).cast::<*mut u8>();
6747 let l563 = *base.add(4).cast::<usize>();
6748 let len564 = l563;
6749 let bytes564 = _rt::Vec::from_raw_parts(
6750 l562.cast(),
6751 len564,
6752 len564,
6753 );
6754 let l565 = *base.add(8).cast::<*mut u8>();
6755 let l566 = *base.add(12).cast::<usize>();
6756 let len567 = l566;
6757 let bytes567 = _rt::Vec::from_raw_parts(
6758 l565.cast(),
6759 len567,
6760 len567,
6761 );
6762 (_rt::string_lift(bytes564), _rt::string_lift(bytes567))
6763 };
6764 result568.push(e568);
6765 }
6766 _rt::cabi_dealloc(base568, len568 * 16, 4);
6767 DeactivatePluginParameters {
6768 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6769 seconds: l550 as u64,
6770 nanoseconds: l551 as u32,
6771 },
6772 plugin: PluginInstallationDescription {
6773 installation_id: super::super::super::golem::api::host::Uuid {
6774 high_bits: l552 as u64,
6775 low_bits: l553 as u64,
6776 },
6777 name: _rt::string_lift(bytes556),
6778 version: _rt::string_lift(bytes559),
6779 parameters: result568,
6780 },
6781 }
6782 };
6783 OplogEntry::DeactivatePlugin(e620)
6784 }
6785 27 => {
6786 let e620 = {
6787 let l569 = *base.add(8).cast::<i64>();
6788 let l570 = *base.add(16).cast::<i32>();
6789 let l571 = *base.add(24).cast::<i64>();
6790 let l572 = *base.add(32).cast::<i64>();
6791 RevertParameters {
6792 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6793 seconds: l569 as u64,
6794 nanoseconds: l570 as u32,
6795 },
6796 start: l571 as u64,
6797 end: l572 as u64,
6798 }
6799 };
6800 OplogEntry::Revert(e620)
6801 }
6802 28 => {
6803 let e620 = {
6804 let l573 = *base.add(8).cast::<i64>();
6805 let l574 = *base.add(16).cast::<i32>();
6806 let l575 = *base.add(24).cast::<*mut u8>();
6807 let l576 = *base.add(28).cast::<usize>();
6808 let len577 = l576;
6809 let bytes577 = _rt::Vec::from_raw_parts(
6810 l575.cast(),
6811 len577,
6812 len577,
6813 );
6814 CancelInvocationParameters {
6815 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6816 seconds: l573 as u64,
6817 nanoseconds: l574 as u32,
6818 },
6819 idempotency_key: _rt::string_lift(bytes577),
6820 }
6821 };
6822 OplogEntry::CancelInvocation(e620)
6823 }
6824 29 => {
6825 let e620 = {
6826 let l578 = *base.add(8).cast::<i64>();
6827 let l579 = *base.add(16).cast::<i32>();
6828 let l580 = *base.add(24).cast::<*mut u8>();
6829 let l581 = *base.add(28).cast::<usize>();
6830 let len582 = l581;
6831 let bytes582 = _rt::Vec::from_raw_parts(
6832 l580.cast(),
6833 len582,
6834 len582,
6835 );
6836 let l583 = i32::from(*base.add(32).cast::<u8>());
6837 let l587 = i32::from(*base.add(44).cast::<u8>());
6838 let l591 = *base.add(56).cast::<*mut u8>();
6839 let l592 = *base.add(60).cast::<usize>();
6840 let base601 = l591;
6841 let len601 = l592;
6842 let mut result601 = _rt::Vec::with_capacity(len601);
6843 for i in 0..len601 {
6844 let base = base601.add(i * 20);
6845 let e601 = {
6846 let l593 = *base.add(0).cast::<*mut u8>();
6847 let l594 = *base.add(4).cast::<usize>();
6848 let len595 = l594;
6849 let bytes595 = _rt::Vec::from_raw_parts(
6850 l593.cast(),
6851 len595,
6852 len595,
6853 );
6854 let l596 = i32::from(*base.add(8).cast::<u8>());
6855 use super::super::super::golem::api::context::AttributeValue as V600;
6856 let v600 = match l596 {
6857 n => {
6858 debug_assert_eq!(n, 0, "invalid enum discriminant");
6859 let e600 = {
6860 let l597 = *base.add(12).cast::<*mut u8>();
6861 let l598 = *base.add(16).cast::<usize>();
6862 let len599 = l598;
6863 let bytes599 = _rt::Vec::from_raw_parts(
6864 l597.cast(),
6865 len599,
6866 len599,
6867 );
6868 _rt::string_lift(bytes599)
6869 };
6870 V600::String(e600)
6871 }
6872 };
6873 super::super::super::golem::api::context::Attribute {
6874 key: _rt::string_lift(bytes595),
6875 value: v600,
6876 }
6877 };
6878 result601.push(e601);
6879 }
6880 _rt::cabi_dealloc(base601, len601 * 20, 4);
6881 StartSpanParameters {
6882 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6883 seconds: l578 as u64,
6884 nanoseconds: l579 as u32,
6885 },
6886 span_id: _rt::string_lift(bytes582),
6887 parent: match l583 {
6888 0 => None,
6889 1 => {
6890 let e = {
6891 let l584 = *base.add(36).cast::<*mut u8>();
6892 let l585 = *base.add(40).cast::<usize>();
6893 let len586 = l585;
6894 let bytes586 = _rt::Vec::from_raw_parts(
6895 l584.cast(),
6896 len586,
6897 len586,
6898 );
6899 _rt::string_lift(bytes586)
6900 };
6901 Some(e)
6902 }
6903 _ => _rt::invalid_enum_discriminant(),
6904 },
6905 linked_context: match l587 {
6906 0 => None,
6907 1 => {
6908 let e = {
6909 let l588 = *base.add(48).cast::<*mut u8>();
6910 let l589 = *base.add(52).cast::<usize>();
6911 let len590 = l589;
6912 let bytes590 = _rt::Vec::from_raw_parts(
6913 l588.cast(),
6914 len590,
6915 len590,
6916 );
6917 _rt::string_lift(bytes590)
6918 };
6919 Some(e)
6920 }
6921 _ => _rt::invalid_enum_discriminant(),
6922 },
6923 attributes: result601,
6924 }
6925 };
6926 OplogEntry::StartSpan(e620)
6927 }
6928 30 => {
6929 let e620 = {
6930 let l602 = *base.add(8).cast::<i64>();
6931 let l603 = *base.add(16).cast::<i32>();
6932 let l604 = *base.add(24).cast::<*mut u8>();
6933 let l605 = *base.add(28).cast::<usize>();
6934 let len606 = l605;
6935 let bytes606 = _rt::Vec::from_raw_parts(
6936 l604.cast(),
6937 len606,
6938 len606,
6939 );
6940 FinishSpanParameters {
6941 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6942 seconds: l602 as u64,
6943 nanoseconds: l603 as u32,
6944 },
6945 span_id: _rt::string_lift(bytes606),
6946 }
6947 };
6948 OplogEntry::FinishSpan(e620)
6949 }
6950 n => {
6951 debug_assert_eq!(n, 31, "invalid enum discriminant");
6952 let e620 = {
6953 let l607 = *base.add(8).cast::<i64>();
6954 let l608 = *base.add(16).cast::<i32>();
6955 let l609 = *base.add(24).cast::<*mut u8>();
6956 let l610 = *base.add(28).cast::<usize>();
6957 let len611 = l610;
6958 let bytes611 = _rt::Vec::from_raw_parts(
6959 l609.cast(),
6960 len611,
6961 len611,
6962 );
6963 let l612 = *base.add(32).cast::<*mut u8>();
6964 let l613 = *base.add(36).cast::<usize>();
6965 let len614 = l613;
6966 let bytes614 = _rt::Vec::from_raw_parts(
6967 l612.cast(),
6968 len614,
6969 len614,
6970 );
6971 let l615 = i32::from(*base.add(40).cast::<u8>());
6972 use super::super::super::golem::api::context::AttributeValue as V619;
6973 let v619 = match l615 {
6974 n => {
6975 debug_assert_eq!(n, 0, "invalid enum discriminant");
6976 let e619 = {
6977 let l616 = *base.add(44).cast::<*mut u8>();
6978 let l617 = *base.add(48).cast::<usize>();
6979 let len618 = l617;
6980 let bytes618 = _rt::Vec::from_raw_parts(
6981 l616.cast(),
6982 len618,
6983 len618,
6984 );
6985 _rt::string_lift(bytes618)
6986 };
6987 V619::String(e619)
6988 }
6989 };
6990 SetSpanAttributeParameters {
6991 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
6992 seconds: l607 as u64,
6993 nanoseconds: l608 as u32,
6994 },
6995 span_id: _rt::string_lift(bytes611),
6996 key: _rt::string_lift(bytes614),
6997 value: v619,
6998 }
6999 };
7000 OplogEntry::SetSpanAttribute(e620)
7001 }
7002 };
7003 v620
7004 };
7005 result621.push(e621);
7006 }
7007 _rt::cabi_dealloc(base621, len621 * 136, 8);
7008 result621
7009 };
7010 Some(e)
7011 }
7012 _ => _rt::invalid_enum_discriminant(),
7013 }
7014 }
7015 }
7016 }
7017 impl SearchOplog {
7018 #[allow(unused_unsafe, clippy::all)]
7019 pub fn new(worker_id: &WorkerId, text: &str) -> Self {
7020 unsafe {
7021 let super::super::super::golem::api::host::WorkerId {
7022 component_id: component_id0,
7023 worker_name: worker_name0,
7024 } = worker_id;
7025 let super::super::super::golem::api::host::ComponentId {
7026 uuid: uuid1,
7027 } = component_id0;
7028 let super::super::super::golem::api::host::Uuid {
7029 high_bits: high_bits2,
7030 low_bits: low_bits2,
7031 } = uuid1;
7032 let vec3 = worker_name0;
7033 let ptr3 = vec3.as_ptr().cast::<u8>();
7034 let len3 = vec3.len();
7035 let vec4 = text;
7036 let ptr4 = vec4.as_ptr().cast::<u8>();
7037 let len4 = vec4.len();
7038 #[cfg(target_arch = "wasm32")]
7039 #[link(wasm_import_module = "golem:api/oplog@1.1.5")]
7040 extern "C" {
7041 #[link_name = "[constructor]search-oplog"]
7042 fn wit_import(
7043 _: i64,
7044 _: i64,
7045 _: *mut u8,
7046 _: usize,
7047 _: *mut u8,
7048 _: usize,
7049 ) -> i32;
7050 }
7051 #[cfg(not(target_arch = "wasm32"))]
7052 fn wit_import(
7053 _: i64,
7054 _: i64,
7055 _: *mut u8,
7056 _: usize,
7057 _: *mut u8,
7058 _: usize,
7059 ) -> i32 {
7060 unreachable!()
7061 }
7062 let ret = wit_import(
7063 _rt::as_i64(high_bits2),
7064 _rt::as_i64(low_bits2),
7065 ptr3.cast_mut(),
7066 len3,
7067 ptr4.cast_mut(),
7068 len4,
7069 );
7070 SearchOplog::from_handle(ret as u32)
7071 }
7072 }
7073 }
7074 impl SearchOplog {
7075 #[allow(unused_unsafe, clippy::all)]
7076 pub fn get_next(&self) -> Option<_rt::Vec<(OplogIndex, OplogEntry)>> {
7077 unsafe {
7078 #[repr(align(4))]
7079 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
7080 let mut ret_area = RetArea(
7081 [::core::mem::MaybeUninit::uninit(); 12],
7082 );
7083 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
7084 #[cfg(target_arch = "wasm32")]
7085 #[link(wasm_import_module = "golem:api/oplog@1.1.5")]
7086 extern "C" {
7087 #[link_name = "[method]search-oplog.get-next"]
7088 fn wit_import(_: i32, _: *mut u8);
7089 }
7090 #[cfg(not(target_arch = "wasm32"))]
7091 fn wit_import(_: i32, _: *mut u8) {
7092 unreachable!()
7093 }
7094 wit_import((self).handle() as i32, ptr0);
7095 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
7096 match l1 {
7097 0 => None,
7098 1 => {
7099 let e = {
7100 let l2 = *ptr0.add(4).cast::<*mut u8>();
7101 let l3 = *ptr0.add(8).cast::<usize>();
7102 let base622 = l2;
7103 let len622 = l3;
7104 let mut result622 = _rt::Vec::with_capacity(len622);
7105 for i in 0..len622 {
7106 let base = base622.add(i * 144);
7107 let e622 = {
7108 let l4 = *base.add(0).cast::<i64>();
7109 let l5 = i32::from(*base.add(8).cast::<u8>());
7110 let v621 = match l5 {
7111 0 => {
7112 let e621 = {
7113 let l6 = *base.add(16).cast::<i64>();
7114 let l7 = *base.add(24).cast::<i32>();
7115 let l8 = *base.add(32).cast::<i64>();
7116 let l9 = *base.add(40).cast::<i64>();
7117 let l10 = *base.add(48).cast::<*mut u8>();
7118 let l11 = *base.add(52).cast::<usize>();
7119 let len12 = l11;
7120 let bytes12 = _rt::Vec::from_raw_parts(
7121 l10.cast(),
7122 len12,
7123 len12,
7124 );
7125 let l13 = *base.add(56).cast::<i64>();
7126 let l14 = *base.add(64).cast::<*mut u8>();
7127 let l15 = *base.add(68).cast::<usize>();
7128 let base19 = l14;
7129 let len19 = l15;
7130 let mut result19 = _rt::Vec::with_capacity(len19);
7131 for i in 0..len19 {
7132 let base = base19.add(i * 8);
7133 let e19 = {
7134 let l16 = *base.add(0).cast::<*mut u8>();
7135 let l17 = *base.add(4).cast::<usize>();
7136 let len18 = l17;
7137 let bytes18 = _rt::Vec::from_raw_parts(
7138 l16.cast(),
7139 len18,
7140 len18,
7141 );
7142 _rt::string_lift(bytes18)
7143 };
7144 result19.push(e19);
7145 }
7146 _rt::cabi_dealloc(base19, len19 * 8, 4);
7147 let l20 = *base.add(72).cast::<*mut u8>();
7148 let l21 = *base.add(76).cast::<usize>();
7149 let base28 = l20;
7150 let len28 = l21;
7151 let mut result28 = _rt::Vec::with_capacity(len28);
7152 for i in 0..len28 {
7153 let base = base28.add(i * 16);
7154 let e28 = {
7155 let l22 = *base.add(0).cast::<*mut u8>();
7156 let l23 = *base.add(4).cast::<usize>();
7157 let len24 = l23;
7158 let bytes24 = _rt::Vec::from_raw_parts(
7159 l22.cast(),
7160 len24,
7161 len24,
7162 );
7163 let l25 = *base.add(8).cast::<*mut u8>();
7164 let l26 = *base.add(12).cast::<usize>();
7165 let len27 = l26;
7166 let bytes27 = _rt::Vec::from_raw_parts(
7167 l25.cast(),
7168 len27,
7169 len27,
7170 );
7171 (_rt::string_lift(bytes24), _rt::string_lift(bytes27))
7172 };
7173 result28.push(e28);
7174 }
7175 _rt::cabi_dealloc(base28, len28 * 16, 4);
7176 let l29 = *base.add(80).cast::<*mut u8>();
7177 let l30 = *base.add(84).cast::<usize>();
7178 let len31 = l30;
7179 let bytes31 = _rt::Vec::from_raw_parts(
7180 l29.cast(),
7181 len31,
7182 len31,
7183 );
7184 let l32 = i32::from(*base.add(88).cast::<u8>());
7185 let l38 = *base.add(120).cast::<i64>();
7186 let l39 = *base.add(128).cast::<i64>();
7187 let l40 = *base.add(136).cast::<*mut u8>();
7188 let l41 = *base.add(140).cast::<usize>();
7189 let base59 = l40;
7190 let len59 = l41;
7191 let mut result59 = _rt::Vec::with_capacity(len59);
7192 for i in 0..len59 {
7193 let base = base59.add(i * 40);
7194 let e59 = {
7195 let l42 = *base.add(0).cast::<i64>();
7196 let l43 = *base.add(8).cast::<i64>();
7197 let l44 = *base.add(16).cast::<*mut u8>();
7198 let l45 = *base.add(20).cast::<usize>();
7199 let len46 = l45;
7200 let bytes46 = _rt::Vec::from_raw_parts(
7201 l44.cast(),
7202 len46,
7203 len46,
7204 );
7205 let l47 = *base.add(24).cast::<*mut u8>();
7206 let l48 = *base.add(28).cast::<usize>();
7207 let len49 = l48;
7208 let bytes49 = _rt::Vec::from_raw_parts(
7209 l47.cast(),
7210 len49,
7211 len49,
7212 );
7213 let l50 = *base.add(32).cast::<*mut u8>();
7214 let l51 = *base.add(36).cast::<usize>();
7215 let base58 = l50;
7216 let len58 = l51;
7217 let mut result58 = _rt::Vec::with_capacity(len58);
7218 for i in 0..len58 {
7219 let base = base58.add(i * 16);
7220 let e58 = {
7221 let l52 = *base.add(0).cast::<*mut u8>();
7222 let l53 = *base.add(4).cast::<usize>();
7223 let len54 = l53;
7224 let bytes54 = _rt::Vec::from_raw_parts(
7225 l52.cast(),
7226 len54,
7227 len54,
7228 );
7229 let l55 = *base.add(8).cast::<*mut u8>();
7230 let l56 = *base.add(12).cast::<usize>();
7231 let len57 = l56;
7232 let bytes57 = _rt::Vec::from_raw_parts(
7233 l55.cast(),
7234 len57,
7235 len57,
7236 );
7237 (_rt::string_lift(bytes54), _rt::string_lift(bytes57))
7238 };
7239 result58.push(e58);
7240 }
7241 _rt::cabi_dealloc(base58, len58 * 16, 4);
7242 PluginInstallationDescription {
7243 installation_id: super::super::super::golem::api::host::Uuid {
7244 high_bits: l42 as u64,
7245 low_bits: l43 as u64,
7246 },
7247 name: _rt::string_lift(bytes46),
7248 version: _rt::string_lift(bytes49),
7249 parameters: result58,
7250 }
7251 };
7252 result59.push(e59);
7253 }
7254 _rt::cabi_dealloc(base59, len59 * 40, 8);
7255 CreateParameters {
7256 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
7257 seconds: l6 as u64,
7258 nanoseconds: l7 as u32,
7259 },
7260 worker_id: super::super::super::golem::api::host::WorkerId {
7261 component_id: super::super::super::golem::api::host::ComponentId {
7262 uuid: super::super::super::golem::api::host::Uuid {
7263 high_bits: l8 as u64,
7264 low_bits: l9 as u64,
7265 },
7266 },
7267 worker_name: _rt::string_lift(bytes12),
7268 },
7269 component_version: l13 as u64,
7270 args: result19,
7271 env: result28,
7272 account_id: super::super::super::golem::api::host::AccountId {
7273 value: _rt::string_lift(bytes31),
7274 },
7275 parent: match l32 {
7276 0 => None,
7277 1 => {
7278 let e = {
7279 let l33 = *base.add(96).cast::<i64>();
7280 let l34 = *base.add(104).cast::<i64>();
7281 let l35 = *base.add(112).cast::<*mut u8>();
7282 let l36 = *base.add(116).cast::<usize>();
7283 let len37 = l36;
7284 let bytes37 = _rt::Vec::from_raw_parts(
7285 l35.cast(),
7286 len37,
7287 len37,
7288 );
7289 super::super::super::golem::api::host::WorkerId {
7290 component_id: super::super::super::golem::api::host::ComponentId {
7291 uuid: super::super::super::golem::api::host::Uuid {
7292 high_bits: l33 as u64,
7293 low_bits: l34 as u64,
7294 },
7295 },
7296 worker_name: _rt::string_lift(bytes37),
7297 }
7298 };
7299 Some(e)
7300 }
7301 _ => _rt::invalid_enum_discriminant(),
7302 },
7303 component_size: l38 as u64,
7304 initial_total_linear_memory_size: l39 as u64,
7305 initial_active_plugins: result59,
7306 }
7307 };
7308 OplogEntry::Create(e621)
7309 }
7310 1 => {
7311 let e621 = {
7312 let l60 = *base.add(16).cast::<i64>();
7313 let l61 = *base.add(24).cast::<i32>();
7314 let l62 = *base.add(32).cast::<*mut u8>();
7315 let l63 = *base.add(36).cast::<usize>();
7316 let len64 = l63;
7317 let bytes64 = _rt::Vec::from_raw_parts(
7318 l62.cast(),
7319 len64,
7320 len64,
7321 );
7322 let l65 = *base.add(40).cast::<*mut u8>();
7323 let l66 = *base.add(44).cast::<usize>();
7324 let base112 = l65;
7325 let len112 = l66;
7326 let mut result112 = _rt::Vec::with_capacity(len112);
7327 for i in 0..len112 {
7328 let base = base112.add(i * 24);
7329 let e112 = {
7330 let l67 = i32::from(*base.add(0).cast::<u8>());
7331 use super::super::super::golem::rpc::types::WitNode as V111;
7332 let v111 = match l67 {
7333 0 => {
7334 let e111 = {
7335 let l68 = *base.add(8).cast::<*mut u8>();
7336 let l69 = *base.add(12).cast::<usize>();
7337 let len70 = l69;
7338 _rt::Vec::from_raw_parts(l68.cast(), len70, len70)
7339 };
7340 V111::RecordValue(e111)
7341 }
7342 1 => {
7343 let e111 = {
7344 let l71 = *base.add(8).cast::<i32>();
7345 let l72 = i32::from(*base.add(12).cast::<u8>());
7346 (
7347 l71 as u32,
7348 match l72 {
7349 0 => None,
7350 1 => {
7351 let e = {
7352 let l73 = *base.add(16).cast::<i32>();
7353 l73
7354 };
7355 Some(e)
7356 }
7357 _ => _rt::invalid_enum_discriminant(),
7358 },
7359 )
7360 };
7361 V111::VariantValue(e111)
7362 }
7363 2 => {
7364 let e111 = {
7365 let l74 = *base.add(8).cast::<i32>();
7366 l74 as u32
7367 };
7368 V111::EnumValue(e111)
7369 }
7370 3 => {
7371 let e111 = {
7372 let l75 = *base.add(8).cast::<*mut u8>();
7373 let l76 = *base.add(12).cast::<usize>();
7374 let base78 = l75;
7375 let len78 = l76;
7376 let mut result78 = _rt::Vec::with_capacity(len78);
7377 for i in 0..len78 {
7378 let base = base78.add(i * 1);
7379 let e78 = {
7380 let l77 = i32::from(*base.add(0).cast::<u8>());
7381 _rt::bool_lift(l77 as u8)
7382 };
7383 result78.push(e78);
7384 }
7385 _rt::cabi_dealloc(base78, len78 * 1, 1);
7386 result78
7387 };
7388 V111::FlagsValue(e111)
7389 }
7390 4 => {
7391 let e111 = {
7392 let l79 = *base.add(8).cast::<*mut u8>();
7393 let l80 = *base.add(12).cast::<usize>();
7394 let len81 = l80;
7395 _rt::Vec::from_raw_parts(l79.cast(), len81, len81)
7396 };
7397 V111::TupleValue(e111)
7398 }
7399 5 => {
7400 let e111 = {
7401 let l82 = *base.add(8).cast::<*mut u8>();
7402 let l83 = *base.add(12).cast::<usize>();
7403 let len84 = l83;
7404 _rt::Vec::from_raw_parts(l82.cast(), len84, len84)
7405 };
7406 V111::ListValue(e111)
7407 }
7408 6 => {
7409 let e111 = {
7410 let l85 = i32::from(*base.add(8).cast::<u8>());
7411 match l85 {
7412 0 => None,
7413 1 => {
7414 let e = {
7415 let l86 = *base.add(12).cast::<i32>();
7416 l86
7417 };
7418 Some(e)
7419 }
7420 _ => _rt::invalid_enum_discriminant(),
7421 }
7422 };
7423 V111::OptionValue(e111)
7424 }
7425 7 => {
7426 let e111 = {
7427 let l87 = i32::from(*base.add(8).cast::<u8>());
7428 match l87 {
7429 0 => {
7430 let e = {
7431 let l88 = i32::from(*base.add(12).cast::<u8>());
7432 match l88 {
7433 0 => None,
7434 1 => {
7435 let e = {
7436 let l89 = *base.add(16).cast::<i32>();
7437 l89
7438 };
7439 Some(e)
7440 }
7441 _ => _rt::invalid_enum_discriminant(),
7442 }
7443 };
7444 Ok(e)
7445 }
7446 1 => {
7447 let e = {
7448 let l90 = i32::from(*base.add(12).cast::<u8>());
7449 match l90 {
7450 0 => None,
7451 1 => {
7452 let e = {
7453 let l91 = *base.add(16).cast::<i32>();
7454 l91
7455 };
7456 Some(e)
7457 }
7458 _ => _rt::invalid_enum_discriminant(),
7459 }
7460 };
7461 Err(e)
7462 }
7463 _ => _rt::invalid_enum_discriminant(),
7464 }
7465 };
7466 V111::ResultValue(e111)
7467 }
7468 8 => {
7469 let e111 = {
7470 let l92 = i32::from(*base.add(8).cast::<u8>());
7471 l92 as u8
7472 };
7473 V111::PrimU8(e111)
7474 }
7475 9 => {
7476 let e111 = {
7477 let l93 = i32::from(*base.add(8).cast::<u16>());
7478 l93 as u16
7479 };
7480 V111::PrimU16(e111)
7481 }
7482 10 => {
7483 let e111 = {
7484 let l94 = *base.add(8).cast::<i32>();
7485 l94 as u32
7486 };
7487 V111::PrimU32(e111)
7488 }
7489 11 => {
7490 let e111 = {
7491 let l95 = *base.add(8).cast::<i64>();
7492 l95 as u64
7493 };
7494 V111::PrimU64(e111)
7495 }
7496 12 => {
7497 let e111 = {
7498 let l96 = i32::from(*base.add(8).cast::<i8>());
7499 l96 as i8
7500 };
7501 V111::PrimS8(e111)
7502 }
7503 13 => {
7504 let e111 = {
7505 let l97 = i32::from(*base.add(8).cast::<i16>());
7506 l97 as i16
7507 };
7508 V111::PrimS16(e111)
7509 }
7510 14 => {
7511 let e111 = {
7512 let l98 = *base.add(8).cast::<i32>();
7513 l98
7514 };
7515 V111::PrimS32(e111)
7516 }
7517 15 => {
7518 let e111 = {
7519 let l99 = *base.add(8).cast::<i64>();
7520 l99
7521 };
7522 V111::PrimS64(e111)
7523 }
7524 16 => {
7525 let e111 = {
7526 let l100 = *base.add(8).cast::<f32>();
7527 l100
7528 };
7529 V111::PrimFloat32(e111)
7530 }
7531 17 => {
7532 let e111 = {
7533 let l101 = *base.add(8).cast::<f64>();
7534 l101
7535 };
7536 V111::PrimFloat64(e111)
7537 }
7538 18 => {
7539 let e111 = {
7540 let l102 = *base.add(8).cast::<i32>();
7541 _rt::char_lift(l102 as u32)
7542 };
7543 V111::PrimChar(e111)
7544 }
7545 19 => {
7546 let e111 = {
7547 let l103 = i32::from(*base.add(8).cast::<u8>());
7548 _rt::bool_lift(l103 as u8)
7549 };
7550 V111::PrimBool(e111)
7551 }
7552 20 => {
7553 let e111 = {
7554 let l104 = *base.add(8).cast::<*mut u8>();
7555 let l105 = *base.add(12).cast::<usize>();
7556 let len106 = l105;
7557 let bytes106 = _rt::Vec::from_raw_parts(
7558 l104.cast(),
7559 len106,
7560 len106,
7561 );
7562 _rt::string_lift(bytes106)
7563 };
7564 V111::PrimString(e111)
7565 }
7566 n => {
7567 debug_assert_eq!(n, 21, "invalid enum discriminant");
7568 let e111 = {
7569 let l107 = *base.add(8).cast::<*mut u8>();
7570 let l108 = *base.add(12).cast::<usize>();
7571 let len109 = l108;
7572 let bytes109 = _rt::Vec::from_raw_parts(
7573 l107.cast(),
7574 len109,
7575 len109,
7576 );
7577 let l110 = *base.add(16).cast::<i64>();
7578 (
7579 super::super::super::golem::rpc::types::Uri {
7580 value: _rt::string_lift(bytes109),
7581 },
7582 l110 as u64,
7583 )
7584 };
7585 V111::Handle(e111)
7586 }
7587 };
7588 v111
7589 };
7590 result112.push(e112);
7591 }
7592 _rt::cabi_dealloc(base112, len112 * 24, 8);
7593 let l113 = *base.add(48).cast::<*mut u8>();
7594 let l114 = *base.add(52).cast::<usize>();
7595 let base160 = l113;
7596 let len160 = l114;
7597 let mut result160 = _rt::Vec::with_capacity(len160);
7598 for i in 0..len160 {
7599 let base = base160.add(i * 24);
7600 let e160 = {
7601 let l115 = i32::from(*base.add(0).cast::<u8>());
7602 use super::super::super::golem::rpc::types::WitNode as V159;
7603 let v159 = match l115 {
7604 0 => {
7605 let e159 = {
7606 let l116 = *base.add(8).cast::<*mut u8>();
7607 let l117 = *base.add(12).cast::<usize>();
7608 let len118 = l117;
7609 _rt::Vec::from_raw_parts(l116.cast(), len118, len118)
7610 };
7611 V159::RecordValue(e159)
7612 }
7613 1 => {
7614 let e159 = {
7615 let l119 = *base.add(8).cast::<i32>();
7616 let l120 = i32::from(*base.add(12).cast::<u8>());
7617 (
7618 l119 as u32,
7619 match l120 {
7620 0 => None,
7621 1 => {
7622 let e = {
7623 let l121 = *base.add(16).cast::<i32>();
7624 l121
7625 };
7626 Some(e)
7627 }
7628 _ => _rt::invalid_enum_discriminant(),
7629 },
7630 )
7631 };
7632 V159::VariantValue(e159)
7633 }
7634 2 => {
7635 let e159 = {
7636 let l122 = *base.add(8).cast::<i32>();
7637 l122 as u32
7638 };
7639 V159::EnumValue(e159)
7640 }
7641 3 => {
7642 let e159 = {
7643 let l123 = *base.add(8).cast::<*mut u8>();
7644 let l124 = *base.add(12).cast::<usize>();
7645 let base126 = l123;
7646 let len126 = l124;
7647 let mut result126 = _rt::Vec::with_capacity(len126);
7648 for i in 0..len126 {
7649 let base = base126.add(i * 1);
7650 let e126 = {
7651 let l125 = i32::from(*base.add(0).cast::<u8>());
7652 _rt::bool_lift(l125 as u8)
7653 };
7654 result126.push(e126);
7655 }
7656 _rt::cabi_dealloc(base126, len126 * 1, 1);
7657 result126
7658 };
7659 V159::FlagsValue(e159)
7660 }
7661 4 => {
7662 let e159 = {
7663 let l127 = *base.add(8).cast::<*mut u8>();
7664 let l128 = *base.add(12).cast::<usize>();
7665 let len129 = l128;
7666 _rt::Vec::from_raw_parts(l127.cast(), len129, len129)
7667 };
7668 V159::TupleValue(e159)
7669 }
7670 5 => {
7671 let e159 = {
7672 let l130 = *base.add(8).cast::<*mut u8>();
7673 let l131 = *base.add(12).cast::<usize>();
7674 let len132 = l131;
7675 _rt::Vec::from_raw_parts(l130.cast(), len132, len132)
7676 };
7677 V159::ListValue(e159)
7678 }
7679 6 => {
7680 let e159 = {
7681 let l133 = i32::from(*base.add(8).cast::<u8>());
7682 match l133 {
7683 0 => None,
7684 1 => {
7685 let e = {
7686 let l134 = *base.add(12).cast::<i32>();
7687 l134
7688 };
7689 Some(e)
7690 }
7691 _ => _rt::invalid_enum_discriminant(),
7692 }
7693 };
7694 V159::OptionValue(e159)
7695 }
7696 7 => {
7697 let e159 = {
7698 let l135 = i32::from(*base.add(8).cast::<u8>());
7699 match l135 {
7700 0 => {
7701 let e = {
7702 let l136 = i32::from(*base.add(12).cast::<u8>());
7703 match l136 {
7704 0 => None,
7705 1 => {
7706 let e = {
7707 let l137 = *base.add(16).cast::<i32>();
7708 l137
7709 };
7710 Some(e)
7711 }
7712 _ => _rt::invalid_enum_discriminant(),
7713 }
7714 };
7715 Ok(e)
7716 }
7717 1 => {
7718 let e = {
7719 let l138 = i32::from(*base.add(12).cast::<u8>());
7720 match l138 {
7721 0 => None,
7722 1 => {
7723 let e = {
7724 let l139 = *base.add(16).cast::<i32>();
7725 l139
7726 };
7727 Some(e)
7728 }
7729 _ => _rt::invalid_enum_discriminant(),
7730 }
7731 };
7732 Err(e)
7733 }
7734 _ => _rt::invalid_enum_discriminant(),
7735 }
7736 };
7737 V159::ResultValue(e159)
7738 }
7739 8 => {
7740 let e159 = {
7741 let l140 = i32::from(*base.add(8).cast::<u8>());
7742 l140 as u8
7743 };
7744 V159::PrimU8(e159)
7745 }
7746 9 => {
7747 let e159 = {
7748 let l141 = i32::from(*base.add(8).cast::<u16>());
7749 l141 as u16
7750 };
7751 V159::PrimU16(e159)
7752 }
7753 10 => {
7754 let e159 = {
7755 let l142 = *base.add(8).cast::<i32>();
7756 l142 as u32
7757 };
7758 V159::PrimU32(e159)
7759 }
7760 11 => {
7761 let e159 = {
7762 let l143 = *base.add(8).cast::<i64>();
7763 l143 as u64
7764 };
7765 V159::PrimU64(e159)
7766 }
7767 12 => {
7768 let e159 = {
7769 let l144 = i32::from(*base.add(8).cast::<i8>());
7770 l144 as i8
7771 };
7772 V159::PrimS8(e159)
7773 }
7774 13 => {
7775 let e159 = {
7776 let l145 = i32::from(*base.add(8).cast::<i16>());
7777 l145 as i16
7778 };
7779 V159::PrimS16(e159)
7780 }
7781 14 => {
7782 let e159 = {
7783 let l146 = *base.add(8).cast::<i32>();
7784 l146
7785 };
7786 V159::PrimS32(e159)
7787 }
7788 15 => {
7789 let e159 = {
7790 let l147 = *base.add(8).cast::<i64>();
7791 l147
7792 };
7793 V159::PrimS64(e159)
7794 }
7795 16 => {
7796 let e159 = {
7797 let l148 = *base.add(8).cast::<f32>();
7798 l148
7799 };
7800 V159::PrimFloat32(e159)
7801 }
7802 17 => {
7803 let e159 = {
7804 let l149 = *base.add(8).cast::<f64>();
7805 l149
7806 };
7807 V159::PrimFloat64(e159)
7808 }
7809 18 => {
7810 let e159 = {
7811 let l150 = *base.add(8).cast::<i32>();
7812 _rt::char_lift(l150 as u32)
7813 };
7814 V159::PrimChar(e159)
7815 }
7816 19 => {
7817 let e159 = {
7818 let l151 = i32::from(*base.add(8).cast::<u8>());
7819 _rt::bool_lift(l151 as u8)
7820 };
7821 V159::PrimBool(e159)
7822 }
7823 20 => {
7824 let e159 = {
7825 let l152 = *base.add(8).cast::<*mut u8>();
7826 let l153 = *base.add(12).cast::<usize>();
7827 let len154 = l153;
7828 let bytes154 = _rt::Vec::from_raw_parts(
7829 l152.cast(),
7830 len154,
7831 len154,
7832 );
7833 _rt::string_lift(bytes154)
7834 };
7835 V159::PrimString(e159)
7836 }
7837 n => {
7838 debug_assert_eq!(n, 21, "invalid enum discriminant");
7839 let e159 = {
7840 let l155 = *base.add(8).cast::<*mut u8>();
7841 let l156 = *base.add(12).cast::<usize>();
7842 let len157 = l156;
7843 let bytes157 = _rt::Vec::from_raw_parts(
7844 l155.cast(),
7845 len157,
7846 len157,
7847 );
7848 let l158 = *base.add(16).cast::<i64>();
7849 (
7850 super::super::super::golem::rpc::types::Uri {
7851 value: _rt::string_lift(bytes157),
7852 },
7853 l158 as u64,
7854 )
7855 };
7856 V159::Handle(e159)
7857 }
7858 };
7859 v159
7860 };
7861 result160.push(e160);
7862 }
7863 _rt::cabi_dealloc(base160, len160 * 24, 8);
7864 let l161 = i32::from(*base.add(56).cast::<u8>());
7865 let v164 = match l161 {
7866 0 => WrappedFunctionType::ReadLocal,
7867 1 => WrappedFunctionType::WriteLocal,
7868 2 => WrappedFunctionType::ReadRemote,
7869 3 => WrappedFunctionType::WriteRemote,
7870 n => {
7871 debug_assert_eq!(n, 4, "invalid enum discriminant");
7872 let e164 = {
7873 let l162 = i32::from(*base.add(64).cast::<u8>());
7874 match l162 {
7875 0 => None,
7876 1 => {
7877 let e = {
7878 let l163 = *base.add(72).cast::<i64>();
7879 l163 as u64
7880 };
7881 Some(e)
7882 }
7883 _ => _rt::invalid_enum_discriminant(),
7884 }
7885 };
7886 WrappedFunctionType::WriteRemoteBatched(e164)
7887 }
7888 };
7889 ImportedFunctionInvokedParameters {
7890 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
7891 seconds: l60 as u64,
7892 nanoseconds: l61 as u32,
7893 },
7894 function_name: _rt::string_lift(bytes64),
7895 request: super::super::super::golem::rpc::types::WitValue {
7896 nodes: result112,
7897 },
7898 response: super::super::super::golem::rpc::types::WitValue {
7899 nodes: result160,
7900 },
7901 wrapped_function_type: v164,
7902 }
7903 };
7904 OplogEntry::ImportedFunctionInvoked(e621)
7905 }
7906 2 => {
7907 let e621 = {
7908 let l165 = *base.add(16).cast::<i64>();
7909 let l166 = *base.add(24).cast::<i32>();
7910 let l167 = *base.add(32).cast::<*mut u8>();
7911 let l168 = *base.add(36).cast::<usize>();
7912 let len169 = l168;
7913 let bytes169 = _rt::Vec::from_raw_parts(
7914 l167.cast(),
7915 len169,
7916 len169,
7917 );
7918 let l170 = *base.add(40).cast::<*mut u8>();
7919 let l171 = *base.add(44).cast::<usize>();
7920 let base220 = l170;
7921 let len220 = l171;
7922 let mut result220 = _rt::Vec::with_capacity(len220);
7923 for i in 0..len220 {
7924 let base = base220.add(i * 8);
7925 let e220 = {
7926 let l172 = *base.add(0).cast::<*mut u8>();
7927 let l173 = *base.add(4).cast::<usize>();
7928 let base219 = l172;
7929 let len219 = l173;
7930 let mut result219 = _rt::Vec::with_capacity(len219);
7931 for i in 0..len219 {
7932 let base = base219.add(i * 24);
7933 let e219 = {
7934 let l174 = i32::from(*base.add(0).cast::<u8>());
7935 use super::super::super::golem::rpc::types::WitNode as V218;
7936 let v218 = match l174 {
7937 0 => {
7938 let e218 = {
7939 let l175 = *base.add(8).cast::<*mut u8>();
7940 let l176 = *base.add(12).cast::<usize>();
7941 let len177 = l176;
7942 _rt::Vec::from_raw_parts(l175.cast(), len177, len177)
7943 };
7944 V218::RecordValue(e218)
7945 }
7946 1 => {
7947 let e218 = {
7948 let l178 = *base.add(8).cast::<i32>();
7949 let l179 = i32::from(*base.add(12).cast::<u8>());
7950 (
7951 l178 as u32,
7952 match l179 {
7953 0 => None,
7954 1 => {
7955 let e = {
7956 let l180 = *base.add(16).cast::<i32>();
7957 l180
7958 };
7959 Some(e)
7960 }
7961 _ => _rt::invalid_enum_discriminant(),
7962 },
7963 )
7964 };
7965 V218::VariantValue(e218)
7966 }
7967 2 => {
7968 let e218 = {
7969 let l181 = *base.add(8).cast::<i32>();
7970 l181 as u32
7971 };
7972 V218::EnumValue(e218)
7973 }
7974 3 => {
7975 let e218 = {
7976 let l182 = *base.add(8).cast::<*mut u8>();
7977 let l183 = *base.add(12).cast::<usize>();
7978 let base185 = l182;
7979 let len185 = l183;
7980 let mut result185 = _rt::Vec::with_capacity(len185);
7981 for i in 0..len185 {
7982 let base = base185.add(i * 1);
7983 let e185 = {
7984 let l184 = i32::from(*base.add(0).cast::<u8>());
7985 _rt::bool_lift(l184 as u8)
7986 };
7987 result185.push(e185);
7988 }
7989 _rt::cabi_dealloc(base185, len185 * 1, 1);
7990 result185
7991 };
7992 V218::FlagsValue(e218)
7993 }
7994 4 => {
7995 let e218 = {
7996 let l186 = *base.add(8).cast::<*mut u8>();
7997 let l187 = *base.add(12).cast::<usize>();
7998 let len188 = l187;
7999 _rt::Vec::from_raw_parts(l186.cast(), len188, len188)
8000 };
8001 V218::TupleValue(e218)
8002 }
8003 5 => {
8004 let e218 = {
8005 let l189 = *base.add(8).cast::<*mut u8>();
8006 let l190 = *base.add(12).cast::<usize>();
8007 let len191 = l190;
8008 _rt::Vec::from_raw_parts(l189.cast(), len191, len191)
8009 };
8010 V218::ListValue(e218)
8011 }
8012 6 => {
8013 let e218 = {
8014 let l192 = i32::from(*base.add(8).cast::<u8>());
8015 match l192 {
8016 0 => None,
8017 1 => {
8018 let e = {
8019 let l193 = *base.add(12).cast::<i32>();
8020 l193
8021 };
8022 Some(e)
8023 }
8024 _ => _rt::invalid_enum_discriminant(),
8025 }
8026 };
8027 V218::OptionValue(e218)
8028 }
8029 7 => {
8030 let e218 = {
8031 let l194 = i32::from(*base.add(8).cast::<u8>());
8032 match l194 {
8033 0 => {
8034 let e = {
8035 let l195 = i32::from(*base.add(12).cast::<u8>());
8036 match l195 {
8037 0 => None,
8038 1 => {
8039 let e = {
8040 let l196 = *base.add(16).cast::<i32>();
8041 l196
8042 };
8043 Some(e)
8044 }
8045 _ => _rt::invalid_enum_discriminant(),
8046 }
8047 };
8048 Ok(e)
8049 }
8050 1 => {
8051 let e = {
8052 let l197 = i32::from(*base.add(12).cast::<u8>());
8053 match l197 {
8054 0 => None,
8055 1 => {
8056 let e = {
8057 let l198 = *base.add(16).cast::<i32>();
8058 l198
8059 };
8060 Some(e)
8061 }
8062 _ => _rt::invalid_enum_discriminant(),
8063 }
8064 };
8065 Err(e)
8066 }
8067 _ => _rt::invalid_enum_discriminant(),
8068 }
8069 };
8070 V218::ResultValue(e218)
8071 }
8072 8 => {
8073 let e218 = {
8074 let l199 = i32::from(*base.add(8).cast::<u8>());
8075 l199 as u8
8076 };
8077 V218::PrimU8(e218)
8078 }
8079 9 => {
8080 let e218 = {
8081 let l200 = i32::from(*base.add(8).cast::<u16>());
8082 l200 as u16
8083 };
8084 V218::PrimU16(e218)
8085 }
8086 10 => {
8087 let e218 = {
8088 let l201 = *base.add(8).cast::<i32>();
8089 l201 as u32
8090 };
8091 V218::PrimU32(e218)
8092 }
8093 11 => {
8094 let e218 = {
8095 let l202 = *base.add(8).cast::<i64>();
8096 l202 as u64
8097 };
8098 V218::PrimU64(e218)
8099 }
8100 12 => {
8101 let e218 = {
8102 let l203 = i32::from(*base.add(8).cast::<i8>());
8103 l203 as i8
8104 };
8105 V218::PrimS8(e218)
8106 }
8107 13 => {
8108 let e218 = {
8109 let l204 = i32::from(*base.add(8).cast::<i16>());
8110 l204 as i16
8111 };
8112 V218::PrimS16(e218)
8113 }
8114 14 => {
8115 let e218 = {
8116 let l205 = *base.add(8).cast::<i32>();
8117 l205
8118 };
8119 V218::PrimS32(e218)
8120 }
8121 15 => {
8122 let e218 = {
8123 let l206 = *base.add(8).cast::<i64>();
8124 l206
8125 };
8126 V218::PrimS64(e218)
8127 }
8128 16 => {
8129 let e218 = {
8130 let l207 = *base.add(8).cast::<f32>();
8131 l207
8132 };
8133 V218::PrimFloat32(e218)
8134 }
8135 17 => {
8136 let e218 = {
8137 let l208 = *base.add(8).cast::<f64>();
8138 l208
8139 };
8140 V218::PrimFloat64(e218)
8141 }
8142 18 => {
8143 let e218 = {
8144 let l209 = *base.add(8).cast::<i32>();
8145 _rt::char_lift(l209 as u32)
8146 };
8147 V218::PrimChar(e218)
8148 }
8149 19 => {
8150 let e218 = {
8151 let l210 = i32::from(*base.add(8).cast::<u8>());
8152 _rt::bool_lift(l210 as u8)
8153 };
8154 V218::PrimBool(e218)
8155 }
8156 20 => {
8157 let e218 = {
8158 let l211 = *base.add(8).cast::<*mut u8>();
8159 let l212 = *base.add(12).cast::<usize>();
8160 let len213 = l212;
8161 let bytes213 = _rt::Vec::from_raw_parts(
8162 l211.cast(),
8163 len213,
8164 len213,
8165 );
8166 _rt::string_lift(bytes213)
8167 };
8168 V218::PrimString(e218)
8169 }
8170 n => {
8171 debug_assert_eq!(n, 21, "invalid enum discriminant");
8172 let e218 = {
8173 let l214 = *base.add(8).cast::<*mut u8>();
8174 let l215 = *base.add(12).cast::<usize>();
8175 let len216 = l215;
8176 let bytes216 = _rt::Vec::from_raw_parts(
8177 l214.cast(),
8178 len216,
8179 len216,
8180 );
8181 let l217 = *base.add(16).cast::<i64>();
8182 (
8183 super::super::super::golem::rpc::types::Uri {
8184 value: _rt::string_lift(bytes216),
8185 },
8186 l217 as u64,
8187 )
8188 };
8189 V218::Handle(e218)
8190 }
8191 };
8192 v218
8193 };
8194 result219.push(e219);
8195 }
8196 _rt::cabi_dealloc(base219, len219 * 24, 8);
8197 super::super::super::golem::rpc::types::WitValue {
8198 nodes: result219,
8199 }
8200 };
8201 result220.push(e220);
8202 }
8203 _rt::cabi_dealloc(base220, len220 * 8, 4);
8204 let l221 = *base.add(48).cast::<*mut u8>();
8205 let l222 = *base.add(52).cast::<usize>();
8206 let len223 = l222;
8207 let bytes223 = _rt::Vec::from_raw_parts(
8208 l221.cast(),
8209 len223,
8210 len223,
8211 );
8212 let l224 = *base.add(56).cast::<*mut u8>();
8213 let l225 = *base.add(60).cast::<usize>();
8214 let len226 = l225;
8215 let bytes226 = _rt::Vec::from_raw_parts(
8216 l224.cast(),
8217 len226,
8218 len226,
8219 );
8220 let l227 = *base.add(64).cast::<*mut u8>();
8221 let l228 = *base.add(68).cast::<usize>();
8222 let base232 = l227;
8223 let len232 = l228;
8224 let mut result232 = _rt::Vec::with_capacity(len232);
8225 for i in 0..len232 {
8226 let base = base232.add(i * 8);
8227 let e232 = {
8228 let l229 = *base.add(0).cast::<*mut u8>();
8229 let l230 = *base.add(4).cast::<usize>();
8230 let len231 = l230;
8231 let bytes231 = _rt::Vec::from_raw_parts(
8232 l229.cast(),
8233 len231,
8234 len231,
8235 );
8236 _rt::string_lift(bytes231)
8237 };
8238 result232.push(e232);
8239 }
8240 _rt::cabi_dealloc(base232, len232 * 8, 4);
8241 let l233 = *base.add(72).cast::<*mut u8>();
8242 let l234 = *base.add(76).cast::<usize>();
8243 let base266 = l233;
8244 let len266 = l234;
8245 let mut result266 = _rt::Vec::with_capacity(len266);
8246 for i in 0..len266 {
8247 let base = base266.add(i * 8);
8248 let e266 = {
8249 let l235 = *base.add(0).cast::<*mut u8>();
8250 let l236 = *base.add(4).cast::<usize>();
8251 let base265 = l235;
8252 let len265 = l236;
8253 let mut result265 = _rt::Vec::with_capacity(len265);
8254 for i in 0..len265 {
8255 let base = base265.add(i * 80);
8256 let e265 = {
8257 let l237 = i32::from(*base.add(0).cast::<u8>());
8258 let v264 = match l237 {
8259 0 => {
8260 let e264 = {
8261 let l238 = *base.add(8).cast::<*mut u8>();
8262 let l239 = *base.add(12).cast::<usize>();
8263 let len240 = l239;
8264 let bytes240 = _rt::Vec::from_raw_parts(
8265 l238.cast(),
8266 len240,
8267 len240,
8268 );
8269 let l241 = *base.add(16).cast::<i64>();
8270 let l242 = *base.add(24).cast::<i32>();
8271 let l243 = i32::from(*base.add(32).cast::<u8>());
8272 let l247 = i32::from(*base.add(48).cast::<u8>());
8273 let l249 = *base.add(64).cast::<*mut u8>();
8274 let l250 = *base.add(68).cast::<usize>();
8275 let base259 = l249;
8276 let len259 = l250;
8277 let mut result259 = _rt::Vec::with_capacity(len259);
8278 for i in 0..len259 {
8279 let base = base259.add(i * 20);
8280 let e259 = {
8281 let l251 = *base.add(0).cast::<*mut u8>();
8282 let l252 = *base.add(4).cast::<usize>();
8283 let len253 = l252;
8284 let bytes253 = _rt::Vec::from_raw_parts(
8285 l251.cast(),
8286 len253,
8287 len253,
8288 );
8289 let l254 = i32::from(*base.add(8).cast::<u8>());
8290 use super::super::super::golem::api::context::AttributeValue as V258;
8291 let v258 = match l254 {
8292 n => {
8293 debug_assert_eq!(n, 0, "invalid enum discriminant");
8294 let e258 = {
8295 let l255 = *base.add(12).cast::<*mut u8>();
8296 let l256 = *base.add(16).cast::<usize>();
8297 let len257 = l256;
8298 let bytes257 = _rt::Vec::from_raw_parts(
8299 l255.cast(),
8300 len257,
8301 len257,
8302 );
8303 _rt::string_lift(bytes257)
8304 };
8305 V258::String(e258)
8306 }
8307 };
8308 super::super::super::golem::api::context::Attribute {
8309 key: _rt::string_lift(bytes253),
8310 value: v258,
8311 }
8312 };
8313 result259.push(e259);
8314 }
8315 _rt::cabi_dealloc(base259, len259 * 20, 4);
8316 let l260 = i32::from(*base.add(72).cast::<u8>());
8317 LocalSpanData {
8318 span_id: _rt::string_lift(bytes240),
8319 start: super::super::super::wasi::clocks::wall_clock::Datetime {
8320 seconds: l241 as u64,
8321 nanoseconds: l242 as u32,
8322 },
8323 parent: match l243 {
8324 0 => None,
8325 1 => {
8326 let e = {
8327 let l244 = *base.add(36).cast::<*mut u8>();
8328 let l245 = *base.add(40).cast::<usize>();
8329 let len246 = l245;
8330 let bytes246 = _rt::Vec::from_raw_parts(
8331 l244.cast(),
8332 len246,
8333 len246,
8334 );
8335 _rt::string_lift(bytes246)
8336 };
8337 Some(e)
8338 }
8339 _ => _rt::invalid_enum_discriminant(),
8340 },
8341 linked_context: match l247 {
8342 0 => None,
8343 1 => {
8344 let e = {
8345 let l248 = *base.add(56).cast::<i64>();
8346 l248 as u64
8347 };
8348 Some(e)
8349 }
8350 _ => _rt::invalid_enum_discriminant(),
8351 },
8352 attributes: result259,
8353 inherited: _rt::bool_lift(l260 as u8),
8354 }
8355 };
8356 SpanData::LocalSpan(e264)
8357 }
8358 n => {
8359 debug_assert_eq!(n, 1, "invalid enum discriminant");
8360 let e264 = {
8361 let l261 = *base.add(8).cast::<*mut u8>();
8362 let l262 = *base.add(12).cast::<usize>();
8363 let len263 = l262;
8364 let bytes263 = _rt::Vec::from_raw_parts(
8365 l261.cast(),
8366 len263,
8367 len263,
8368 );
8369 ExternalSpanData {
8370 span_id: _rt::string_lift(bytes263),
8371 }
8372 };
8373 SpanData::ExternalSpan(e264)
8374 }
8375 };
8376 v264
8377 };
8378 result265.push(e265);
8379 }
8380 _rt::cabi_dealloc(base265, len265 * 80, 8);
8381 result265
8382 };
8383 result266.push(e266);
8384 }
8385 _rt::cabi_dealloc(base266, len266 * 8, 4);
8386 ExportedFunctionInvokedParameters {
8387 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
8388 seconds: l165 as u64,
8389 nanoseconds: l166 as u32,
8390 },
8391 function_name: _rt::string_lift(bytes169),
8392 request: result220,
8393 idempotency_key: _rt::string_lift(bytes223),
8394 trace_id: _rt::string_lift(bytes226),
8395 trace_states: result232,
8396 invocation_context: result266,
8397 }
8398 };
8399 OplogEntry::ExportedFunctionInvoked(e621)
8400 }
8401 3 => {
8402 let e621 = {
8403 let l267 = *base.add(16).cast::<i64>();
8404 let l268 = *base.add(24).cast::<i32>();
8405 let l269 = *base.add(32).cast::<*mut u8>();
8406 let l270 = *base.add(36).cast::<usize>();
8407 let base316 = l269;
8408 let len316 = l270;
8409 let mut result316 = _rt::Vec::with_capacity(len316);
8410 for i in 0..len316 {
8411 let base = base316.add(i * 24);
8412 let e316 = {
8413 let l271 = i32::from(*base.add(0).cast::<u8>());
8414 use super::super::super::golem::rpc::types::WitNode as V315;
8415 let v315 = match l271 {
8416 0 => {
8417 let e315 = {
8418 let l272 = *base.add(8).cast::<*mut u8>();
8419 let l273 = *base.add(12).cast::<usize>();
8420 let len274 = l273;
8421 _rt::Vec::from_raw_parts(l272.cast(), len274, len274)
8422 };
8423 V315::RecordValue(e315)
8424 }
8425 1 => {
8426 let e315 = {
8427 let l275 = *base.add(8).cast::<i32>();
8428 let l276 = i32::from(*base.add(12).cast::<u8>());
8429 (
8430 l275 as u32,
8431 match l276 {
8432 0 => None,
8433 1 => {
8434 let e = {
8435 let l277 = *base.add(16).cast::<i32>();
8436 l277
8437 };
8438 Some(e)
8439 }
8440 _ => _rt::invalid_enum_discriminant(),
8441 },
8442 )
8443 };
8444 V315::VariantValue(e315)
8445 }
8446 2 => {
8447 let e315 = {
8448 let l278 = *base.add(8).cast::<i32>();
8449 l278 as u32
8450 };
8451 V315::EnumValue(e315)
8452 }
8453 3 => {
8454 let e315 = {
8455 let l279 = *base.add(8).cast::<*mut u8>();
8456 let l280 = *base.add(12).cast::<usize>();
8457 let base282 = l279;
8458 let len282 = l280;
8459 let mut result282 = _rt::Vec::with_capacity(len282);
8460 for i in 0..len282 {
8461 let base = base282.add(i * 1);
8462 let e282 = {
8463 let l281 = i32::from(*base.add(0).cast::<u8>());
8464 _rt::bool_lift(l281 as u8)
8465 };
8466 result282.push(e282);
8467 }
8468 _rt::cabi_dealloc(base282, len282 * 1, 1);
8469 result282
8470 };
8471 V315::FlagsValue(e315)
8472 }
8473 4 => {
8474 let e315 = {
8475 let l283 = *base.add(8).cast::<*mut u8>();
8476 let l284 = *base.add(12).cast::<usize>();
8477 let len285 = l284;
8478 _rt::Vec::from_raw_parts(l283.cast(), len285, len285)
8479 };
8480 V315::TupleValue(e315)
8481 }
8482 5 => {
8483 let e315 = {
8484 let l286 = *base.add(8).cast::<*mut u8>();
8485 let l287 = *base.add(12).cast::<usize>();
8486 let len288 = l287;
8487 _rt::Vec::from_raw_parts(l286.cast(), len288, len288)
8488 };
8489 V315::ListValue(e315)
8490 }
8491 6 => {
8492 let e315 = {
8493 let l289 = i32::from(*base.add(8).cast::<u8>());
8494 match l289 {
8495 0 => None,
8496 1 => {
8497 let e = {
8498 let l290 = *base.add(12).cast::<i32>();
8499 l290
8500 };
8501 Some(e)
8502 }
8503 _ => _rt::invalid_enum_discriminant(),
8504 }
8505 };
8506 V315::OptionValue(e315)
8507 }
8508 7 => {
8509 let e315 = {
8510 let l291 = i32::from(*base.add(8).cast::<u8>());
8511 match l291 {
8512 0 => {
8513 let e = {
8514 let l292 = i32::from(*base.add(12).cast::<u8>());
8515 match l292 {
8516 0 => None,
8517 1 => {
8518 let e = {
8519 let l293 = *base.add(16).cast::<i32>();
8520 l293
8521 };
8522 Some(e)
8523 }
8524 _ => _rt::invalid_enum_discriminant(),
8525 }
8526 };
8527 Ok(e)
8528 }
8529 1 => {
8530 let e = {
8531 let l294 = i32::from(*base.add(12).cast::<u8>());
8532 match l294 {
8533 0 => None,
8534 1 => {
8535 let e = {
8536 let l295 = *base.add(16).cast::<i32>();
8537 l295
8538 };
8539 Some(e)
8540 }
8541 _ => _rt::invalid_enum_discriminant(),
8542 }
8543 };
8544 Err(e)
8545 }
8546 _ => _rt::invalid_enum_discriminant(),
8547 }
8548 };
8549 V315::ResultValue(e315)
8550 }
8551 8 => {
8552 let e315 = {
8553 let l296 = i32::from(*base.add(8).cast::<u8>());
8554 l296 as u8
8555 };
8556 V315::PrimU8(e315)
8557 }
8558 9 => {
8559 let e315 = {
8560 let l297 = i32::from(*base.add(8).cast::<u16>());
8561 l297 as u16
8562 };
8563 V315::PrimU16(e315)
8564 }
8565 10 => {
8566 let e315 = {
8567 let l298 = *base.add(8).cast::<i32>();
8568 l298 as u32
8569 };
8570 V315::PrimU32(e315)
8571 }
8572 11 => {
8573 let e315 = {
8574 let l299 = *base.add(8).cast::<i64>();
8575 l299 as u64
8576 };
8577 V315::PrimU64(e315)
8578 }
8579 12 => {
8580 let e315 = {
8581 let l300 = i32::from(*base.add(8).cast::<i8>());
8582 l300 as i8
8583 };
8584 V315::PrimS8(e315)
8585 }
8586 13 => {
8587 let e315 = {
8588 let l301 = i32::from(*base.add(8).cast::<i16>());
8589 l301 as i16
8590 };
8591 V315::PrimS16(e315)
8592 }
8593 14 => {
8594 let e315 = {
8595 let l302 = *base.add(8).cast::<i32>();
8596 l302
8597 };
8598 V315::PrimS32(e315)
8599 }
8600 15 => {
8601 let e315 = {
8602 let l303 = *base.add(8).cast::<i64>();
8603 l303
8604 };
8605 V315::PrimS64(e315)
8606 }
8607 16 => {
8608 let e315 = {
8609 let l304 = *base.add(8).cast::<f32>();
8610 l304
8611 };
8612 V315::PrimFloat32(e315)
8613 }
8614 17 => {
8615 let e315 = {
8616 let l305 = *base.add(8).cast::<f64>();
8617 l305
8618 };
8619 V315::PrimFloat64(e315)
8620 }
8621 18 => {
8622 let e315 = {
8623 let l306 = *base.add(8).cast::<i32>();
8624 _rt::char_lift(l306 as u32)
8625 };
8626 V315::PrimChar(e315)
8627 }
8628 19 => {
8629 let e315 = {
8630 let l307 = i32::from(*base.add(8).cast::<u8>());
8631 _rt::bool_lift(l307 as u8)
8632 };
8633 V315::PrimBool(e315)
8634 }
8635 20 => {
8636 let e315 = {
8637 let l308 = *base.add(8).cast::<*mut u8>();
8638 let l309 = *base.add(12).cast::<usize>();
8639 let len310 = l309;
8640 let bytes310 = _rt::Vec::from_raw_parts(
8641 l308.cast(),
8642 len310,
8643 len310,
8644 );
8645 _rt::string_lift(bytes310)
8646 };
8647 V315::PrimString(e315)
8648 }
8649 n => {
8650 debug_assert_eq!(n, 21, "invalid enum discriminant");
8651 let e315 = {
8652 let l311 = *base.add(8).cast::<*mut u8>();
8653 let l312 = *base.add(12).cast::<usize>();
8654 let len313 = l312;
8655 let bytes313 = _rt::Vec::from_raw_parts(
8656 l311.cast(),
8657 len313,
8658 len313,
8659 );
8660 let l314 = *base.add(16).cast::<i64>();
8661 (
8662 super::super::super::golem::rpc::types::Uri {
8663 value: _rt::string_lift(bytes313),
8664 },
8665 l314 as u64,
8666 )
8667 };
8668 V315::Handle(e315)
8669 }
8670 };
8671 v315
8672 };
8673 result316.push(e316);
8674 }
8675 _rt::cabi_dealloc(base316, len316 * 24, 8);
8676 let l317 = *base.add(40).cast::<i64>();
8677 ExportedFunctionCompletedParameters {
8678 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
8679 seconds: l267 as u64,
8680 nanoseconds: l268 as u32,
8681 },
8682 response: super::super::super::golem::rpc::types::WitValue {
8683 nodes: result316,
8684 },
8685 consumed_fuel: l317,
8686 }
8687 };
8688 OplogEntry::ExportedFunctionCompleted(e621)
8689 }
8690 4 => {
8691 let e621 = {
8692 let l318 = *base.add(16).cast::<i64>();
8693 let l319 = *base.add(24).cast::<i32>();
8694 super::super::super::wasi::clocks::wall_clock::Datetime {
8695 seconds: l318 as u64,
8696 nanoseconds: l319 as u32,
8697 }
8698 };
8699 OplogEntry::Suspend(e621)
8700 }
8701 5 => {
8702 let e621 = {
8703 let l320 = *base.add(16).cast::<i64>();
8704 let l321 = *base.add(24).cast::<i32>();
8705 let l322 = *base.add(32).cast::<*mut u8>();
8706 let l323 = *base.add(36).cast::<usize>();
8707 let len324 = l323;
8708 let bytes324 = _rt::Vec::from_raw_parts(
8709 l322.cast(),
8710 len324,
8711 len324,
8712 );
8713 ErrorParameters {
8714 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
8715 seconds: l320 as u64,
8716 nanoseconds: l321 as u32,
8717 },
8718 error: _rt::string_lift(bytes324),
8719 }
8720 };
8721 OplogEntry::Error(e621)
8722 }
8723 6 => {
8724 let e621 = {
8725 let l325 = *base.add(16).cast::<i64>();
8726 let l326 = *base.add(24).cast::<i32>();
8727 super::super::super::wasi::clocks::wall_clock::Datetime {
8728 seconds: l325 as u64,
8729 nanoseconds: l326 as u32,
8730 }
8731 };
8732 OplogEntry::NoOp(e621)
8733 }
8734 7 => {
8735 let e621 = {
8736 let l327 = *base.add(16).cast::<i64>();
8737 let l328 = *base.add(24).cast::<i32>();
8738 let l329 = *base.add(32).cast::<i64>();
8739 let l330 = *base.add(40).cast::<i64>();
8740 JumpParameters {
8741 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
8742 seconds: l327 as u64,
8743 nanoseconds: l328 as u32,
8744 },
8745 start: l329 as u64,
8746 end: l330 as u64,
8747 }
8748 };
8749 OplogEntry::Jump(e621)
8750 }
8751 8 => {
8752 let e621 = {
8753 let l331 = *base.add(16).cast::<i64>();
8754 let l332 = *base.add(24).cast::<i32>();
8755 super::super::super::wasi::clocks::wall_clock::Datetime {
8756 seconds: l331 as u64,
8757 nanoseconds: l332 as u32,
8758 }
8759 };
8760 OplogEntry::Interrupted(e621)
8761 }
8762 9 => {
8763 let e621 = {
8764 let l333 = *base.add(16).cast::<i64>();
8765 let l334 = *base.add(24).cast::<i32>();
8766 super::super::super::wasi::clocks::wall_clock::Datetime {
8767 seconds: l333 as u64,
8768 nanoseconds: l334 as u32,
8769 }
8770 };
8771 OplogEntry::Exited(e621)
8772 }
8773 10 => {
8774 let e621 = {
8775 let l335 = *base.add(16).cast::<i64>();
8776 let l336 = *base.add(24).cast::<i32>();
8777 let l337 = *base.add(32).cast::<i32>();
8778 let l338 = *base.add(40).cast::<i64>();
8779 let l339 = *base.add(48).cast::<i64>();
8780 let l340 = *base.add(56).cast::<f64>();
8781 let l341 = i32::from(*base.add(64).cast::<u8>());
8782 ChangeRetryPolicyParameters {
8783 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
8784 seconds: l335 as u64,
8785 nanoseconds: l336 as u32,
8786 },
8787 retry_policy: super::super::super::golem::api::host::RetryPolicy {
8788 max_attempts: l337 as u32,
8789 min_delay: l338 as u64,
8790 max_delay: l339 as u64,
8791 multiplier: l340,
8792 max_jitter_factor: match l341 {
8793 0 => None,
8794 1 => {
8795 let e = {
8796 let l342 = *base.add(72).cast::<f64>();
8797 l342
8798 };
8799 Some(e)
8800 }
8801 _ => _rt::invalid_enum_discriminant(),
8802 },
8803 },
8804 }
8805 };
8806 OplogEntry::ChangeRetryPolicy(e621)
8807 }
8808 11 => {
8809 let e621 = {
8810 let l343 = *base.add(16).cast::<i64>();
8811 let l344 = *base.add(24).cast::<i32>();
8812 super::super::super::wasi::clocks::wall_clock::Datetime {
8813 seconds: l343 as u64,
8814 nanoseconds: l344 as u32,
8815 }
8816 };
8817 OplogEntry::BeginAtomicRegion(e621)
8818 }
8819 12 => {
8820 let e621 = {
8821 let l345 = *base.add(16).cast::<i64>();
8822 let l346 = *base.add(24).cast::<i32>();
8823 let l347 = *base.add(32).cast::<i64>();
8824 EndAtomicRegionParameters {
8825 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
8826 seconds: l345 as u64,
8827 nanoseconds: l346 as u32,
8828 },
8829 begin_index: l347 as u64,
8830 }
8831 };
8832 OplogEntry::EndAtomicRegion(e621)
8833 }
8834 13 => {
8835 let e621 = {
8836 let l348 = *base.add(16).cast::<i64>();
8837 let l349 = *base.add(24).cast::<i32>();
8838 super::super::super::wasi::clocks::wall_clock::Datetime {
8839 seconds: l348 as u64,
8840 nanoseconds: l349 as u32,
8841 }
8842 };
8843 OplogEntry::BeginRemoteWrite(e621)
8844 }
8845 14 => {
8846 let e621 = {
8847 let l350 = *base.add(16).cast::<i64>();
8848 let l351 = *base.add(24).cast::<i32>();
8849 let l352 = *base.add(32).cast::<i64>();
8850 EndRemoteWriteParameters {
8851 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
8852 seconds: l350 as u64,
8853 nanoseconds: l351 as u32,
8854 },
8855 begin_index: l352 as u64,
8856 }
8857 };
8858 OplogEntry::EndRemoteWrite(e621)
8859 }
8860 15 => {
8861 let e621 = {
8862 let l353 = *base.add(16).cast::<i64>();
8863 let l354 = *base.add(24).cast::<i32>();
8864 let l355 = i32::from(*base.add(32).cast::<u8>());
8865 let v415 = match l355 {
8866 0 => {
8867 let e415 = {
8868 let l356 = *base.add(40).cast::<*mut u8>();
8869 let l357 = *base.add(44).cast::<usize>();
8870 let len358 = l357;
8871 let bytes358 = _rt::Vec::from_raw_parts(
8872 l356.cast(),
8873 len358,
8874 len358,
8875 );
8876 let l359 = *base.add(48).cast::<*mut u8>();
8877 let l360 = *base.add(52).cast::<usize>();
8878 let len361 = l360;
8879 let bytes361 = _rt::Vec::from_raw_parts(
8880 l359.cast(),
8881 len361,
8882 len361,
8883 );
8884 let l362 = i32::from(*base.add(56).cast::<u8>());
8885 ExportedFunctionInvocationParameters {
8886 idempotency_key: _rt::string_lift(bytes358),
8887 function_name: _rt::string_lift(bytes361),
8888 input: match l362 {
8889 0 => None,
8890 1 => {
8891 let e = {
8892 let l363 = *base.add(60).cast::<*mut u8>();
8893 let l364 = *base.add(64).cast::<usize>();
8894 let base413 = l363;
8895 let len413 = l364;
8896 let mut result413 = _rt::Vec::with_capacity(len413);
8897 for i in 0..len413 {
8898 let base = base413.add(i * 8);
8899 let e413 = {
8900 let l365 = *base.add(0).cast::<*mut u8>();
8901 let l366 = *base.add(4).cast::<usize>();
8902 let base412 = l365;
8903 let len412 = l366;
8904 let mut result412 = _rt::Vec::with_capacity(len412);
8905 for i in 0..len412 {
8906 let base = base412.add(i * 24);
8907 let e412 = {
8908 let l367 = i32::from(*base.add(0).cast::<u8>());
8909 use super::super::super::golem::rpc::types::WitNode as V411;
8910 let v411 = match l367 {
8911 0 => {
8912 let e411 = {
8913 let l368 = *base.add(8).cast::<*mut u8>();
8914 let l369 = *base.add(12).cast::<usize>();
8915 let len370 = l369;
8916 _rt::Vec::from_raw_parts(l368.cast(), len370, len370)
8917 };
8918 V411::RecordValue(e411)
8919 }
8920 1 => {
8921 let e411 = {
8922 let l371 = *base.add(8).cast::<i32>();
8923 let l372 = i32::from(*base.add(12).cast::<u8>());
8924 (
8925 l371 as u32,
8926 match l372 {
8927 0 => None,
8928 1 => {
8929 let e = {
8930 let l373 = *base.add(16).cast::<i32>();
8931 l373
8932 };
8933 Some(e)
8934 }
8935 _ => _rt::invalid_enum_discriminant(),
8936 },
8937 )
8938 };
8939 V411::VariantValue(e411)
8940 }
8941 2 => {
8942 let e411 = {
8943 let l374 = *base.add(8).cast::<i32>();
8944 l374 as u32
8945 };
8946 V411::EnumValue(e411)
8947 }
8948 3 => {
8949 let e411 = {
8950 let l375 = *base.add(8).cast::<*mut u8>();
8951 let l376 = *base.add(12).cast::<usize>();
8952 let base378 = l375;
8953 let len378 = l376;
8954 let mut result378 = _rt::Vec::with_capacity(len378);
8955 for i in 0..len378 {
8956 let base = base378.add(i * 1);
8957 let e378 = {
8958 let l377 = i32::from(*base.add(0).cast::<u8>());
8959 _rt::bool_lift(l377 as u8)
8960 };
8961 result378.push(e378);
8962 }
8963 _rt::cabi_dealloc(base378, len378 * 1, 1);
8964 result378
8965 };
8966 V411::FlagsValue(e411)
8967 }
8968 4 => {
8969 let e411 = {
8970 let l379 = *base.add(8).cast::<*mut u8>();
8971 let l380 = *base.add(12).cast::<usize>();
8972 let len381 = l380;
8973 _rt::Vec::from_raw_parts(l379.cast(), len381, len381)
8974 };
8975 V411::TupleValue(e411)
8976 }
8977 5 => {
8978 let e411 = {
8979 let l382 = *base.add(8).cast::<*mut u8>();
8980 let l383 = *base.add(12).cast::<usize>();
8981 let len384 = l383;
8982 _rt::Vec::from_raw_parts(l382.cast(), len384, len384)
8983 };
8984 V411::ListValue(e411)
8985 }
8986 6 => {
8987 let e411 = {
8988 let l385 = i32::from(*base.add(8).cast::<u8>());
8989 match l385 {
8990 0 => None,
8991 1 => {
8992 let e = {
8993 let l386 = *base.add(12).cast::<i32>();
8994 l386
8995 };
8996 Some(e)
8997 }
8998 _ => _rt::invalid_enum_discriminant(),
8999 }
9000 };
9001 V411::OptionValue(e411)
9002 }
9003 7 => {
9004 let e411 = {
9005 let l387 = i32::from(*base.add(8).cast::<u8>());
9006 match l387 {
9007 0 => {
9008 let e = {
9009 let l388 = i32::from(*base.add(12).cast::<u8>());
9010 match l388 {
9011 0 => None,
9012 1 => {
9013 let e = {
9014 let l389 = *base.add(16).cast::<i32>();
9015 l389
9016 };
9017 Some(e)
9018 }
9019 _ => _rt::invalid_enum_discriminant(),
9020 }
9021 };
9022 Ok(e)
9023 }
9024 1 => {
9025 let e = {
9026 let l390 = i32::from(*base.add(12).cast::<u8>());
9027 match l390 {
9028 0 => None,
9029 1 => {
9030 let e = {
9031 let l391 = *base.add(16).cast::<i32>();
9032 l391
9033 };
9034 Some(e)
9035 }
9036 _ => _rt::invalid_enum_discriminant(),
9037 }
9038 };
9039 Err(e)
9040 }
9041 _ => _rt::invalid_enum_discriminant(),
9042 }
9043 };
9044 V411::ResultValue(e411)
9045 }
9046 8 => {
9047 let e411 = {
9048 let l392 = i32::from(*base.add(8).cast::<u8>());
9049 l392 as u8
9050 };
9051 V411::PrimU8(e411)
9052 }
9053 9 => {
9054 let e411 = {
9055 let l393 = i32::from(*base.add(8).cast::<u16>());
9056 l393 as u16
9057 };
9058 V411::PrimU16(e411)
9059 }
9060 10 => {
9061 let e411 = {
9062 let l394 = *base.add(8).cast::<i32>();
9063 l394 as u32
9064 };
9065 V411::PrimU32(e411)
9066 }
9067 11 => {
9068 let e411 = {
9069 let l395 = *base.add(8).cast::<i64>();
9070 l395 as u64
9071 };
9072 V411::PrimU64(e411)
9073 }
9074 12 => {
9075 let e411 = {
9076 let l396 = i32::from(*base.add(8).cast::<i8>());
9077 l396 as i8
9078 };
9079 V411::PrimS8(e411)
9080 }
9081 13 => {
9082 let e411 = {
9083 let l397 = i32::from(*base.add(8).cast::<i16>());
9084 l397 as i16
9085 };
9086 V411::PrimS16(e411)
9087 }
9088 14 => {
9089 let e411 = {
9090 let l398 = *base.add(8).cast::<i32>();
9091 l398
9092 };
9093 V411::PrimS32(e411)
9094 }
9095 15 => {
9096 let e411 = {
9097 let l399 = *base.add(8).cast::<i64>();
9098 l399
9099 };
9100 V411::PrimS64(e411)
9101 }
9102 16 => {
9103 let e411 = {
9104 let l400 = *base.add(8).cast::<f32>();
9105 l400
9106 };
9107 V411::PrimFloat32(e411)
9108 }
9109 17 => {
9110 let e411 = {
9111 let l401 = *base.add(8).cast::<f64>();
9112 l401
9113 };
9114 V411::PrimFloat64(e411)
9115 }
9116 18 => {
9117 let e411 = {
9118 let l402 = *base.add(8).cast::<i32>();
9119 _rt::char_lift(l402 as u32)
9120 };
9121 V411::PrimChar(e411)
9122 }
9123 19 => {
9124 let e411 = {
9125 let l403 = i32::from(*base.add(8).cast::<u8>());
9126 _rt::bool_lift(l403 as u8)
9127 };
9128 V411::PrimBool(e411)
9129 }
9130 20 => {
9131 let e411 = {
9132 let l404 = *base.add(8).cast::<*mut u8>();
9133 let l405 = *base.add(12).cast::<usize>();
9134 let len406 = l405;
9135 let bytes406 = _rt::Vec::from_raw_parts(
9136 l404.cast(),
9137 len406,
9138 len406,
9139 );
9140 _rt::string_lift(bytes406)
9141 };
9142 V411::PrimString(e411)
9143 }
9144 n => {
9145 debug_assert_eq!(n, 21, "invalid enum discriminant");
9146 let e411 = {
9147 let l407 = *base.add(8).cast::<*mut u8>();
9148 let l408 = *base.add(12).cast::<usize>();
9149 let len409 = l408;
9150 let bytes409 = _rt::Vec::from_raw_parts(
9151 l407.cast(),
9152 len409,
9153 len409,
9154 );
9155 let l410 = *base.add(16).cast::<i64>();
9156 (
9157 super::super::super::golem::rpc::types::Uri {
9158 value: _rt::string_lift(bytes409),
9159 },
9160 l410 as u64,
9161 )
9162 };
9163 V411::Handle(e411)
9164 }
9165 };
9166 v411
9167 };
9168 result412.push(e412);
9169 }
9170 _rt::cabi_dealloc(base412, len412 * 24, 8);
9171 super::super::super::golem::rpc::types::WitValue {
9172 nodes: result412,
9173 }
9174 };
9175 result413.push(e413);
9176 }
9177 _rt::cabi_dealloc(base413, len413 * 8, 4);
9178 result413
9179 };
9180 Some(e)
9181 }
9182 _ => _rt::invalid_enum_discriminant(),
9183 },
9184 }
9185 };
9186 WorkerInvocation::ExportedFunction(e415)
9187 }
9188 n => {
9189 debug_assert_eq!(n, 1, "invalid enum discriminant");
9190 let e415 = {
9191 let l414 = *base.add(40).cast::<i64>();
9192 l414 as u64
9193 };
9194 WorkerInvocation::ManualUpdate(e415)
9195 }
9196 };
9197 PendingWorkerInvocationParameters {
9198 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9199 seconds: l353 as u64,
9200 nanoseconds: l354 as u32,
9201 },
9202 invocation: v415,
9203 }
9204 };
9205 OplogEntry::PendingWorkerInvocation(e621)
9206 }
9207 16 => {
9208 let e621 = {
9209 let l416 = *base.add(16).cast::<i64>();
9210 let l417 = *base.add(24).cast::<i32>();
9211 let l418 = *base.add(32).cast::<i64>();
9212 let l419 = i32::from(*base.add(40).cast::<u8>());
9213 let v423 = match l419 {
9214 0 => UpdateDescription::AutoUpdate,
9215 n => {
9216 debug_assert_eq!(n, 1, "invalid enum discriminant");
9217 let e423 = {
9218 let l420 = *base.add(44).cast::<*mut u8>();
9219 let l421 = *base.add(48).cast::<usize>();
9220 let len422 = l421;
9221 _rt::Vec::from_raw_parts(l420.cast(), len422, len422)
9222 };
9223 UpdateDescription::SnapshotBased(e423)
9224 }
9225 };
9226 PendingUpdateParameters {
9227 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9228 seconds: l416 as u64,
9229 nanoseconds: l417 as u32,
9230 },
9231 target_version: l418 as u64,
9232 update_description: v423,
9233 }
9234 };
9235 OplogEntry::PendingUpdate(e621)
9236 }
9237 17 => {
9238 let e621 = {
9239 let l424 = *base.add(16).cast::<i64>();
9240 let l425 = *base.add(24).cast::<i32>();
9241 let l426 = *base.add(32).cast::<i64>();
9242 let l427 = *base.add(40).cast::<i64>();
9243 let l428 = *base.add(48).cast::<*mut u8>();
9244 let l429 = *base.add(52).cast::<usize>();
9245 let base447 = l428;
9246 let len447 = l429;
9247 let mut result447 = _rt::Vec::with_capacity(len447);
9248 for i in 0..len447 {
9249 let base = base447.add(i * 40);
9250 let e447 = {
9251 let l430 = *base.add(0).cast::<i64>();
9252 let l431 = *base.add(8).cast::<i64>();
9253 let l432 = *base.add(16).cast::<*mut u8>();
9254 let l433 = *base.add(20).cast::<usize>();
9255 let len434 = l433;
9256 let bytes434 = _rt::Vec::from_raw_parts(
9257 l432.cast(),
9258 len434,
9259 len434,
9260 );
9261 let l435 = *base.add(24).cast::<*mut u8>();
9262 let l436 = *base.add(28).cast::<usize>();
9263 let len437 = l436;
9264 let bytes437 = _rt::Vec::from_raw_parts(
9265 l435.cast(),
9266 len437,
9267 len437,
9268 );
9269 let l438 = *base.add(32).cast::<*mut u8>();
9270 let l439 = *base.add(36).cast::<usize>();
9271 let base446 = l438;
9272 let len446 = l439;
9273 let mut result446 = _rt::Vec::with_capacity(len446);
9274 for i in 0..len446 {
9275 let base = base446.add(i * 16);
9276 let e446 = {
9277 let l440 = *base.add(0).cast::<*mut u8>();
9278 let l441 = *base.add(4).cast::<usize>();
9279 let len442 = l441;
9280 let bytes442 = _rt::Vec::from_raw_parts(
9281 l440.cast(),
9282 len442,
9283 len442,
9284 );
9285 let l443 = *base.add(8).cast::<*mut u8>();
9286 let l444 = *base.add(12).cast::<usize>();
9287 let len445 = l444;
9288 let bytes445 = _rt::Vec::from_raw_parts(
9289 l443.cast(),
9290 len445,
9291 len445,
9292 );
9293 (_rt::string_lift(bytes442), _rt::string_lift(bytes445))
9294 };
9295 result446.push(e446);
9296 }
9297 _rt::cabi_dealloc(base446, len446 * 16, 4);
9298 PluginInstallationDescription {
9299 installation_id: super::super::super::golem::api::host::Uuid {
9300 high_bits: l430 as u64,
9301 low_bits: l431 as u64,
9302 },
9303 name: _rt::string_lift(bytes434),
9304 version: _rt::string_lift(bytes437),
9305 parameters: result446,
9306 }
9307 };
9308 result447.push(e447);
9309 }
9310 _rt::cabi_dealloc(base447, len447 * 40, 8);
9311 SuccessfulUpdateParameters {
9312 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9313 seconds: l424 as u64,
9314 nanoseconds: l425 as u32,
9315 },
9316 target_version: l426 as u64,
9317 new_component_size: l427 as u64,
9318 new_active_plugins: result447,
9319 }
9320 };
9321 OplogEntry::SuccessfulUpdate(e621)
9322 }
9323 18 => {
9324 let e621 = {
9325 let l448 = *base.add(16).cast::<i64>();
9326 let l449 = *base.add(24).cast::<i32>();
9327 let l450 = *base.add(32).cast::<i64>();
9328 let l451 = i32::from(*base.add(40).cast::<u8>());
9329 FailedUpdateParameters {
9330 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9331 seconds: l448 as u64,
9332 nanoseconds: l449 as u32,
9333 },
9334 target_version: l450 as u64,
9335 details: match l451 {
9336 0 => None,
9337 1 => {
9338 let e = {
9339 let l452 = *base.add(44).cast::<*mut u8>();
9340 let l453 = *base.add(48).cast::<usize>();
9341 let len454 = l453;
9342 let bytes454 = _rt::Vec::from_raw_parts(
9343 l452.cast(),
9344 len454,
9345 len454,
9346 );
9347 _rt::string_lift(bytes454)
9348 };
9349 Some(e)
9350 }
9351 _ => _rt::invalid_enum_discriminant(),
9352 },
9353 }
9354 };
9355 OplogEntry::FailedUpdate(e621)
9356 }
9357 19 => {
9358 let e621 = {
9359 let l455 = *base.add(16).cast::<i64>();
9360 let l456 = *base.add(24).cast::<i32>();
9361 let l457 = *base.add(32).cast::<i64>();
9362 GrowMemoryParameters {
9363 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9364 seconds: l455 as u64,
9365 nanoseconds: l456 as u32,
9366 },
9367 delta: l457 as u64,
9368 }
9369 };
9370 OplogEntry::GrowMemory(e621)
9371 }
9372 20 => {
9373 let e621 = {
9374 let l458 = *base.add(16).cast::<i64>();
9375 let l459 = *base.add(24).cast::<i32>();
9376 let l460 = *base.add(32).cast::<i64>();
9377 CreateResourceParameters {
9378 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9379 seconds: l458 as u64,
9380 nanoseconds: l459 as u32,
9381 },
9382 resource_id: l460 as u64,
9383 }
9384 };
9385 OplogEntry::CreateResource(e621)
9386 }
9387 21 => {
9388 let e621 = {
9389 let l461 = *base.add(16).cast::<i64>();
9390 let l462 = *base.add(24).cast::<i32>();
9391 let l463 = *base.add(32).cast::<i64>();
9392 DropResourceParameters {
9393 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9394 seconds: l461 as u64,
9395 nanoseconds: l462 as u32,
9396 },
9397 resource_id: l463 as u64,
9398 }
9399 };
9400 OplogEntry::DropResource(e621)
9401 }
9402 22 => {
9403 let e621 = {
9404 let l464 = *base.add(16).cast::<i64>();
9405 let l465 = *base.add(24).cast::<i32>();
9406 let l466 = *base.add(32).cast::<i64>();
9407 let l467 = *base.add(40).cast::<*mut u8>();
9408 let l468 = *base.add(44).cast::<usize>();
9409 let len469 = l468;
9410 let bytes469 = _rt::Vec::from_raw_parts(
9411 l467.cast(),
9412 len469,
9413 len469,
9414 );
9415 let l470 = *base.add(48).cast::<*mut u8>();
9416 let l471 = *base.add(52).cast::<usize>();
9417 let base520 = l470;
9418 let len520 = l471;
9419 let mut result520 = _rt::Vec::with_capacity(len520);
9420 for i in 0..len520 {
9421 let base = base520.add(i * 8);
9422 let e520 = {
9423 let l472 = *base.add(0).cast::<*mut u8>();
9424 let l473 = *base.add(4).cast::<usize>();
9425 let base519 = l472;
9426 let len519 = l473;
9427 let mut result519 = _rt::Vec::with_capacity(len519);
9428 for i in 0..len519 {
9429 let base = base519.add(i * 24);
9430 let e519 = {
9431 let l474 = i32::from(*base.add(0).cast::<u8>());
9432 use super::super::super::golem::rpc::types::WitNode as V518;
9433 let v518 = match l474 {
9434 0 => {
9435 let e518 = {
9436 let l475 = *base.add(8).cast::<*mut u8>();
9437 let l476 = *base.add(12).cast::<usize>();
9438 let len477 = l476;
9439 _rt::Vec::from_raw_parts(l475.cast(), len477, len477)
9440 };
9441 V518::RecordValue(e518)
9442 }
9443 1 => {
9444 let e518 = {
9445 let l478 = *base.add(8).cast::<i32>();
9446 let l479 = i32::from(*base.add(12).cast::<u8>());
9447 (
9448 l478 as u32,
9449 match l479 {
9450 0 => None,
9451 1 => {
9452 let e = {
9453 let l480 = *base.add(16).cast::<i32>();
9454 l480
9455 };
9456 Some(e)
9457 }
9458 _ => _rt::invalid_enum_discriminant(),
9459 },
9460 )
9461 };
9462 V518::VariantValue(e518)
9463 }
9464 2 => {
9465 let e518 = {
9466 let l481 = *base.add(8).cast::<i32>();
9467 l481 as u32
9468 };
9469 V518::EnumValue(e518)
9470 }
9471 3 => {
9472 let e518 = {
9473 let l482 = *base.add(8).cast::<*mut u8>();
9474 let l483 = *base.add(12).cast::<usize>();
9475 let base485 = l482;
9476 let len485 = l483;
9477 let mut result485 = _rt::Vec::with_capacity(len485);
9478 for i in 0..len485 {
9479 let base = base485.add(i * 1);
9480 let e485 = {
9481 let l484 = i32::from(*base.add(0).cast::<u8>());
9482 _rt::bool_lift(l484 as u8)
9483 };
9484 result485.push(e485);
9485 }
9486 _rt::cabi_dealloc(base485, len485 * 1, 1);
9487 result485
9488 };
9489 V518::FlagsValue(e518)
9490 }
9491 4 => {
9492 let e518 = {
9493 let l486 = *base.add(8).cast::<*mut u8>();
9494 let l487 = *base.add(12).cast::<usize>();
9495 let len488 = l487;
9496 _rt::Vec::from_raw_parts(l486.cast(), len488, len488)
9497 };
9498 V518::TupleValue(e518)
9499 }
9500 5 => {
9501 let e518 = {
9502 let l489 = *base.add(8).cast::<*mut u8>();
9503 let l490 = *base.add(12).cast::<usize>();
9504 let len491 = l490;
9505 _rt::Vec::from_raw_parts(l489.cast(), len491, len491)
9506 };
9507 V518::ListValue(e518)
9508 }
9509 6 => {
9510 let e518 = {
9511 let l492 = i32::from(*base.add(8).cast::<u8>());
9512 match l492 {
9513 0 => None,
9514 1 => {
9515 let e = {
9516 let l493 = *base.add(12).cast::<i32>();
9517 l493
9518 };
9519 Some(e)
9520 }
9521 _ => _rt::invalid_enum_discriminant(),
9522 }
9523 };
9524 V518::OptionValue(e518)
9525 }
9526 7 => {
9527 let e518 = {
9528 let l494 = i32::from(*base.add(8).cast::<u8>());
9529 match l494 {
9530 0 => {
9531 let e = {
9532 let l495 = i32::from(*base.add(12).cast::<u8>());
9533 match l495 {
9534 0 => None,
9535 1 => {
9536 let e = {
9537 let l496 = *base.add(16).cast::<i32>();
9538 l496
9539 };
9540 Some(e)
9541 }
9542 _ => _rt::invalid_enum_discriminant(),
9543 }
9544 };
9545 Ok(e)
9546 }
9547 1 => {
9548 let e = {
9549 let l497 = i32::from(*base.add(12).cast::<u8>());
9550 match l497 {
9551 0 => None,
9552 1 => {
9553 let e = {
9554 let l498 = *base.add(16).cast::<i32>();
9555 l498
9556 };
9557 Some(e)
9558 }
9559 _ => _rt::invalid_enum_discriminant(),
9560 }
9561 };
9562 Err(e)
9563 }
9564 _ => _rt::invalid_enum_discriminant(),
9565 }
9566 };
9567 V518::ResultValue(e518)
9568 }
9569 8 => {
9570 let e518 = {
9571 let l499 = i32::from(*base.add(8).cast::<u8>());
9572 l499 as u8
9573 };
9574 V518::PrimU8(e518)
9575 }
9576 9 => {
9577 let e518 = {
9578 let l500 = i32::from(*base.add(8).cast::<u16>());
9579 l500 as u16
9580 };
9581 V518::PrimU16(e518)
9582 }
9583 10 => {
9584 let e518 = {
9585 let l501 = *base.add(8).cast::<i32>();
9586 l501 as u32
9587 };
9588 V518::PrimU32(e518)
9589 }
9590 11 => {
9591 let e518 = {
9592 let l502 = *base.add(8).cast::<i64>();
9593 l502 as u64
9594 };
9595 V518::PrimU64(e518)
9596 }
9597 12 => {
9598 let e518 = {
9599 let l503 = i32::from(*base.add(8).cast::<i8>());
9600 l503 as i8
9601 };
9602 V518::PrimS8(e518)
9603 }
9604 13 => {
9605 let e518 = {
9606 let l504 = i32::from(*base.add(8).cast::<i16>());
9607 l504 as i16
9608 };
9609 V518::PrimS16(e518)
9610 }
9611 14 => {
9612 let e518 = {
9613 let l505 = *base.add(8).cast::<i32>();
9614 l505
9615 };
9616 V518::PrimS32(e518)
9617 }
9618 15 => {
9619 let e518 = {
9620 let l506 = *base.add(8).cast::<i64>();
9621 l506
9622 };
9623 V518::PrimS64(e518)
9624 }
9625 16 => {
9626 let e518 = {
9627 let l507 = *base.add(8).cast::<f32>();
9628 l507
9629 };
9630 V518::PrimFloat32(e518)
9631 }
9632 17 => {
9633 let e518 = {
9634 let l508 = *base.add(8).cast::<f64>();
9635 l508
9636 };
9637 V518::PrimFloat64(e518)
9638 }
9639 18 => {
9640 let e518 = {
9641 let l509 = *base.add(8).cast::<i32>();
9642 _rt::char_lift(l509 as u32)
9643 };
9644 V518::PrimChar(e518)
9645 }
9646 19 => {
9647 let e518 = {
9648 let l510 = i32::from(*base.add(8).cast::<u8>());
9649 _rt::bool_lift(l510 as u8)
9650 };
9651 V518::PrimBool(e518)
9652 }
9653 20 => {
9654 let e518 = {
9655 let l511 = *base.add(8).cast::<*mut u8>();
9656 let l512 = *base.add(12).cast::<usize>();
9657 let len513 = l512;
9658 let bytes513 = _rt::Vec::from_raw_parts(
9659 l511.cast(),
9660 len513,
9661 len513,
9662 );
9663 _rt::string_lift(bytes513)
9664 };
9665 V518::PrimString(e518)
9666 }
9667 n => {
9668 debug_assert_eq!(n, 21, "invalid enum discriminant");
9669 let e518 = {
9670 let l514 = *base.add(8).cast::<*mut u8>();
9671 let l515 = *base.add(12).cast::<usize>();
9672 let len516 = l515;
9673 let bytes516 = _rt::Vec::from_raw_parts(
9674 l514.cast(),
9675 len516,
9676 len516,
9677 );
9678 let l517 = *base.add(16).cast::<i64>();
9679 (
9680 super::super::super::golem::rpc::types::Uri {
9681 value: _rt::string_lift(bytes516),
9682 },
9683 l517 as u64,
9684 )
9685 };
9686 V518::Handle(e518)
9687 }
9688 };
9689 v518
9690 };
9691 result519.push(e519);
9692 }
9693 _rt::cabi_dealloc(base519, len519 * 24, 8);
9694 super::super::super::golem::rpc::types::WitValue {
9695 nodes: result519,
9696 }
9697 };
9698 result520.push(e520);
9699 }
9700 _rt::cabi_dealloc(base520, len520 * 8, 4);
9701 DescribeResourceParameters {
9702 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9703 seconds: l464 as u64,
9704 nanoseconds: l465 as u32,
9705 },
9706 resource_id: l466 as u64,
9707 resource_name: _rt::string_lift(bytes469),
9708 resource_params: result520,
9709 }
9710 };
9711 OplogEntry::DescribeResource(e621)
9712 }
9713 23 => {
9714 let e621 = {
9715 let l521 = *base.add(16).cast::<i64>();
9716 let l522 = *base.add(24).cast::<i32>();
9717 let l523 = i32::from(*base.add(32).cast::<u8>());
9718 let l524 = *base.add(36).cast::<*mut u8>();
9719 let l525 = *base.add(40).cast::<usize>();
9720 let len526 = l525;
9721 let bytes526 = _rt::Vec::from_raw_parts(
9722 l524.cast(),
9723 len526,
9724 len526,
9725 );
9726 let l527 = *base.add(44).cast::<*mut u8>();
9727 let l528 = *base.add(48).cast::<usize>();
9728 let len529 = l528;
9729 let bytes529 = _rt::Vec::from_raw_parts(
9730 l527.cast(),
9731 len529,
9732 len529,
9733 );
9734 LogParameters {
9735 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9736 seconds: l521 as u64,
9737 nanoseconds: l522 as u32,
9738 },
9739 level: LogLevel::_lift(l523 as u8),
9740 context: _rt::string_lift(bytes526),
9741 message: _rt::string_lift(bytes529),
9742 }
9743 };
9744 OplogEntry::Log(e621)
9745 }
9746 24 => {
9747 let e621 = {
9748 let l530 = *base.add(16).cast::<i64>();
9749 let l531 = *base.add(24).cast::<i32>();
9750 super::super::super::wasi::clocks::wall_clock::Datetime {
9751 seconds: l530 as u64,
9752 nanoseconds: l531 as u32,
9753 }
9754 };
9755 OplogEntry::Restart(e621)
9756 }
9757 25 => {
9758 let e621 = {
9759 let l532 = *base.add(16).cast::<i64>();
9760 let l533 = *base.add(24).cast::<i32>();
9761 let l534 = *base.add(32).cast::<i64>();
9762 let l535 = *base.add(40).cast::<i64>();
9763 let l536 = *base.add(48).cast::<*mut u8>();
9764 let l537 = *base.add(52).cast::<usize>();
9765 let len538 = l537;
9766 let bytes538 = _rt::Vec::from_raw_parts(
9767 l536.cast(),
9768 len538,
9769 len538,
9770 );
9771 let l539 = *base.add(56).cast::<*mut u8>();
9772 let l540 = *base.add(60).cast::<usize>();
9773 let len541 = l540;
9774 let bytes541 = _rt::Vec::from_raw_parts(
9775 l539.cast(),
9776 len541,
9777 len541,
9778 );
9779 let l542 = *base.add(64).cast::<*mut u8>();
9780 let l543 = *base.add(68).cast::<usize>();
9781 let base550 = l542;
9782 let len550 = l543;
9783 let mut result550 = _rt::Vec::with_capacity(len550);
9784 for i in 0..len550 {
9785 let base = base550.add(i * 16);
9786 let e550 = {
9787 let l544 = *base.add(0).cast::<*mut u8>();
9788 let l545 = *base.add(4).cast::<usize>();
9789 let len546 = l545;
9790 let bytes546 = _rt::Vec::from_raw_parts(
9791 l544.cast(),
9792 len546,
9793 len546,
9794 );
9795 let l547 = *base.add(8).cast::<*mut u8>();
9796 let l548 = *base.add(12).cast::<usize>();
9797 let len549 = l548;
9798 let bytes549 = _rt::Vec::from_raw_parts(
9799 l547.cast(),
9800 len549,
9801 len549,
9802 );
9803 (_rt::string_lift(bytes546), _rt::string_lift(bytes549))
9804 };
9805 result550.push(e550);
9806 }
9807 _rt::cabi_dealloc(base550, len550 * 16, 4);
9808 ActivatePluginParameters {
9809 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9810 seconds: l532 as u64,
9811 nanoseconds: l533 as u32,
9812 },
9813 plugin: PluginInstallationDescription {
9814 installation_id: super::super::super::golem::api::host::Uuid {
9815 high_bits: l534 as u64,
9816 low_bits: l535 as u64,
9817 },
9818 name: _rt::string_lift(bytes538),
9819 version: _rt::string_lift(bytes541),
9820 parameters: result550,
9821 },
9822 }
9823 };
9824 OplogEntry::ActivatePlugin(e621)
9825 }
9826 26 => {
9827 let e621 = {
9828 let l551 = *base.add(16).cast::<i64>();
9829 let l552 = *base.add(24).cast::<i32>();
9830 let l553 = *base.add(32).cast::<i64>();
9831 let l554 = *base.add(40).cast::<i64>();
9832 let l555 = *base.add(48).cast::<*mut u8>();
9833 let l556 = *base.add(52).cast::<usize>();
9834 let len557 = l556;
9835 let bytes557 = _rt::Vec::from_raw_parts(
9836 l555.cast(),
9837 len557,
9838 len557,
9839 );
9840 let l558 = *base.add(56).cast::<*mut u8>();
9841 let l559 = *base.add(60).cast::<usize>();
9842 let len560 = l559;
9843 let bytes560 = _rt::Vec::from_raw_parts(
9844 l558.cast(),
9845 len560,
9846 len560,
9847 );
9848 let l561 = *base.add(64).cast::<*mut u8>();
9849 let l562 = *base.add(68).cast::<usize>();
9850 let base569 = l561;
9851 let len569 = l562;
9852 let mut result569 = _rt::Vec::with_capacity(len569);
9853 for i in 0..len569 {
9854 let base = base569.add(i * 16);
9855 let e569 = {
9856 let l563 = *base.add(0).cast::<*mut u8>();
9857 let l564 = *base.add(4).cast::<usize>();
9858 let len565 = l564;
9859 let bytes565 = _rt::Vec::from_raw_parts(
9860 l563.cast(),
9861 len565,
9862 len565,
9863 );
9864 let l566 = *base.add(8).cast::<*mut u8>();
9865 let l567 = *base.add(12).cast::<usize>();
9866 let len568 = l567;
9867 let bytes568 = _rt::Vec::from_raw_parts(
9868 l566.cast(),
9869 len568,
9870 len568,
9871 );
9872 (_rt::string_lift(bytes565), _rt::string_lift(bytes568))
9873 };
9874 result569.push(e569);
9875 }
9876 _rt::cabi_dealloc(base569, len569 * 16, 4);
9877 DeactivatePluginParameters {
9878 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9879 seconds: l551 as u64,
9880 nanoseconds: l552 as u32,
9881 },
9882 plugin: PluginInstallationDescription {
9883 installation_id: super::super::super::golem::api::host::Uuid {
9884 high_bits: l553 as u64,
9885 low_bits: l554 as u64,
9886 },
9887 name: _rt::string_lift(bytes557),
9888 version: _rt::string_lift(bytes560),
9889 parameters: result569,
9890 },
9891 }
9892 };
9893 OplogEntry::DeactivatePlugin(e621)
9894 }
9895 27 => {
9896 let e621 = {
9897 let l570 = *base.add(16).cast::<i64>();
9898 let l571 = *base.add(24).cast::<i32>();
9899 let l572 = *base.add(32).cast::<i64>();
9900 let l573 = *base.add(40).cast::<i64>();
9901 RevertParameters {
9902 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9903 seconds: l570 as u64,
9904 nanoseconds: l571 as u32,
9905 },
9906 start: l572 as u64,
9907 end: l573 as u64,
9908 }
9909 };
9910 OplogEntry::Revert(e621)
9911 }
9912 28 => {
9913 let e621 = {
9914 let l574 = *base.add(16).cast::<i64>();
9915 let l575 = *base.add(24).cast::<i32>();
9916 let l576 = *base.add(32).cast::<*mut u8>();
9917 let l577 = *base.add(36).cast::<usize>();
9918 let len578 = l577;
9919 let bytes578 = _rt::Vec::from_raw_parts(
9920 l576.cast(),
9921 len578,
9922 len578,
9923 );
9924 CancelInvocationParameters {
9925 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9926 seconds: l574 as u64,
9927 nanoseconds: l575 as u32,
9928 },
9929 idempotency_key: _rt::string_lift(bytes578),
9930 }
9931 };
9932 OplogEntry::CancelInvocation(e621)
9933 }
9934 29 => {
9935 let e621 = {
9936 let l579 = *base.add(16).cast::<i64>();
9937 let l580 = *base.add(24).cast::<i32>();
9938 let l581 = *base.add(32).cast::<*mut u8>();
9939 let l582 = *base.add(36).cast::<usize>();
9940 let len583 = l582;
9941 let bytes583 = _rt::Vec::from_raw_parts(
9942 l581.cast(),
9943 len583,
9944 len583,
9945 );
9946 let l584 = i32::from(*base.add(40).cast::<u8>());
9947 let l588 = i32::from(*base.add(52).cast::<u8>());
9948 let l592 = *base.add(64).cast::<*mut u8>();
9949 let l593 = *base.add(68).cast::<usize>();
9950 let base602 = l592;
9951 let len602 = l593;
9952 let mut result602 = _rt::Vec::with_capacity(len602);
9953 for i in 0..len602 {
9954 let base = base602.add(i * 20);
9955 let e602 = {
9956 let l594 = *base.add(0).cast::<*mut u8>();
9957 let l595 = *base.add(4).cast::<usize>();
9958 let len596 = l595;
9959 let bytes596 = _rt::Vec::from_raw_parts(
9960 l594.cast(),
9961 len596,
9962 len596,
9963 );
9964 let l597 = i32::from(*base.add(8).cast::<u8>());
9965 use super::super::super::golem::api::context::AttributeValue as V601;
9966 let v601 = match l597 {
9967 n => {
9968 debug_assert_eq!(n, 0, "invalid enum discriminant");
9969 let e601 = {
9970 let l598 = *base.add(12).cast::<*mut u8>();
9971 let l599 = *base.add(16).cast::<usize>();
9972 let len600 = l599;
9973 let bytes600 = _rt::Vec::from_raw_parts(
9974 l598.cast(),
9975 len600,
9976 len600,
9977 );
9978 _rt::string_lift(bytes600)
9979 };
9980 V601::String(e601)
9981 }
9982 };
9983 super::super::super::golem::api::context::Attribute {
9984 key: _rt::string_lift(bytes596),
9985 value: v601,
9986 }
9987 };
9988 result602.push(e602);
9989 }
9990 _rt::cabi_dealloc(base602, len602 * 20, 4);
9991 StartSpanParameters {
9992 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
9993 seconds: l579 as u64,
9994 nanoseconds: l580 as u32,
9995 },
9996 span_id: _rt::string_lift(bytes583),
9997 parent: match l584 {
9998 0 => None,
9999 1 => {
10000 let e = {
10001 let l585 = *base.add(44).cast::<*mut u8>();
10002 let l586 = *base.add(48).cast::<usize>();
10003 let len587 = l586;
10004 let bytes587 = _rt::Vec::from_raw_parts(
10005 l585.cast(),
10006 len587,
10007 len587,
10008 );
10009 _rt::string_lift(bytes587)
10010 };
10011 Some(e)
10012 }
10013 _ => _rt::invalid_enum_discriminant(),
10014 },
10015 linked_context: match l588 {
10016 0 => None,
10017 1 => {
10018 let e = {
10019 let l589 = *base.add(56).cast::<*mut u8>();
10020 let l590 = *base.add(60).cast::<usize>();
10021 let len591 = l590;
10022 let bytes591 = _rt::Vec::from_raw_parts(
10023 l589.cast(),
10024 len591,
10025 len591,
10026 );
10027 _rt::string_lift(bytes591)
10028 };
10029 Some(e)
10030 }
10031 _ => _rt::invalid_enum_discriminant(),
10032 },
10033 attributes: result602,
10034 }
10035 };
10036 OplogEntry::StartSpan(e621)
10037 }
10038 30 => {
10039 let e621 = {
10040 let l603 = *base.add(16).cast::<i64>();
10041 let l604 = *base.add(24).cast::<i32>();
10042 let l605 = *base.add(32).cast::<*mut u8>();
10043 let l606 = *base.add(36).cast::<usize>();
10044 let len607 = l606;
10045 let bytes607 = _rt::Vec::from_raw_parts(
10046 l605.cast(),
10047 len607,
10048 len607,
10049 );
10050 FinishSpanParameters {
10051 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
10052 seconds: l603 as u64,
10053 nanoseconds: l604 as u32,
10054 },
10055 span_id: _rt::string_lift(bytes607),
10056 }
10057 };
10058 OplogEntry::FinishSpan(e621)
10059 }
10060 n => {
10061 debug_assert_eq!(n, 31, "invalid enum discriminant");
10062 let e621 = {
10063 let l608 = *base.add(16).cast::<i64>();
10064 let l609 = *base.add(24).cast::<i32>();
10065 let l610 = *base.add(32).cast::<*mut u8>();
10066 let l611 = *base.add(36).cast::<usize>();
10067 let len612 = l611;
10068 let bytes612 = _rt::Vec::from_raw_parts(
10069 l610.cast(),
10070 len612,
10071 len612,
10072 );
10073 let l613 = *base.add(40).cast::<*mut u8>();
10074 let l614 = *base.add(44).cast::<usize>();
10075 let len615 = l614;
10076 let bytes615 = _rt::Vec::from_raw_parts(
10077 l613.cast(),
10078 len615,
10079 len615,
10080 );
10081 let l616 = i32::from(*base.add(48).cast::<u8>());
10082 use super::super::super::golem::api::context::AttributeValue as V620;
10083 let v620 = match l616 {
10084 n => {
10085 debug_assert_eq!(n, 0, "invalid enum discriminant");
10086 let e620 = {
10087 let l617 = *base.add(52).cast::<*mut u8>();
10088 let l618 = *base.add(56).cast::<usize>();
10089 let len619 = l618;
10090 let bytes619 = _rt::Vec::from_raw_parts(
10091 l617.cast(),
10092 len619,
10093 len619,
10094 );
10095 _rt::string_lift(bytes619)
10096 };
10097 V620::String(e620)
10098 }
10099 };
10100 SetSpanAttributeParameters {
10101 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
10102 seconds: l608 as u64,
10103 nanoseconds: l609 as u32,
10104 },
10105 span_id: _rt::string_lift(bytes612),
10106 key: _rt::string_lift(bytes615),
10107 value: v620,
10108 }
10109 };
10110 OplogEntry::SetSpanAttribute(e621)
10111 }
10112 };
10113 (l4 as u64, v621)
10114 };
10115 result622.push(e622);
10116 }
10117 _rt::cabi_dealloc(base622, len622 * 144, 8);
10118 result622
10119 };
10120 Some(e)
10121 }
10122 _ => _rt::invalid_enum_discriminant(),
10123 }
10124 }
10125 }
10126 }
10127 }
10128 }
10129 pub mod durability {
10130 #[allow(dead_code, clippy::all)]
10131 pub mod durability {
10132 #[used]
10133 #[doc(hidden)]
10134 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
10135 use super::super::super::_rt;
10136 pub type PersistenceLevel = super::super::super::golem::api::host::PersistenceLevel;
10137 pub type OplogIndex = super::super::super::golem::api::oplog::OplogIndex;
10138 pub type WrappedFunctionType = super::super::super::golem::api::oplog::WrappedFunctionType;
10139 pub type Datetime = super::super::super::wasi::clocks::wall_clock::Datetime;
10140 pub type ValueAndType = super::super::super::golem::rpc::types::ValueAndType;
10141 pub type DurableFunctionType = WrappedFunctionType;
10142 #[repr(C)]
10143 #[derive(Clone, Copy)]
10144 pub struct DurableExecutionState {
10145 pub is_live: bool,
10146 pub persistence_level: PersistenceLevel,
10147 }
10148 impl ::core::fmt::Debug for DurableExecutionState {
10149 fn fmt(
10150 &self,
10151 f: &mut ::core::fmt::Formatter<'_>,
10152 ) -> ::core::fmt::Result {
10153 f.debug_struct("DurableExecutionState")
10154 .field("is-live", &self.is_live)
10155 .field("persistence-level", &self.persistence_level)
10156 .finish()
10157 }
10158 }
10159 #[repr(u8)]
10160 #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
10161 pub enum OplogEntryVersion {
10162 V1,
10163 V2,
10164 }
10165 impl ::core::fmt::Debug for OplogEntryVersion {
10166 fn fmt(
10167 &self,
10168 f: &mut ::core::fmt::Formatter<'_>,
10169 ) -> ::core::fmt::Result {
10170 match self {
10171 OplogEntryVersion::V1 => {
10172 f.debug_tuple("OplogEntryVersion::V1").finish()
10173 }
10174 OplogEntryVersion::V2 => {
10175 f.debug_tuple("OplogEntryVersion::V2").finish()
10176 }
10177 }
10178 }
10179 }
10180 impl OplogEntryVersion {
10181 #[doc(hidden)]
10182 pub unsafe fn _lift(val: u8) -> OplogEntryVersion {
10183 if !cfg!(debug_assertions) {
10184 return ::core::mem::transmute(val);
10185 }
10186 match val {
10187 0 => OplogEntryVersion::V1,
10188 1 => OplogEntryVersion::V2,
10189 _ => panic!("invalid enum discriminant"),
10190 }
10191 }
10192 }
10193 #[derive(Clone)]
10194 pub struct PersistedDurableFunctionInvocation {
10195 pub timestamp: Datetime,
10196 pub function_name: _rt::String,
10197 pub response: _rt::Vec<u8>,
10198 pub function_type: DurableFunctionType,
10199 pub entry_version: OplogEntryVersion,
10200 }
10201 impl ::core::fmt::Debug for PersistedDurableFunctionInvocation {
10202 fn fmt(
10203 &self,
10204 f: &mut ::core::fmt::Formatter<'_>,
10205 ) -> ::core::fmt::Result {
10206 f.debug_struct("PersistedDurableFunctionInvocation")
10207 .field("timestamp", &self.timestamp)
10208 .field("function-name", &self.function_name)
10209 .field("response", &self.response)
10210 .field("function-type", &self.function_type)
10211 .field("entry-version", &self.entry_version)
10212 .finish()
10213 }
10214 }
10215 #[allow(unused_unsafe, clippy::all)]
10216 /// Observes a function call (produces logs and metrics)
10217 pub fn observe_function_call(iface: &str, function: &str) {
10218 unsafe {
10219 let vec0 = iface;
10220 let ptr0 = vec0.as_ptr().cast::<u8>();
10221 let len0 = vec0.len();
10222 let vec1 = function;
10223 let ptr1 = vec1.as_ptr().cast::<u8>();
10224 let len1 = vec1.len();
10225 #[cfg(target_arch = "wasm32")]
10226 #[link(wasm_import_module = "golem:durability/durability@1.2.0")]
10227 extern "C" {
10228 #[link_name = "observe-function-call"]
10229 fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize);
10230 }
10231 #[cfg(not(target_arch = "wasm32"))]
10232 fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize) {
10233 unreachable!()
10234 }
10235 wit_import(ptr0.cast_mut(), len0, ptr1.cast_mut(), len1);
10236 }
10237 }
10238 #[allow(unused_unsafe, clippy::all)]
10239 /// Marks the beginning of a durable function.
10240 ///
10241 /// There must be a corresponding call to `end-durable-function` after the function has
10242 /// performed its work (it can be ended in a different context, for example after an async
10243 /// pollable operation has been completed)
10244 pub fn begin_durable_function(
10245 function_type: DurableFunctionType,
10246 ) -> OplogIndex {
10247 unsafe {
10248 use super::super::super::golem::api::oplog::WrappedFunctionType as V1;
10249 let (result2_0, result2_1, result2_2) = match function_type {
10250 V1::ReadLocal => (0i32, 0i32, 0i64),
10251 V1::WriteLocal => (1i32, 0i32, 0i64),
10252 V1::ReadRemote => (2i32, 0i32, 0i64),
10253 V1::WriteRemote => (3i32, 0i32, 0i64),
10254 V1::WriteRemoteBatched(e) => {
10255 let (result0_0, result0_1) = match e {
10256 Some(e) => (1i32, _rt::as_i64(e)),
10257 None => (0i32, 0i64),
10258 };
10259 (4i32, result0_0, result0_1)
10260 }
10261 };
10262 #[cfg(target_arch = "wasm32")]
10263 #[link(wasm_import_module = "golem:durability/durability@1.2.0")]
10264 extern "C" {
10265 #[link_name = "begin-durable-function"]
10266 fn wit_import(_: i32, _: i32, _: i64) -> i64;
10267 }
10268 #[cfg(not(target_arch = "wasm32"))]
10269 fn wit_import(_: i32, _: i32, _: i64) -> i64 {
10270 unreachable!()
10271 }
10272 let ret = wit_import(result2_0, result2_1, result2_2);
10273 ret as u64
10274 }
10275 }
10276 #[allow(unused_unsafe, clippy::all)]
10277 /// Marks the end of a durable function
10278 ///
10279 /// This is a pair of `begin-durable-function` and should be called after the durable function
10280 /// has performed and persisted or replayed its work. The `begin-index` should be the index
10281 /// returned by `begin-durable-function`.
10282 ///
10283 /// Normally commit behavior is decided by the executor based on the `function-type`. However, in special
10284 /// cases the `forced-commit` parameter can be used to force commit the oplog in an efficient way.
10285 pub fn end_durable_function(
10286 function_type: DurableFunctionType,
10287 begin_index: OplogIndex,
10288 forced_commit: bool,
10289 ) {
10290 unsafe {
10291 use super::super::super::golem::api::oplog::WrappedFunctionType as V1;
10292 let (result2_0, result2_1, result2_2) = match function_type {
10293 V1::ReadLocal => (0i32, 0i32, 0i64),
10294 V1::WriteLocal => (1i32, 0i32, 0i64),
10295 V1::ReadRemote => (2i32, 0i32, 0i64),
10296 V1::WriteRemote => (3i32, 0i32, 0i64),
10297 V1::WriteRemoteBatched(e) => {
10298 let (result0_0, result0_1) = match e {
10299 Some(e) => (1i32, _rt::as_i64(e)),
10300 None => (0i32, 0i64),
10301 };
10302 (4i32, result0_0, result0_1)
10303 }
10304 };
10305 #[cfg(target_arch = "wasm32")]
10306 #[link(wasm_import_module = "golem:durability/durability@1.2.0")]
10307 extern "C" {
10308 #[link_name = "end-durable-function"]
10309 fn wit_import(_: i32, _: i32, _: i64, _: i64, _: i32);
10310 }
10311 #[cfg(not(target_arch = "wasm32"))]
10312 fn wit_import(_: i32, _: i32, _: i64, _: i64, _: i32) {
10313 unreachable!()
10314 }
10315 wit_import(
10316 result2_0,
10317 result2_1,
10318 result2_2,
10319 _rt::as_i64(begin_index),
10320 match &forced_commit {
10321 true => 1,
10322 false => 0,
10323 },
10324 );
10325 }
10326 }
10327 #[allow(unused_unsafe, clippy::all)]
10328 /// Gets the current durable execution state
10329 pub fn current_durable_execution_state() -> DurableExecutionState {
10330 unsafe {
10331 #[repr(align(1))]
10332 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
10333 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]);
10334 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
10335 #[cfg(target_arch = "wasm32")]
10336 #[link(wasm_import_module = "golem:durability/durability@1.2.0")]
10337 extern "C" {
10338 #[link_name = "current-durable-execution-state"]
10339 fn wit_import(_: *mut u8);
10340 }
10341 #[cfg(not(target_arch = "wasm32"))]
10342 fn wit_import(_: *mut u8) {
10343 unreachable!()
10344 }
10345 wit_import(ptr0);
10346 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
10347 let l2 = i32::from(*ptr0.add(1).cast::<u8>());
10348 use super::super::super::golem::api::host::PersistenceLevel as V3;
10349 let v3 = match l2 {
10350 0 => V3::PersistNothing,
10351 1 => V3::PersistRemoteSideEffects,
10352 n => {
10353 debug_assert_eq!(n, 2, "invalid enum discriminant");
10354 V3::Smart
10355 }
10356 };
10357 DurableExecutionState {
10358 is_live: _rt::bool_lift(l1 as u8),
10359 persistence_level: v3,
10360 }
10361 }
10362 }
10363 #[allow(unused_unsafe, clippy::all)]
10364 /// Writes a record to the worker's oplog representing a durable function invocation
10365 pub fn persist_durable_function_invocation(
10366 function_name: &str,
10367 request: &[u8],
10368 response: &[u8],
10369 function_type: DurableFunctionType,
10370 ) {
10371 unsafe {
10372 let vec0 = function_name;
10373 let ptr0 = vec0.as_ptr().cast::<u8>();
10374 let len0 = vec0.len();
10375 let vec1 = request;
10376 let ptr1 = vec1.as_ptr().cast::<u8>();
10377 let len1 = vec1.len();
10378 let vec2 = response;
10379 let ptr2 = vec2.as_ptr().cast::<u8>();
10380 let len2 = vec2.len();
10381 use super::super::super::golem::api::oplog::WrappedFunctionType as V4;
10382 let (result5_0, result5_1, result5_2) = match function_type {
10383 V4::ReadLocal => (0i32, 0i32, 0i64),
10384 V4::WriteLocal => (1i32, 0i32, 0i64),
10385 V4::ReadRemote => (2i32, 0i32, 0i64),
10386 V4::WriteRemote => (3i32, 0i32, 0i64),
10387 V4::WriteRemoteBatched(e) => {
10388 let (result3_0, result3_1) = match e {
10389 Some(e) => (1i32, _rt::as_i64(e)),
10390 None => (0i32, 0i64),
10391 };
10392 (4i32, result3_0, result3_1)
10393 }
10394 };
10395 #[cfg(target_arch = "wasm32")]
10396 #[link(wasm_import_module = "golem:durability/durability@1.2.0")]
10397 extern "C" {
10398 #[link_name = "persist-durable-function-invocation"]
10399 fn wit_import(
10400 _: *mut u8,
10401 _: usize,
10402 _: *mut u8,
10403 _: usize,
10404 _: *mut u8,
10405 _: usize,
10406 _: i32,
10407 _: i32,
10408 _: i64,
10409 );
10410 }
10411 #[cfg(not(target_arch = "wasm32"))]
10412 fn wit_import(
10413 _: *mut u8,
10414 _: usize,
10415 _: *mut u8,
10416 _: usize,
10417 _: *mut u8,
10418 _: usize,
10419 _: i32,
10420 _: i32,
10421 _: i64,
10422 ) {
10423 unreachable!()
10424 }
10425 wit_import(
10426 ptr0.cast_mut(),
10427 len0,
10428 ptr1.cast_mut(),
10429 len1,
10430 ptr2.cast_mut(),
10431 len2,
10432 result5_0,
10433 result5_1,
10434 result5_2,
10435 );
10436 }
10437 }
10438 #[allow(unused_unsafe, clippy::all)]
10439 /// Writes a record to the worker's oplog representing a durable function invocation
10440 ///
10441 /// The request and response are defined as pairs of value and type, which makes it
10442 /// self-describing for observers of oplogs. This is the recommended way to persist
10443 /// third-party function invocations.
10444 pub fn persist_typed_durable_function_invocation(
10445 function_name: &str,
10446 request: &ValueAndType,
10447 response: &ValueAndType,
10448 function_type: DurableFunctionType,
10449 ) {
10450 unsafe {
10451 let mut cleanup_list = _rt::Vec::new();
10452 let vec0 = function_name;
10453 let ptr0 = vec0.as_ptr().cast::<u8>();
10454 let len0 = vec0.len();
10455 let super::super::super::golem::rpc::types::ValueAndType {
10456 value: value1,
10457 typ: typ1,
10458 } = request;
10459 let super::super::super::golem::rpc::types::WitValue {
10460 nodes: nodes2,
10461 } = value1;
10462 let vec13 = nodes2;
10463 let len13 = vec13.len();
10464 let layout13 = _rt::alloc::Layout::from_size_align_unchecked(
10465 vec13.len() * 24,
10466 8,
10467 );
10468 let result13 = if layout13.size() != 0 {
10469 let ptr = _rt::alloc::alloc(layout13).cast::<u8>();
10470 if ptr.is_null() {
10471 _rt::alloc::handle_alloc_error(layout13);
10472 }
10473 ptr
10474 } else {
10475 ::core::ptr::null_mut()
10476 };
10477 for (i, e) in vec13.into_iter().enumerate() {
10478 let base = result13.add(i * 24);
10479 {
10480 use super::super::super::golem::rpc::types::WitNode as V12;
10481 match e {
10482 V12::RecordValue(e) => {
10483 *base.add(0).cast::<u8>() = (0i32) as u8;
10484 let vec3 = e;
10485 let ptr3 = vec3.as_ptr().cast::<u8>();
10486 let len3 = vec3.len();
10487 *base.add(12).cast::<usize>() = len3;
10488 *base.add(8).cast::<*mut u8>() = ptr3.cast_mut();
10489 }
10490 V12::VariantValue(e) => {
10491 *base.add(0).cast::<u8>() = (1i32) as u8;
10492 let (t4_0, t4_1) = e;
10493 *base.add(8).cast::<i32>() = _rt::as_i32(t4_0);
10494 match t4_1 {
10495 Some(e) => {
10496 *base.add(12).cast::<u8>() = (1i32) as u8;
10497 *base.add(16).cast::<i32>() = _rt::as_i32(e);
10498 }
10499 None => {
10500 *base.add(12).cast::<u8>() = (0i32) as u8;
10501 }
10502 };
10503 }
10504 V12::EnumValue(e) => {
10505 *base.add(0).cast::<u8>() = (2i32) as u8;
10506 *base.add(8).cast::<i32>() = _rt::as_i32(e);
10507 }
10508 V12::FlagsValue(e) => {
10509 *base.add(0).cast::<u8>() = (3i32) as u8;
10510 let vec5 = e;
10511 let len5 = vec5.len();
10512 let layout5 = _rt::alloc::Layout::from_size_align_unchecked(
10513 vec5.len() * 1,
10514 1,
10515 );
10516 let result5 = if layout5.size() != 0 {
10517 let ptr = _rt::alloc::alloc(layout5).cast::<u8>();
10518 if ptr.is_null() {
10519 _rt::alloc::handle_alloc_error(layout5);
10520 }
10521 ptr
10522 } else {
10523 ::core::ptr::null_mut()
10524 };
10525 for (i, e) in vec5.into_iter().enumerate() {
10526 let base = result5.add(i * 1);
10527 {
10528 *base.add(0).cast::<u8>() = (match e {
10529 true => 1,
10530 false => 0,
10531 }) as u8;
10532 }
10533 }
10534 *base.add(12).cast::<usize>() = len5;
10535 *base.add(8).cast::<*mut u8>() = result5;
10536 cleanup_list.extend_from_slice(&[(result5, layout5)]);
10537 }
10538 V12::TupleValue(e) => {
10539 *base.add(0).cast::<u8>() = (4i32) as u8;
10540 let vec6 = e;
10541 let ptr6 = vec6.as_ptr().cast::<u8>();
10542 let len6 = vec6.len();
10543 *base.add(12).cast::<usize>() = len6;
10544 *base.add(8).cast::<*mut u8>() = ptr6.cast_mut();
10545 }
10546 V12::ListValue(e) => {
10547 *base.add(0).cast::<u8>() = (5i32) as u8;
10548 let vec7 = e;
10549 let ptr7 = vec7.as_ptr().cast::<u8>();
10550 let len7 = vec7.len();
10551 *base.add(12).cast::<usize>() = len7;
10552 *base.add(8).cast::<*mut u8>() = ptr7.cast_mut();
10553 }
10554 V12::OptionValue(e) => {
10555 *base.add(0).cast::<u8>() = (6i32) as u8;
10556 match e {
10557 Some(e) => {
10558 *base.add(8).cast::<u8>() = (1i32) as u8;
10559 *base.add(12).cast::<i32>() = _rt::as_i32(e);
10560 }
10561 None => {
10562 *base.add(8).cast::<u8>() = (0i32) as u8;
10563 }
10564 };
10565 }
10566 V12::ResultValue(e) => {
10567 *base.add(0).cast::<u8>() = (7i32) as u8;
10568 match e {
10569 Ok(e) => {
10570 *base.add(8).cast::<u8>() = (0i32) as u8;
10571 match e {
10572 Some(e) => {
10573 *base.add(12).cast::<u8>() = (1i32) as u8;
10574 *base.add(16).cast::<i32>() = _rt::as_i32(e);
10575 }
10576 None => {
10577 *base.add(12).cast::<u8>() = (0i32) as u8;
10578 }
10579 };
10580 }
10581 Err(e) => {
10582 *base.add(8).cast::<u8>() = (1i32) as u8;
10583 match e {
10584 Some(e) => {
10585 *base.add(12).cast::<u8>() = (1i32) as u8;
10586 *base.add(16).cast::<i32>() = _rt::as_i32(e);
10587 }
10588 None => {
10589 *base.add(12).cast::<u8>() = (0i32) as u8;
10590 }
10591 };
10592 }
10593 };
10594 }
10595 V12::PrimU8(e) => {
10596 *base.add(0).cast::<u8>() = (8i32) as u8;
10597 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
10598 }
10599 V12::PrimU16(e) => {
10600 *base.add(0).cast::<u8>() = (9i32) as u8;
10601 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
10602 }
10603 V12::PrimU32(e) => {
10604 *base.add(0).cast::<u8>() = (10i32) as u8;
10605 *base.add(8).cast::<i32>() = _rt::as_i32(e);
10606 }
10607 V12::PrimU64(e) => {
10608 *base.add(0).cast::<u8>() = (11i32) as u8;
10609 *base.add(8).cast::<i64>() = _rt::as_i64(e);
10610 }
10611 V12::PrimS8(e) => {
10612 *base.add(0).cast::<u8>() = (12i32) as u8;
10613 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
10614 }
10615 V12::PrimS16(e) => {
10616 *base.add(0).cast::<u8>() = (13i32) as u8;
10617 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
10618 }
10619 V12::PrimS32(e) => {
10620 *base.add(0).cast::<u8>() = (14i32) as u8;
10621 *base.add(8).cast::<i32>() = _rt::as_i32(e);
10622 }
10623 V12::PrimS64(e) => {
10624 *base.add(0).cast::<u8>() = (15i32) as u8;
10625 *base.add(8).cast::<i64>() = _rt::as_i64(e);
10626 }
10627 V12::PrimFloat32(e) => {
10628 *base.add(0).cast::<u8>() = (16i32) as u8;
10629 *base.add(8).cast::<f32>() = _rt::as_f32(e);
10630 }
10631 V12::PrimFloat64(e) => {
10632 *base.add(0).cast::<u8>() = (17i32) as u8;
10633 *base.add(8).cast::<f64>() = _rt::as_f64(e);
10634 }
10635 V12::PrimChar(e) => {
10636 *base.add(0).cast::<u8>() = (18i32) as u8;
10637 *base.add(8).cast::<i32>() = _rt::as_i32(e);
10638 }
10639 V12::PrimBool(e) => {
10640 *base.add(0).cast::<u8>() = (19i32) as u8;
10641 *base.add(8).cast::<u8>() = (match e {
10642 true => 1,
10643 false => 0,
10644 }) as u8;
10645 }
10646 V12::PrimString(e) => {
10647 *base.add(0).cast::<u8>() = (20i32) as u8;
10648 let vec8 = e;
10649 let ptr8 = vec8.as_ptr().cast::<u8>();
10650 let len8 = vec8.len();
10651 *base.add(12).cast::<usize>() = len8;
10652 *base.add(8).cast::<*mut u8>() = ptr8.cast_mut();
10653 }
10654 V12::Handle(e) => {
10655 *base.add(0).cast::<u8>() = (21i32) as u8;
10656 let (t9_0, t9_1) = e;
10657 let super::super::super::golem::rpc::types::Uri {
10658 value: value10,
10659 } = t9_0;
10660 let vec11 = value10;
10661 let ptr11 = vec11.as_ptr().cast::<u8>();
10662 let len11 = vec11.len();
10663 *base.add(12).cast::<usize>() = len11;
10664 *base.add(8).cast::<*mut u8>() = ptr11.cast_mut();
10665 *base.add(16).cast::<i64>() = _rt::as_i64(t9_1);
10666 }
10667 }
10668 }
10669 }
10670 let super::super::super::golem::rpc::types::WitType {
10671 nodes: nodes14,
10672 } = typ1;
10673 let vec29 = nodes14;
10674 let len29 = vec29.len();
10675 let layout29 = _rt::alloc::Layout::from_size_align_unchecked(
10676 vec29.len() * 24,
10677 8,
10678 );
10679 let result29 = if layout29.size() != 0 {
10680 let ptr = _rt::alloc::alloc(layout29).cast::<u8>();
10681 if ptr.is_null() {
10682 _rt::alloc::handle_alloc_error(layout29);
10683 }
10684 ptr
10685 } else {
10686 ::core::ptr::null_mut()
10687 };
10688 for (i, e) in vec29.into_iter().enumerate() {
10689 let base = result29.add(i * 24);
10690 {
10691 use super::super::super::golem::rpc::types::WitTypeNode as V28;
10692 match e {
10693 V28::RecordType(e) => {
10694 *base.add(0).cast::<u8>() = (0i32) as u8;
10695 let vec17 = e;
10696 let len17 = vec17.len();
10697 let layout17 = _rt::alloc::Layout::from_size_align_unchecked(
10698 vec17.len() * 12,
10699 4,
10700 );
10701 let result17 = if layout17.size() != 0 {
10702 let ptr = _rt::alloc::alloc(layout17).cast::<u8>();
10703 if ptr.is_null() {
10704 _rt::alloc::handle_alloc_error(layout17);
10705 }
10706 ptr
10707 } else {
10708 ::core::ptr::null_mut()
10709 };
10710 for (i, e) in vec17.into_iter().enumerate() {
10711 let base = result17.add(i * 12);
10712 {
10713 let (t15_0, t15_1) = e;
10714 let vec16 = t15_0;
10715 let ptr16 = vec16.as_ptr().cast::<u8>();
10716 let len16 = vec16.len();
10717 *base.add(4).cast::<usize>() = len16;
10718 *base.add(0).cast::<*mut u8>() = ptr16.cast_mut();
10719 *base.add(8).cast::<i32>() = _rt::as_i32(t15_1);
10720 }
10721 }
10722 *base.add(12).cast::<usize>() = len17;
10723 *base.add(8).cast::<*mut u8>() = result17;
10724 cleanup_list.extend_from_slice(&[(result17, layout17)]);
10725 }
10726 V28::VariantType(e) => {
10727 *base.add(0).cast::<u8>() = (1i32) as u8;
10728 let vec20 = e;
10729 let len20 = vec20.len();
10730 let layout20 = _rt::alloc::Layout::from_size_align_unchecked(
10731 vec20.len() * 16,
10732 4,
10733 );
10734 let result20 = if layout20.size() != 0 {
10735 let ptr = _rt::alloc::alloc(layout20).cast::<u8>();
10736 if ptr.is_null() {
10737 _rt::alloc::handle_alloc_error(layout20);
10738 }
10739 ptr
10740 } else {
10741 ::core::ptr::null_mut()
10742 };
10743 for (i, e) in vec20.into_iter().enumerate() {
10744 let base = result20.add(i * 16);
10745 {
10746 let (t18_0, t18_1) = e;
10747 let vec19 = t18_0;
10748 let ptr19 = vec19.as_ptr().cast::<u8>();
10749 let len19 = vec19.len();
10750 *base.add(4).cast::<usize>() = len19;
10751 *base.add(0).cast::<*mut u8>() = ptr19.cast_mut();
10752 match t18_1 {
10753 Some(e) => {
10754 *base.add(8).cast::<u8>() = (1i32) as u8;
10755 *base.add(12).cast::<i32>() = _rt::as_i32(e);
10756 }
10757 None => {
10758 *base.add(8).cast::<u8>() = (0i32) as u8;
10759 }
10760 };
10761 }
10762 }
10763 *base.add(12).cast::<usize>() = len20;
10764 *base.add(8).cast::<*mut u8>() = result20;
10765 cleanup_list.extend_from_slice(&[(result20, layout20)]);
10766 }
10767 V28::EnumType(e) => {
10768 *base.add(0).cast::<u8>() = (2i32) as u8;
10769 let vec22 = e;
10770 let len22 = vec22.len();
10771 let layout22 = _rt::alloc::Layout::from_size_align_unchecked(
10772 vec22.len() * 8,
10773 4,
10774 );
10775 let result22 = if layout22.size() != 0 {
10776 let ptr = _rt::alloc::alloc(layout22).cast::<u8>();
10777 if ptr.is_null() {
10778 _rt::alloc::handle_alloc_error(layout22);
10779 }
10780 ptr
10781 } else {
10782 ::core::ptr::null_mut()
10783 };
10784 for (i, e) in vec22.into_iter().enumerate() {
10785 let base = result22.add(i * 8);
10786 {
10787 let vec21 = e;
10788 let ptr21 = vec21.as_ptr().cast::<u8>();
10789 let len21 = vec21.len();
10790 *base.add(4).cast::<usize>() = len21;
10791 *base.add(0).cast::<*mut u8>() = ptr21.cast_mut();
10792 }
10793 }
10794 *base.add(12).cast::<usize>() = len22;
10795 *base.add(8).cast::<*mut u8>() = result22;
10796 cleanup_list.extend_from_slice(&[(result22, layout22)]);
10797 }
10798 V28::FlagsType(e) => {
10799 *base.add(0).cast::<u8>() = (3i32) as u8;
10800 let vec24 = e;
10801 let len24 = vec24.len();
10802 let layout24 = _rt::alloc::Layout::from_size_align_unchecked(
10803 vec24.len() * 8,
10804 4,
10805 );
10806 let result24 = if layout24.size() != 0 {
10807 let ptr = _rt::alloc::alloc(layout24).cast::<u8>();
10808 if ptr.is_null() {
10809 _rt::alloc::handle_alloc_error(layout24);
10810 }
10811 ptr
10812 } else {
10813 ::core::ptr::null_mut()
10814 };
10815 for (i, e) in vec24.into_iter().enumerate() {
10816 let base = result24.add(i * 8);
10817 {
10818 let vec23 = e;
10819 let ptr23 = vec23.as_ptr().cast::<u8>();
10820 let len23 = vec23.len();
10821 *base.add(4).cast::<usize>() = len23;
10822 *base.add(0).cast::<*mut u8>() = ptr23.cast_mut();
10823 }
10824 }
10825 *base.add(12).cast::<usize>() = len24;
10826 *base.add(8).cast::<*mut u8>() = result24;
10827 cleanup_list.extend_from_slice(&[(result24, layout24)]);
10828 }
10829 V28::TupleType(e) => {
10830 *base.add(0).cast::<u8>() = (4i32) as u8;
10831 let vec25 = e;
10832 let ptr25 = vec25.as_ptr().cast::<u8>();
10833 let len25 = vec25.len();
10834 *base.add(12).cast::<usize>() = len25;
10835 *base.add(8).cast::<*mut u8>() = ptr25.cast_mut();
10836 }
10837 V28::ListType(e) => {
10838 *base.add(0).cast::<u8>() = (5i32) as u8;
10839 *base.add(8).cast::<i32>() = _rt::as_i32(e);
10840 }
10841 V28::OptionType(e) => {
10842 *base.add(0).cast::<u8>() = (6i32) as u8;
10843 *base.add(8).cast::<i32>() = _rt::as_i32(e);
10844 }
10845 V28::ResultType(e) => {
10846 *base.add(0).cast::<u8>() = (7i32) as u8;
10847 let (t26_0, t26_1) = e;
10848 match t26_0 {
10849 Some(e) => {
10850 *base.add(8).cast::<u8>() = (1i32) as u8;
10851 *base.add(12).cast::<i32>() = _rt::as_i32(e);
10852 }
10853 None => {
10854 *base.add(8).cast::<u8>() = (0i32) as u8;
10855 }
10856 };
10857 match t26_1 {
10858 Some(e) => {
10859 *base.add(16).cast::<u8>() = (1i32) as u8;
10860 *base.add(20).cast::<i32>() = _rt::as_i32(e);
10861 }
10862 None => {
10863 *base.add(16).cast::<u8>() = (0i32) as u8;
10864 }
10865 };
10866 }
10867 V28::PrimU8Type => {
10868 *base.add(0).cast::<u8>() = (8i32) as u8;
10869 }
10870 V28::PrimU16Type => {
10871 *base.add(0).cast::<u8>() = (9i32) as u8;
10872 }
10873 V28::PrimU32Type => {
10874 *base.add(0).cast::<u8>() = (10i32) as u8;
10875 }
10876 V28::PrimU64Type => {
10877 *base.add(0).cast::<u8>() = (11i32) as u8;
10878 }
10879 V28::PrimS8Type => {
10880 *base.add(0).cast::<u8>() = (12i32) as u8;
10881 }
10882 V28::PrimS16Type => {
10883 *base.add(0).cast::<u8>() = (13i32) as u8;
10884 }
10885 V28::PrimS32Type => {
10886 *base.add(0).cast::<u8>() = (14i32) as u8;
10887 }
10888 V28::PrimS64Type => {
10889 *base.add(0).cast::<u8>() = (15i32) as u8;
10890 }
10891 V28::PrimF32Type => {
10892 *base.add(0).cast::<u8>() = (16i32) as u8;
10893 }
10894 V28::PrimF64Type => {
10895 *base.add(0).cast::<u8>() = (17i32) as u8;
10896 }
10897 V28::PrimCharType => {
10898 *base.add(0).cast::<u8>() = (18i32) as u8;
10899 }
10900 V28::PrimBoolType => {
10901 *base.add(0).cast::<u8>() = (19i32) as u8;
10902 }
10903 V28::PrimStringType => {
10904 *base.add(0).cast::<u8>() = (20i32) as u8;
10905 }
10906 V28::HandleType(e) => {
10907 *base.add(0).cast::<u8>() = (21i32) as u8;
10908 let (t27_0, t27_1) = e;
10909 *base.add(8).cast::<i64>() = _rt::as_i64(t27_0);
10910 *base.add(16).cast::<u8>() = (t27_1.clone() as i32) as u8;
10911 }
10912 }
10913 }
10914 }
10915 let super::super::super::golem::rpc::types::ValueAndType {
10916 value: value30,
10917 typ: typ30,
10918 } = response;
10919 let super::super::super::golem::rpc::types::WitValue {
10920 nodes: nodes31,
10921 } = value30;
10922 let vec42 = nodes31;
10923 let len42 = vec42.len();
10924 let layout42 = _rt::alloc::Layout::from_size_align_unchecked(
10925 vec42.len() * 24,
10926 8,
10927 );
10928 let result42 = if layout42.size() != 0 {
10929 let ptr = _rt::alloc::alloc(layout42).cast::<u8>();
10930 if ptr.is_null() {
10931 _rt::alloc::handle_alloc_error(layout42);
10932 }
10933 ptr
10934 } else {
10935 ::core::ptr::null_mut()
10936 };
10937 for (i, e) in vec42.into_iter().enumerate() {
10938 let base = result42.add(i * 24);
10939 {
10940 use super::super::super::golem::rpc::types::WitNode as V41;
10941 match e {
10942 V41::RecordValue(e) => {
10943 *base.add(0).cast::<u8>() = (0i32) as u8;
10944 let vec32 = e;
10945 let ptr32 = vec32.as_ptr().cast::<u8>();
10946 let len32 = vec32.len();
10947 *base.add(12).cast::<usize>() = len32;
10948 *base.add(8).cast::<*mut u8>() = ptr32.cast_mut();
10949 }
10950 V41::VariantValue(e) => {
10951 *base.add(0).cast::<u8>() = (1i32) as u8;
10952 let (t33_0, t33_1) = e;
10953 *base.add(8).cast::<i32>() = _rt::as_i32(t33_0);
10954 match t33_1 {
10955 Some(e) => {
10956 *base.add(12).cast::<u8>() = (1i32) as u8;
10957 *base.add(16).cast::<i32>() = _rt::as_i32(e);
10958 }
10959 None => {
10960 *base.add(12).cast::<u8>() = (0i32) as u8;
10961 }
10962 };
10963 }
10964 V41::EnumValue(e) => {
10965 *base.add(0).cast::<u8>() = (2i32) as u8;
10966 *base.add(8).cast::<i32>() = _rt::as_i32(e);
10967 }
10968 V41::FlagsValue(e) => {
10969 *base.add(0).cast::<u8>() = (3i32) as u8;
10970 let vec34 = e;
10971 let len34 = vec34.len();
10972 let layout34 = _rt::alloc::Layout::from_size_align_unchecked(
10973 vec34.len() * 1,
10974 1,
10975 );
10976 let result34 = if layout34.size() != 0 {
10977 let ptr = _rt::alloc::alloc(layout34).cast::<u8>();
10978 if ptr.is_null() {
10979 _rt::alloc::handle_alloc_error(layout34);
10980 }
10981 ptr
10982 } else {
10983 ::core::ptr::null_mut()
10984 };
10985 for (i, e) in vec34.into_iter().enumerate() {
10986 let base = result34.add(i * 1);
10987 {
10988 *base.add(0).cast::<u8>() = (match e {
10989 true => 1,
10990 false => 0,
10991 }) as u8;
10992 }
10993 }
10994 *base.add(12).cast::<usize>() = len34;
10995 *base.add(8).cast::<*mut u8>() = result34;
10996 cleanup_list.extend_from_slice(&[(result34, layout34)]);
10997 }
10998 V41::TupleValue(e) => {
10999 *base.add(0).cast::<u8>() = (4i32) as u8;
11000 let vec35 = e;
11001 let ptr35 = vec35.as_ptr().cast::<u8>();
11002 let len35 = vec35.len();
11003 *base.add(12).cast::<usize>() = len35;
11004 *base.add(8).cast::<*mut u8>() = ptr35.cast_mut();
11005 }
11006 V41::ListValue(e) => {
11007 *base.add(0).cast::<u8>() = (5i32) as u8;
11008 let vec36 = e;
11009 let ptr36 = vec36.as_ptr().cast::<u8>();
11010 let len36 = vec36.len();
11011 *base.add(12).cast::<usize>() = len36;
11012 *base.add(8).cast::<*mut u8>() = ptr36.cast_mut();
11013 }
11014 V41::OptionValue(e) => {
11015 *base.add(0).cast::<u8>() = (6i32) as u8;
11016 match e {
11017 Some(e) => {
11018 *base.add(8).cast::<u8>() = (1i32) as u8;
11019 *base.add(12).cast::<i32>() = _rt::as_i32(e);
11020 }
11021 None => {
11022 *base.add(8).cast::<u8>() = (0i32) as u8;
11023 }
11024 };
11025 }
11026 V41::ResultValue(e) => {
11027 *base.add(0).cast::<u8>() = (7i32) as u8;
11028 match e {
11029 Ok(e) => {
11030 *base.add(8).cast::<u8>() = (0i32) as u8;
11031 match e {
11032 Some(e) => {
11033 *base.add(12).cast::<u8>() = (1i32) as u8;
11034 *base.add(16).cast::<i32>() = _rt::as_i32(e);
11035 }
11036 None => {
11037 *base.add(12).cast::<u8>() = (0i32) as u8;
11038 }
11039 };
11040 }
11041 Err(e) => {
11042 *base.add(8).cast::<u8>() = (1i32) as u8;
11043 match e {
11044 Some(e) => {
11045 *base.add(12).cast::<u8>() = (1i32) as u8;
11046 *base.add(16).cast::<i32>() = _rt::as_i32(e);
11047 }
11048 None => {
11049 *base.add(12).cast::<u8>() = (0i32) as u8;
11050 }
11051 };
11052 }
11053 };
11054 }
11055 V41::PrimU8(e) => {
11056 *base.add(0).cast::<u8>() = (8i32) as u8;
11057 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
11058 }
11059 V41::PrimU16(e) => {
11060 *base.add(0).cast::<u8>() = (9i32) as u8;
11061 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
11062 }
11063 V41::PrimU32(e) => {
11064 *base.add(0).cast::<u8>() = (10i32) as u8;
11065 *base.add(8).cast::<i32>() = _rt::as_i32(e);
11066 }
11067 V41::PrimU64(e) => {
11068 *base.add(0).cast::<u8>() = (11i32) as u8;
11069 *base.add(8).cast::<i64>() = _rt::as_i64(e);
11070 }
11071 V41::PrimS8(e) => {
11072 *base.add(0).cast::<u8>() = (12i32) as u8;
11073 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
11074 }
11075 V41::PrimS16(e) => {
11076 *base.add(0).cast::<u8>() = (13i32) as u8;
11077 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
11078 }
11079 V41::PrimS32(e) => {
11080 *base.add(0).cast::<u8>() = (14i32) as u8;
11081 *base.add(8).cast::<i32>() = _rt::as_i32(e);
11082 }
11083 V41::PrimS64(e) => {
11084 *base.add(0).cast::<u8>() = (15i32) as u8;
11085 *base.add(8).cast::<i64>() = _rt::as_i64(e);
11086 }
11087 V41::PrimFloat32(e) => {
11088 *base.add(0).cast::<u8>() = (16i32) as u8;
11089 *base.add(8).cast::<f32>() = _rt::as_f32(e);
11090 }
11091 V41::PrimFloat64(e) => {
11092 *base.add(0).cast::<u8>() = (17i32) as u8;
11093 *base.add(8).cast::<f64>() = _rt::as_f64(e);
11094 }
11095 V41::PrimChar(e) => {
11096 *base.add(0).cast::<u8>() = (18i32) as u8;
11097 *base.add(8).cast::<i32>() = _rt::as_i32(e);
11098 }
11099 V41::PrimBool(e) => {
11100 *base.add(0).cast::<u8>() = (19i32) as u8;
11101 *base.add(8).cast::<u8>() = (match e {
11102 true => 1,
11103 false => 0,
11104 }) as u8;
11105 }
11106 V41::PrimString(e) => {
11107 *base.add(0).cast::<u8>() = (20i32) as u8;
11108 let vec37 = e;
11109 let ptr37 = vec37.as_ptr().cast::<u8>();
11110 let len37 = vec37.len();
11111 *base.add(12).cast::<usize>() = len37;
11112 *base.add(8).cast::<*mut u8>() = ptr37.cast_mut();
11113 }
11114 V41::Handle(e) => {
11115 *base.add(0).cast::<u8>() = (21i32) as u8;
11116 let (t38_0, t38_1) = e;
11117 let super::super::super::golem::rpc::types::Uri {
11118 value: value39,
11119 } = t38_0;
11120 let vec40 = value39;
11121 let ptr40 = vec40.as_ptr().cast::<u8>();
11122 let len40 = vec40.len();
11123 *base.add(12).cast::<usize>() = len40;
11124 *base.add(8).cast::<*mut u8>() = ptr40.cast_mut();
11125 *base.add(16).cast::<i64>() = _rt::as_i64(t38_1);
11126 }
11127 }
11128 }
11129 }
11130 let super::super::super::golem::rpc::types::WitType {
11131 nodes: nodes43,
11132 } = typ30;
11133 let vec58 = nodes43;
11134 let len58 = vec58.len();
11135 let layout58 = _rt::alloc::Layout::from_size_align_unchecked(
11136 vec58.len() * 24,
11137 8,
11138 );
11139 let result58 = if layout58.size() != 0 {
11140 let ptr = _rt::alloc::alloc(layout58).cast::<u8>();
11141 if ptr.is_null() {
11142 _rt::alloc::handle_alloc_error(layout58);
11143 }
11144 ptr
11145 } else {
11146 ::core::ptr::null_mut()
11147 };
11148 for (i, e) in vec58.into_iter().enumerate() {
11149 let base = result58.add(i * 24);
11150 {
11151 use super::super::super::golem::rpc::types::WitTypeNode as V57;
11152 match e {
11153 V57::RecordType(e) => {
11154 *base.add(0).cast::<u8>() = (0i32) as u8;
11155 let vec46 = e;
11156 let len46 = vec46.len();
11157 let layout46 = _rt::alloc::Layout::from_size_align_unchecked(
11158 vec46.len() * 12,
11159 4,
11160 );
11161 let result46 = if layout46.size() != 0 {
11162 let ptr = _rt::alloc::alloc(layout46).cast::<u8>();
11163 if ptr.is_null() {
11164 _rt::alloc::handle_alloc_error(layout46);
11165 }
11166 ptr
11167 } else {
11168 ::core::ptr::null_mut()
11169 };
11170 for (i, e) in vec46.into_iter().enumerate() {
11171 let base = result46.add(i * 12);
11172 {
11173 let (t44_0, t44_1) = e;
11174 let vec45 = t44_0;
11175 let ptr45 = vec45.as_ptr().cast::<u8>();
11176 let len45 = vec45.len();
11177 *base.add(4).cast::<usize>() = len45;
11178 *base.add(0).cast::<*mut u8>() = ptr45.cast_mut();
11179 *base.add(8).cast::<i32>() = _rt::as_i32(t44_1);
11180 }
11181 }
11182 *base.add(12).cast::<usize>() = len46;
11183 *base.add(8).cast::<*mut u8>() = result46;
11184 cleanup_list.extend_from_slice(&[(result46, layout46)]);
11185 }
11186 V57::VariantType(e) => {
11187 *base.add(0).cast::<u8>() = (1i32) as u8;
11188 let vec49 = e;
11189 let len49 = vec49.len();
11190 let layout49 = _rt::alloc::Layout::from_size_align_unchecked(
11191 vec49.len() * 16,
11192 4,
11193 );
11194 let result49 = if layout49.size() != 0 {
11195 let ptr = _rt::alloc::alloc(layout49).cast::<u8>();
11196 if ptr.is_null() {
11197 _rt::alloc::handle_alloc_error(layout49);
11198 }
11199 ptr
11200 } else {
11201 ::core::ptr::null_mut()
11202 };
11203 for (i, e) in vec49.into_iter().enumerate() {
11204 let base = result49.add(i * 16);
11205 {
11206 let (t47_0, t47_1) = e;
11207 let vec48 = t47_0;
11208 let ptr48 = vec48.as_ptr().cast::<u8>();
11209 let len48 = vec48.len();
11210 *base.add(4).cast::<usize>() = len48;
11211 *base.add(0).cast::<*mut u8>() = ptr48.cast_mut();
11212 match t47_1 {
11213 Some(e) => {
11214 *base.add(8).cast::<u8>() = (1i32) as u8;
11215 *base.add(12).cast::<i32>() = _rt::as_i32(e);
11216 }
11217 None => {
11218 *base.add(8).cast::<u8>() = (0i32) as u8;
11219 }
11220 };
11221 }
11222 }
11223 *base.add(12).cast::<usize>() = len49;
11224 *base.add(8).cast::<*mut u8>() = result49;
11225 cleanup_list.extend_from_slice(&[(result49, layout49)]);
11226 }
11227 V57::EnumType(e) => {
11228 *base.add(0).cast::<u8>() = (2i32) as u8;
11229 let vec51 = e;
11230 let len51 = vec51.len();
11231 let layout51 = _rt::alloc::Layout::from_size_align_unchecked(
11232 vec51.len() * 8,
11233 4,
11234 );
11235 let result51 = if layout51.size() != 0 {
11236 let ptr = _rt::alloc::alloc(layout51).cast::<u8>();
11237 if ptr.is_null() {
11238 _rt::alloc::handle_alloc_error(layout51);
11239 }
11240 ptr
11241 } else {
11242 ::core::ptr::null_mut()
11243 };
11244 for (i, e) in vec51.into_iter().enumerate() {
11245 let base = result51.add(i * 8);
11246 {
11247 let vec50 = e;
11248 let ptr50 = vec50.as_ptr().cast::<u8>();
11249 let len50 = vec50.len();
11250 *base.add(4).cast::<usize>() = len50;
11251 *base.add(0).cast::<*mut u8>() = ptr50.cast_mut();
11252 }
11253 }
11254 *base.add(12).cast::<usize>() = len51;
11255 *base.add(8).cast::<*mut u8>() = result51;
11256 cleanup_list.extend_from_slice(&[(result51, layout51)]);
11257 }
11258 V57::FlagsType(e) => {
11259 *base.add(0).cast::<u8>() = (3i32) as u8;
11260 let vec53 = e;
11261 let len53 = vec53.len();
11262 let layout53 = _rt::alloc::Layout::from_size_align_unchecked(
11263 vec53.len() * 8,
11264 4,
11265 );
11266 let result53 = if layout53.size() != 0 {
11267 let ptr = _rt::alloc::alloc(layout53).cast::<u8>();
11268 if ptr.is_null() {
11269 _rt::alloc::handle_alloc_error(layout53);
11270 }
11271 ptr
11272 } else {
11273 ::core::ptr::null_mut()
11274 };
11275 for (i, e) in vec53.into_iter().enumerate() {
11276 let base = result53.add(i * 8);
11277 {
11278 let vec52 = e;
11279 let ptr52 = vec52.as_ptr().cast::<u8>();
11280 let len52 = vec52.len();
11281 *base.add(4).cast::<usize>() = len52;
11282 *base.add(0).cast::<*mut u8>() = ptr52.cast_mut();
11283 }
11284 }
11285 *base.add(12).cast::<usize>() = len53;
11286 *base.add(8).cast::<*mut u8>() = result53;
11287 cleanup_list.extend_from_slice(&[(result53, layout53)]);
11288 }
11289 V57::TupleType(e) => {
11290 *base.add(0).cast::<u8>() = (4i32) as u8;
11291 let vec54 = e;
11292 let ptr54 = vec54.as_ptr().cast::<u8>();
11293 let len54 = vec54.len();
11294 *base.add(12).cast::<usize>() = len54;
11295 *base.add(8).cast::<*mut u8>() = ptr54.cast_mut();
11296 }
11297 V57::ListType(e) => {
11298 *base.add(0).cast::<u8>() = (5i32) as u8;
11299 *base.add(8).cast::<i32>() = _rt::as_i32(e);
11300 }
11301 V57::OptionType(e) => {
11302 *base.add(0).cast::<u8>() = (6i32) as u8;
11303 *base.add(8).cast::<i32>() = _rt::as_i32(e);
11304 }
11305 V57::ResultType(e) => {
11306 *base.add(0).cast::<u8>() = (7i32) as u8;
11307 let (t55_0, t55_1) = e;
11308 match t55_0 {
11309 Some(e) => {
11310 *base.add(8).cast::<u8>() = (1i32) as u8;
11311 *base.add(12).cast::<i32>() = _rt::as_i32(e);
11312 }
11313 None => {
11314 *base.add(8).cast::<u8>() = (0i32) as u8;
11315 }
11316 };
11317 match t55_1 {
11318 Some(e) => {
11319 *base.add(16).cast::<u8>() = (1i32) as u8;
11320 *base.add(20).cast::<i32>() = _rt::as_i32(e);
11321 }
11322 None => {
11323 *base.add(16).cast::<u8>() = (0i32) as u8;
11324 }
11325 };
11326 }
11327 V57::PrimU8Type => {
11328 *base.add(0).cast::<u8>() = (8i32) as u8;
11329 }
11330 V57::PrimU16Type => {
11331 *base.add(0).cast::<u8>() = (9i32) as u8;
11332 }
11333 V57::PrimU32Type => {
11334 *base.add(0).cast::<u8>() = (10i32) as u8;
11335 }
11336 V57::PrimU64Type => {
11337 *base.add(0).cast::<u8>() = (11i32) as u8;
11338 }
11339 V57::PrimS8Type => {
11340 *base.add(0).cast::<u8>() = (12i32) as u8;
11341 }
11342 V57::PrimS16Type => {
11343 *base.add(0).cast::<u8>() = (13i32) as u8;
11344 }
11345 V57::PrimS32Type => {
11346 *base.add(0).cast::<u8>() = (14i32) as u8;
11347 }
11348 V57::PrimS64Type => {
11349 *base.add(0).cast::<u8>() = (15i32) as u8;
11350 }
11351 V57::PrimF32Type => {
11352 *base.add(0).cast::<u8>() = (16i32) as u8;
11353 }
11354 V57::PrimF64Type => {
11355 *base.add(0).cast::<u8>() = (17i32) as u8;
11356 }
11357 V57::PrimCharType => {
11358 *base.add(0).cast::<u8>() = (18i32) as u8;
11359 }
11360 V57::PrimBoolType => {
11361 *base.add(0).cast::<u8>() = (19i32) as u8;
11362 }
11363 V57::PrimStringType => {
11364 *base.add(0).cast::<u8>() = (20i32) as u8;
11365 }
11366 V57::HandleType(e) => {
11367 *base.add(0).cast::<u8>() = (21i32) as u8;
11368 let (t56_0, t56_1) = e;
11369 *base.add(8).cast::<i64>() = _rt::as_i64(t56_0);
11370 *base.add(16).cast::<u8>() = (t56_1.clone() as i32) as u8;
11371 }
11372 }
11373 }
11374 }
11375 use super::super::super::golem::api::oplog::WrappedFunctionType as V60;
11376 let (result61_0, result61_1, result61_2) = match function_type {
11377 V60::ReadLocal => (0i32, 0i32, 0i64),
11378 V60::WriteLocal => (1i32, 0i32, 0i64),
11379 V60::ReadRemote => (2i32, 0i32, 0i64),
11380 V60::WriteRemote => (3i32, 0i32, 0i64),
11381 V60::WriteRemoteBatched(e) => {
11382 let (result59_0, result59_1) = match e {
11383 Some(e) => (1i32, _rt::as_i64(e)),
11384 None => (0i32, 0i64),
11385 };
11386 (4i32, result59_0, result59_1)
11387 }
11388 };
11389 #[cfg(target_arch = "wasm32")]
11390 #[link(wasm_import_module = "golem:durability/durability@1.2.0")]
11391 extern "C" {
11392 #[link_name = "persist-typed-durable-function-invocation"]
11393 fn wit_import(
11394 _: *mut u8,
11395 _: usize,
11396 _: *mut u8,
11397 _: usize,
11398 _: *mut u8,
11399 _: usize,
11400 _: *mut u8,
11401 _: usize,
11402 _: *mut u8,
11403 _: usize,
11404 _: i32,
11405 _: i32,
11406 _: i64,
11407 );
11408 }
11409 #[cfg(not(target_arch = "wasm32"))]
11410 fn wit_import(
11411 _: *mut u8,
11412 _: usize,
11413 _: *mut u8,
11414 _: usize,
11415 _: *mut u8,
11416 _: usize,
11417 _: *mut u8,
11418 _: usize,
11419 _: *mut u8,
11420 _: usize,
11421 _: i32,
11422 _: i32,
11423 _: i64,
11424 ) {
11425 unreachable!()
11426 }
11427 wit_import(
11428 ptr0.cast_mut(),
11429 len0,
11430 result13,
11431 len13,
11432 result29,
11433 len29,
11434 result42,
11435 len42,
11436 result58,
11437 len58,
11438 result61_0,
11439 result61_1,
11440 result61_2,
11441 );
11442 if layout13.size() != 0 {
11443 _rt::alloc::dealloc(result13.cast(), layout13);
11444 }
11445 if layout29.size() != 0 {
11446 _rt::alloc::dealloc(result29.cast(), layout29);
11447 }
11448 if layout42.size() != 0 {
11449 _rt::alloc::dealloc(result42.cast(), layout42);
11450 }
11451 if layout58.size() != 0 {
11452 _rt::alloc::dealloc(result58.cast(), layout58);
11453 }
11454 for (ptr, layout) in cleanup_list {
11455 if layout.size() != 0 {
11456 _rt::alloc::dealloc(ptr.cast(), layout);
11457 }
11458 }
11459 }
11460 }
11461 #[allow(unused_unsafe, clippy::all)]
11462 /// Reads the next persisted durable function invocation from the oplog during replay
11463 pub fn read_persisted_durable_function_invocation() -> PersistedDurableFunctionInvocation {
11464 unsafe {
11465 #[repr(align(8))]
11466 struct RetArea([::core::mem::MaybeUninit<u8>; 64]);
11467 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 64]);
11468 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
11469 #[cfg(target_arch = "wasm32")]
11470 #[link(wasm_import_module = "golem:durability/durability@1.2.0")]
11471 extern "C" {
11472 #[link_name = "read-persisted-durable-function-invocation"]
11473 fn wit_import(_: *mut u8);
11474 }
11475 #[cfg(not(target_arch = "wasm32"))]
11476 fn wit_import(_: *mut u8) {
11477 unreachable!()
11478 }
11479 wit_import(ptr0);
11480 let l1 = *ptr0.add(0).cast::<i64>();
11481 let l2 = *ptr0.add(8).cast::<i32>();
11482 let l3 = *ptr0.add(16).cast::<*mut u8>();
11483 let l4 = *ptr0.add(20).cast::<usize>();
11484 let len5 = l4;
11485 let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5);
11486 let l6 = *ptr0.add(24).cast::<*mut u8>();
11487 let l7 = *ptr0.add(28).cast::<usize>();
11488 let len8 = l7;
11489 let l9 = i32::from(*ptr0.add(32).cast::<u8>());
11490 use super::super::super::golem::api::oplog::WrappedFunctionType as V12;
11491 let v12 = match l9 {
11492 0 => V12::ReadLocal,
11493 1 => V12::WriteLocal,
11494 2 => V12::ReadRemote,
11495 3 => V12::WriteRemote,
11496 n => {
11497 debug_assert_eq!(n, 4, "invalid enum discriminant");
11498 let e12 = {
11499 let l10 = i32::from(*ptr0.add(40).cast::<u8>());
11500 match l10 {
11501 0 => None,
11502 1 => {
11503 let e = {
11504 let l11 = *ptr0.add(48).cast::<i64>();
11505 l11 as u64
11506 };
11507 Some(e)
11508 }
11509 _ => _rt::invalid_enum_discriminant(),
11510 }
11511 };
11512 V12::WriteRemoteBatched(e12)
11513 }
11514 };
11515 let l13 = i32::from(*ptr0.add(56).cast::<u8>());
11516 PersistedDurableFunctionInvocation {
11517 timestamp: super::super::super::wasi::clocks::wall_clock::Datetime {
11518 seconds: l1 as u64,
11519 nanoseconds: l2 as u32,
11520 },
11521 function_name: _rt::string_lift(bytes5),
11522 response: _rt::Vec::from_raw_parts(l6.cast(), len8, len8),
11523 function_type: v12,
11524 entry_version: OplogEntryVersion::_lift(l13 as u8),
11525 }
11526 }
11527 }
11528 }
11529 }
11530 pub mod rdbms {
11531 #[allow(dead_code, clippy::all)]
11532 pub mod types {
11533 #[used]
11534 #[doc(hidden)]
11535 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
11536 #[repr(C)]
11537 #[derive(Clone, Copy)]
11538 pub struct Uuid {
11539 pub high_bits: u64,
11540 pub low_bits: u64,
11541 }
11542 impl ::core::fmt::Debug for Uuid {
11543 fn fmt(
11544 &self,
11545 f: &mut ::core::fmt::Formatter<'_>,
11546 ) -> ::core::fmt::Result {
11547 f.debug_struct("Uuid")
11548 .field("high-bits", &self.high_bits)
11549 .field("low-bits", &self.low_bits)
11550 .finish()
11551 }
11552 }
11553 #[derive(Clone, Copy)]
11554 pub enum IpAddress {
11555 Ipv4((u8, u8, u8, u8)),
11556 Ipv6((u16, u16, u16, u16, u16, u16, u16, u16)),
11557 }
11558 impl ::core::fmt::Debug for IpAddress {
11559 fn fmt(
11560 &self,
11561 f: &mut ::core::fmt::Formatter<'_>,
11562 ) -> ::core::fmt::Result {
11563 match self {
11564 IpAddress::Ipv4(e) => {
11565 f.debug_tuple("IpAddress::Ipv4").field(e).finish()
11566 }
11567 IpAddress::Ipv6(e) => {
11568 f.debug_tuple("IpAddress::Ipv6").field(e).finish()
11569 }
11570 }
11571 }
11572 }
11573 #[repr(C)]
11574 #[derive(Clone, Copy)]
11575 pub struct MacAddress {
11576 pub octets: (u8, u8, u8, u8, u8, u8),
11577 }
11578 impl ::core::fmt::Debug for MacAddress {
11579 fn fmt(
11580 &self,
11581 f: &mut ::core::fmt::Formatter<'_>,
11582 ) -> ::core::fmt::Result {
11583 f.debug_struct("MacAddress").field("octets", &self.octets).finish()
11584 }
11585 }
11586 #[repr(C)]
11587 #[derive(Clone, Copy)]
11588 pub struct Date {
11589 pub year: i32,
11590 pub month: u8,
11591 pub day: u8,
11592 }
11593 impl ::core::fmt::Debug for Date {
11594 fn fmt(
11595 &self,
11596 f: &mut ::core::fmt::Formatter<'_>,
11597 ) -> ::core::fmt::Result {
11598 f.debug_struct("Date")
11599 .field("year", &self.year)
11600 .field("month", &self.month)
11601 .field("day", &self.day)
11602 .finish()
11603 }
11604 }
11605 #[repr(C)]
11606 #[derive(Clone, Copy)]
11607 pub struct Time {
11608 pub hour: u8,
11609 pub minute: u8,
11610 pub second: u8,
11611 pub nanosecond: u32,
11612 }
11613 impl ::core::fmt::Debug for Time {
11614 fn fmt(
11615 &self,
11616 f: &mut ::core::fmt::Formatter<'_>,
11617 ) -> ::core::fmt::Result {
11618 f.debug_struct("Time")
11619 .field("hour", &self.hour)
11620 .field("minute", &self.minute)
11621 .field("second", &self.second)
11622 .field("nanosecond", &self.nanosecond)
11623 .finish()
11624 }
11625 }
11626 #[repr(C)]
11627 #[derive(Clone, Copy)]
11628 pub struct Timestamp {
11629 pub date: Date,
11630 pub time: Time,
11631 }
11632 impl ::core::fmt::Debug for Timestamp {
11633 fn fmt(
11634 &self,
11635 f: &mut ::core::fmt::Formatter<'_>,
11636 ) -> ::core::fmt::Result {
11637 f.debug_struct("Timestamp")
11638 .field("date", &self.date)
11639 .field("time", &self.time)
11640 .finish()
11641 }
11642 }
11643 #[repr(C)]
11644 #[derive(Clone, Copy)]
11645 pub struct Timestamptz {
11646 pub timestamp: Timestamp,
11647 pub offset: i32,
11648 }
11649 impl ::core::fmt::Debug for Timestamptz {
11650 fn fmt(
11651 &self,
11652 f: &mut ::core::fmt::Formatter<'_>,
11653 ) -> ::core::fmt::Result {
11654 f.debug_struct("Timestamptz")
11655 .field("timestamp", &self.timestamp)
11656 .field("offset", &self.offset)
11657 .finish()
11658 }
11659 }
11660 #[repr(C)]
11661 #[derive(Clone, Copy)]
11662 pub struct Timetz {
11663 pub time: Time,
11664 pub offset: i32,
11665 }
11666 impl ::core::fmt::Debug for Timetz {
11667 fn fmt(
11668 &self,
11669 f: &mut ::core::fmt::Formatter<'_>,
11670 ) -> ::core::fmt::Result {
11671 f.debug_struct("Timetz")
11672 .field("time", &self.time)
11673 .field("offset", &self.offset)
11674 .finish()
11675 }
11676 }
11677 }
11678 #[allow(dead_code, clippy::all)]
11679 pub mod mysql {
11680 #[used]
11681 #[doc(hidden)]
11682 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
11683 use super::super::super::_rt;
11684 pub type Date = super::super::super::golem::rdbms::types::Date;
11685 pub type Time = super::super::super::golem::rdbms::types::Time;
11686 pub type Timestamp = super::super::super::golem::rdbms::types::Timestamp;
11687 #[derive(Clone)]
11688 pub enum Error {
11689 ConnectionFailure(_rt::String),
11690 QueryParameterFailure(_rt::String),
11691 QueryExecutionFailure(_rt::String),
11692 QueryResponseFailure(_rt::String),
11693 Other(_rt::String),
11694 }
11695 impl ::core::fmt::Debug for Error {
11696 fn fmt(
11697 &self,
11698 f: &mut ::core::fmt::Formatter<'_>,
11699 ) -> ::core::fmt::Result {
11700 match self {
11701 Error::ConnectionFailure(e) => {
11702 f.debug_tuple("Error::ConnectionFailure").field(e).finish()
11703 }
11704 Error::QueryParameterFailure(e) => {
11705 f.debug_tuple("Error::QueryParameterFailure")
11706 .field(e)
11707 .finish()
11708 }
11709 Error::QueryExecutionFailure(e) => {
11710 f.debug_tuple("Error::QueryExecutionFailure")
11711 .field(e)
11712 .finish()
11713 }
11714 Error::QueryResponseFailure(e) => {
11715 f.debug_tuple("Error::QueryResponseFailure")
11716 .field(e)
11717 .finish()
11718 }
11719 Error::Other(e) => {
11720 f.debug_tuple("Error::Other").field(e).finish()
11721 }
11722 }
11723 }
11724 }
11725 impl ::core::fmt::Display for Error {
11726 fn fmt(
11727 &self,
11728 f: &mut ::core::fmt::Formatter<'_>,
11729 ) -> ::core::fmt::Result {
11730 write!(f, "{:?}", self)
11731 }
11732 }
11733 impl std::error::Error for Error {}
11734 #[derive(Clone, Copy)]
11735 pub enum DbColumnType {
11736 Boolean,
11737 Tinyint,
11738 Smallint,
11739 Mediumint,
11740 Int,
11741 Bigint,
11742 TinyintUnsigned,
11743 SmallintUnsigned,
11744 MediumintUnsigned,
11745 IntUnsigned,
11746 BigintUnsigned,
11747 Float,
11748 Double,
11749 Decimal,
11750 Date,
11751 Datetime,
11752 Timestamp,
11753 Time,
11754 Year,
11755 Fixchar,
11756 Varchar,
11757 Tinytext,
11758 Text,
11759 Mediumtext,
11760 Longtext,
11761 Binary,
11762 Varbinary,
11763 Tinyblob,
11764 Blob,
11765 Mediumblob,
11766 Longblob,
11767 Enumeration,
11768 Set,
11769 Bit,
11770 Json,
11771 }
11772 impl ::core::fmt::Debug for DbColumnType {
11773 fn fmt(
11774 &self,
11775 f: &mut ::core::fmt::Formatter<'_>,
11776 ) -> ::core::fmt::Result {
11777 match self {
11778 DbColumnType::Boolean => {
11779 f.debug_tuple("DbColumnType::Boolean").finish()
11780 }
11781 DbColumnType::Tinyint => {
11782 f.debug_tuple("DbColumnType::Tinyint").finish()
11783 }
11784 DbColumnType::Smallint => {
11785 f.debug_tuple("DbColumnType::Smallint").finish()
11786 }
11787 DbColumnType::Mediumint => {
11788 f.debug_tuple("DbColumnType::Mediumint").finish()
11789 }
11790 DbColumnType::Int => f.debug_tuple("DbColumnType::Int").finish(),
11791 DbColumnType::Bigint => {
11792 f.debug_tuple("DbColumnType::Bigint").finish()
11793 }
11794 DbColumnType::TinyintUnsigned => {
11795 f.debug_tuple("DbColumnType::TinyintUnsigned").finish()
11796 }
11797 DbColumnType::SmallintUnsigned => {
11798 f.debug_tuple("DbColumnType::SmallintUnsigned").finish()
11799 }
11800 DbColumnType::MediumintUnsigned => {
11801 f.debug_tuple("DbColumnType::MediumintUnsigned").finish()
11802 }
11803 DbColumnType::IntUnsigned => {
11804 f.debug_tuple("DbColumnType::IntUnsigned").finish()
11805 }
11806 DbColumnType::BigintUnsigned => {
11807 f.debug_tuple("DbColumnType::BigintUnsigned").finish()
11808 }
11809 DbColumnType::Float => {
11810 f.debug_tuple("DbColumnType::Float").finish()
11811 }
11812 DbColumnType::Double => {
11813 f.debug_tuple("DbColumnType::Double").finish()
11814 }
11815 DbColumnType::Decimal => {
11816 f.debug_tuple("DbColumnType::Decimal").finish()
11817 }
11818 DbColumnType::Date => {
11819 f.debug_tuple("DbColumnType::Date").finish()
11820 }
11821 DbColumnType::Datetime => {
11822 f.debug_tuple("DbColumnType::Datetime").finish()
11823 }
11824 DbColumnType::Timestamp => {
11825 f.debug_tuple("DbColumnType::Timestamp").finish()
11826 }
11827 DbColumnType::Time => {
11828 f.debug_tuple("DbColumnType::Time").finish()
11829 }
11830 DbColumnType::Year => {
11831 f.debug_tuple("DbColumnType::Year").finish()
11832 }
11833 DbColumnType::Fixchar => {
11834 f.debug_tuple("DbColumnType::Fixchar").finish()
11835 }
11836 DbColumnType::Varchar => {
11837 f.debug_tuple("DbColumnType::Varchar").finish()
11838 }
11839 DbColumnType::Tinytext => {
11840 f.debug_tuple("DbColumnType::Tinytext").finish()
11841 }
11842 DbColumnType::Text => {
11843 f.debug_tuple("DbColumnType::Text").finish()
11844 }
11845 DbColumnType::Mediumtext => {
11846 f.debug_tuple("DbColumnType::Mediumtext").finish()
11847 }
11848 DbColumnType::Longtext => {
11849 f.debug_tuple("DbColumnType::Longtext").finish()
11850 }
11851 DbColumnType::Binary => {
11852 f.debug_tuple("DbColumnType::Binary").finish()
11853 }
11854 DbColumnType::Varbinary => {
11855 f.debug_tuple("DbColumnType::Varbinary").finish()
11856 }
11857 DbColumnType::Tinyblob => {
11858 f.debug_tuple("DbColumnType::Tinyblob").finish()
11859 }
11860 DbColumnType::Blob => {
11861 f.debug_tuple("DbColumnType::Blob").finish()
11862 }
11863 DbColumnType::Mediumblob => {
11864 f.debug_tuple("DbColumnType::Mediumblob").finish()
11865 }
11866 DbColumnType::Longblob => {
11867 f.debug_tuple("DbColumnType::Longblob").finish()
11868 }
11869 DbColumnType::Enumeration => {
11870 f.debug_tuple("DbColumnType::Enumeration").finish()
11871 }
11872 DbColumnType::Set => f.debug_tuple("DbColumnType::Set").finish(),
11873 DbColumnType::Bit => f.debug_tuple("DbColumnType::Bit").finish(),
11874 DbColumnType::Json => {
11875 f.debug_tuple("DbColumnType::Json").finish()
11876 }
11877 }
11878 }
11879 }
11880 #[derive(Clone)]
11881 pub struct DbColumn {
11882 pub ordinal: u64,
11883 pub name: _rt::String,
11884 pub db_type: DbColumnType,
11885 pub db_type_name: _rt::String,
11886 }
11887 impl ::core::fmt::Debug for DbColumn {
11888 fn fmt(
11889 &self,
11890 f: &mut ::core::fmt::Formatter<'_>,
11891 ) -> ::core::fmt::Result {
11892 f.debug_struct("DbColumn")
11893 .field("ordinal", &self.ordinal)
11894 .field("name", &self.name)
11895 .field("db-type", &self.db_type)
11896 .field("db-type-name", &self.db_type_name)
11897 .finish()
11898 }
11899 }
11900 /// Value descriptor for a single database value
11901 #[derive(Clone)]
11902 pub enum DbValue {
11903 Boolean(bool),
11904 Tinyint(i8),
11905 Smallint(i16),
11906 /// s24
11907 Mediumint(i32),
11908 Int(i32),
11909 Bigint(i64),
11910 TinyintUnsigned(u8),
11911 SmallintUnsigned(u16),
11912 /// u24
11913 MediumintUnsigned(u32),
11914 IntUnsigned(u32),
11915 BigintUnsigned(u64),
11916 Float(f32),
11917 Double(f64),
11918 Decimal(_rt::String),
11919 Date(Date),
11920 Datetime(Timestamp),
11921 Timestamp(Timestamp),
11922 Time(Time),
11923 Year(u16),
11924 Fixchar(_rt::String),
11925 Varchar(_rt::String),
11926 Tinytext(_rt::String),
11927 Text(_rt::String),
11928 Mediumtext(_rt::String),
11929 Longtext(_rt::String),
11930 Binary(_rt::Vec<u8>),
11931 Varbinary(_rt::Vec<u8>),
11932 Tinyblob(_rt::Vec<u8>),
11933 Blob(_rt::Vec<u8>),
11934 Mediumblob(_rt::Vec<u8>),
11935 Longblob(_rt::Vec<u8>),
11936 Enumeration(_rt::String),
11937 Set(_rt::String),
11938 Bit(_rt::Vec<bool>),
11939 Json(_rt::String),
11940 Null,
11941 }
11942 impl ::core::fmt::Debug for DbValue {
11943 fn fmt(
11944 &self,
11945 f: &mut ::core::fmt::Formatter<'_>,
11946 ) -> ::core::fmt::Result {
11947 match self {
11948 DbValue::Boolean(e) => {
11949 f.debug_tuple("DbValue::Boolean").field(e).finish()
11950 }
11951 DbValue::Tinyint(e) => {
11952 f.debug_tuple("DbValue::Tinyint").field(e).finish()
11953 }
11954 DbValue::Smallint(e) => {
11955 f.debug_tuple("DbValue::Smallint").field(e).finish()
11956 }
11957 DbValue::Mediumint(e) => {
11958 f.debug_tuple("DbValue::Mediumint").field(e).finish()
11959 }
11960 DbValue::Int(e) => {
11961 f.debug_tuple("DbValue::Int").field(e).finish()
11962 }
11963 DbValue::Bigint(e) => {
11964 f.debug_tuple("DbValue::Bigint").field(e).finish()
11965 }
11966 DbValue::TinyintUnsigned(e) => {
11967 f.debug_tuple("DbValue::TinyintUnsigned").field(e).finish()
11968 }
11969 DbValue::SmallintUnsigned(e) => {
11970 f.debug_tuple("DbValue::SmallintUnsigned").field(e).finish()
11971 }
11972 DbValue::MediumintUnsigned(e) => {
11973 f.debug_tuple("DbValue::MediumintUnsigned").field(e).finish()
11974 }
11975 DbValue::IntUnsigned(e) => {
11976 f.debug_tuple("DbValue::IntUnsigned").field(e).finish()
11977 }
11978 DbValue::BigintUnsigned(e) => {
11979 f.debug_tuple("DbValue::BigintUnsigned").field(e).finish()
11980 }
11981 DbValue::Float(e) => {
11982 f.debug_tuple("DbValue::Float").field(e).finish()
11983 }
11984 DbValue::Double(e) => {
11985 f.debug_tuple("DbValue::Double").field(e).finish()
11986 }
11987 DbValue::Decimal(e) => {
11988 f.debug_tuple("DbValue::Decimal").field(e).finish()
11989 }
11990 DbValue::Date(e) => {
11991 f.debug_tuple("DbValue::Date").field(e).finish()
11992 }
11993 DbValue::Datetime(e) => {
11994 f.debug_tuple("DbValue::Datetime").field(e).finish()
11995 }
11996 DbValue::Timestamp(e) => {
11997 f.debug_tuple("DbValue::Timestamp").field(e).finish()
11998 }
11999 DbValue::Time(e) => {
12000 f.debug_tuple("DbValue::Time").field(e).finish()
12001 }
12002 DbValue::Year(e) => {
12003 f.debug_tuple("DbValue::Year").field(e).finish()
12004 }
12005 DbValue::Fixchar(e) => {
12006 f.debug_tuple("DbValue::Fixchar").field(e).finish()
12007 }
12008 DbValue::Varchar(e) => {
12009 f.debug_tuple("DbValue::Varchar").field(e).finish()
12010 }
12011 DbValue::Tinytext(e) => {
12012 f.debug_tuple("DbValue::Tinytext").field(e).finish()
12013 }
12014 DbValue::Text(e) => {
12015 f.debug_tuple("DbValue::Text").field(e).finish()
12016 }
12017 DbValue::Mediumtext(e) => {
12018 f.debug_tuple("DbValue::Mediumtext").field(e).finish()
12019 }
12020 DbValue::Longtext(e) => {
12021 f.debug_tuple("DbValue::Longtext").field(e).finish()
12022 }
12023 DbValue::Binary(e) => {
12024 f.debug_tuple("DbValue::Binary").field(e).finish()
12025 }
12026 DbValue::Varbinary(e) => {
12027 f.debug_tuple("DbValue::Varbinary").field(e).finish()
12028 }
12029 DbValue::Tinyblob(e) => {
12030 f.debug_tuple("DbValue::Tinyblob").field(e).finish()
12031 }
12032 DbValue::Blob(e) => {
12033 f.debug_tuple("DbValue::Blob").field(e).finish()
12034 }
12035 DbValue::Mediumblob(e) => {
12036 f.debug_tuple("DbValue::Mediumblob").field(e).finish()
12037 }
12038 DbValue::Longblob(e) => {
12039 f.debug_tuple("DbValue::Longblob").field(e).finish()
12040 }
12041 DbValue::Enumeration(e) => {
12042 f.debug_tuple("DbValue::Enumeration").field(e).finish()
12043 }
12044 DbValue::Set(e) => {
12045 f.debug_tuple("DbValue::Set").field(e).finish()
12046 }
12047 DbValue::Bit(e) => {
12048 f.debug_tuple("DbValue::Bit").field(e).finish()
12049 }
12050 DbValue::Json(e) => {
12051 f.debug_tuple("DbValue::Json").field(e).finish()
12052 }
12053 DbValue::Null => f.debug_tuple("DbValue::Null").finish(),
12054 }
12055 }
12056 }
12057 /// A single row of values
12058 #[derive(Clone)]
12059 pub struct DbRow {
12060 pub values: _rt::Vec<DbValue>,
12061 }
12062 impl ::core::fmt::Debug for DbRow {
12063 fn fmt(
12064 &self,
12065 f: &mut ::core::fmt::Formatter<'_>,
12066 ) -> ::core::fmt::Result {
12067 f.debug_struct("DbRow").field("values", &self.values).finish()
12068 }
12069 }
12070 #[derive(Clone)]
12071 pub struct DbResult {
12072 pub columns: _rt::Vec<DbColumn>,
12073 pub rows: _rt::Vec<DbRow>,
12074 }
12075 impl ::core::fmt::Debug for DbResult {
12076 fn fmt(
12077 &self,
12078 f: &mut ::core::fmt::Formatter<'_>,
12079 ) -> ::core::fmt::Result {
12080 f.debug_struct("DbResult")
12081 .field("columns", &self.columns)
12082 .field("rows", &self.rows)
12083 .finish()
12084 }
12085 }
12086 /// A potentially very large and lazy stream of rows:
12087 #[derive(Debug)]
12088 #[repr(transparent)]
12089 pub struct DbResultStream {
12090 handle: _rt::Resource<DbResultStream>,
12091 }
12092 impl DbResultStream {
12093 #[doc(hidden)]
12094 pub unsafe fn from_handle(handle: u32) -> Self {
12095 Self {
12096 handle: _rt::Resource::from_handle(handle),
12097 }
12098 }
12099 #[doc(hidden)]
12100 pub fn take_handle(&self) -> u32 {
12101 _rt::Resource::take_handle(&self.handle)
12102 }
12103 #[doc(hidden)]
12104 pub fn handle(&self) -> u32 {
12105 _rt::Resource::handle(&self.handle)
12106 }
12107 }
12108 unsafe impl _rt::WasmResource for DbResultStream {
12109 #[inline]
12110 unsafe fn drop(_handle: u32) {
12111 #[cfg(not(target_arch = "wasm32"))]
12112 unreachable!();
12113 #[cfg(target_arch = "wasm32")]
12114 {
12115 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
12116 extern "C" {
12117 #[link_name = "[resource-drop]db-result-stream"]
12118 fn drop(_: u32);
12119 }
12120 drop(_handle);
12121 }
12122 }
12123 }
12124 #[derive(Debug)]
12125 #[repr(transparent)]
12126 pub struct DbConnection {
12127 handle: _rt::Resource<DbConnection>,
12128 }
12129 impl DbConnection {
12130 #[doc(hidden)]
12131 pub unsafe fn from_handle(handle: u32) -> Self {
12132 Self {
12133 handle: _rt::Resource::from_handle(handle),
12134 }
12135 }
12136 #[doc(hidden)]
12137 pub fn take_handle(&self) -> u32 {
12138 _rt::Resource::take_handle(&self.handle)
12139 }
12140 #[doc(hidden)]
12141 pub fn handle(&self) -> u32 {
12142 _rt::Resource::handle(&self.handle)
12143 }
12144 }
12145 unsafe impl _rt::WasmResource for DbConnection {
12146 #[inline]
12147 unsafe fn drop(_handle: u32) {
12148 #[cfg(not(target_arch = "wasm32"))]
12149 unreachable!();
12150 #[cfg(target_arch = "wasm32")]
12151 {
12152 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
12153 extern "C" {
12154 #[link_name = "[resource-drop]db-connection"]
12155 fn drop(_: u32);
12156 }
12157 drop(_handle);
12158 }
12159 }
12160 }
12161 #[derive(Debug)]
12162 #[repr(transparent)]
12163 pub struct DbTransaction {
12164 handle: _rt::Resource<DbTransaction>,
12165 }
12166 impl DbTransaction {
12167 #[doc(hidden)]
12168 pub unsafe fn from_handle(handle: u32) -> Self {
12169 Self {
12170 handle: _rt::Resource::from_handle(handle),
12171 }
12172 }
12173 #[doc(hidden)]
12174 pub fn take_handle(&self) -> u32 {
12175 _rt::Resource::take_handle(&self.handle)
12176 }
12177 #[doc(hidden)]
12178 pub fn handle(&self) -> u32 {
12179 _rt::Resource::handle(&self.handle)
12180 }
12181 }
12182 unsafe impl _rt::WasmResource for DbTransaction {
12183 #[inline]
12184 unsafe fn drop(_handle: u32) {
12185 #[cfg(not(target_arch = "wasm32"))]
12186 unreachable!();
12187 #[cfg(target_arch = "wasm32")]
12188 {
12189 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
12190 extern "C" {
12191 #[link_name = "[resource-drop]db-transaction"]
12192 fn drop(_: u32);
12193 }
12194 drop(_handle);
12195 }
12196 }
12197 }
12198 impl DbResultStream {
12199 #[allow(unused_unsafe, clippy::all)]
12200 pub fn get_columns(&self) -> _rt::Vec<DbColumn> {
12201 unsafe {
12202 #[repr(align(4))]
12203 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
12204 let mut ret_area = RetArea(
12205 [::core::mem::MaybeUninit::uninit(); 8],
12206 );
12207 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
12208 #[cfg(target_arch = "wasm32")]
12209 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
12210 extern "C" {
12211 #[link_name = "[method]db-result-stream.get-columns"]
12212 fn wit_import(_: i32, _: *mut u8);
12213 }
12214 #[cfg(not(target_arch = "wasm32"))]
12215 fn wit_import(_: i32, _: *mut u8) {
12216 unreachable!()
12217 }
12218 wit_import((self).handle() as i32, ptr0);
12219 let l1 = *ptr0.add(0).cast::<*mut u8>();
12220 let l2 = *ptr0.add(4).cast::<usize>();
12221 let base12 = l1;
12222 let len12 = l2;
12223 let mut result12 = _rt::Vec::with_capacity(len12);
12224 for i in 0..len12 {
12225 let base = base12.add(i * 32);
12226 let e12 = {
12227 let l3 = *base.add(0).cast::<i64>();
12228 let l4 = *base.add(8).cast::<*mut u8>();
12229 let l5 = *base.add(12).cast::<usize>();
12230 let len6 = l5;
12231 let bytes6 = _rt::Vec::from_raw_parts(
12232 l4.cast(),
12233 len6,
12234 len6,
12235 );
12236 let l7 = i32::from(*base.add(16).cast::<u8>());
12237 let v8 = match l7 {
12238 0 => DbColumnType::Boolean,
12239 1 => DbColumnType::Tinyint,
12240 2 => DbColumnType::Smallint,
12241 3 => DbColumnType::Mediumint,
12242 4 => DbColumnType::Int,
12243 5 => DbColumnType::Bigint,
12244 6 => DbColumnType::TinyintUnsigned,
12245 7 => DbColumnType::SmallintUnsigned,
12246 8 => DbColumnType::MediumintUnsigned,
12247 9 => DbColumnType::IntUnsigned,
12248 10 => DbColumnType::BigintUnsigned,
12249 11 => DbColumnType::Float,
12250 12 => DbColumnType::Double,
12251 13 => DbColumnType::Decimal,
12252 14 => DbColumnType::Date,
12253 15 => DbColumnType::Datetime,
12254 16 => DbColumnType::Timestamp,
12255 17 => DbColumnType::Time,
12256 18 => DbColumnType::Year,
12257 19 => DbColumnType::Fixchar,
12258 20 => DbColumnType::Varchar,
12259 21 => DbColumnType::Tinytext,
12260 22 => DbColumnType::Text,
12261 23 => DbColumnType::Mediumtext,
12262 24 => DbColumnType::Longtext,
12263 25 => DbColumnType::Binary,
12264 26 => DbColumnType::Varbinary,
12265 27 => DbColumnType::Tinyblob,
12266 28 => DbColumnType::Blob,
12267 29 => DbColumnType::Mediumblob,
12268 30 => DbColumnType::Longblob,
12269 31 => DbColumnType::Enumeration,
12270 32 => DbColumnType::Set,
12271 33 => DbColumnType::Bit,
12272 n => {
12273 debug_assert_eq!(n, 34, "invalid enum discriminant");
12274 DbColumnType::Json
12275 }
12276 };
12277 let l9 = *base.add(20).cast::<*mut u8>();
12278 let l10 = *base.add(24).cast::<usize>();
12279 let len11 = l10;
12280 let bytes11 = _rt::Vec::from_raw_parts(
12281 l9.cast(),
12282 len11,
12283 len11,
12284 );
12285 DbColumn {
12286 ordinal: l3 as u64,
12287 name: _rt::string_lift(bytes6),
12288 db_type: v8,
12289 db_type_name: _rt::string_lift(bytes11),
12290 }
12291 };
12292 result12.push(e12);
12293 }
12294 _rt::cabi_dealloc(base12, len12 * 32, 8);
12295 result12
12296 }
12297 }
12298 }
12299 impl DbResultStream {
12300 #[allow(unused_unsafe, clippy::all)]
12301 pub fn get_next(&self) -> Option<_rt::Vec<DbRow>> {
12302 unsafe {
12303 #[repr(align(4))]
12304 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
12305 let mut ret_area = RetArea(
12306 [::core::mem::MaybeUninit::uninit(); 12],
12307 );
12308 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
12309 #[cfg(target_arch = "wasm32")]
12310 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
12311 extern "C" {
12312 #[link_name = "[method]db-result-stream.get-next"]
12313 fn wit_import(_: i32, _: *mut u8);
12314 }
12315 #[cfg(not(target_arch = "wasm32"))]
12316 fn wit_import(_: i32, _: *mut u8) {
12317 unreachable!()
12318 }
12319 wit_import((self).handle() as i32, ptr0);
12320 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
12321 match l1 {
12322 0 => None,
12323 1 => {
12324 let e = {
12325 let l2 = *ptr0.add(4).cast::<*mut u8>();
12326 let l3 = *ptr0.add(8).cast::<usize>();
12327 let base96 = l2;
12328 let len96 = l3;
12329 let mut result96 = _rt::Vec::with_capacity(len96);
12330 for i in 0..len96 {
12331 let base = base96.add(i * 8);
12332 let e96 = {
12333 let l4 = *base.add(0).cast::<*mut u8>();
12334 let l5 = *base.add(4).cast::<usize>();
12335 let base95 = l4;
12336 let len95 = l5;
12337 let mut result95 = _rt::Vec::with_capacity(len95);
12338 for i in 0..len95 {
12339 let base = base95.add(i * 24);
12340 let e95 = {
12341 let l6 = i32::from(*base.add(0).cast::<u8>());
12342 let v94 = match l6 {
12343 0 => {
12344 let e94 = {
12345 let l7 = i32::from(*base.add(8).cast::<u8>());
12346 _rt::bool_lift(l7 as u8)
12347 };
12348 DbValue::Boolean(e94)
12349 }
12350 1 => {
12351 let e94 = {
12352 let l8 = i32::from(*base.add(8).cast::<i8>());
12353 l8 as i8
12354 };
12355 DbValue::Tinyint(e94)
12356 }
12357 2 => {
12358 let e94 = {
12359 let l9 = i32::from(*base.add(8).cast::<i16>());
12360 l9 as i16
12361 };
12362 DbValue::Smallint(e94)
12363 }
12364 3 => {
12365 let e94 = {
12366 let l10 = *base.add(8).cast::<i32>();
12367 l10
12368 };
12369 DbValue::Mediumint(e94)
12370 }
12371 4 => {
12372 let e94 = {
12373 let l11 = *base.add(8).cast::<i32>();
12374 l11
12375 };
12376 DbValue::Int(e94)
12377 }
12378 5 => {
12379 let e94 = {
12380 let l12 = *base.add(8).cast::<i64>();
12381 l12
12382 };
12383 DbValue::Bigint(e94)
12384 }
12385 6 => {
12386 let e94 = {
12387 let l13 = i32::from(*base.add(8).cast::<u8>());
12388 l13 as u8
12389 };
12390 DbValue::TinyintUnsigned(e94)
12391 }
12392 7 => {
12393 let e94 = {
12394 let l14 = i32::from(*base.add(8).cast::<u16>());
12395 l14 as u16
12396 };
12397 DbValue::SmallintUnsigned(e94)
12398 }
12399 8 => {
12400 let e94 = {
12401 let l15 = *base.add(8).cast::<i32>();
12402 l15 as u32
12403 };
12404 DbValue::MediumintUnsigned(e94)
12405 }
12406 9 => {
12407 let e94 = {
12408 let l16 = *base.add(8).cast::<i32>();
12409 l16 as u32
12410 };
12411 DbValue::IntUnsigned(e94)
12412 }
12413 10 => {
12414 let e94 = {
12415 let l17 = *base.add(8).cast::<i64>();
12416 l17 as u64
12417 };
12418 DbValue::BigintUnsigned(e94)
12419 }
12420 11 => {
12421 let e94 = {
12422 let l18 = *base.add(8).cast::<f32>();
12423 l18
12424 };
12425 DbValue::Float(e94)
12426 }
12427 12 => {
12428 let e94 = {
12429 let l19 = *base.add(8).cast::<f64>();
12430 l19
12431 };
12432 DbValue::Double(e94)
12433 }
12434 13 => {
12435 let e94 = {
12436 let l20 = *base.add(8).cast::<*mut u8>();
12437 let l21 = *base.add(12).cast::<usize>();
12438 let len22 = l21;
12439 let bytes22 = _rt::Vec::from_raw_parts(
12440 l20.cast(),
12441 len22,
12442 len22,
12443 );
12444 _rt::string_lift(bytes22)
12445 };
12446 DbValue::Decimal(e94)
12447 }
12448 14 => {
12449 let e94 = {
12450 let l23 = *base.add(8).cast::<i32>();
12451 let l24 = i32::from(*base.add(12).cast::<u8>());
12452 let l25 = i32::from(*base.add(13).cast::<u8>());
12453 super::super::super::golem::rdbms::types::Date {
12454 year: l23,
12455 month: l24 as u8,
12456 day: l25 as u8,
12457 }
12458 };
12459 DbValue::Date(e94)
12460 }
12461 15 => {
12462 let e94 = {
12463 let l26 = *base.add(8).cast::<i32>();
12464 let l27 = i32::from(*base.add(12).cast::<u8>());
12465 let l28 = i32::from(*base.add(13).cast::<u8>());
12466 let l29 = i32::from(*base.add(16).cast::<u8>());
12467 let l30 = i32::from(*base.add(17).cast::<u8>());
12468 let l31 = i32::from(*base.add(18).cast::<u8>());
12469 let l32 = *base.add(20).cast::<i32>();
12470 super::super::super::golem::rdbms::types::Timestamp {
12471 date: super::super::super::golem::rdbms::types::Date {
12472 year: l26,
12473 month: l27 as u8,
12474 day: l28 as u8,
12475 },
12476 time: super::super::super::golem::rdbms::types::Time {
12477 hour: l29 as u8,
12478 minute: l30 as u8,
12479 second: l31 as u8,
12480 nanosecond: l32 as u32,
12481 },
12482 }
12483 };
12484 DbValue::Datetime(e94)
12485 }
12486 16 => {
12487 let e94 = {
12488 let l33 = *base.add(8).cast::<i32>();
12489 let l34 = i32::from(*base.add(12).cast::<u8>());
12490 let l35 = i32::from(*base.add(13).cast::<u8>());
12491 let l36 = i32::from(*base.add(16).cast::<u8>());
12492 let l37 = i32::from(*base.add(17).cast::<u8>());
12493 let l38 = i32::from(*base.add(18).cast::<u8>());
12494 let l39 = *base.add(20).cast::<i32>();
12495 super::super::super::golem::rdbms::types::Timestamp {
12496 date: super::super::super::golem::rdbms::types::Date {
12497 year: l33,
12498 month: l34 as u8,
12499 day: l35 as u8,
12500 },
12501 time: super::super::super::golem::rdbms::types::Time {
12502 hour: l36 as u8,
12503 minute: l37 as u8,
12504 second: l38 as u8,
12505 nanosecond: l39 as u32,
12506 },
12507 }
12508 };
12509 DbValue::Timestamp(e94)
12510 }
12511 17 => {
12512 let e94 = {
12513 let l40 = i32::from(*base.add(8).cast::<u8>());
12514 let l41 = i32::from(*base.add(9).cast::<u8>());
12515 let l42 = i32::from(*base.add(10).cast::<u8>());
12516 let l43 = *base.add(12).cast::<i32>();
12517 super::super::super::golem::rdbms::types::Time {
12518 hour: l40 as u8,
12519 minute: l41 as u8,
12520 second: l42 as u8,
12521 nanosecond: l43 as u32,
12522 }
12523 };
12524 DbValue::Time(e94)
12525 }
12526 18 => {
12527 let e94 = {
12528 let l44 = i32::from(*base.add(8).cast::<u16>());
12529 l44 as u16
12530 };
12531 DbValue::Year(e94)
12532 }
12533 19 => {
12534 let e94 = {
12535 let l45 = *base.add(8).cast::<*mut u8>();
12536 let l46 = *base.add(12).cast::<usize>();
12537 let len47 = l46;
12538 let bytes47 = _rt::Vec::from_raw_parts(
12539 l45.cast(),
12540 len47,
12541 len47,
12542 );
12543 _rt::string_lift(bytes47)
12544 };
12545 DbValue::Fixchar(e94)
12546 }
12547 20 => {
12548 let e94 = {
12549 let l48 = *base.add(8).cast::<*mut u8>();
12550 let l49 = *base.add(12).cast::<usize>();
12551 let len50 = l49;
12552 let bytes50 = _rt::Vec::from_raw_parts(
12553 l48.cast(),
12554 len50,
12555 len50,
12556 );
12557 _rt::string_lift(bytes50)
12558 };
12559 DbValue::Varchar(e94)
12560 }
12561 21 => {
12562 let e94 = {
12563 let l51 = *base.add(8).cast::<*mut u8>();
12564 let l52 = *base.add(12).cast::<usize>();
12565 let len53 = l52;
12566 let bytes53 = _rt::Vec::from_raw_parts(
12567 l51.cast(),
12568 len53,
12569 len53,
12570 );
12571 _rt::string_lift(bytes53)
12572 };
12573 DbValue::Tinytext(e94)
12574 }
12575 22 => {
12576 let e94 = {
12577 let l54 = *base.add(8).cast::<*mut u8>();
12578 let l55 = *base.add(12).cast::<usize>();
12579 let len56 = l55;
12580 let bytes56 = _rt::Vec::from_raw_parts(
12581 l54.cast(),
12582 len56,
12583 len56,
12584 );
12585 _rt::string_lift(bytes56)
12586 };
12587 DbValue::Text(e94)
12588 }
12589 23 => {
12590 let e94 = {
12591 let l57 = *base.add(8).cast::<*mut u8>();
12592 let l58 = *base.add(12).cast::<usize>();
12593 let len59 = l58;
12594 let bytes59 = _rt::Vec::from_raw_parts(
12595 l57.cast(),
12596 len59,
12597 len59,
12598 );
12599 _rt::string_lift(bytes59)
12600 };
12601 DbValue::Mediumtext(e94)
12602 }
12603 24 => {
12604 let e94 = {
12605 let l60 = *base.add(8).cast::<*mut u8>();
12606 let l61 = *base.add(12).cast::<usize>();
12607 let len62 = l61;
12608 let bytes62 = _rt::Vec::from_raw_parts(
12609 l60.cast(),
12610 len62,
12611 len62,
12612 );
12613 _rt::string_lift(bytes62)
12614 };
12615 DbValue::Longtext(e94)
12616 }
12617 25 => {
12618 let e94 = {
12619 let l63 = *base.add(8).cast::<*mut u8>();
12620 let l64 = *base.add(12).cast::<usize>();
12621 let len65 = l64;
12622 _rt::Vec::from_raw_parts(l63.cast(), len65, len65)
12623 };
12624 DbValue::Binary(e94)
12625 }
12626 26 => {
12627 let e94 = {
12628 let l66 = *base.add(8).cast::<*mut u8>();
12629 let l67 = *base.add(12).cast::<usize>();
12630 let len68 = l67;
12631 _rt::Vec::from_raw_parts(l66.cast(), len68, len68)
12632 };
12633 DbValue::Varbinary(e94)
12634 }
12635 27 => {
12636 let e94 = {
12637 let l69 = *base.add(8).cast::<*mut u8>();
12638 let l70 = *base.add(12).cast::<usize>();
12639 let len71 = l70;
12640 _rt::Vec::from_raw_parts(l69.cast(), len71, len71)
12641 };
12642 DbValue::Tinyblob(e94)
12643 }
12644 28 => {
12645 let e94 = {
12646 let l72 = *base.add(8).cast::<*mut u8>();
12647 let l73 = *base.add(12).cast::<usize>();
12648 let len74 = l73;
12649 _rt::Vec::from_raw_parts(l72.cast(), len74, len74)
12650 };
12651 DbValue::Blob(e94)
12652 }
12653 29 => {
12654 let e94 = {
12655 let l75 = *base.add(8).cast::<*mut u8>();
12656 let l76 = *base.add(12).cast::<usize>();
12657 let len77 = l76;
12658 _rt::Vec::from_raw_parts(l75.cast(), len77, len77)
12659 };
12660 DbValue::Mediumblob(e94)
12661 }
12662 30 => {
12663 let e94 = {
12664 let l78 = *base.add(8).cast::<*mut u8>();
12665 let l79 = *base.add(12).cast::<usize>();
12666 let len80 = l79;
12667 _rt::Vec::from_raw_parts(l78.cast(), len80, len80)
12668 };
12669 DbValue::Longblob(e94)
12670 }
12671 31 => {
12672 let e94 = {
12673 let l81 = *base.add(8).cast::<*mut u8>();
12674 let l82 = *base.add(12).cast::<usize>();
12675 let len83 = l82;
12676 let bytes83 = _rt::Vec::from_raw_parts(
12677 l81.cast(),
12678 len83,
12679 len83,
12680 );
12681 _rt::string_lift(bytes83)
12682 };
12683 DbValue::Enumeration(e94)
12684 }
12685 32 => {
12686 let e94 = {
12687 let l84 = *base.add(8).cast::<*mut u8>();
12688 let l85 = *base.add(12).cast::<usize>();
12689 let len86 = l85;
12690 let bytes86 = _rt::Vec::from_raw_parts(
12691 l84.cast(),
12692 len86,
12693 len86,
12694 );
12695 _rt::string_lift(bytes86)
12696 };
12697 DbValue::Set(e94)
12698 }
12699 33 => {
12700 let e94 = {
12701 let l87 = *base.add(8).cast::<*mut u8>();
12702 let l88 = *base.add(12).cast::<usize>();
12703 let base90 = l87;
12704 let len90 = l88;
12705 let mut result90 = _rt::Vec::with_capacity(len90);
12706 for i in 0..len90 {
12707 let base = base90.add(i * 1);
12708 let e90 = {
12709 let l89 = i32::from(*base.add(0).cast::<u8>());
12710 _rt::bool_lift(l89 as u8)
12711 };
12712 result90.push(e90);
12713 }
12714 _rt::cabi_dealloc(base90, len90 * 1, 1);
12715 result90
12716 };
12717 DbValue::Bit(e94)
12718 }
12719 34 => {
12720 let e94 = {
12721 let l91 = *base.add(8).cast::<*mut u8>();
12722 let l92 = *base.add(12).cast::<usize>();
12723 let len93 = l92;
12724 let bytes93 = _rt::Vec::from_raw_parts(
12725 l91.cast(),
12726 len93,
12727 len93,
12728 );
12729 _rt::string_lift(bytes93)
12730 };
12731 DbValue::Json(e94)
12732 }
12733 n => {
12734 debug_assert_eq!(n, 35, "invalid enum discriminant");
12735 DbValue::Null
12736 }
12737 };
12738 v94
12739 };
12740 result95.push(e95);
12741 }
12742 _rt::cabi_dealloc(base95, len95 * 24, 8);
12743 DbRow { values: result95 }
12744 };
12745 result96.push(e96);
12746 }
12747 _rt::cabi_dealloc(base96, len96 * 8, 4);
12748 result96
12749 };
12750 Some(e)
12751 }
12752 _ => _rt::invalid_enum_discriminant(),
12753 }
12754 }
12755 }
12756 }
12757 impl DbConnection {
12758 #[allow(unused_unsafe, clippy::all)]
12759 pub fn open(address: &str) -> Result<DbConnection, Error> {
12760 unsafe {
12761 #[repr(align(4))]
12762 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
12763 let mut ret_area = RetArea(
12764 [::core::mem::MaybeUninit::uninit(); 16],
12765 );
12766 let vec0 = address;
12767 let ptr0 = vec0.as_ptr().cast::<u8>();
12768 let len0 = vec0.len();
12769 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
12770 #[cfg(target_arch = "wasm32")]
12771 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
12772 extern "C" {
12773 #[link_name = "[static]db-connection.open"]
12774 fn wit_import(_: *mut u8, _: usize, _: *mut u8);
12775 }
12776 #[cfg(not(target_arch = "wasm32"))]
12777 fn wit_import(_: *mut u8, _: usize, _: *mut u8) {
12778 unreachable!()
12779 }
12780 wit_import(ptr0.cast_mut(), len0, ptr1);
12781 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
12782 match l2 {
12783 0 => {
12784 let e = {
12785 let l3 = *ptr1.add(4).cast::<i32>();
12786 DbConnection::from_handle(l3 as u32)
12787 };
12788 Ok(e)
12789 }
12790 1 => {
12791 let e = {
12792 let l4 = i32::from(*ptr1.add(4).cast::<u8>());
12793 let v20 = match l4 {
12794 0 => {
12795 let e20 = {
12796 let l5 = *ptr1.add(8).cast::<*mut u8>();
12797 let l6 = *ptr1.add(12).cast::<usize>();
12798 let len7 = l6;
12799 let bytes7 = _rt::Vec::from_raw_parts(
12800 l5.cast(),
12801 len7,
12802 len7,
12803 );
12804 _rt::string_lift(bytes7)
12805 };
12806 Error::ConnectionFailure(e20)
12807 }
12808 1 => {
12809 let e20 = {
12810 let l8 = *ptr1.add(8).cast::<*mut u8>();
12811 let l9 = *ptr1.add(12).cast::<usize>();
12812 let len10 = l9;
12813 let bytes10 = _rt::Vec::from_raw_parts(
12814 l8.cast(),
12815 len10,
12816 len10,
12817 );
12818 _rt::string_lift(bytes10)
12819 };
12820 Error::QueryParameterFailure(e20)
12821 }
12822 2 => {
12823 let e20 = {
12824 let l11 = *ptr1.add(8).cast::<*mut u8>();
12825 let l12 = *ptr1.add(12).cast::<usize>();
12826 let len13 = l12;
12827 let bytes13 = _rt::Vec::from_raw_parts(
12828 l11.cast(),
12829 len13,
12830 len13,
12831 );
12832 _rt::string_lift(bytes13)
12833 };
12834 Error::QueryExecutionFailure(e20)
12835 }
12836 3 => {
12837 let e20 = {
12838 let l14 = *ptr1.add(8).cast::<*mut u8>();
12839 let l15 = *ptr1.add(12).cast::<usize>();
12840 let len16 = l15;
12841 let bytes16 = _rt::Vec::from_raw_parts(
12842 l14.cast(),
12843 len16,
12844 len16,
12845 );
12846 _rt::string_lift(bytes16)
12847 };
12848 Error::QueryResponseFailure(e20)
12849 }
12850 n => {
12851 debug_assert_eq!(n, 4, "invalid enum discriminant");
12852 let e20 = {
12853 let l17 = *ptr1.add(8).cast::<*mut u8>();
12854 let l18 = *ptr1.add(12).cast::<usize>();
12855 let len19 = l18;
12856 let bytes19 = _rt::Vec::from_raw_parts(
12857 l17.cast(),
12858 len19,
12859 len19,
12860 );
12861 _rt::string_lift(bytes19)
12862 };
12863 Error::Other(e20)
12864 }
12865 };
12866 v20
12867 };
12868 Err(e)
12869 }
12870 _ => _rt::invalid_enum_discriminant(),
12871 }
12872 }
12873 }
12874 }
12875 impl DbConnection {
12876 #[allow(unused_unsafe, clippy::all)]
12877 pub fn query(
12878 &self,
12879 statement: &str,
12880 params: &[DbValue],
12881 ) -> Result<DbResult, Error> {
12882 unsafe {
12883 let mut cleanup_list = _rt::Vec::new();
12884 #[repr(align(4))]
12885 struct RetArea([::core::mem::MaybeUninit<u8>; 20]);
12886 let mut ret_area = RetArea(
12887 [::core::mem::MaybeUninit::uninit(); 20],
12888 );
12889 let vec0 = statement;
12890 let ptr0 = vec0.as_ptr().cast::<u8>();
12891 let len0 = vec0.len();
12892 let vec26 = params;
12893 let len26 = vec26.len();
12894 let layout26 = _rt::alloc::Layout::from_size_align_unchecked(
12895 vec26.len() * 24,
12896 8,
12897 );
12898 let result26 = if layout26.size() != 0 {
12899 let ptr = _rt::alloc::alloc(layout26).cast::<u8>();
12900 if ptr.is_null() {
12901 _rt::alloc::handle_alloc_error(layout26);
12902 }
12903 ptr
12904 } else {
12905 ::core::ptr::null_mut()
12906 };
12907 for (i, e) in vec26.into_iter().enumerate() {
12908 let base = result26.add(i * 24);
12909 {
12910 match e {
12911 DbValue::Boolean(e) => {
12912 *base.add(0).cast::<u8>() = (0i32) as u8;
12913 *base.add(8).cast::<u8>() = (match e {
12914 true => 1,
12915 false => 0,
12916 }) as u8;
12917 }
12918 DbValue::Tinyint(e) => {
12919 *base.add(0).cast::<u8>() = (1i32) as u8;
12920 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
12921 }
12922 DbValue::Smallint(e) => {
12923 *base.add(0).cast::<u8>() = (2i32) as u8;
12924 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
12925 }
12926 DbValue::Mediumint(e) => {
12927 *base.add(0).cast::<u8>() = (3i32) as u8;
12928 *base.add(8).cast::<i32>() = _rt::as_i32(e);
12929 }
12930 DbValue::Int(e) => {
12931 *base.add(0).cast::<u8>() = (4i32) as u8;
12932 *base.add(8).cast::<i32>() = _rt::as_i32(e);
12933 }
12934 DbValue::Bigint(e) => {
12935 *base.add(0).cast::<u8>() = (5i32) as u8;
12936 *base.add(8).cast::<i64>() = _rt::as_i64(e);
12937 }
12938 DbValue::TinyintUnsigned(e) => {
12939 *base.add(0).cast::<u8>() = (6i32) as u8;
12940 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
12941 }
12942 DbValue::SmallintUnsigned(e) => {
12943 *base.add(0).cast::<u8>() = (7i32) as u8;
12944 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
12945 }
12946 DbValue::MediumintUnsigned(e) => {
12947 *base.add(0).cast::<u8>() = (8i32) as u8;
12948 *base.add(8).cast::<i32>() = _rt::as_i32(e);
12949 }
12950 DbValue::IntUnsigned(e) => {
12951 *base.add(0).cast::<u8>() = (9i32) as u8;
12952 *base.add(8).cast::<i32>() = _rt::as_i32(e);
12953 }
12954 DbValue::BigintUnsigned(e) => {
12955 *base.add(0).cast::<u8>() = (10i32) as u8;
12956 *base.add(8).cast::<i64>() = _rt::as_i64(e);
12957 }
12958 DbValue::Float(e) => {
12959 *base.add(0).cast::<u8>() = (11i32) as u8;
12960 *base.add(8).cast::<f32>() = _rt::as_f32(e);
12961 }
12962 DbValue::Double(e) => {
12963 *base.add(0).cast::<u8>() = (12i32) as u8;
12964 *base.add(8).cast::<f64>() = _rt::as_f64(e);
12965 }
12966 DbValue::Decimal(e) => {
12967 *base.add(0).cast::<u8>() = (13i32) as u8;
12968 let vec1 = e;
12969 let ptr1 = vec1.as_ptr().cast::<u8>();
12970 let len1 = vec1.len();
12971 *base.add(12).cast::<usize>() = len1;
12972 *base.add(8).cast::<*mut u8>() = ptr1.cast_mut();
12973 }
12974 DbValue::Date(e) => {
12975 *base.add(0).cast::<u8>() = (14i32) as u8;
12976 let super::super::super::golem::rdbms::types::Date {
12977 year: year2,
12978 month: month2,
12979 day: day2,
12980 } = e;
12981 *base.add(8).cast::<i32>() = _rt::as_i32(year2);
12982 *base.add(12).cast::<u8>() = (_rt::as_i32(month2)) as u8;
12983 *base.add(13).cast::<u8>() = (_rt::as_i32(day2)) as u8;
12984 }
12985 DbValue::Datetime(e) => {
12986 *base.add(0).cast::<u8>() = (15i32) as u8;
12987 let super::super::super::golem::rdbms::types::Timestamp {
12988 date: date3,
12989 time: time3,
12990 } = e;
12991 let super::super::super::golem::rdbms::types::Date {
12992 year: year4,
12993 month: month4,
12994 day: day4,
12995 } = date3;
12996 *base.add(8).cast::<i32>() = _rt::as_i32(year4);
12997 *base.add(12).cast::<u8>() = (_rt::as_i32(month4)) as u8;
12998 *base.add(13).cast::<u8>() = (_rt::as_i32(day4)) as u8;
12999 let super::super::super::golem::rdbms::types::Time {
13000 hour: hour5,
13001 minute: minute5,
13002 second: second5,
13003 nanosecond: nanosecond5,
13004 } = time3;
13005 *base.add(16).cast::<u8>() = (_rt::as_i32(hour5)) as u8;
13006 *base.add(17).cast::<u8>() = (_rt::as_i32(minute5)) as u8;
13007 *base.add(18).cast::<u8>() = (_rt::as_i32(second5)) as u8;
13008 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond5);
13009 }
13010 DbValue::Timestamp(e) => {
13011 *base.add(0).cast::<u8>() = (16i32) as u8;
13012 let super::super::super::golem::rdbms::types::Timestamp {
13013 date: date6,
13014 time: time6,
13015 } = e;
13016 let super::super::super::golem::rdbms::types::Date {
13017 year: year7,
13018 month: month7,
13019 day: day7,
13020 } = date6;
13021 *base.add(8).cast::<i32>() = _rt::as_i32(year7);
13022 *base.add(12).cast::<u8>() = (_rt::as_i32(month7)) as u8;
13023 *base.add(13).cast::<u8>() = (_rt::as_i32(day7)) as u8;
13024 let super::super::super::golem::rdbms::types::Time {
13025 hour: hour8,
13026 minute: minute8,
13027 second: second8,
13028 nanosecond: nanosecond8,
13029 } = time6;
13030 *base.add(16).cast::<u8>() = (_rt::as_i32(hour8)) as u8;
13031 *base.add(17).cast::<u8>() = (_rt::as_i32(minute8)) as u8;
13032 *base.add(18).cast::<u8>() = (_rt::as_i32(second8)) as u8;
13033 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond8);
13034 }
13035 DbValue::Time(e) => {
13036 *base.add(0).cast::<u8>() = (17i32) as u8;
13037 let super::super::super::golem::rdbms::types::Time {
13038 hour: hour9,
13039 minute: minute9,
13040 second: second9,
13041 nanosecond: nanosecond9,
13042 } = e;
13043 *base.add(8).cast::<u8>() = (_rt::as_i32(hour9)) as u8;
13044 *base.add(9).cast::<u8>() = (_rt::as_i32(minute9)) as u8;
13045 *base.add(10).cast::<u8>() = (_rt::as_i32(second9)) as u8;
13046 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond9);
13047 }
13048 DbValue::Year(e) => {
13049 *base.add(0).cast::<u8>() = (18i32) as u8;
13050 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
13051 }
13052 DbValue::Fixchar(e) => {
13053 *base.add(0).cast::<u8>() = (19i32) as u8;
13054 let vec10 = e;
13055 let ptr10 = vec10.as_ptr().cast::<u8>();
13056 let len10 = vec10.len();
13057 *base.add(12).cast::<usize>() = len10;
13058 *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
13059 }
13060 DbValue::Varchar(e) => {
13061 *base.add(0).cast::<u8>() = (20i32) as u8;
13062 let vec11 = e;
13063 let ptr11 = vec11.as_ptr().cast::<u8>();
13064 let len11 = vec11.len();
13065 *base.add(12).cast::<usize>() = len11;
13066 *base.add(8).cast::<*mut u8>() = ptr11.cast_mut();
13067 }
13068 DbValue::Tinytext(e) => {
13069 *base.add(0).cast::<u8>() = (21i32) as u8;
13070 let vec12 = e;
13071 let ptr12 = vec12.as_ptr().cast::<u8>();
13072 let len12 = vec12.len();
13073 *base.add(12).cast::<usize>() = len12;
13074 *base.add(8).cast::<*mut u8>() = ptr12.cast_mut();
13075 }
13076 DbValue::Text(e) => {
13077 *base.add(0).cast::<u8>() = (22i32) as u8;
13078 let vec13 = e;
13079 let ptr13 = vec13.as_ptr().cast::<u8>();
13080 let len13 = vec13.len();
13081 *base.add(12).cast::<usize>() = len13;
13082 *base.add(8).cast::<*mut u8>() = ptr13.cast_mut();
13083 }
13084 DbValue::Mediumtext(e) => {
13085 *base.add(0).cast::<u8>() = (23i32) as u8;
13086 let vec14 = e;
13087 let ptr14 = vec14.as_ptr().cast::<u8>();
13088 let len14 = vec14.len();
13089 *base.add(12).cast::<usize>() = len14;
13090 *base.add(8).cast::<*mut u8>() = ptr14.cast_mut();
13091 }
13092 DbValue::Longtext(e) => {
13093 *base.add(0).cast::<u8>() = (24i32) as u8;
13094 let vec15 = e;
13095 let ptr15 = vec15.as_ptr().cast::<u8>();
13096 let len15 = vec15.len();
13097 *base.add(12).cast::<usize>() = len15;
13098 *base.add(8).cast::<*mut u8>() = ptr15.cast_mut();
13099 }
13100 DbValue::Binary(e) => {
13101 *base.add(0).cast::<u8>() = (25i32) as u8;
13102 let vec16 = e;
13103 let ptr16 = vec16.as_ptr().cast::<u8>();
13104 let len16 = vec16.len();
13105 *base.add(12).cast::<usize>() = len16;
13106 *base.add(8).cast::<*mut u8>() = ptr16.cast_mut();
13107 }
13108 DbValue::Varbinary(e) => {
13109 *base.add(0).cast::<u8>() = (26i32) as u8;
13110 let vec17 = e;
13111 let ptr17 = vec17.as_ptr().cast::<u8>();
13112 let len17 = vec17.len();
13113 *base.add(12).cast::<usize>() = len17;
13114 *base.add(8).cast::<*mut u8>() = ptr17.cast_mut();
13115 }
13116 DbValue::Tinyblob(e) => {
13117 *base.add(0).cast::<u8>() = (27i32) as u8;
13118 let vec18 = e;
13119 let ptr18 = vec18.as_ptr().cast::<u8>();
13120 let len18 = vec18.len();
13121 *base.add(12).cast::<usize>() = len18;
13122 *base.add(8).cast::<*mut u8>() = ptr18.cast_mut();
13123 }
13124 DbValue::Blob(e) => {
13125 *base.add(0).cast::<u8>() = (28i32) as u8;
13126 let vec19 = e;
13127 let ptr19 = vec19.as_ptr().cast::<u8>();
13128 let len19 = vec19.len();
13129 *base.add(12).cast::<usize>() = len19;
13130 *base.add(8).cast::<*mut u8>() = ptr19.cast_mut();
13131 }
13132 DbValue::Mediumblob(e) => {
13133 *base.add(0).cast::<u8>() = (29i32) as u8;
13134 let vec20 = e;
13135 let ptr20 = vec20.as_ptr().cast::<u8>();
13136 let len20 = vec20.len();
13137 *base.add(12).cast::<usize>() = len20;
13138 *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
13139 }
13140 DbValue::Longblob(e) => {
13141 *base.add(0).cast::<u8>() = (30i32) as u8;
13142 let vec21 = e;
13143 let ptr21 = vec21.as_ptr().cast::<u8>();
13144 let len21 = vec21.len();
13145 *base.add(12).cast::<usize>() = len21;
13146 *base.add(8).cast::<*mut u8>() = ptr21.cast_mut();
13147 }
13148 DbValue::Enumeration(e) => {
13149 *base.add(0).cast::<u8>() = (31i32) as u8;
13150 let vec22 = e;
13151 let ptr22 = vec22.as_ptr().cast::<u8>();
13152 let len22 = vec22.len();
13153 *base.add(12).cast::<usize>() = len22;
13154 *base.add(8).cast::<*mut u8>() = ptr22.cast_mut();
13155 }
13156 DbValue::Set(e) => {
13157 *base.add(0).cast::<u8>() = (32i32) as u8;
13158 let vec23 = e;
13159 let ptr23 = vec23.as_ptr().cast::<u8>();
13160 let len23 = vec23.len();
13161 *base.add(12).cast::<usize>() = len23;
13162 *base.add(8).cast::<*mut u8>() = ptr23.cast_mut();
13163 }
13164 DbValue::Bit(e) => {
13165 *base.add(0).cast::<u8>() = (33i32) as u8;
13166 let vec24 = e;
13167 let len24 = vec24.len();
13168 let layout24 = _rt::alloc::Layout::from_size_align_unchecked(
13169 vec24.len() * 1,
13170 1,
13171 );
13172 let result24 = if layout24.size() != 0 {
13173 let ptr = _rt::alloc::alloc(layout24).cast::<u8>();
13174 if ptr.is_null() {
13175 _rt::alloc::handle_alloc_error(layout24);
13176 }
13177 ptr
13178 } else {
13179 ::core::ptr::null_mut()
13180 };
13181 for (i, e) in vec24.into_iter().enumerate() {
13182 let base = result24.add(i * 1);
13183 {
13184 *base.add(0).cast::<u8>() = (match e {
13185 true => 1,
13186 false => 0,
13187 }) as u8;
13188 }
13189 }
13190 *base.add(12).cast::<usize>() = len24;
13191 *base.add(8).cast::<*mut u8>() = result24;
13192 cleanup_list.extend_from_slice(&[(result24, layout24)]);
13193 }
13194 DbValue::Json(e) => {
13195 *base.add(0).cast::<u8>() = (34i32) as u8;
13196 let vec25 = e;
13197 let ptr25 = vec25.as_ptr().cast::<u8>();
13198 let len25 = vec25.len();
13199 *base.add(12).cast::<usize>() = len25;
13200 *base.add(8).cast::<*mut u8>() = ptr25.cast_mut();
13201 }
13202 DbValue::Null => {
13203 *base.add(0).cast::<u8>() = (35i32) as u8;
13204 }
13205 }
13206 }
13207 }
13208 let ptr27 = ret_area.0.as_mut_ptr().cast::<u8>();
13209 #[cfg(target_arch = "wasm32")]
13210 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
13211 extern "C" {
13212 #[link_name = "[method]db-connection.query"]
13213 fn wit_import(
13214 _: i32,
13215 _: *mut u8,
13216 _: usize,
13217 _: *mut u8,
13218 _: usize,
13219 _: *mut u8,
13220 );
13221 }
13222 #[cfg(not(target_arch = "wasm32"))]
13223 fn wit_import(
13224 _: i32,
13225 _: *mut u8,
13226 _: usize,
13227 _: *mut u8,
13228 _: usize,
13229 _: *mut u8,
13230 ) {
13231 unreachable!()
13232 }
13233 wit_import(
13234 (self).handle() as i32,
13235 ptr0.cast_mut(),
13236 len0,
13237 result26,
13238 len26,
13239 ptr27,
13240 );
13241 let l28 = i32::from(*ptr27.add(0).cast::<u8>());
13242 if layout26.size() != 0 {
13243 _rt::alloc::dealloc(result26.cast(), layout26);
13244 }
13245 for (ptr, layout) in cleanup_list {
13246 if layout.size() != 0 {
13247 _rt::alloc::dealloc(ptr.cast(), layout);
13248 }
13249 }
13250 match l28 {
13251 0 => {
13252 let e = {
13253 let l29 = *ptr27.add(4).cast::<*mut u8>();
13254 let l30 = *ptr27.add(8).cast::<usize>();
13255 let base40 = l29;
13256 let len40 = l30;
13257 let mut result40 = _rt::Vec::with_capacity(len40);
13258 for i in 0..len40 {
13259 let base = base40.add(i * 32);
13260 let e40 = {
13261 let l31 = *base.add(0).cast::<i64>();
13262 let l32 = *base.add(8).cast::<*mut u8>();
13263 let l33 = *base.add(12).cast::<usize>();
13264 let len34 = l33;
13265 let bytes34 = _rt::Vec::from_raw_parts(
13266 l32.cast(),
13267 len34,
13268 len34,
13269 );
13270 let l35 = i32::from(*base.add(16).cast::<u8>());
13271 let v36 = match l35 {
13272 0 => DbColumnType::Boolean,
13273 1 => DbColumnType::Tinyint,
13274 2 => DbColumnType::Smallint,
13275 3 => DbColumnType::Mediumint,
13276 4 => DbColumnType::Int,
13277 5 => DbColumnType::Bigint,
13278 6 => DbColumnType::TinyintUnsigned,
13279 7 => DbColumnType::SmallintUnsigned,
13280 8 => DbColumnType::MediumintUnsigned,
13281 9 => DbColumnType::IntUnsigned,
13282 10 => DbColumnType::BigintUnsigned,
13283 11 => DbColumnType::Float,
13284 12 => DbColumnType::Double,
13285 13 => DbColumnType::Decimal,
13286 14 => DbColumnType::Date,
13287 15 => DbColumnType::Datetime,
13288 16 => DbColumnType::Timestamp,
13289 17 => DbColumnType::Time,
13290 18 => DbColumnType::Year,
13291 19 => DbColumnType::Fixchar,
13292 20 => DbColumnType::Varchar,
13293 21 => DbColumnType::Tinytext,
13294 22 => DbColumnType::Text,
13295 23 => DbColumnType::Mediumtext,
13296 24 => DbColumnType::Longtext,
13297 25 => DbColumnType::Binary,
13298 26 => DbColumnType::Varbinary,
13299 27 => DbColumnType::Tinyblob,
13300 28 => DbColumnType::Blob,
13301 29 => DbColumnType::Mediumblob,
13302 30 => DbColumnType::Longblob,
13303 31 => DbColumnType::Enumeration,
13304 32 => DbColumnType::Set,
13305 33 => DbColumnType::Bit,
13306 n => {
13307 debug_assert_eq!(n, 34, "invalid enum discriminant");
13308 DbColumnType::Json
13309 }
13310 };
13311 let l37 = *base.add(20).cast::<*mut u8>();
13312 let l38 = *base.add(24).cast::<usize>();
13313 let len39 = l38;
13314 let bytes39 = _rt::Vec::from_raw_parts(
13315 l37.cast(),
13316 len39,
13317 len39,
13318 );
13319 DbColumn {
13320 ordinal: l31 as u64,
13321 name: _rt::string_lift(bytes34),
13322 db_type: v36,
13323 db_type_name: _rt::string_lift(bytes39),
13324 }
13325 };
13326 result40.push(e40);
13327 }
13328 _rt::cabi_dealloc(base40, len40 * 32, 8);
13329 let l41 = *ptr27.add(12).cast::<*mut u8>();
13330 let l42 = *ptr27.add(16).cast::<usize>();
13331 let base135 = l41;
13332 let len135 = l42;
13333 let mut result135 = _rt::Vec::with_capacity(len135);
13334 for i in 0..len135 {
13335 let base = base135.add(i * 8);
13336 let e135 = {
13337 let l43 = *base.add(0).cast::<*mut u8>();
13338 let l44 = *base.add(4).cast::<usize>();
13339 let base134 = l43;
13340 let len134 = l44;
13341 let mut result134 = _rt::Vec::with_capacity(len134);
13342 for i in 0..len134 {
13343 let base = base134.add(i * 24);
13344 let e134 = {
13345 let l45 = i32::from(*base.add(0).cast::<u8>());
13346 let v133 = match l45 {
13347 0 => {
13348 let e133 = {
13349 let l46 = i32::from(*base.add(8).cast::<u8>());
13350 _rt::bool_lift(l46 as u8)
13351 };
13352 DbValue::Boolean(e133)
13353 }
13354 1 => {
13355 let e133 = {
13356 let l47 = i32::from(*base.add(8).cast::<i8>());
13357 l47 as i8
13358 };
13359 DbValue::Tinyint(e133)
13360 }
13361 2 => {
13362 let e133 = {
13363 let l48 = i32::from(*base.add(8).cast::<i16>());
13364 l48 as i16
13365 };
13366 DbValue::Smallint(e133)
13367 }
13368 3 => {
13369 let e133 = {
13370 let l49 = *base.add(8).cast::<i32>();
13371 l49
13372 };
13373 DbValue::Mediumint(e133)
13374 }
13375 4 => {
13376 let e133 = {
13377 let l50 = *base.add(8).cast::<i32>();
13378 l50
13379 };
13380 DbValue::Int(e133)
13381 }
13382 5 => {
13383 let e133 = {
13384 let l51 = *base.add(8).cast::<i64>();
13385 l51
13386 };
13387 DbValue::Bigint(e133)
13388 }
13389 6 => {
13390 let e133 = {
13391 let l52 = i32::from(*base.add(8).cast::<u8>());
13392 l52 as u8
13393 };
13394 DbValue::TinyintUnsigned(e133)
13395 }
13396 7 => {
13397 let e133 = {
13398 let l53 = i32::from(*base.add(8).cast::<u16>());
13399 l53 as u16
13400 };
13401 DbValue::SmallintUnsigned(e133)
13402 }
13403 8 => {
13404 let e133 = {
13405 let l54 = *base.add(8).cast::<i32>();
13406 l54 as u32
13407 };
13408 DbValue::MediumintUnsigned(e133)
13409 }
13410 9 => {
13411 let e133 = {
13412 let l55 = *base.add(8).cast::<i32>();
13413 l55 as u32
13414 };
13415 DbValue::IntUnsigned(e133)
13416 }
13417 10 => {
13418 let e133 = {
13419 let l56 = *base.add(8).cast::<i64>();
13420 l56 as u64
13421 };
13422 DbValue::BigintUnsigned(e133)
13423 }
13424 11 => {
13425 let e133 = {
13426 let l57 = *base.add(8).cast::<f32>();
13427 l57
13428 };
13429 DbValue::Float(e133)
13430 }
13431 12 => {
13432 let e133 = {
13433 let l58 = *base.add(8).cast::<f64>();
13434 l58
13435 };
13436 DbValue::Double(e133)
13437 }
13438 13 => {
13439 let e133 = {
13440 let l59 = *base.add(8).cast::<*mut u8>();
13441 let l60 = *base.add(12).cast::<usize>();
13442 let len61 = l60;
13443 let bytes61 = _rt::Vec::from_raw_parts(
13444 l59.cast(),
13445 len61,
13446 len61,
13447 );
13448 _rt::string_lift(bytes61)
13449 };
13450 DbValue::Decimal(e133)
13451 }
13452 14 => {
13453 let e133 = {
13454 let l62 = *base.add(8).cast::<i32>();
13455 let l63 = i32::from(*base.add(12).cast::<u8>());
13456 let l64 = i32::from(*base.add(13).cast::<u8>());
13457 super::super::super::golem::rdbms::types::Date {
13458 year: l62,
13459 month: l63 as u8,
13460 day: l64 as u8,
13461 }
13462 };
13463 DbValue::Date(e133)
13464 }
13465 15 => {
13466 let e133 = {
13467 let l65 = *base.add(8).cast::<i32>();
13468 let l66 = i32::from(*base.add(12).cast::<u8>());
13469 let l67 = i32::from(*base.add(13).cast::<u8>());
13470 let l68 = i32::from(*base.add(16).cast::<u8>());
13471 let l69 = i32::from(*base.add(17).cast::<u8>());
13472 let l70 = i32::from(*base.add(18).cast::<u8>());
13473 let l71 = *base.add(20).cast::<i32>();
13474 super::super::super::golem::rdbms::types::Timestamp {
13475 date: super::super::super::golem::rdbms::types::Date {
13476 year: l65,
13477 month: l66 as u8,
13478 day: l67 as u8,
13479 },
13480 time: super::super::super::golem::rdbms::types::Time {
13481 hour: l68 as u8,
13482 minute: l69 as u8,
13483 second: l70 as u8,
13484 nanosecond: l71 as u32,
13485 },
13486 }
13487 };
13488 DbValue::Datetime(e133)
13489 }
13490 16 => {
13491 let e133 = {
13492 let l72 = *base.add(8).cast::<i32>();
13493 let l73 = i32::from(*base.add(12).cast::<u8>());
13494 let l74 = i32::from(*base.add(13).cast::<u8>());
13495 let l75 = i32::from(*base.add(16).cast::<u8>());
13496 let l76 = i32::from(*base.add(17).cast::<u8>());
13497 let l77 = i32::from(*base.add(18).cast::<u8>());
13498 let l78 = *base.add(20).cast::<i32>();
13499 super::super::super::golem::rdbms::types::Timestamp {
13500 date: super::super::super::golem::rdbms::types::Date {
13501 year: l72,
13502 month: l73 as u8,
13503 day: l74 as u8,
13504 },
13505 time: super::super::super::golem::rdbms::types::Time {
13506 hour: l75 as u8,
13507 minute: l76 as u8,
13508 second: l77 as u8,
13509 nanosecond: l78 as u32,
13510 },
13511 }
13512 };
13513 DbValue::Timestamp(e133)
13514 }
13515 17 => {
13516 let e133 = {
13517 let l79 = i32::from(*base.add(8).cast::<u8>());
13518 let l80 = i32::from(*base.add(9).cast::<u8>());
13519 let l81 = i32::from(*base.add(10).cast::<u8>());
13520 let l82 = *base.add(12).cast::<i32>();
13521 super::super::super::golem::rdbms::types::Time {
13522 hour: l79 as u8,
13523 minute: l80 as u8,
13524 second: l81 as u8,
13525 nanosecond: l82 as u32,
13526 }
13527 };
13528 DbValue::Time(e133)
13529 }
13530 18 => {
13531 let e133 = {
13532 let l83 = i32::from(*base.add(8).cast::<u16>());
13533 l83 as u16
13534 };
13535 DbValue::Year(e133)
13536 }
13537 19 => {
13538 let e133 = {
13539 let l84 = *base.add(8).cast::<*mut u8>();
13540 let l85 = *base.add(12).cast::<usize>();
13541 let len86 = l85;
13542 let bytes86 = _rt::Vec::from_raw_parts(
13543 l84.cast(),
13544 len86,
13545 len86,
13546 );
13547 _rt::string_lift(bytes86)
13548 };
13549 DbValue::Fixchar(e133)
13550 }
13551 20 => {
13552 let e133 = {
13553 let l87 = *base.add(8).cast::<*mut u8>();
13554 let l88 = *base.add(12).cast::<usize>();
13555 let len89 = l88;
13556 let bytes89 = _rt::Vec::from_raw_parts(
13557 l87.cast(),
13558 len89,
13559 len89,
13560 );
13561 _rt::string_lift(bytes89)
13562 };
13563 DbValue::Varchar(e133)
13564 }
13565 21 => {
13566 let e133 = {
13567 let l90 = *base.add(8).cast::<*mut u8>();
13568 let l91 = *base.add(12).cast::<usize>();
13569 let len92 = l91;
13570 let bytes92 = _rt::Vec::from_raw_parts(
13571 l90.cast(),
13572 len92,
13573 len92,
13574 );
13575 _rt::string_lift(bytes92)
13576 };
13577 DbValue::Tinytext(e133)
13578 }
13579 22 => {
13580 let e133 = {
13581 let l93 = *base.add(8).cast::<*mut u8>();
13582 let l94 = *base.add(12).cast::<usize>();
13583 let len95 = l94;
13584 let bytes95 = _rt::Vec::from_raw_parts(
13585 l93.cast(),
13586 len95,
13587 len95,
13588 );
13589 _rt::string_lift(bytes95)
13590 };
13591 DbValue::Text(e133)
13592 }
13593 23 => {
13594 let e133 = {
13595 let l96 = *base.add(8).cast::<*mut u8>();
13596 let l97 = *base.add(12).cast::<usize>();
13597 let len98 = l97;
13598 let bytes98 = _rt::Vec::from_raw_parts(
13599 l96.cast(),
13600 len98,
13601 len98,
13602 );
13603 _rt::string_lift(bytes98)
13604 };
13605 DbValue::Mediumtext(e133)
13606 }
13607 24 => {
13608 let e133 = {
13609 let l99 = *base.add(8).cast::<*mut u8>();
13610 let l100 = *base.add(12).cast::<usize>();
13611 let len101 = l100;
13612 let bytes101 = _rt::Vec::from_raw_parts(
13613 l99.cast(),
13614 len101,
13615 len101,
13616 );
13617 _rt::string_lift(bytes101)
13618 };
13619 DbValue::Longtext(e133)
13620 }
13621 25 => {
13622 let e133 = {
13623 let l102 = *base.add(8).cast::<*mut u8>();
13624 let l103 = *base.add(12).cast::<usize>();
13625 let len104 = l103;
13626 _rt::Vec::from_raw_parts(l102.cast(), len104, len104)
13627 };
13628 DbValue::Binary(e133)
13629 }
13630 26 => {
13631 let e133 = {
13632 let l105 = *base.add(8).cast::<*mut u8>();
13633 let l106 = *base.add(12).cast::<usize>();
13634 let len107 = l106;
13635 _rt::Vec::from_raw_parts(l105.cast(), len107, len107)
13636 };
13637 DbValue::Varbinary(e133)
13638 }
13639 27 => {
13640 let e133 = {
13641 let l108 = *base.add(8).cast::<*mut u8>();
13642 let l109 = *base.add(12).cast::<usize>();
13643 let len110 = l109;
13644 _rt::Vec::from_raw_parts(l108.cast(), len110, len110)
13645 };
13646 DbValue::Tinyblob(e133)
13647 }
13648 28 => {
13649 let e133 = {
13650 let l111 = *base.add(8).cast::<*mut u8>();
13651 let l112 = *base.add(12).cast::<usize>();
13652 let len113 = l112;
13653 _rt::Vec::from_raw_parts(l111.cast(), len113, len113)
13654 };
13655 DbValue::Blob(e133)
13656 }
13657 29 => {
13658 let e133 = {
13659 let l114 = *base.add(8).cast::<*mut u8>();
13660 let l115 = *base.add(12).cast::<usize>();
13661 let len116 = l115;
13662 _rt::Vec::from_raw_parts(l114.cast(), len116, len116)
13663 };
13664 DbValue::Mediumblob(e133)
13665 }
13666 30 => {
13667 let e133 = {
13668 let l117 = *base.add(8).cast::<*mut u8>();
13669 let l118 = *base.add(12).cast::<usize>();
13670 let len119 = l118;
13671 _rt::Vec::from_raw_parts(l117.cast(), len119, len119)
13672 };
13673 DbValue::Longblob(e133)
13674 }
13675 31 => {
13676 let e133 = {
13677 let l120 = *base.add(8).cast::<*mut u8>();
13678 let l121 = *base.add(12).cast::<usize>();
13679 let len122 = l121;
13680 let bytes122 = _rt::Vec::from_raw_parts(
13681 l120.cast(),
13682 len122,
13683 len122,
13684 );
13685 _rt::string_lift(bytes122)
13686 };
13687 DbValue::Enumeration(e133)
13688 }
13689 32 => {
13690 let e133 = {
13691 let l123 = *base.add(8).cast::<*mut u8>();
13692 let l124 = *base.add(12).cast::<usize>();
13693 let len125 = l124;
13694 let bytes125 = _rt::Vec::from_raw_parts(
13695 l123.cast(),
13696 len125,
13697 len125,
13698 );
13699 _rt::string_lift(bytes125)
13700 };
13701 DbValue::Set(e133)
13702 }
13703 33 => {
13704 let e133 = {
13705 let l126 = *base.add(8).cast::<*mut u8>();
13706 let l127 = *base.add(12).cast::<usize>();
13707 let base129 = l126;
13708 let len129 = l127;
13709 let mut result129 = _rt::Vec::with_capacity(len129);
13710 for i in 0..len129 {
13711 let base = base129.add(i * 1);
13712 let e129 = {
13713 let l128 = i32::from(*base.add(0).cast::<u8>());
13714 _rt::bool_lift(l128 as u8)
13715 };
13716 result129.push(e129);
13717 }
13718 _rt::cabi_dealloc(base129, len129 * 1, 1);
13719 result129
13720 };
13721 DbValue::Bit(e133)
13722 }
13723 34 => {
13724 let e133 = {
13725 let l130 = *base.add(8).cast::<*mut u8>();
13726 let l131 = *base.add(12).cast::<usize>();
13727 let len132 = l131;
13728 let bytes132 = _rt::Vec::from_raw_parts(
13729 l130.cast(),
13730 len132,
13731 len132,
13732 );
13733 _rt::string_lift(bytes132)
13734 };
13735 DbValue::Json(e133)
13736 }
13737 n => {
13738 debug_assert_eq!(n, 35, "invalid enum discriminant");
13739 DbValue::Null
13740 }
13741 };
13742 v133
13743 };
13744 result134.push(e134);
13745 }
13746 _rt::cabi_dealloc(base134, len134 * 24, 8);
13747 DbRow { values: result134 }
13748 };
13749 result135.push(e135);
13750 }
13751 _rt::cabi_dealloc(base135, len135 * 8, 4);
13752 DbResult {
13753 columns: result40,
13754 rows: result135,
13755 }
13756 };
13757 Ok(e)
13758 }
13759 1 => {
13760 let e = {
13761 let l136 = i32::from(*ptr27.add(4).cast::<u8>());
13762 let v152 = match l136 {
13763 0 => {
13764 let e152 = {
13765 let l137 = *ptr27.add(8).cast::<*mut u8>();
13766 let l138 = *ptr27.add(12).cast::<usize>();
13767 let len139 = l138;
13768 let bytes139 = _rt::Vec::from_raw_parts(
13769 l137.cast(),
13770 len139,
13771 len139,
13772 );
13773 _rt::string_lift(bytes139)
13774 };
13775 Error::ConnectionFailure(e152)
13776 }
13777 1 => {
13778 let e152 = {
13779 let l140 = *ptr27.add(8).cast::<*mut u8>();
13780 let l141 = *ptr27.add(12).cast::<usize>();
13781 let len142 = l141;
13782 let bytes142 = _rt::Vec::from_raw_parts(
13783 l140.cast(),
13784 len142,
13785 len142,
13786 );
13787 _rt::string_lift(bytes142)
13788 };
13789 Error::QueryParameterFailure(e152)
13790 }
13791 2 => {
13792 let e152 = {
13793 let l143 = *ptr27.add(8).cast::<*mut u8>();
13794 let l144 = *ptr27.add(12).cast::<usize>();
13795 let len145 = l144;
13796 let bytes145 = _rt::Vec::from_raw_parts(
13797 l143.cast(),
13798 len145,
13799 len145,
13800 );
13801 _rt::string_lift(bytes145)
13802 };
13803 Error::QueryExecutionFailure(e152)
13804 }
13805 3 => {
13806 let e152 = {
13807 let l146 = *ptr27.add(8).cast::<*mut u8>();
13808 let l147 = *ptr27.add(12).cast::<usize>();
13809 let len148 = l147;
13810 let bytes148 = _rt::Vec::from_raw_parts(
13811 l146.cast(),
13812 len148,
13813 len148,
13814 );
13815 _rt::string_lift(bytes148)
13816 };
13817 Error::QueryResponseFailure(e152)
13818 }
13819 n => {
13820 debug_assert_eq!(n, 4, "invalid enum discriminant");
13821 let e152 = {
13822 let l149 = *ptr27.add(8).cast::<*mut u8>();
13823 let l150 = *ptr27.add(12).cast::<usize>();
13824 let len151 = l150;
13825 let bytes151 = _rt::Vec::from_raw_parts(
13826 l149.cast(),
13827 len151,
13828 len151,
13829 );
13830 _rt::string_lift(bytes151)
13831 };
13832 Error::Other(e152)
13833 }
13834 };
13835 v152
13836 };
13837 Err(e)
13838 }
13839 _ => _rt::invalid_enum_discriminant(),
13840 }
13841 }
13842 }
13843 }
13844 impl DbConnection {
13845 #[allow(unused_unsafe, clippy::all)]
13846 pub fn query_stream(
13847 &self,
13848 statement: &str,
13849 params: &[DbValue],
13850 ) -> Result<DbResultStream, Error> {
13851 unsafe {
13852 let mut cleanup_list = _rt::Vec::new();
13853 #[repr(align(4))]
13854 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
13855 let mut ret_area = RetArea(
13856 [::core::mem::MaybeUninit::uninit(); 16],
13857 );
13858 let vec0 = statement;
13859 let ptr0 = vec0.as_ptr().cast::<u8>();
13860 let len0 = vec0.len();
13861 let vec26 = params;
13862 let len26 = vec26.len();
13863 let layout26 = _rt::alloc::Layout::from_size_align_unchecked(
13864 vec26.len() * 24,
13865 8,
13866 );
13867 let result26 = if layout26.size() != 0 {
13868 let ptr = _rt::alloc::alloc(layout26).cast::<u8>();
13869 if ptr.is_null() {
13870 _rt::alloc::handle_alloc_error(layout26);
13871 }
13872 ptr
13873 } else {
13874 ::core::ptr::null_mut()
13875 };
13876 for (i, e) in vec26.into_iter().enumerate() {
13877 let base = result26.add(i * 24);
13878 {
13879 match e {
13880 DbValue::Boolean(e) => {
13881 *base.add(0).cast::<u8>() = (0i32) as u8;
13882 *base.add(8).cast::<u8>() = (match e {
13883 true => 1,
13884 false => 0,
13885 }) as u8;
13886 }
13887 DbValue::Tinyint(e) => {
13888 *base.add(0).cast::<u8>() = (1i32) as u8;
13889 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
13890 }
13891 DbValue::Smallint(e) => {
13892 *base.add(0).cast::<u8>() = (2i32) as u8;
13893 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
13894 }
13895 DbValue::Mediumint(e) => {
13896 *base.add(0).cast::<u8>() = (3i32) as u8;
13897 *base.add(8).cast::<i32>() = _rt::as_i32(e);
13898 }
13899 DbValue::Int(e) => {
13900 *base.add(0).cast::<u8>() = (4i32) as u8;
13901 *base.add(8).cast::<i32>() = _rt::as_i32(e);
13902 }
13903 DbValue::Bigint(e) => {
13904 *base.add(0).cast::<u8>() = (5i32) as u8;
13905 *base.add(8).cast::<i64>() = _rt::as_i64(e);
13906 }
13907 DbValue::TinyintUnsigned(e) => {
13908 *base.add(0).cast::<u8>() = (6i32) as u8;
13909 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
13910 }
13911 DbValue::SmallintUnsigned(e) => {
13912 *base.add(0).cast::<u8>() = (7i32) as u8;
13913 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
13914 }
13915 DbValue::MediumintUnsigned(e) => {
13916 *base.add(0).cast::<u8>() = (8i32) as u8;
13917 *base.add(8).cast::<i32>() = _rt::as_i32(e);
13918 }
13919 DbValue::IntUnsigned(e) => {
13920 *base.add(0).cast::<u8>() = (9i32) as u8;
13921 *base.add(8).cast::<i32>() = _rt::as_i32(e);
13922 }
13923 DbValue::BigintUnsigned(e) => {
13924 *base.add(0).cast::<u8>() = (10i32) as u8;
13925 *base.add(8).cast::<i64>() = _rt::as_i64(e);
13926 }
13927 DbValue::Float(e) => {
13928 *base.add(0).cast::<u8>() = (11i32) as u8;
13929 *base.add(8).cast::<f32>() = _rt::as_f32(e);
13930 }
13931 DbValue::Double(e) => {
13932 *base.add(0).cast::<u8>() = (12i32) as u8;
13933 *base.add(8).cast::<f64>() = _rt::as_f64(e);
13934 }
13935 DbValue::Decimal(e) => {
13936 *base.add(0).cast::<u8>() = (13i32) as u8;
13937 let vec1 = e;
13938 let ptr1 = vec1.as_ptr().cast::<u8>();
13939 let len1 = vec1.len();
13940 *base.add(12).cast::<usize>() = len1;
13941 *base.add(8).cast::<*mut u8>() = ptr1.cast_mut();
13942 }
13943 DbValue::Date(e) => {
13944 *base.add(0).cast::<u8>() = (14i32) as u8;
13945 let super::super::super::golem::rdbms::types::Date {
13946 year: year2,
13947 month: month2,
13948 day: day2,
13949 } = e;
13950 *base.add(8).cast::<i32>() = _rt::as_i32(year2);
13951 *base.add(12).cast::<u8>() = (_rt::as_i32(month2)) as u8;
13952 *base.add(13).cast::<u8>() = (_rt::as_i32(day2)) as u8;
13953 }
13954 DbValue::Datetime(e) => {
13955 *base.add(0).cast::<u8>() = (15i32) as u8;
13956 let super::super::super::golem::rdbms::types::Timestamp {
13957 date: date3,
13958 time: time3,
13959 } = e;
13960 let super::super::super::golem::rdbms::types::Date {
13961 year: year4,
13962 month: month4,
13963 day: day4,
13964 } = date3;
13965 *base.add(8).cast::<i32>() = _rt::as_i32(year4);
13966 *base.add(12).cast::<u8>() = (_rt::as_i32(month4)) as u8;
13967 *base.add(13).cast::<u8>() = (_rt::as_i32(day4)) as u8;
13968 let super::super::super::golem::rdbms::types::Time {
13969 hour: hour5,
13970 minute: minute5,
13971 second: second5,
13972 nanosecond: nanosecond5,
13973 } = time3;
13974 *base.add(16).cast::<u8>() = (_rt::as_i32(hour5)) as u8;
13975 *base.add(17).cast::<u8>() = (_rt::as_i32(minute5)) as u8;
13976 *base.add(18).cast::<u8>() = (_rt::as_i32(second5)) as u8;
13977 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond5);
13978 }
13979 DbValue::Timestamp(e) => {
13980 *base.add(0).cast::<u8>() = (16i32) as u8;
13981 let super::super::super::golem::rdbms::types::Timestamp {
13982 date: date6,
13983 time: time6,
13984 } = e;
13985 let super::super::super::golem::rdbms::types::Date {
13986 year: year7,
13987 month: month7,
13988 day: day7,
13989 } = date6;
13990 *base.add(8).cast::<i32>() = _rt::as_i32(year7);
13991 *base.add(12).cast::<u8>() = (_rt::as_i32(month7)) as u8;
13992 *base.add(13).cast::<u8>() = (_rt::as_i32(day7)) as u8;
13993 let super::super::super::golem::rdbms::types::Time {
13994 hour: hour8,
13995 minute: minute8,
13996 second: second8,
13997 nanosecond: nanosecond8,
13998 } = time6;
13999 *base.add(16).cast::<u8>() = (_rt::as_i32(hour8)) as u8;
14000 *base.add(17).cast::<u8>() = (_rt::as_i32(minute8)) as u8;
14001 *base.add(18).cast::<u8>() = (_rt::as_i32(second8)) as u8;
14002 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond8);
14003 }
14004 DbValue::Time(e) => {
14005 *base.add(0).cast::<u8>() = (17i32) as u8;
14006 let super::super::super::golem::rdbms::types::Time {
14007 hour: hour9,
14008 minute: minute9,
14009 second: second9,
14010 nanosecond: nanosecond9,
14011 } = e;
14012 *base.add(8).cast::<u8>() = (_rt::as_i32(hour9)) as u8;
14013 *base.add(9).cast::<u8>() = (_rt::as_i32(minute9)) as u8;
14014 *base.add(10).cast::<u8>() = (_rt::as_i32(second9)) as u8;
14015 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond9);
14016 }
14017 DbValue::Year(e) => {
14018 *base.add(0).cast::<u8>() = (18i32) as u8;
14019 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
14020 }
14021 DbValue::Fixchar(e) => {
14022 *base.add(0).cast::<u8>() = (19i32) as u8;
14023 let vec10 = e;
14024 let ptr10 = vec10.as_ptr().cast::<u8>();
14025 let len10 = vec10.len();
14026 *base.add(12).cast::<usize>() = len10;
14027 *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
14028 }
14029 DbValue::Varchar(e) => {
14030 *base.add(0).cast::<u8>() = (20i32) as u8;
14031 let vec11 = e;
14032 let ptr11 = vec11.as_ptr().cast::<u8>();
14033 let len11 = vec11.len();
14034 *base.add(12).cast::<usize>() = len11;
14035 *base.add(8).cast::<*mut u8>() = ptr11.cast_mut();
14036 }
14037 DbValue::Tinytext(e) => {
14038 *base.add(0).cast::<u8>() = (21i32) as u8;
14039 let vec12 = e;
14040 let ptr12 = vec12.as_ptr().cast::<u8>();
14041 let len12 = vec12.len();
14042 *base.add(12).cast::<usize>() = len12;
14043 *base.add(8).cast::<*mut u8>() = ptr12.cast_mut();
14044 }
14045 DbValue::Text(e) => {
14046 *base.add(0).cast::<u8>() = (22i32) as u8;
14047 let vec13 = e;
14048 let ptr13 = vec13.as_ptr().cast::<u8>();
14049 let len13 = vec13.len();
14050 *base.add(12).cast::<usize>() = len13;
14051 *base.add(8).cast::<*mut u8>() = ptr13.cast_mut();
14052 }
14053 DbValue::Mediumtext(e) => {
14054 *base.add(0).cast::<u8>() = (23i32) as u8;
14055 let vec14 = e;
14056 let ptr14 = vec14.as_ptr().cast::<u8>();
14057 let len14 = vec14.len();
14058 *base.add(12).cast::<usize>() = len14;
14059 *base.add(8).cast::<*mut u8>() = ptr14.cast_mut();
14060 }
14061 DbValue::Longtext(e) => {
14062 *base.add(0).cast::<u8>() = (24i32) as u8;
14063 let vec15 = e;
14064 let ptr15 = vec15.as_ptr().cast::<u8>();
14065 let len15 = vec15.len();
14066 *base.add(12).cast::<usize>() = len15;
14067 *base.add(8).cast::<*mut u8>() = ptr15.cast_mut();
14068 }
14069 DbValue::Binary(e) => {
14070 *base.add(0).cast::<u8>() = (25i32) as u8;
14071 let vec16 = e;
14072 let ptr16 = vec16.as_ptr().cast::<u8>();
14073 let len16 = vec16.len();
14074 *base.add(12).cast::<usize>() = len16;
14075 *base.add(8).cast::<*mut u8>() = ptr16.cast_mut();
14076 }
14077 DbValue::Varbinary(e) => {
14078 *base.add(0).cast::<u8>() = (26i32) as u8;
14079 let vec17 = e;
14080 let ptr17 = vec17.as_ptr().cast::<u8>();
14081 let len17 = vec17.len();
14082 *base.add(12).cast::<usize>() = len17;
14083 *base.add(8).cast::<*mut u8>() = ptr17.cast_mut();
14084 }
14085 DbValue::Tinyblob(e) => {
14086 *base.add(0).cast::<u8>() = (27i32) as u8;
14087 let vec18 = e;
14088 let ptr18 = vec18.as_ptr().cast::<u8>();
14089 let len18 = vec18.len();
14090 *base.add(12).cast::<usize>() = len18;
14091 *base.add(8).cast::<*mut u8>() = ptr18.cast_mut();
14092 }
14093 DbValue::Blob(e) => {
14094 *base.add(0).cast::<u8>() = (28i32) as u8;
14095 let vec19 = e;
14096 let ptr19 = vec19.as_ptr().cast::<u8>();
14097 let len19 = vec19.len();
14098 *base.add(12).cast::<usize>() = len19;
14099 *base.add(8).cast::<*mut u8>() = ptr19.cast_mut();
14100 }
14101 DbValue::Mediumblob(e) => {
14102 *base.add(0).cast::<u8>() = (29i32) as u8;
14103 let vec20 = e;
14104 let ptr20 = vec20.as_ptr().cast::<u8>();
14105 let len20 = vec20.len();
14106 *base.add(12).cast::<usize>() = len20;
14107 *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
14108 }
14109 DbValue::Longblob(e) => {
14110 *base.add(0).cast::<u8>() = (30i32) as u8;
14111 let vec21 = e;
14112 let ptr21 = vec21.as_ptr().cast::<u8>();
14113 let len21 = vec21.len();
14114 *base.add(12).cast::<usize>() = len21;
14115 *base.add(8).cast::<*mut u8>() = ptr21.cast_mut();
14116 }
14117 DbValue::Enumeration(e) => {
14118 *base.add(0).cast::<u8>() = (31i32) as u8;
14119 let vec22 = e;
14120 let ptr22 = vec22.as_ptr().cast::<u8>();
14121 let len22 = vec22.len();
14122 *base.add(12).cast::<usize>() = len22;
14123 *base.add(8).cast::<*mut u8>() = ptr22.cast_mut();
14124 }
14125 DbValue::Set(e) => {
14126 *base.add(0).cast::<u8>() = (32i32) as u8;
14127 let vec23 = e;
14128 let ptr23 = vec23.as_ptr().cast::<u8>();
14129 let len23 = vec23.len();
14130 *base.add(12).cast::<usize>() = len23;
14131 *base.add(8).cast::<*mut u8>() = ptr23.cast_mut();
14132 }
14133 DbValue::Bit(e) => {
14134 *base.add(0).cast::<u8>() = (33i32) as u8;
14135 let vec24 = e;
14136 let len24 = vec24.len();
14137 let layout24 = _rt::alloc::Layout::from_size_align_unchecked(
14138 vec24.len() * 1,
14139 1,
14140 );
14141 let result24 = if layout24.size() != 0 {
14142 let ptr = _rt::alloc::alloc(layout24).cast::<u8>();
14143 if ptr.is_null() {
14144 _rt::alloc::handle_alloc_error(layout24);
14145 }
14146 ptr
14147 } else {
14148 ::core::ptr::null_mut()
14149 };
14150 for (i, e) in vec24.into_iter().enumerate() {
14151 let base = result24.add(i * 1);
14152 {
14153 *base.add(0).cast::<u8>() = (match e {
14154 true => 1,
14155 false => 0,
14156 }) as u8;
14157 }
14158 }
14159 *base.add(12).cast::<usize>() = len24;
14160 *base.add(8).cast::<*mut u8>() = result24;
14161 cleanup_list.extend_from_slice(&[(result24, layout24)]);
14162 }
14163 DbValue::Json(e) => {
14164 *base.add(0).cast::<u8>() = (34i32) as u8;
14165 let vec25 = e;
14166 let ptr25 = vec25.as_ptr().cast::<u8>();
14167 let len25 = vec25.len();
14168 *base.add(12).cast::<usize>() = len25;
14169 *base.add(8).cast::<*mut u8>() = ptr25.cast_mut();
14170 }
14171 DbValue::Null => {
14172 *base.add(0).cast::<u8>() = (35i32) as u8;
14173 }
14174 }
14175 }
14176 }
14177 let ptr27 = ret_area.0.as_mut_ptr().cast::<u8>();
14178 #[cfg(target_arch = "wasm32")]
14179 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
14180 extern "C" {
14181 #[link_name = "[method]db-connection.query-stream"]
14182 fn wit_import(
14183 _: i32,
14184 _: *mut u8,
14185 _: usize,
14186 _: *mut u8,
14187 _: usize,
14188 _: *mut u8,
14189 );
14190 }
14191 #[cfg(not(target_arch = "wasm32"))]
14192 fn wit_import(
14193 _: i32,
14194 _: *mut u8,
14195 _: usize,
14196 _: *mut u8,
14197 _: usize,
14198 _: *mut u8,
14199 ) {
14200 unreachable!()
14201 }
14202 wit_import(
14203 (self).handle() as i32,
14204 ptr0.cast_mut(),
14205 len0,
14206 result26,
14207 len26,
14208 ptr27,
14209 );
14210 let l28 = i32::from(*ptr27.add(0).cast::<u8>());
14211 if layout26.size() != 0 {
14212 _rt::alloc::dealloc(result26.cast(), layout26);
14213 }
14214 for (ptr, layout) in cleanup_list {
14215 if layout.size() != 0 {
14216 _rt::alloc::dealloc(ptr.cast(), layout);
14217 }
14218 }
14219 match l28 {
14220 0 => {
14221 let e = {
14222 let l29 = *ptr27.add(4).cast::<i32>();
14223 DbResultStream::from_handle(l29 as u32)
14224 };
14225 Ok(e)
14226 }
14227 1 => {
14228 let e = {
14229 let l30 = i32::from(*ptr27.add(4).cast::<u8>());
14230 let v46 = match l30 {
14231 0 => {
14232 let e46 = {
14233 let l31 = *ptr27.add(8).cast::<*mut u8>();
14234 let l32 = *ptr27.add(12).cast::<usize>();
14235 let len33 = l32;
14236 let bytes33 = _rt::Vec::from_raw_parts(
14237 l31.cast(),
14238 len33,
14239 len33,
14240 );
14241 _rt::string_lift(bytes33)
14242 };
14243 Error::ConnectionFailure(e46)
14244 }
14245 1 => {
14246 let e46 = {
14247 let l34 = *ptr27.add(8).cast::<*mut u8>();
14248 let l35 = *ptr27.add(12).cast::<usize>();
14249 let len36 = l35;
14250 let bytes36 = _rt::Vec::from_raw_parts(
14251 l34.cast(),
14252 len36,
14253 len36,
14254 );
14255 _rt::string_lift(bytes36)
14256 };
14257 Error::QueryParameterFailure(e46)
14258 }
14259 2 => {
14260 let e46 = {
14261 let l37 = *ptr27.add(8).cast::<*mut u8>();
14262 let l38 = *ptr27.add(12).cast::<usize>();
14263 let len39 = l38;
14264 let bytes39 = _rt::Vec::from_raw_parts(
14265 l37.cast(),
14266 len39,
14267 len39,
14268 );
14269 _rt::string_lift(bytes39)
14270 };
14271 Error::QueryExecutionFailure(e46)
14272 }
14273 3 => {
14274 let e46 = {
14275 let l40 = *ptr27.add(8).cast::<*mut u8>();
14276 let l41 = *ptr27.add(12).cast::<usize>();
14277 let len42 = l41;
14278 let bytes42 = _rt::Vec::from_raw_parts(
14279 l40.cast(),
14280 len42,
14281 len42,
14282 );
14283 _rt::string_lift(bytes42)
14284 };
14285 Error::QueryResponseFailure(e46)
14286 }
14287 n => {
14288 debug_assert_eq!(n, 4, "invalid enum discriminant");
14289 let e46 = {
14290 let l43 = *ptr27.add(8).cast::<*mut u8>();
14291 let l44 = *ptr27.add(12).cast::<usize>();
14292 let len45 = l44;
14293 let bytes45 = _rt::Vec::from_raw_parts(
14294 l43.cast(),
14295 len45,
14296 len45,
14297 );
14298 _rt::string_lift(bytes45)
14299 };
14300 Error::Other(e46)
14301 }
14302 };
14303 v46
14304 };
14305 Err(e)
14306 }
14307 _ => _rt::invalid_enum_discriminant(),
14308 }
14309 }
14310 }
14311 }
14312 impl DbConnection {
14313 #[allow(unused_unsafe, clippy::all)]
14314 pub fn execute(
14315 &self,
14316 statement: &str,
14317 params: &[DbValue],
14318 ) -> Result<u64, Error> {
14319 unsafe {
14320 let mut cleanup_list = _rt::Vec::new();
14321 #[repr(align(8))]
14322 struct RetArea([::core::mem::MaybeUninit<u8>; 24]);
14323 let mut ret_area = RetArea(
14324 [::core::mem::MaybeUninit::uninit(); 24],
14325 );
14326 let vec0 = statement;
14327 let ptr0 = vec0.as_ptr().cast::<u8>();
14328 let len0 = vec0.len();
14329 let vec26 = params;
14330 let len26 = vec26.len();
14331 let layout26 = _rt::alloc::Layout::from_size_align_unchecked(
14332 vec26.len() * 24,
14333 8,
14334 );
14335 let result26 = if layout26.size() != 0 {
14336 let ptr = _rt::alloc::alloc(layout26).cast::<u8>();
14337 if ptr.is_null() {
14338 _rt::alloc::handle_alloc_error(layout26);
14339 }
14340 ptr
14341 } else {
14342 ::core::ptr::null_mut()
14343 };
14344 for (i, e) in vec26.into_iter().enumerate() {
14345 let base = result26.add(i * 24);
14346 {
14347 match e {
14348 DbValue::Boolean(e) => {
14349 *base.add(0).cast::<u8>() = (0i32) as u8;
14350 *base.add(8).cast::<u8>() = (match e {
14351 true => 1,
14352 false => 0,
14353 }) as u8;
14354 }
14355 DbValue::Tinyint(e) => {
14356 *base.add(0).cast::<u8>() = (1i32) as u8;
14357 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
14358 }
14359 DbValue::Smallint(e) => {
14360 *base.add(0).cast::<u8>() = (2i32) as u8;
14361 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
14362 }
14363 DbValue::Mediumint(e) => {
14364 *base.add(0).cast::<u8>() = (3i32) as u8;
14365 *base.add(8).cast::<i32>() = _rt::as_i32(e);
14366 }
14367 DbValue::Int(e) => {
14368 *base.add(0).cast::<u8>() = (4i32) as u8;
14369 *base.add(8).cast::<i32>() = _rt::as_i32(e);
14370 }
14371 DbValue::Bigint(e) => {
14372 *base.add(0).cast::<u8>() = (5i32) as u8;
14373 *base.add(8).cast::<i64>() = _rt::as_i64(e);
14374 }
14375 DbValue::TinyintUnsigned(e) => {
14376 *base.add(0).cast::<u8>() = (6i32) as u8;
14377 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
14378 }
14379 DbValue::SmallintUnsigned(e) => {
14380 *base.add(0).cast::<u8>() = (7i32) as u8;
14381 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
14382 }
14383 DbValue::MediumintUnsigned(e) => {
14384 *base.add(0).cast::<u8>() = (8i32) as u8;
14385 *base.add(8).cast::<i32>() = _rt::as_i32(e);
14386 }
14387 DbValue::IntUnsigned(e) => {
14388 *base.add(0).cast::<u8>() = (9i32) as u8;
14389 *base.add(8).cast::<i32>() = _rt::as_i32(e);
14390 }
14391 DbValue::BigintUnsigned(e) => {
14392 *base.add(0).cast::<u8>() = (10i32) as u8;
14393 *base.add(8).cast::<i64>() = _rt::as_i64(e);
14394 }
14395 DbValue::Float(e) => {
14396 *base.add(0).cast::<u8>() = (11i32) as u8;
14397 *base.add(8).cast::<f32>() = _rt::as_f32(e);
14398 }
14399 DbValue::Double(e) => {
14400 *base.add(0).cast::<u8>() = (12i32) as u8;
14401 *base.add(8).cast::<f64>() = _rt::as_f64(e);
14402 }
14403 DbValue::Decimal(e) => {
14404 *base.add(0).cast::<u8>() = (13i32) as u8;
14405 let vec1 = e;
14406 let ptr1 = vec1.as_ptr().cast::<u8>();
14407 let len1 = vec1.len();
14408 *base.add(12).cast::<usize>() = len1;
14409 *base.add(8).cast::<*mut u8>() = ptr1.cast_mut();
14410 }
14411 DbValue::Date(e) => {
14412 *base.add(0).cast::<u8>() = (14i32) as u8;
14413 let super::super::super::golem::rdbms::types::Date {
14414 year: year2,
14415 month: month2,
14416 day: day2,
14417 } = e;
14418 *base.add(8).cast::<i32>() = _rt::as_i32(year2);
14419 *base.add(12).cast::<u8>() = (_rt::as_i32(month2)) as u8;
14420 *base.add(13).cast::<u8>() = (_rt::as_i32(day2)) as u8;
14421 }
14422 DbValue::Datetime(e) => {
14423 *base.add(0).cast::<u8>() = (15i32) as u8;
14424 let super::super::super::golem::rdbms::types::Timestamp {
14425 date: date3,
14426 time: time3,
14427 } = e;
14428 let super::super::super::golem::rdbms::types::Date {
14429 year: year4,
14430 month: month4,
14431 day: day4,
14432 } = date3;
14433 *base.add(8).cast::<i32>() = _rt::as_i32(year4);
14434 *base.add(12).cast::<u8>() = (_rt::as_i32(month4)) as u8;
14435 *base.add(13).cast::<u8>() = (_rt::as_i32(day4)) as u8;
14436 let super::super::super::golem::rdbms::types::Time {
14437 hour: hour5,
14438 minute: minute5,
14439 second: second5,
14440 nanosecond: nanosecond5,
14441 } = time3;
14442 *base.add(16).cast::<u8>() = (_rt::as_i32(hour5)) as u8;
14443 *base.add(17).cast::<u8>() = (_rt::as_i32(minute5)) as u8;
14444 *base.add(18).cast::<u8>() = (_rt::as_i32(second5)) as u8;
14445 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond5);
14446 }
14447 DbValue::Timestamp(e) => {
14448 *base.add(0).cast::<u8>() = (16i32) as u8;
14449 let super::super::super::golem::rdbms::types::Timestamp {
14450 date: date6,
14451 time: time6,
14452 } = e;
14453 let super::super::super::golem::rdbms::types::Date {
14454 year: year7,
14455 month: month7,
14456 day: day7,
14457 } = date6;
14458 *base.add(8).cast::<i32>() = _rt::as_i32(year7);
14459 *base.add(12).cast::<u8>() = (_rt::as_i32(month7)) as u8;
14460 *base.add(13).cast::<u8>() = (_rt::as_i32(day7)) as u8;
14461 let super::super::super::golem::rdbms::types::Time {
14462 hour: hour8,
14463 minute: minute8,
14464 second: second8,
14465 nanosecond: nanosecond8,
14466 } = time6;
14467 *base.add(16).cast::<u8>() = (_rt::as_i32(hour8)) as u8;
14468 *base.add(17).cast::<u8>() = (_rt::as_i32(minute8)) as u8;
14469 *base.add(18).cast::<u8>() = (_rt::as_i32(second8)) as u8;
14470 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond8);
14471 }
14472 DbValue::Time(e) => {
14473 *base.add(0).cast::<u8>() = (17i32) as u8;
14474 let super::super::super::golem::rdbms::types::Time {
14475 hour: hour9,
14476 minute: minute9,
14477 second: second9,
14478 nanosecond: nanosecond9,
14479 } = e;
14480 *base.add(8).cast::<u8>() = (_rt::as_i32(hour9)) as u8;
14481 *base.add(9).cast::<u8>() = (_rt::as_i32(minute9)) as u8;
14482 *base.add(10).cast::<u8>() = (_rt::as_i32(second9)) as u8;
14483 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond9);
14484 }
14485 DbValue::Year(e) => {
14486 *base.add(0).cast::<u8>() = (18i32) as u8;
14487 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
14488 }
14489 DbValue::Fixchar(e) => {
14490 *base.add(0).cast::<u8>() = (19i32) as u8;
14491 let vec10 = e;
14492 let ptr10 = vec10.as_ptr().cast::<u8>();
14493 let len10 = vec10.len();
14494 *base.add(12).cast::<usize>() = len10;
14495 *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
14496 }
14497 DbValue::Varchar(e) => {
14498 *base.add(0).cast::<u8>() = (20i32) as u8;
14499 let vec11 = e;
14500 let ptr11 = vec11.as_ptr().cast::<u8>();
14501 let len11 = vec11.len();
14502 *base.add(12).cast::<usize>() = len11;
14503 *base.add(8).cast::<*mut u8>() = ptr11.cast_mut();
14504 }
14505 DbValue::Tinytext(e) => {
14506 *base.add(0).cast::<u8>() = (21i32) as u8;
14507 let vec12 = e;
14508 let ptr12 = vec12.as_ptr().cast::<u8>();
14509 let len12 = vec12.len();
14510 *base.add(12).cast::<usize>() = len12;
14511 *base.add(8).cast::<*mut u8>() = ptr12.cast_mut();
14512 }
14513 DbValue::Text(e) => {
14514 *base.add(0).cast::<u8>() = (22i32) as u8;
14515 let vec13 = e;
14516 let ptr13 = vec13.as_ptr().cast::<u8>();
14517 let len13 = vec13.len();
14518 *base.add(12).cast::<usize>() = len13;
14519 *base.add(8).cast::<*mut u8>() = ptr13.cast_mut();
14520 }
14521 DbValue::Mediumtext(e) => {
14522 *base.add(0).cast::<u8>() = (23i32) as u8;
14523 let vec14 = e;
14524 let ptr14 = vec14.as_ptr().cast::<u8>();
14525 let len14 = vec14.len();
14526 *base.add(12).cast::<usize>() = len14;
14527 *base.add(8).cast::<*mut u8>() = ptr14.cast_mut();
14528 }
14529 DbValue::Longtext(e) => {
14530 *base.add(0).cast::<u8>() = (24i32) as u8;
14531 let vec15 = e;
14532 let ptr15 = vec15.as_ptr().cast::<u8>();
14533 let len15 = vec15.len();
14534 *base.add(12).cast::<usize>() = len15;
14535 *base.add(8).cast::<*mut u8>() = ptr15.cast_mut();
14536 }
14537 DbValue::Binary(e) => {
14538 *base.add(0).cast::<u8>() = (25i32) as u8;
14539 let vec16 = e;
14540 let ptr16 = vec16.as_ptr().cast::<u8>();
14541 let len16 = vec16.len();
14542 *base.add(12).cast::<usize>() = len16;
14543 *base.add(8).cast::<*mut u8>() = ptr16.cast_mut();
14544 }
14545 DbValue::Varbinary(e) => {
14546 *base.add(0).cast::<u8>() = (26i32) as u8;
14547 let vec17 = e;
14548 let ptr17 = vec17.as_ptr().cast::<u8>();
14549 let len17 = vec17.len();
14550 *base.add(12).cast::<usize>() = len17;
14551 *base.add(8).cast::<*mut u8>() = ptr17.cast_mut();
14552 }
14553 DbValue::Tinyblob(e) => {
14554 *base.add(0).cast::<u8>() = (27i32) as u8;
14555 let vec18 = e;
14556 let ptr18 = vec18.as_ptr().cast::<u8>();
14557 let len18 = vec18.len();
14558 *base.add(12).cast::<usize>() = len18;
14559 *base.add(8).cast::<*mut u8>() = ptr18.cast_mut();
14560 }
14561 DbValue::Blob(e) => {
14562 *base.add(0).cast::<u8>() = (28i32) as u8;
14563 let vec19 = e;
14564 let ptr19 = vec19.as_ptr().cast::<u8>();
14565 let len19 = vec19.len();
14566 *base.add(12).cast::<usize>() = len19;
14567 *base.add(8).cast::<*mut u8>() = ptr19.cast_mut();
14568 }
14569 DbValue::Mediumblob(e) => {
14570 *base.add(0).cast::<u8>() = (29i32) as u8;
14571 let vec20 = e;
14572 let ptr20 = vec20.as_ptr().cast::<u8>();
14573 let len20 = vec20.len();
14574 *base.add(12).cast::<usize>() = len20;
14575 *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
14576 }
14577 DbValue::Longblob(e) => {
14578 *base.add(0).cast::<u8>() = (30i32) as u8;
14579 let vec21 = e;
14580 let ptr21 = vec21.as_ptr().cast::<u8>();
14581 let len21 = vec21.len();
14582 *base.add(12).cast::<usize>() = len21;
14583 *base.add(8).cast::<*mut u8>() = ptr21.cast_mut();
14584 }
14585 DbValue::Enumeration(e) => {
14586 *base.add(0).cast::<u8>() = (31i32) as u8;
14587 let vec22 = e;
14588 let ptr22 = vec22.as_ptr().cast::<u8>();
14589 let len22 = vec22.len();
14590 *base.add(12).cast::<usize>() = len22;
14591 *base.add(8).cast::<*mut u8>() = ptr22.cast_mut();
14592 }
14593 DbValue::Set(e) => {
14594 *base.add(0).cast::<u8>() = (32i32) as u8;
14595 let vec23 = e;
14596 let ptr23 = vec23.as_ptr().cast::<u8>();
14597 let len23 = vec23.len();
14598 *base.add(12).cast::<usize>() = len23;
14599 *base.add(8).cast::<*mut u8>() = ptr23.cast_mut();
14600 }
14601 DbValue::Bit(e) => {
14602 *base.add(0).cast::<u8>() = (33i32) as u8;
14603 let vec24 = e;
14604 let len24 = vec24.len();
14605 let layout24 = _rt::alloc::Layout::from_size_align_unchecked(
14606 vec24.len() * 1,
14607 1,
14608 );
14609 let result24 = if layout24.size() != 0 {
14610 let ptr = _rt::alloc::alloc(layout24).cast::<u8>();
14611 if ptr.is_null() {
14612 _rt::alloc::handle_alloc_error(layout24);
14613 }
14614 ptr
14615 } else {
14616 ::core::ptr::null_mut()
14617 };
14618 for (i, e) in vec24.into_iter().enumerate() {
14619 let base = result24.add(i * 1);
14620 {
14621 *base.add(0).cast::<u8>() = (match e {
14622 true => 1,
14623 false => 0,
14624 }) as u8;
14625 }
14626 }
14627 *base.add(12).cast::<usize>() = len24;
14628 *base.add(8).cast::<*mut u8>() = result24;
14629 cleanup_list.extend_from_slice(&[(result24, layout24)]);
14630 }
14631 DbValue::Json(e) => {
14632 *base.add(0).cast::<u8>() = (34i32) as u8;
14633 let vec25 = e;
14634 let ptr25 = vec25.as_ptr().cast::<u8>();
14635 let len25 = vec25.len();
14636 *base.add(12).cast::<usize>() = len25;
14637 *base.add(8).cast::<*mut u8>() = ptr25.cast_mut();
14638 }
14639 DbValue::Null => {
14640 *base.add(0).cast::<u8>() = (35i32) as u8;
14641 }
14642 }
14643 }
14644 }
14645 let ptr27 = ret_area.0.as_mut_ptr().cast::<u8>();
14646 #[cfg(target_arch = "wasm32")]
14647 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
14648 extern "C" {
14649 #[link_name = "[method]db-connection.execute"]
14650 fn wit_import(
14651 _: i32,
14652 _: *mut u8,
14653 _: usize,
14654 _: *mut u8,
14655 _: usize,
14656 _: *mut u8,
14657 );
14658 }
14659 #[cfg(not(target_arch = "wasm32"))]
14660 fn wit_import(
14661 _: i32,
14662 _: *mut u8,
14663 _: usize,
14664 _: *mut u8,
14665 _: usize,
14666 _: *mut u8,
14667 ) {
14668 unreachable!()
14669 }
14670 wit_import(
14671 (self).handle() as i32,
14672 ptr0.cast_mut(),
14673 len0,
14674 result26,
14675 len26,
14676 ptr27,
14677 );
14678 let l28 = i32::from(*ptr27.add(0).cast::<u8>());
14679 if layout26.size() != 0 {
14680 _rt::alloc::dealloc(result26.cast(), layout26);
14681 }
14682 for (ptr, layout) in cleanup_list {
14683 if layout.size() != 0 {
14684 _rt::alloc::dealloc(ptr.cast(), layout);
14685 }
14686 }
14687 match l28 {
14688 0 => {
14689 let e = {
14690 let l29 = *ptr27.add(8).cast::<i64>();
14691 l29 as u64
14692 };
14693 Ok(e)
14694 }
14695 1 => {
14696 let e = {
14697 let l30 = i32::from(*ptr27.add(8).cast::<u8>());
14698 let v46 = match l30 {
14699 0 => {
14700 let e46 = {
14701 let l31 = *ptr27.add(12).cast::<*mut u8>();
14702 let l32 = *ptr27.add(16).cast::<usize>();
14703 let len33 = l32;
14704 let bytes33 = _rt::Vec::from_raw_parts(
14705 l31.cast(),
14706 len33,
14707 len33,
14708 );
14709 _rt::string_lift(bytes33)
14710 };
14711 Error::ConnectionFailure(e46)
14712 }
14713 1 => {
14714 let e46 = {
14715 let l34 = *ptr27.add(12).cast::<*mut u8>();
14716 let l35 = *ptr27.add(16).cast::<usize>();
14717 let len36 = l35;
14718 let bytes36 = _rt::Vec::from_raw_parts(
14719 l34.cast(),
14720 len36,
14721 len36,
14722 );
14723 _rt::string_lift(bytes36)
14724 };
14725 Error::QueryParameterFailure(e46)
14726 }
14727 2 => {
14728 let e46 = {
14729 let l37 = *ptr27.add(12).cast::<*mut u8>();
14730 let l38 = *ptr27.add(16).cast::<usize>();
14731 let len39 = l38;
14732 let bytes39 = _rt::Vec::from_raw_parts(
14733 l37.cast(),
14734 len39,
14735 len39,
14736 );
14737 _rt::string_lift(bytes39)
14738 };
14739 Error::QueryExecutionFailure(e46)
14740 }
14741 3 => {
14742 let e46 = {
14743 let l40 = *ptr27.add(12).cast::<*mut u8>();
14744 let l41 = *ptr27.add(16).cast::<usize>();
14745 let len42 = l41;
14746 let bytes42 = _rt::Vec::from_raw_parts(
14747 l40.cast(),
14748 len42,
14749 len42,
14750 );
14751 _rt::string_lift(bytes42)
14752 };
14753 Error::QueryResponseFailure(e46)
14754 }
14755 n => {
14756 debug_assert_eq!(n, 4, "invalid enum discriminant");
14757 let e46 = {
14758 let l43 = *ptr27.add(12).cast::<*mut u8>();
14759 let l44 = *ptr27.add(16).cast::<usize>();
14760 let len45 = l44;
14761 let bytes45 = _rt::Vec::from_raw_parts(
14762 l43.cast(),
14763 len45,
14764 len45,
14765 );
14766 _rt::string_lift(bytes45)
14767 };
14768 Error::Other(e46)
14769 }
14770 };
14771 v46
14772 };
14773 Err(e)
14774 }
14775 _ => _rt::invalid_enum_discriminant(),
14776 }
14777 }
14778 }
14779 }
14780 impl DbConnection {
14781 #[allow(unused_unsafe, clippy::all)]
14782 pub fn begin_transaction(&self) -> Result<DbTransaction, Error> {
14783 unsafe {
14784 #[repr(align(4))]
14785 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
14786 let mut ret_area = RetArea(
14787 [::core::mem::MaybeUninit::uninit(); 16],
14788 );
14789 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
14790 #[cfg(target_arch = "wasm32")]
14791 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
14792 extern "C" {
14793 #[link_name = "[method]db-connection.begin-transaction"]
14794 fn wit_import(_: i32, _: *mut u8);
14795 }
14796 #[cfg(not(target_arch = "wasm32"))]
14797 fn wit_import(_: i32, _: *mut u8) {
14798 unreachable!()
14799 }
14800 wit_import((self).handle() as i32, ptr0);
14801 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
14802 match l1 {
14803 0 => {
14804 let e = {
14805 let l2 = *ptr0.add(4).cast::<i32>();
14806 DbTransaction::from_handle(l2 as u32)
14807 };
14808 Ok(e)
14809 }
14810 1 => {
14811 let e = {
14812 let l3 = i32::from(*ptr0.add(4).cast::<u8>());
14813 let v19 = match l3 {
14814 0 => {
14815 let e19 = {
14816 let l4 = *ptr0.add(8).cast::<*mut u8>();
14817 let l5 = *ptr0.add(12).cast::<usize>();
14818 let len6 = l5;
14819 let bytes6 = _rt::Vec::from_raw_parts(
14820 l4.cast(),
14821 len6,
14822 len6,
14823 );
14824 _rt::string_lift(bytes6)
14825 };
14826 Error::ConnectionFailure(e19)
14827 }
14828 1 => {
14829 let e19 = {
14830 let l7 = *ptr0.add(8).cast::<*mut u8>();
14831 let l8 = *ptr0.add(12).cast::<usize>();
14832 let len9 = l8;
14833 let bytes9 = _rt::Vec::from_raw_parts(
14834 l7.cast(),
14835 len9,
14836 len9,
14837 );
14838 _rt::string_lift(bytes9)
14839 };
14840 Error::QueryParameterFailure(e19)
14841 }
14842 2 => {
14843 let e19 = {
14844 let l10 = *ptr0.add(8).cast::<*mut u8>();
14845 let l11 = *ptr0.add(12).cast::<usize>();
14846 let len12 = l11;
14847 let bytes12 = _rt::Vec::from_raw_parts(
14848 l10.cast(),
14849 len12,
14850 len12,
14851 );
14852 _rt::string_lift(bytes12)
14853 };
14854 Error::QueryExecutionFailure(e19)
14855 }
14856 3 => {
14857 let e19 = {
14858 let l13 = *ptr0.add(8).cast::<*mut u8>();
14859 let l14 = *ptr0.add(12).cast::<usize>();
14860 let len15 = l14;
14861 let bytes15 = _rt::Vec::from_raw_parts(
14862 l13.cast(),
14863 len15,
14864 len15,
14865 );
14866 _rt::string_lift(bytes15)
14867 };
14868 Error::QueryResponseFailure(e19)
14869 }
14870 n => {
14871 debug_assert_eq!(n, 4, "invalid enum discriminant");
14872 let e19 = {
14873 let l16 = *ptr0.add(8).cast::<*mut u8>();
14874 let l17 = *ptr0.add(12).cast::<usize>();
14875 let len18 = l17;
14876 let bytes18 = _rt::Vec::from_raw_parts(
14877 l16.cast(),
14878 len18,
14879 len18,
14880 );
14881 _rt::string_lift(bytes18)
14882 };
14883 Error::Other(e19)
14884 }
14885 };
14886 v19
14887 };
14888 Err(e)
14889 }
14890 _ => _rt::invalid_enum_discriminant(),
14891 }
14892 }
14893 }
14894 }
14895 impl DbTransaction {
14896 #[allow(unused_unsafe, clippy::all)]
14897 pub fn query(
14898 &self,
14899 statement: &str,
14900 params: &[DbValue],
14901 ) -> Result<DbResult, Error> {
14902 unsafe {
14903 let mut cleanup_list = _rt::Vec::new();
14904 #[repr(align(4))]
14905 struct RetArea([::core::mem::MaybeUninit<u8>; 20]);
14906 let mut ret_area = RetArea(
14907 [::core::mem::MaybeUninit::uninit(); 20],
14908 );
14909 let vec0 = statement;
14910 let ptr0 = vec0.as_ptr().cast::<u8>();
14911 let len0 = vec0.len();
14912 let vec26 = params;
14913 let len26 = vec26.len();
14914 let layout26 = _rt::alloc::Layout::from_size_align_unchecked(
14915 vec26.len() * 24,
14916 8,
14917 );
14918 let result26 = if layout26.size() != 0 {
14919 let ptr = _rt::alloc::alloc(layout26).cast::<u8>();
14920 if ptr.is_null() {
14921 _rt::alloc::handle_alloc_error(layout26);
14922 }
14923 ptr
14924 } else {
14925 ::core::ptr::null_mut()
14926 };
14927 for (i, e) in vec26.into_iter().enumerate() {
14928 let base = result26.add(i * 24);
14929 {
14930 match e {
14931 DbValue::Boolean(e) => {
14932 *base.add(0).cast::<u8>() = (0i32) as u8;
14933 *base.add(8).cast::<u8>() = (match e {
14934 true => 1,
14935 false => 0,
14936 }) as u8;
14937 }
14938 DbValue::Tinyint(e) => {
14939 *base.add(0).cast::<u8>() = (1i32) as u8;
14940 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
14941 }
14942 DbValue::Smallint(e) => {
14943 *base.add(0).cast::<u8>() = (2i32) as u8;
14944 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
14945 }
14946 DbValue::Mediumint(e) => {
14947 *base.add(0).cast::<u8>() = (3i32) as u8;
14948 *base.add(8).cast::<i32>() = _rt::as_i32(e);
14949 }
14950 DbValue::Int(e) => {
14951 *base.add(0).cast::<u8>() = (4i32) as u8;
14952 *base.add(8).cast::<i32>() = _rt::as_i32(e);
14953 }
14954 DbValue::Bigint(e) => {
14955 *base.add(0).cast::<u8>() = (5i32) as u8;
14956 *base.add(8).cast::<i64>() = _rt::as_i64(e);
14957 }
14958 DbValue::TinyintUnsigned(e) => {
14959 *base.add(0).cast::<u8>() = (6i32) as u8;
14960 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
14961 }
14962 DbValue::SmallintUnsigned(e) => {
14963 *base.add(0).cast::<u8>() = (7i32) as u8;
14964 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
14965 }
14966 DbValue::MediumintUnsigned(e) => {
14967 *base.add(0).cast::<u8>() = (8i32) as u8;
14968 *base.add(8).cast::<i32>() = _rt::as_i32(e);
14969 }
14970 DbValue::IntUnsigned(e) => {
14971 *base.add(0).cast::<u8>() = (9i32) as u8;
14972 *base.add(8).cast::<i32>() = _rt::as_i32(e);
14973 }
14974 DbValue::BigintUnsigned(e) => {
14975 *base.add(0).cast::<u8>() = (10i32) as u8;
14976 *base.add(8).cast::<i64>() = _rt::as_i64(e);
14977 }
14978 DbValue::Float(e) => {
14979 *base.add(0).cast::<u8>() = (11i32) as u8;
14980 *base.add(8).cast::<f32>() = _rt::as_f32(e);
14981 }
14982 DbValue::Double(e) => {
14983 *base.add(0).cast::<u8>() = (12i32) as u8;
14984 *base.add(8).cast::<f64>() = _rt::as_f64(e);
14985 }
14986 DbValue::Decimal(e) => {
14987 *base.add(0).cast::<u8>() = (13i32) as u8;
14988 let vec1 = e;
14989 let ptr1 = vec1.as_ptr().cast::<u8>();
14990 let len1 = vec1.len();
14991 *base.add(12).cast::<usize>() = len1;
14992 *base.add(8).cast::<*mut u8>() = ptr1.cast_mut();
14993 }
14994 DbValue::Date(e) => {
14995 *base.add(0).cast::<u8>() = (14i32) as u8;
14996 let super::super::super::golem::rdbms::types::Date {
14997 year: year2,
14998 month: month2,
14999 day: day2,
15000 } = e;
15001 *base.add(8).cast::<i32>() = _rt::as_i32(year2);
15002 *base.add(12).cast::<u8>() = (_rt::as_i32(month2)) as u8;
15003 *base.add(13).cast::<u8>() = (_rt::as_i32(day2)) as u8;
15004 }
15005 DbValue::Datetime(e) => {
15006 *base.add(0).cast::<u8>() = (15i32) as u8;
15007 let super::super::super::golem::rdbms::types::Timestamp {
15008 date: date3,
15009 time: time3,
15010 } = e;
15011 let super::super::super::golem::rdbms::types::Date {
15012 year: year4,
15013 month: month4,
15014 day: day4,
15015 } = date3;
15016 *base.add(8).cast::<i32>() = _rt::as_i32(year4);
15017 *base.add(12).cast::<u8>() = (_rt::as_i32(month4)) as u8;
15018 *base.add(13).cast::<u8>() = (_rt::as_i32(day4)) as u8;
15019 let super::super::super::golem::rdbms::types::Time {
15020 hour: hour5,
15021 minute: minute5,
15022 second: second5,
15023 nanosecond: nanosecond5,
15024 } = time3;
15025 *base.add(16).cast::<u8>() = (_rt::as_i32(hour5)) as u8;
15026 *base.add(17).cast::<u8>() = (_rt::as_i32(minute5)) as u8;
15027 *base.add(18).cast::<u8>() = (_rt::as_i32(second5)) as u8;
15028 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond5);
15029 }
15030 DbValue::Timestamp(e) => {
15031 *base.add(0).cast::<u8>() = (16i32) as u8;
15032 let super::super::super::golem::rdbms::types::Timestamp {
15033 date: date6,
15034 time: time6,
15035 } = e;
15036 let super::super::super::golem::rdbms::types::Date {
15037 year: year7,
15038 month: month7,
15039 day: day7,
15040 } = date6;
15041 *base.add(8).cast::<i32>() = _rt::as_i32(year7);
15042 *base.add(12).cast::<u8>() = (_rt::as_i32(month7)) as u8;
15043 *base.add(13).cast::<u8>() = (_rt::as_i32(day7)) as u8;
15044 let super::super::super::golem::rdbms::types::Time {
15045 hour: hour8,
15046 minute: minute8,
15047 second: second8,
15048 nanosecond: nanosecond8,
15049 } = time6;
15050 *base.add(16).cast::<u8>() = (_rt::as_i32(hour8)) as u8;
15051 *base.add(17).cast::<u8>() = (_rt::as_i32(minute8)) as u8;
15052 *base.add(18).cast::<u8>() = (_rt::as_i32(second8)) as u8;
15053 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond8);
15054 }
15055 DbValue::Time(e) => {
15056 *base.add(0).cast::<u8>() = (17i32) as u8;
15057 let super::super::super::golem::rdbms::types::Time {
15058 hour: hour9,
15059 minute: minute9,
15060 second: second9,
15061 nanosecond: nanosecond9,
15062 } = e;
15063 *base.add(8).cast::<u8>() = (_rt::as_i32(hour9)) as u8;
15064 *base.add(9).cast::<u8>() = (_rt::as_i32(minute9)) as u8;
15065 *base.add(10).cast::<u8>() = (_rt::as_i32(second9)) as u8;
15066 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond9);
15067 }
15068 DbValue::Year(e) => {
15069 *base.add(0).cast::<u8>() = (18i32) as u8;
15070 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
15071 }
15072 DbValue::Fixchar(e) => {
15073 *base.add(0).cast::<u8>() = (19i32) as u8;
15074 let vec10 = e;
15075 let ptr10 = vec10.as_ptr().cast::<u8>();
15076 let len10 = vec10.len();
15077 *base.add(12).cast::<usize>() = len10;
15078 *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
15079 }
15080 DbValue::Varchar(e) => {
15081 *base.add(0).cast::<u8>() = (20i32) as u8;
15082 let vec11 = e;
15083 let ptr11 = vec11.as_ptr().cast::<u8>();
15084 let len11 = vec11.len();
15085 *base.add(12).cast::<usize>() = len11;
15086 *base.add(8).cast::<*mut u8>() = ptr11.cast_mut();
15087 }
15088 DbValue::Tinytext(e) => {
15089 *base.add(0).cast::<u8>() = (21i32) as u8;
15090 let vec12 = e;
15091 let ptr12 = vec12.as_ptr().cast::<u8>();
15092 let len12 = vec12.len();
15093 *base.add(12).cast::<usize>() = len12;
15094 *base.add(8).cast::<*mut u8>() = ptr12.cast_mut();
15095 }
15096 DbValue::Text(e) => {
15097 *base.add(0).cast::<u8>() = (22i32) as u8;
15098 let vec13 = e;
15099 let ptr13 = vec13.as_ptr().cast::<u8>();
15100 let len13 = vec13.len();
15101 *base.add(12).cast::<usize>() = len13;
15102 *base.add(8).cast::<*mut u8>() = ptr13.cast_mut();
15103 }
15104 DbValue::Mediumtext(e) => {
15105 *base.add(0).cast::<u8>() = (23i32) as u8;
15106 let vec14 = e;
15107 let ptr14 = vec14.as_ptr().cast::<u8>();
15108 let len14 = vec14.len();
15109 *base.add(12).cast::<usize>() = len14;
15110 *base.add(8).cast::<*mut u8>() = ptr14.cast_mut();
15111 }
15112 DbValue::Longtext(e) => {
15113 *base.add(0).cast::<u8>() = (24i32) as u8;
15114 let vec15 = e;
15115 let ptr15 = vec15.as_ptr().cast::<u8>();
15116 let len15 = vec15.len();
15117 *base.add(12).cast::<usize>() = len15;
15118 *base.add(8).cast::<*mut u8>() = ptr15.cast_mut();
15119 }
15120 DbValue::Binary(e) => {
15121 *base.add(0).cast::<u8>() = (25i32) as u8;
15122 let vec16 = e;
15123 let ptr16 = vec16.as_ptr().cast::<u8>();
15124 let len16 = vec16.len();
15125 *base.add(12).cast::<usize>() = len16;
15126 *base.add(8).cast::<*mut u8>() = ptr16.cast_mut();
15127 }
15128 DbValue::Varbinary(e) => {
15129 *base.add(0).cast::<u8>() = (26i32) as u8;
15130 let vec17 = e;
15131 let ptr17 = vec17.as_ptr().cast::<u8>();
15132 let len17 = vec17.len();
15133 *base.add(12).cast::<usize>() = len17;
15134 *base.add(8).cast::<*mut u8>() = ptr17.cast_mut();
15135 }
15136 DbValue::Tinyblob(e) => {
15137 *base.add(0).cast::<u8>() = (27i32) as u8;
15138 let vec18 = e;
15139 let ptr18 = vec18.as_ptr().cast::<u8>();
15140 let len18 = vec18.len();
15141 *base.add(12).cast::<usize>() = len18;
15142 *base.add(8).cast::<*mut u8>() = ptr18.cast_mut();
15143 }
15144 DbValue::Blob(e) => {
15145 *base.add(0).cast::<u8>() = (28i32) as u8;
15146 let vec19 = e;
15147 let ptr19 = vec19.as_ptr().cast::<u8>();
15148 let len19 = vec19.len();
15149 *base.add(12).cast::<usize>() = len19;
15150 *base.add(8).cast::<*mut u8>() = ptr19.cast_mut();
15151 }
15152 DbValue::Mediumblob(e) => {
15153 *base.add(0).cast::<u8>() = (29i32) as u8;
15154 let vec20 = e;
15155 let ptr20 = vec20.as_ptr().cast::<u8>();
15156 let len20 = vec20.len();
15157 *base.add(12).cast::<usize>() = len20;
15158 *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
15159 }
15160 DbValue::Longblob(e) => {
15161 *base.add(0).cast::<u8>() = (30i32) as u8;
15162 let vec21 = e;
15163 let ptr21 = vec21.as_ptr().cast::<u8>();
15164 let len21 = vec21.len();
15165 *base.add(12).cast::<usize>() = len21;
15166 *base.add(8).cast::<*mut u8>() = ptr21.cast_mut();
15167 }
15168 DbValue::Enumeration(e) => {
15169 *base.add(0).cast::<u8>() = (31i32) as u8;
15170 let vec22 = e;
15171 let ptr22 = vec22.as_ptr().cast::<u8>();
15172 let len22 = vec22.len();
15173 *base.add(12).cast::<usize>() = len22;
15174 *base.add(8).cast::<*mut u8>() = ptr22.cast_mut();
15175 }
15176 DbValue::Set(e) => {
15177 *base.add(0).cast::<u8>() = (32i32) as u8;
15178 let vec23 = e;
15179 let ptr23 = vec23.as_ptr().cast::<u8>();
15180 let len23 = vec23.len();
15181 *base.add(12).cast::<usize>() = len23;
15182 *base.add(8).cast::<*mut u8>() = ptr23.cast_mut();
15183 }
15184 DbValue::Bit(e) => {
15185 *base.add(0).cast::<u8>() = (33i32) as u8;
15186 let vec24 = e;
15187 let len24 = vec24.len();
15188 let layout24 = _rt::alloc::Layout::from_size_align_unchecked(
15189 vec24.len() * 1,
15190 1,
15191 );
15192 let result24 = if layout24.size() != 0 {
15193 let ptr = _rt::alloc::alloc(layout24).cast::<u8>();
15194 if ptr.is_null() {
15195 _rt::alloc::handle_alloc_error(layout24);
15196 }
15197 ptr
15198 } else {
15199 ::core::ptr::null_mut()
15200 };
15201 for (i, e) in vec24.into_iter().enumerate() {
15202 let base = result24.add(i * 1);
15203 {
15204 *base.add(0).cast::<u8>() = (match e {
15205 true => 1,
15206 false => 0,
15207 }) as u8;
15208 }
15209 }
15210 *base.add(12).cast::<usize>() = len24;
15211 *base.add(8).cast::<*mut u8>() = result24;
15212 cleanup_list.extend_from_slice(&[(result24, layout24)]);
15213 }
15214 DbValue::Json(e) => {
15215 *base.add(0).cast::<u8>() = (34i32) as u8;
15216 let vec25 = e;
15217 let ptr25 = vec25.as_ptr().cast::<u8>();
15218 let len25 = vec25.len();
15219 *base.add(12).cast::<usize>() = len25;
15220 *base.add(8).cast::<*mut u8>() = ptr25.cast_mut();
15221 }
15222 DbValue::Null => {
15223 *base.add(0).cast::<u8>() = (35i32) as u8;
15224 }
15225 }
15226 }
15227 }
15228 let ptr27 = ret_area.0.as_mut_ptr().cast::<u8>();
15229 #[cfg(target_arch = "wasm32")]
15230 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
15231 extern "C" {
15232 #[link_name = "[method]db-transaction.query"]
15233 fn wit_import(
15234 _: i32,
15235 _: *mut u8,
15236 _: usize,
15237 _: *mut u8,
15238 _: usize,
15239 _: *mut u8,
15240 );
15241 }
15242 #[cfg(not(target_arch = "wasm32"))]
15243 fn wit_import(
15244 _: i32,
15245 _: *mut u8,
15246 _: usize,
15247 _: *mut u8,
15248 _: usize,
15249 _: *mut u8,
15250 ) {
15251 unreachable!()
15252 }
15253 wit_import(
15254 (self).handle() as i32,
15255 ptr0.cast_mut(),
15256 len0,
15257 result26,
15258 len26,
15259 ptr27,
15260 );
15261 let l28 = i32::from(*ptr27.add(0).cast::<u8>());
15262 if layout26.size() != 0 {
15263 _rt::alloc::dealloc(result26.cast(), layout26);
15264 }
15265 for (ptr, layout) in cleanup_list {
15266 if layout.size() != 0 {
15267 _rt::alloc::dealloc(ptr.cast(), layout);
15268 }
15269 }
15270 match l28 {
15271 0 => {
15272 let e = {
15273 let l29 = *ptr27.add(4).cast::<*mut u8>();
15274 let l30 = *ptr27.add(8).cast::<usize>();
15275 let base40 = l29;
15276 let len40 = l30;
15277 let mut result40 = _rt::Vec::with_capacity(len40);
15278 for i in 0..len40 {
15279 let base = base40.add(i * 32);
15280 let e40 = {
15281 let l31 = *base.add(0).cast::<i64>();
15282 let l32 = *base.add(8).cast::<*mut u8>();
15283 let l33 = *base.add(12).cast::<usize>();
15284 let len34 = l33;
15285 let bytes34 = _rt::Vec::from_raw_parts(
15286 l32.cast(),
15287 len34,
15288 len34,
15289 );
15290 let l35 = i32::from(*base.add(16).cast::<u8>());
15291 let v36 = match l35 {
15292 0 => DbColumnType::Boolean,
15293 1 => DbColumnType::Tinyint,
15294 2 => DbColumnType::Smallint,
15295 3 => DbColumnType::Mediumint,
15296 4 => DbColumnType::Int,
15297 5 => DbColumnType::Bigint,
15298 6 => DbColumnType::TinyintUnsigned,
15299 7 => DbColumnType::SmallintUnsigned,
15300 8 => DbColumnType::MediumintUnsigned,
15301 9 => DbColumnType::IntUnsigned,
15302 10 => DbColumnType::BigintUnsigned,
15303 11 => DbColumnType::Float,
15304 12 => DbColumnType::Double,
15305 13 => DbColumnType::Decimal,
15306 14 => DbColumnType::Date,
15307 15 => DbColumnType::Datetime,
15308 16 => DbColumnType::Timestamp,
15309 17 => DbColumnType::Time,
15310 18 => DbColumnType::Year,
15311 19 => DbColumnType::Fixchar,
15312 20 => DbColumnType::Varchar,
15313 21 => DbColumnType::Tinytext,
15314 22 => DbColumnType::Text,
15315 23 => DbColumnType::Mediumtext,
15316 24 => DbColumnType::Longtext,
15317 25 => DbColumnType::Binary,
15318 26 => DbColumnType::Varbinary,
15319 27 => DbColumnType::Tinyblob,
15320 28 => DbColumnType::Blob,
15321 29 => DbColumnType::Mediumblob,
15322 30 => DbColumnType::Longblob,
15323 31 => DbColumnType::Enumeration,
15324 32 => DbColumnType::Set,
15325 33 => DbColumnType::Bit,
15326 n => {
15327 debug_assert_eq!(n, 34, "invalid enum discriminant");
15328 DbColumnType::Json
15329 }
15330 };
15331 let l37 = *base.add(20).cast::<*mut u8>();
15332 let l38 = *base.add(24).cast::<usize>();
15333 let len39 = l38;
15334 let bytes39 = _rt::Vec::from_raw_parts(
15335 l37.cast(),
15336 len39,
15337 len39,
15338 );
15339 DbColumn {
15340 ordinal: l31 as u64,
15341 name: _rt::string_lift(bytes34),
15342 db_type: v36,
15343 db_type_name: _rt::string_lift(bytes39),
15344 }
15345 };
15346 result40.push(e40);
15347 }
15348 _rt::cabi_dealloc(base40, len40 * 32, 8);
15349 let l41 = *ptr27.add(12).cast::<*mut u8>();
15350 let l42 = *ptr27.add(16).cast::<usize>();
15351 let base135 = l41;
15352 let len135 = l42;
15353 let mut result135 = _rt::Vec::with_capacity(len135);
15354 for i in 0..len135 {
15355 let base = base135.add(i * 8);
15356 let e135 = {
15357 let l43 = *base.add(0).cast::<*mut u8>();
15358 let l44 = *base.add(4).cast::<usize>();
15359 let base134 = l43;
15360 let len134 = l44;
15361 let mut result134 = _rt::Vec::with_capacity(len134);
15362 for i in 0..len134 {
15363 let base = base134.add(i * 24);
15364 let e134 = {
15365 let l45 = i32::from(*base.add(0).cast::<u8>());
15366 let v133 = match l45 {
15367 0 => {
15368 let e133 = {
15369 let l46 = i32::from(*base.add(8).cast::<u8>());
15370 _rt::bool_lift(l46 as u8)
15371 };
15372 DbValue::Boolean(e133)
15373 }
15374 1 => {
15375 let e133 = {
15376 let l47 = i32::from(*base.add(8).cast::<i8>());
15377 l47 as i8
15378 };
15379 DbValue::Tinyint(e133)
15380 }
15381 2 => {
15382 let e133 = {
15383 let l48 = i32::from(*base.add(8).cast::<i16>());
15384 l48 as i16
15385 };
15386 DbValue::Smallint(e133)
15387 }
15388 3 => {
15389 let e133 = {
15390 let l49 = *base.add(8).cast::<i32>();
15391 l49
15392 };
15393 DbValue::Mediumint(e133)
15394 }
15395 4 => {
15396 let e133 = {
15397 let l50 = *base.add(8).cast::<i32>();
15398 l50
15399 };
15400 DbValue::Int(e133)
15401 }
15402 5 => {
15403 let e133 = {
15404 let l51 = *base.add(8).cast::<i64>();
15405 l51
15406 };
15407 DbValue::Bigint(e133)
15408 }
15409 6 => {
15410 let e133 = {
15411 let l52 = i32::from(*base.add(8).cast::<u8>());
15412 l52 as u8
15413 };
15414 DbValue::TinyintUnsigned(e133)
15415 }
15416 7 => {
15417 let e133 = {
15418 let l53 = i32::from(*base.add(8).cast::<u16>());
15419 l53 as u16
15420 };
15421 DbValue::SmallintUnsigned(e133)
15422 }
15423 8 => {
15424 let e133 = {
15425 let l54 = *base.add(8).cast::<i32>();
15426 l54 as u32
15427 };
15428 DbValue::MediumintUnsigned(e133)
15429 }
15430 9 => {
15431 let e133 = {
15432 let l55 = *base.add(8).cast::<i32>();
15433 l55 as u32
15434 };
15435 DbValue::IntUnsigned(e133)
15436 }
15437 10 => {
15438 let e133 = {
15439 let l56 = *base.add(8).cast::<i64>();
15440 l56 as u64
15441 };
15442 DbValue::BigintUnsigned(e133)
15443 }
15444 11 => {
15445 let e133 = {
15446 let l57 = *base.add(8).cast::<f32>();
15447 l57
15448 };
15449 DbValue::Float(e133)
15450 }
15451 12 => {
15452 let e133 = {
15453 let l58 = *base.add(8).cast::<f64>();
15454 l58
15455 };
15456 DbValue::Double(e133)
15457 }
15458 13 => {
15459 let e133 = {
15460 let l59 = *base.add(8).cast::<*mut u8>();
15461 let l60 = *base.add(12).cast::<usize>();
15462 let len61 = l60;
15463 let bytes61 = _rt::Vec::from_raw_parts(
15464 l59.cast(),
15465 len61,
15466 len61,
15467 );
15468 _rt::string_lift(bytes61)
15469 };
15470 DbValue::Decimal(e133)
15471 }
15472 14 => {
15473 let e133 = {
15474 let l62 = *base.add(8).cast::<i32>();
15475 let l63 = i32::from(*base.add(12).cast::<u8>());
15476 let l64 = i32::from(*base.add(13).cast::<u8>());
15477 super::super::super::golem::rdbms::types::Date {
15478 year: l62,
15479 month: l63 as u8,
15480 day: l64 as u8,
15481 }
15482 };
15483 DbValue::Date(e133)
15484 }
15485 15 => {
15486 let e133 = {
15487 let l65 = *base.add(8).cast::<i32>();
15488 let l66 = i32::from(*base.add(12).cast::<u8>());
15489 let l67 = i32::from(*base.add(13).cast::<u8>());
15490 let l68 = i32::from(*base.add(16).cast::<u8>());
15491 let l69 = i32::from(*base.add(17).cast::<u8>());
15492 let l70 = i32::from(*base.add(18).cast::<u8>());
15493 let l71 = *base.add(20).cast::<i32>();
15494 super::super::super::golem::rdbms::types::Timestamp {
15495 date: super::super::super::golem::rdbms::types::Date {
15496 year: l65,
15497 month: l66 as u8,
15498 day: l67 as u8,
15499 },
15500 time: super::super::super::golem::rdbms::types::Time {
15501 hour: l68 as u8,
15502 minute: l69 as u8,
15503 second: l70 as u8,
15504 nanosecond: l71 as u32,
15505 },
15506 }
15507 };
15508 DbValue::Datetime(e133)
15509 }
15510 16 => {
15511 let e133 = {
15512 let l72 = *base.add(8).cast::<i32>();
15513 let l73 = i32::from(*base.add(12).cast::<u8>());
15514 let l74 = i32::from(*base.add(13).cast::<u8>());
15515 let l75 = i32::from(*base.add(16).cast::<u8>());
15516 let l76 = i32::from(*base.add(17).cast::<u8>());
15517 let l77 = i32::from(*base.add(18).cast::<u8>());
15518 let l78 = *base.add(20).cast::<i32>();
15519 super::super::super::golem::rdbms::types::Timestamp {
15520 date: super::super::super::golem::rdbms::types::Date {
15521 year: l72,
15522 month: l73 as u8,
15523 day: l74 as u8,
15524 },
15525 time: super::super::super::golem::rdbms::types::Time {
15526 hour: l75 as u8,
15527 minute: l76 as u8,
15528 second: l77 as u8,
15529 nanosecond: l78 as u32,
15530 },
15531 }
15532 };
15533 DbValue::Timestamp(e133)
15534 }
15535 17 => {
15536 let e133 = {
15537 let l79 = i32::from(*base.add(8).cast::<u8>());
15538 let l80 = i32::from(*base.add(9).cast::<u8>());
15539 let l81 = i32::from(*base.add(10).cast::<u8>());
15540 let l82 = *base.add(12).cast::<i32>();
15541 super::super::super::golem::rdbms::types::Time {
15542 hour: l79 as u8,
15543 minute: l80 as u8,
15544 second: l81 as u8,
15545 nanosecond: l82 as u32,
15546 }
15547 };
15548 DbValue::Time(e133)
15549 }
15550 18 => {
15551 let e133 = {
15552 let l83 = i32::from(*base.add(8).cast::<u16>());
15553 l83 as u16
15554 };
15555 DbValue::Year(e133)
15556 }
15557 19 => {
15558 let e133 = {
15559 let l84 = *base.add(8).cast::<*mut u8>();
15560 let l85 = *base.add(12).cast::<usize>();
15561 let len86 = l85;
15562 let bytes86 = _rt::Vec::from_raw_parts(
15563 l84.cast(),
15564 len86,
15565 len86,
15566 );
15567 _rt::string_lift(bytes86)
15568 };
15569 DbValue::Fixchar(e133)
15570 }
15571 20 => {
15572 let e133 = {
15573 let l87 = *base.add(8).cast::<*mut u8>();
15574 let l88 = *base.add(12).cast::<usize>();
15575 let len89 = l88;
15576 let bytes89 = _rt::Vec::from_raw_parts(
15577 l87.cast(),
15578 len89,
15579 len89,
15580 );
15581 _rt::string_lift(bytes89)
15582 };
15583 DbValue::Varchar(e133)
15584 }
15585 21 => {
15586 let e133 = {
15587 let l90 = *base.add(8).cast::<*mut u8>();
15588 let l91 = *base.add(12).cast::<usize>();
15589 let len92 = l91;
15590 let bytes92 = _rt::Vec::from_raw_parts(
15591 l90.cast(),
15592 len92,
15593 len92,
15594 );
15595 _rt::string_lift(bytes92)
15596 };
15597 DbValue::Tinytext(e133)
15598 }
15599 22 => {
15600 let e133 = {
15601 let l93 = *base.add(8).cast::<*mut u8>();
15602 let l94 = *base.add(12).cast::<usize>();
15603 let len95 = l94;
15604 let bytes95 = _rt::Vec::from_raw_parts(
15605 l93.cast(),
15606 len95,
15607 len95,
15608 );
15609 _rt::string_lift(bytes95)
15610 };
15611 DbValue::Text(e133)
15612 }
15613 23 => {
15614 let e133 = {
15615 let l96 = *base.add(8).cast::<*mut u8>();
15616 let l97 = *base.add(12).cast::<usize>();
15617 let len98 = l97;
15618 let bytes98 = _rt::Vec::from_raw_parts(
15619 l96.cast(),
15620 len98,
15621 len98,
15622 );
15623 _rt::string_lift(bytes98)
15624 };
15625 DbValue::Mediumtext(e133)
15626 }
15627 24 => {
15628 let e133 = {
15629 let l99 = *base.add(8).cast::<*mut u8>();
15630 let l100 = *base.add(12).cast::<usize>();
15631 let len101 = l100;
15632 let bytes101 = _rt::Vec::from_raw_parts(
15633 l99.cast(),
15634 len101,
15635 len101,
15636 );
15637 _rt::string_lift(bytes101)
15638 };
15639 DbValue::Longtext(e133)
15640 }
15641 25 => {
15642 let e133 = {
15643 let l102 = *base.add(8).cast::<*mut u8>();
15644 let l103 = *base.add(12).cast::<usize>();
15645 let len104 = l103;
15646 _rt::Vec::from_raw_parts(l102.cast(), len104, len104)
15647 };
15648 DbValue::Binary(e133)
15649 }
15650 26 => {
15651 let e133 = {
15652 let l105 = *base.add(8).cast::<*mut u8>();
15653 let l106 = *base.add(12).cast::<usize>();
15654 let len107 = l106;
15655 _rt::Vec::from_raw_parts(l105.cast(), len107, len107)
15656 };
15657 DbValue::Varbinary(e133)
15658 }
15659 27 => {
15660 let e133 = {
15661 let l108 = *base.add(8).cast::<*mut u8>();
15662 let l109 = *base.add(12).cast::<usize>();
15663 let len110 = l109;
15664 _rt::Vec::from_raw_parts(l108.cast(), len110, len110)
15665 };
15666 DbValue::Tinyblob(e133)
15667 }
15668 28 => {
15669 let e133 = {
15670 let l111 = *base.add(8).cast::<*mut u8>();
15671 let l112 = *base.add(12).cast::<usize>();
15672 let len113 = l112;
15673 _rt::Vec::from_raw_parts(l111.cast(), len113, len113)
15674 };
15675 DbValue::Blob(e133)
15676 }
15677 29 => {
15678 let e133 = {
15679 let l114 = *base.add(8).cast::<*mut u8>();
15680 let l115 = *base.add(12).cast::<usize>();
15681 let len116 = l115;
15682 _rt::Vec::from_raw_parts(l114.cast(), len116, len116)
15683 };
15684 DbValue::Mediumblob(e133)
15685 }
15686 30 => {
15687 let e133 = {
15688 let l117 = *base.add(8).cast::<*mut u8>();
15689 let l118 = *base.add(12).cast::<usize>();
15690 let len119 = l118;
15691 _rt::Vec::from_raw_parts(l117.cast(), len119, len119)
15692 };
15693 DbValue::Longblob(e133)
15694 }
15695 31 => {
15696 let e133 = {
15697 let l120 = *base.add(8).cast::<*mut u8>();
15698 let l121 = *base.add(12).cast::<usize>();
15699 let len122 = l121;
15700 let bytes122 = _rt::Vec::from_raw_parts(
15701 l120.cast(),
15702 len122,
15703 len122,
15704 );
15705 _rt::string_lift(bytes122)
15706 };
15707 DbValue::Enumeration(e133)
15708 }
15709 32 => {
15710 let e133 = {
15711 let l123 = *base.add(8).cast::<*mut u8>();
15712 let l124 = *base.add(12).cast::<usize>();
15713 let len125 = l124;
15714 let bytes125 = _rt::Vec::from_raw_parts(
15715 l123.cast(),
15716 len125,
15717 len125,
15718 );
15719 _rt::string_lift(bytes125)
15720 };
15721 DbValue::Set(e133)
15722 }
15723 33 => {
15724 let e133 = {
15725 let l126 = *base.add(8).cast::<*mut u8>();
15726 let l127 = *base.add(12).cast::<usize>();
15727 let base129 = l126;
15728 let len129 = l127;
15729 let mut result129 = _rt::Vec::with_capacity(len129);
15730 for i in 0..len129 {
15731 let base = base129.add(i * 1);
15732 let e129 = {
15733 let l128 = i32::from(*base.add(0).cast::<u8>());
15734 _rt::bool_lift(l128 as u8)
15735 };
15736 result129.push(e129);
15737 }
15738 _rt::cabi_dealloc(base129, len129 * 1, 1);
15739 result129
15740 };
15741 DbValue::Bit(e133)
15742 }
15743 34 => {
15744 let e133 = {
15745 let l130 = *base.add(8).cast::<*mut u8>();
15746 let l131 = *base.add(12).cast::<usize>();
15747 let len132 = l131;
15748 let bytes132 = _rt::Vec::from_raw_parts(
15749 l130.cast(),
15750 len132,
15751 len132,
15752 );
15753 _rt::string_lift(bytes132)
15754 };
15755 DbValue::Json(e133)
15756 }
15757 n => {
15758 debug_assert_eq!(n, 35, "invalid enum discriminant");
15759 DbValue::Null
15760 }
15761 };
15762 v133
15763 };
15764 result134.push(e134);
15765 }
15766 _rt::cabi_dealloc(base134, len134 * 24, 8);
15767 DbRow { values: result134 }
15768 };
15769 result135.push(e135);
15770 }
15771 _rt::cabi_dealloc(base135, len135 * 8, 4);
15772 DbResult {
15773 columns: result40,
15774 rows: result135,
15775 }
15776 };
15777 Ok(e)
15778 }
15779 1 => {
15780 let e = {
15781 let l136 = i32::from(*ptr27.add(4).cast::<u8>());
15782 let v152 = match l136 {
15783 0 => {
15784 let e152 = {
15785 let l137 = *ptr27.add(8).cast::<*mut u8>();
15786 let l138 = *ptr27.add(12).cast::<usize>();
15787 let len139 = l138;
15788 let bytes139 = _rt::Vec::from_raw_parts(
15789 l137.cast(),
15790 len139,
15791 len139,
15792 );
15793 _rt::string_lift(bytes139)
15794 };
15795 Error::ConnectionFailure(e152)
15796 }
15797 1 => {
15798 let e152 = {
15799 let l140 = *ptr27.add(8).cast::<*mut u8>();
15800 let l141 = *ptr27.add(12).cast::<usize>();
15801 let len142 = l141;
15802 let bytes142 = _rt::Vec::from_raw_parts(
15803 l140.cast(),
15804 len142,
15805 len142,
15806 );
15807 _rt::string_lift(bytes142)
15808 };
15809 Error::QueryParameterFailure(e152)
15810 }
15811 2 => {
15812 let e152 = {
15813 let l143 = *ptr27.add(8).cast::<*mut u8>();
15814 let l144 = *ptr27.add(12).cast::<usize>();
15815 let len145 = l144;
15816 let bytes145 = _rt::Vec::from_raw_parts(
15817 l143.cast(),
15818 len145,
15819 len145,
15820 );
15821 _rt::string_lift(bytes145)
15822 };
15823 Error::QueryExecutionFailure(e152)
15824 }
15825 3 => {
15826 let e152 = {
15827 let l146 = *ptr27.add(8).cast::<*mut u8>();
15828 let l147 = *ptr27.add(12).cast::<usize>();
15829 let len148 = l147;
15830 let bytes148 = _rt::Vec::from_raw_parts(
15831 l146.cast(),
15832 len148,
15833 len148,
15834 );
15835 _rt::string_lift(bytes148)
15836 };
15837 Error::QueryResponseFailure(e152)
15838 }
15839 n => {
15840 debug_assert_eq!(n, 4, "invalid enum discriminant");
15841 let e152 = {
15842 let l149 = *ptr27.add(8).cast::<*mut u8>();
15843 let l150 = *ptr27.add(12).cast::<usize>();
15844 let len151 = l150;
15845 let bytes151 = _rt::Vec::from_raw_parts(
15846 l149.cast(),
15847 len151,
15848 len151,
15849 );
15850 _rt::string_lift(bytes151)
15851 };
15852 Error::Other(e152)
15853 }
15854 };
15855 v152
15856 };
15857 Err(e)
15858 }
15859 _ => _rt::invalid_enum_discriminant(),
15860 }
15861 }
15862 }
15863 }
15864 impl DbTransaction {
15865 #[allow(unused_unsafe, clippy::all)]
15866 pub fn query_stream(
15867 &self,
15868 statement: &str,
15869 params: &[DbValue],
15870 ) -> Result<DbResultStream, Error> {
15871 unsafe {
15872 let mut cleanup_list = _rt::Vec::new();
15873 #[repr(align(4))]
15874 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
15875 let mut ret_area = RetArea(
15876 [::core::mem::MaybeUninit::uninit(); 16],
15877 );
15878 let vec0 = statement;
15879 let ptr0 = vec0.as_ptr().cast::<u8>();
15880 let len0 = vec0.len();
15881 let vec26 = params;
15882 let len26 = vec26.len();
15883 let layout26 = _rt::alloc::Layout::from_size_align_unchecked(
15884 vec26.len() * 24,
15885 8,
15886 );
15887 let result26 = if layout26.size() != 0 {
15888 let ptr = _rt::alloc::alloc(layout26).cast::<u8>();
15889 if ptr.is_null() {
15890 _rt::alloc::handle_alloc_error(layout26);
15891 }
15892 ptr
15893 } else {
15894 ::core::ptr::null_mut()
15895 };
15896 for (i, e) in vec26.into_iter().enumerate() {
15897 let base = result26.add(i * 24);
15898 {
15899 match e {
15900 DbValue::Boolean(e) => {
15901 *base.add(0).cast::<u8>() = (0i32) as u8;
15902 *base.add(8).cast::<u8>() = (match e {
15903 true => 1,
15904 false => 0,
15905 }) as u8;
15906 }
15907 DbValue::Tinyint(e) => {
15908 *base.add(0).cast::<u8>() = (1i32) as u8;
15909 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
15910 }
15911 DbValue::Smallint(e) => {
15912 *base.add(0).cast::<u8>() = (2i32) as u8;
15913 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
15914 }
15915 DbValue::Mediumint(e) => {
15916 *base.add(0).cast::<u8>() = (3i32) as u8;
15917 *base.add(8).cast::<i32>() = _rt::as_i32(e);
15918 }
15919 DbValue::Int(e) => {
15920 *base.add(0).cast::<u8>() = (4i32) as u8;
15921 *base.add(8).cast::<i32>() = _rt::as_i32(e);
15922 }
15923 DbValue::Bigint(e) => {
15924 *base.add(0).cast::<u8>() = (5i32) as u8;
15925 *base.add(8).cast::<i64>() = _rt::as_i64(e);
15926 }
15927 DbValue::TinyintUnsigned(e) => {
15928 *base.add(0).cast::<u8>() = (6i32) as u8;
15929 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
15930 }
15931 DbValue::SmallintUnsigned(e) => {
15932 *base.add(0).cast::<u8>() = (7i32) as u8;
15933 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
15934 }
15935 DbValue::MediumintUnsigned(e) => {
15936 *base.add(0).cast::<u8>() = (8i32) as u8;
15937 *base.add(8).cast::<i32>() = _rt::as_i32(e);
15938 }
15939 DbValue::IntUnsigned(e) => {
15940 *base.add(0).cast::<u8>() = (9i32) as u8;
15941 *base.add(8).cast::<i32>() = _rt::as_i32(e);
15942 }
15943 DbValue::BigintUnsigned(e) => {
15944 *base.add(0).cast::<u8>() = (10i32) as u8;
15945 *base.add(8).cast::<i64>() = _rt::as_i64(e);
15946 }
15947 DbValue::Float(e) => {
15948 *base.add(0).cast::<u8>() = (11i32) as u8;
15949 *base.add(8).cast::<f32>() = _rt::as_f32(e);
15950 }
15951 DbValue::Double(e) => {
15952 *base.add(0).cast::<u8>() = (12i32) as u8;
15953 *base.add(8).cast::<f64>() = _rt::as_f64(e);
15954 }
15955 DbValue::Decimal(e) => {
15956 *base.add(0).cast::<u8>() = (13i32) as u8;
15957 let vec1 = e;
15958 let ptr1 = vec1.as_ptr().cast::<u8>();
15959 let len1 = vec1.len();
15960 *base.add(12).cast::<usize>() = len1;
15961 *base.add(8).cast::<*mut u8>() = ptr1.cast_mut();
15962 }
15963 DbValue::Date(e) => {
15964 *base.add(0).cast::<u8>() = (14i32) as u8;
15965 let super::super::super::golem::rdbms::types::Date {
15966 year: year2,
15967 month: month2,
15968 day: day2,
15969 } = e;
15970 *base.add(8).cast::<i32>() = _rt::as_i32(year2);
15971 *base.add(12).cast::<u8>() = (_rt::as_i32(month2)) as u8;
15972 *base.add(13).cast::<u8>() = (_rt::as_i32(day2)) as u8;
15973 }
15974 DbValue::Datetime(e) => {
15975 *base.add(0).cast::<u8>() = (15i32) as u8;
15976 let super::super::super::golem::rdbms::types::Timestamp {
15977 date: date3,
15978 time: time3,
15979 } = e;
15980 let super::super::super::golem::rdbms::types::Date {
15981 year: year4,
15982 month: month4,
15983 day: day4,
15984 } = date3;
15985 *base.add(8).cast::<i32>() = _rt::as_i32(year4);
15986 *base.add(12).cast::<u8>() = (_rt::as_i32(month4)) as u8;
15987 *base.add(13).cast::<u8>() = (_rt::as_i32(day4)) as u8;
15988 let super::super::super::golem::rdbms::types::Time {
15989 hour: hour5,
15990 minute: minute5,
15991 second: second5,
15992 nanosecond: nanosecond5,
15993 } = time3;
15994 *base.add(16).cast::<u8>() = (_rt::as_i32(hour5)) as u8;
15995 *base.add(17).cast::<u8>() = (_rt::as_i32(minute5)) as u8;
15996 *base.add(18).cast::<u8>() = (_rt::as_i32(second5)) as u8;
15997 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond5);
15998 }
15999 DbValue::Timestamp(e) => {
16000 *base.add(0).cast::<u8>() = (16i32) as u8;
16001 let super::super::super::golem::rdbms::types::Timestamp {
16002 date: date6,
16003 time: time6,
16004 } = e;
16005 let super::super::super::golem::rdbms::types::Date {
16006 year: year7,
16007 month: month7,
16008 day: day7,
16009 } = date6;
16010 *base.add(8).cast::<i32>() = _rt::as_i32(year7);
16011 *base.add(12).cast::<u8>() = (_rt::as_i32(month7)) as u8;
16012 *base.add(13).cast::<u8>() = (_rt::as_i32(day7)) as u8;
16013 let super::super::super::golem::rdbms::types::Time {
16014 hour: hour8,
16015 minute: minute8,
16016 second: second8,
16017 nanosecond: nanosecond8,
16018 } = time6;
16019 *base.add(16).cast::<u8>() = (_rt::as_i32(hour8)) as u8;
16020 *base.add(17).cast::<u8>() = (_rt::as_i32(minute8)) as u8;
16021 *base.add(18).cast::<u8>() = (_rt::as_i32(second8)) as u8;
16022 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond8);
16023 }
16024 DbValue::Time(e) => {
16025 *base.add(0).cast::<u8>() = (17i32) as u8;
16026 let super::super::super::golem::rdbms::types::Time {
16027 hour: hour9,
16028 minute: minute9,
16029 second: second9,
16030 nanosecond: nanosecond9,
16031 } = e;
16032 *base.add(8).cast::<u8>() = (_rt::as_i32(hour9)) as u8;
16033 *base.add(9).cast::<u8>() = (_rt::as_i32(minute9)) as u8;
16034 *base.add(10).cast::<u8>() = (_rt::as_i32(second9)) as u8;
16035 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond9);
16036 }
16037 DbValue::Year(e) => {
16038 *base.add(0).cast::<u8>() = (18i32) as u8;
16039 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
16040 }
16041 DbValue::Fixchar(e) => {
16042 *base.add(0).cast::<u8>() = (19i32) as u8;
16043 let vec10 = e;
16044 let ptr10 = vec10.as_ptr().cast::<u8>();
16045 let len10 = vec10.len();
16046 *base.add(12).cast::<usize>() = len10;
16047 *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
16048 }
16049 DbValue::Varchar(e) => {
16050 *base.add(0).cast::<u8>() = (20i32) as u8;
16051 let vec11 = e;
16052 let ptr11 = vec11.as_ptr().cast::<u8>();
16053 let len11 = vec11.len();
16054 *base.add(12).cast::<usize>() = len11;
16055 *base.add(8).cast::<*mut u8>() = ptr11.cast_mut();
16056 }
16057 DbValue::Tinytext(e) => {
16058 *base.add(0).cast::<u8>() = (21i32) as u8;
16059 let vec12 = e;
16060 let ptr12 = vec12.as_ptr().cast::<u8>();
16061 let len12 = vec12.len();
16062 *base.add(12).cast::<usize>() = len12;
16063 *base.add(8).cast::<*mut u8>() = ptr12.cast_mut();
16064 }
16065 DbValue::Text(e) => {
16066 *base.add(0).cast::<u8>() = (22i32) as u8;
16067 let vec13 = e;
16068 let ptr13 = vec13.as_ptr().cast::<u8>();
16069 let len13 = vec13.len();
16070 *base.add(12).cast::<usize>() = len13;
16071 *base.add(8).cast::<*mut u8>() = ptr13.cast_mut();
16072 }
16073 DbValue::Mediumtext(e) => {
16074 *base.add(0).cast::<u8>() = (23i32) as u8;
16075 let vec14 = e;
16076 let ptr14 = vec14.as_ptr().cast::<u8>();
16077 let len14 = vec14.len();
16078 *base.add(12).cast::<usize>() = len14;
16079 *base.add(8).cast::<*mut u8>() = ptr14.cast_mut();
16080 }
16081 DbValue::Longtext(e) => {
16082 *base.add(0).cast::<u8>() = (24i32) as u8;
16083 let vec15 = e;
16084 let ptr15 = vec15.as_ptr().cast::<u8>();
16085 let len15 = vec15.len();
16086 *base.add(12).cast::<usize>() = len15;
16087 *base.add(8).cast::<*mut u8>() = ptr15.cast_mut();
16088 }
16089 DbValue::Binary(e) => {
16090 *base.add(0).cast::<u8>() = (25i32) as u8;
16091 let vec16 = e;
16092 let ptr16 = vec16.as_ptr().cast::<u8>();
16093 let len16 = vec16.len();
16094 *base.add(12).cast::<usize>() = len16;
16095 *base.add(8).cast::<*mut u8>() = ptr16.cast_mut();
16096 }
16097 DbValue::Varbinary(e) => {
16098 *base.add(0).cast::<u8>() = (26i32) as u8;
16099 let vec17 = e;
16100 let ptr17 = vec17.as_ptr().cast::<u8>();
16101 let len17 = vec17.len();
16102 *base.add(12).cast::<usize>() = len17;
16103 *base.add(8).cast::<*mut u8>() = ptr17.cast_mut();
16104 }
16105 DbValue::Tinyblob(e) => {
16106 *base.add(0).cast::<u8>() = (27i32) as u8;
16107 let vec18 = e;
16108 let ptr18 = vec18.as_ptr().cast::<u8>();
16109 let len18 = vec18.len();
16110 *base.add(12).cast::<usize>() = len18;
16111 *base.add(8).cast::<*mut u8>() = ptr18.cast_mut();
16112 }
16113 DbValue::Blob(e) => {
16114 *base.add(0).cast::<u8>() = (28i32) as u8;
16115 let vec19 = e;
16116 let ptr19 = vec19.as_ptr().cast::<u8>();
16117 let len19 = vec19.len();
16118 *base.add(12).cast::<usize>() = len19;
16119 *base.add(8).cast::<*mut u8>() = ptr19.cast_mut();
16120 }
16121 DbValue::Mediumblob(e) => {
16122 *base.add(0).cast::<u8>() = (29i32) as u8;
16123 let vec20 = e;
16124 let ptr20 = vec20.as_ptr().cast::<u8>();
16125 let len20 = vec20.len();
16126 *base.add(12).cast::<usize>() = len20;
16127 *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
16128 }
16129 DbValue::Longblob(e) => {
16130 *base.add(0).cast::<u8>() = (30i32) as u8;
16131 let vec21 = e;
16132 let ptr21 = vec21.as_ptr().cast::<u8>();
16133 let len21 = vec21.len();
16134 *base.add(12).cast::<usize>() = len21;
16135 *base.add(8).cast::<*mut u8>() = ptr21.cast_mut();
16136 }
16137 DbValue::Enumeration(e) => {
16138 *base.add(0).cast::<u8>() = (31i32) as u8;
16139 let vec22 = e;
16140 let ptr22 = vec22.as_ptr().cast::<u8>();
16141 let len22 = vec22.len();
16142 *base.add(12).cast::<usize>() = len22;
16143 *base.add(8).cast::<*mut u8>() = ptr22.cast_mut();
16144 }
16145 DbValue::Set(e) => {
16146 *base.add(0).cast::<u8>() = (32i32) as u8;
16147 let vec23 = e;
16148 let ptr23 = vec23.as_ptr().cast::<u8>();
16149 let len23 = vec23.len();
16150 *base.add(12).cast::<usize>() = len23;
16151 *base.add(8).cast::<*mut u8>() = ptr23.cast_mut();
16152 }
16153 DbValue::Bit(e) => {
16154 *base.add(0).cast::<u8>() = (33i32) as u8;
16155 let vec24 = e;
16156 let len24 = vec24.len();
16157 let layout24 = _rt::alloc::Layout::from_size_align_unchecked(
16158 vec24.len() * 1,
16159 1,
16160 );
16161 let result24 = if layout24.size() != 0 {
16162 let ptr = _rt::alloc::alloc(layout24).cast::<u8>();
16163 if ptr.is_null() {
16164 _rt::alloc::handle_alloc_error(layout24);
16165 }
16166 ptr
16167 } else {
16168 ::core::ptr::null_mut()
16169 };
16170 for (i, e) in vec24.into_iter().enumerate() {
16171 let base = result24.add(i * 1);
16172 {
16173 *base.add(0).cast::<u8>() = (match e {
16174 true => 1,
16175 false => 0,
16176 }) as u8;
16177 }
16178 }
16179 *base.add(12).cast::<usize>() = len24;
16180 *base.add(8).cast::<*mut u8>() = result24;
16181 cleanup_list.extend_from_slice(&[(result24, layout24)]);
16182 }
16183 DbValue::Json(e) => {
16184 *base.add(0).cast::<u8>() = (34i32) as u8;
16185 let vec25 = e;
16186 let ptr25 = vec25.as_ptr().cast::<u8>();
16187 let len25 = vec25.len();
16188 *base.add(12).cast::<usize>() = len25;
16189 *base.add(8).cast::<*mut u8>() = ptr25.cast_mut();
16190 }
16191 DbValue::Null => {
16192 *base.add(0).cast::<u8>() = (35i32) as u8;
16193 }
16194 }
16195 }
16196 }
16197 let ptr27 = ret_area.0.as_mut_ptr().cast::<u8>();
16198 #[cfg(target_arch = "wasm32")]
16199 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
16200 extern "C" {
16201 #[link_name = "[method]db-transaction.query-stream"]
16202 fn wit_import(
16203 _: i32,
16204 _: *mut u8,
16205 _: usize,
16206 _: *mut u8,
16207 _: usize,
16208 _: *mut u8,
16209 );
16210 }
16211 #[cfg(not(target_arch = "wasm32"))]
16212 fn wit_import(
16213 _: i32,
16214 _: *mut u8,
16215 _: usize,
16216 _: *mut u8,
16217 _: usize,
16218 _: *mut u8,
16219 ) {
16220 unreachable!()
16221 }
16222 wit_import(
16223 (self).handle() as i32,
16224 ptr0.cast_mut(),
16225 len0,
16226 result26,
16227 len26,
16228 ptr27,
16229 );
16230 let l28 = i32::from(*ptr27.add(0).cast::<u8>());
16231 if layout26.size() != 0 {
16232 _rt::alloc::dealloc(result26.cast(), layout26);
16233 }
16234 for (ptr, layout) in cleanup_list {
16235 if layout.size() != 0 {
16236 _rt::alloc::dealloc(ptr.cast(), layout);
16237 }
16238 }
16239 match l28 {
16240 0 => {
16241 let e = {
16242 let l29 = *ptr27.add(4).cast::<i32>();
16243 DbResultStream::from_handle(l29 as u32)
16244 };
16245 Ok(e)
16246 }
16247 1 => {
16248 let e = {
16249 let l30 = i32::from(*ptr27.add(4).cast::<u8>());
16250 let v46 = match l30 {
16251 0 => {
16252 let e46 = {
16253 let l31 = *ptr27.add(8).cast::<*mut u8>();
16254 let l32 = *ptr27.add(12).cast::<usize>();
16255 let len33 = l32;
16256 let bytes33 = _rt::Vec::from_raw_parts(
16257 l31.cast(),
16258 len33,
16259 len33,
16260 );
16261 _rt::string_lift(bytes33)
16262 };
16263 Error::ConnectionFailure(e46)
16264 }
16265 1 => {
16266 let e46 = {
16267 let l34 = *ptr27.add(8).cast::<*mut u8>();
16268 let l35 = *ptr27.add(12).cast::<usize>();
16269 let len36 = l35;
16270 let bytes36 = _rt::Vec::from_raw_parts(
16271 l34.cast(),
16272 len36,
16273 len36,
16274 );
16275 _rt::string_lift(bytes36)
16276 };
16277 Error::QueryParameterFailure(e46)
16278 }
16279 2 => {
16280 let e46 = {
16281 let l37 = *ptr27.add(8).cast::<*mut u8>();
16282 let l38 = *ptr27.add(12).cast::<usize>();
16283 let len39 = l38;
16284 let bytes39 = _rt::Vec::from_raw_parts(
16285 l37.cast(),
16286 len39,
16287 len39,
16288 );
16289 _rt::string_lift(bytes39)
16290 };
16291 Error::QueryExecutionFailure(e46)
16292 }
16293 3 => {
16294 let e46 = {
16295 let l40 = *ptr27.add(8).cast::<*mut u8>();
16296 let l41 = *ptr27.add(12).cast::<usize>();
16297 let len42 = l41;
16298 let bytes42 = _rt::Vec::from_raw_parts(
16299 l40.cast(),
16300 len42,
16301 len42,
16302 );
16303 _rt::string_lift(bytes42)
16304 };
16305 Error::QueryResponseFailure(e46)
16306 }
16307 n => {
16308 debug_assert_eq!(n, 4, "invalid enum discriminant");
16309 let e46 = {
16310 let l43 = *ptr27.add(8).cast::<*mut u8>();
16311 let l44 = *ptr27.add(12).cast::<usize>();
16312 let len45 = l44;
16313 let bytes45 = _rt::Vec::from_raw_parts(
16314 l43.cast(),
16315 len45,
16316 len45,
16317 );
16318 _rt::string_lift(bytes45)
16319 };
16320 Error::Other(e46)
16321 }
16322 };
16323 v46
16324 };
16325 Err(e)
16326 }
16327 _ => _rt::invalid_enum_discriminant(),
16328 }
16329 }
16330 }
16331 }
16332 impl DbTransaction {
16333 #[allow(unused_unsafe, clippy::all)]
16334 pub fn execute(
16335 &self,
16336 statement: &str,
16337 params: &[DbValue],
16338 ) -> Result<u64, Error> {
16339 unsafe {
16340 let mut cleanup_list = _rt::Vec::new();
16341 #[repr(align(8))]
16342 struct RetArea([::core::mem::MaybeUninit<u8>; 24]);
16343 let mut ret_area = RetArea(
16344 [::core::mem::MaybeUninit::uninit(); 24],
16345 );
16346 let vec0 = statement;
16347 let ptr0 = vec0.as_ptr().cast::<u8>();
16348 let len0 = vec0.len();
16349 let vec26 = params;
16350 let len26 = vec26.len();
16351 let layout26 = _rt::alloc::Layout::from_size_align_unchecked(
16352 vec26.len() * 24,
16353 8,
16354 );
16355 let result26 = if layout26.size() != 0 {
16356 let ptr = _rt::alloc::alloc(layout26).cast::<u8>();
16357 if ptr.is_null() {
16358 _rt::alloc::handle_alloc_error(layout26);
16359 }
16360 ptr
16361 } else {
16362 ::core::ptr::null_mut()
16363 };
16364 for (i, e) in vec26.into_iter().enumerate() {
16365 let base = result26.add(i * 24);
16366 {
16367 match e {
16368 DbValue::Boolean(e) => {
16369 *base.add(0).cast::<u8>() = (0i32) as u8;
16370 *base.add(8).cast::<u8>() = (match e {
16371 true => 1,
16372 false => 0,
16373 }) as u8;
16374 }
16375 DbValue::Tinyint(e) => {
16376 *base.add(0).cast::<u8>() = (1i32) as u8;
16377 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
16378 }
16379 DbValue::Smallint(e) => {
16380 *base.add(0).cast::<u8>() = (2i32) as u8;
16381 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
16382 }
16383 DbValue::Mediumint(e) => {
16384 *base.add(0).cast::<u8>() = (3i32) as u8;
16385 *base.add(8).cast::<i32>() = _rt::as_i32(e);
16386 }
16387 DbValue::Int(e) => {
16388 *base.add(0).cast::<u8>() = (4i32) as u8;
16389 *base.add(8).cast::<i32>() = _rt::as_i32(e);
16390 }
16391 DbValue::Bigint(e) => {
16392 *base.add(0).cast::<u8>() = (5i32) as u8;
16393 *base.add(8).cast::<i64>() = _rt::as_i64(e);
16394 }
16395 DbValue::TinyintUnsigned(e) => {
16396 *base.add(0).cast::<u8>() = (6i32) as u8;
16397 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
16398 }
16399 DbValue::SmallintUnsigned(e) => {
16400 *base.add(0).cast::<u8>() = (7i32) as u8;
16401 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
16402 }
16403 DbValue::MediumintUnsigned(e) => {
16404 *base.add(0).cast::<u8>() = (8i32) as u8;
16405 *base.add(8).cast::<i32>() = _rt::as_i32(e);
16406 }
16407 DbValue::IntUnsigned(e) => {
16408 *base.add(0).cast::<u8>() = (9i32) as u8;
16409 *base.add(8).cast::<i32>() = _rt::as_i32(e);
16410 }
16411 DbValue::BigintUnsigned(e) => {
16412 *base.add(0).cast::<u8>() = (10i32) as u8;
16413 *base.add(8).cast::<i64>() = _rt::as_i64(e);
16414 }
16415 DbValue::Float(e) => {
16416 *base.add(0).cast::<u8>() = (11i32) as u8;
16417 *base.add(8).cast::<f32>() = _rt::as_f32(e);
16418 }
16419 DbValue::Double(e) => {
16420 *base.add(0).cast::<u8>() = (12i32) as u8;
16421 *base.add(8).cast::<f64>() = _rt::as_f64(e);
16422 }
16423 DbValue::Decimal(e) => {
16424 *base.add(0).cast::<u8>() = (13i32) as u8;
16425 let vec1 = e;
16426 let ptr1 = vec1.as_ptr().cast::<u8>();
16427 let len1 = vec1.len();
16428 *base.add(12).cast::<usize>() = len1;
16429 *base.add(8).cast::<*mut u8>() = ptr1.cast_mut();
16430 }
16431 DbValue::Date(e) => {
16432 *base.add(0).cast::<u8>() = (14i32) as u8;
16433 let super::super::super::golem::rdbms::types::Date {
16434 year: year2,
16435 month: month2,
16436 day: day2,
16437 } = e;
16438 *base.add(8).cast::<i32>() = _rt::as_i32(year2);
16439 *base.add(12).cast::<u8>() = (_rt::as_i32(month2)) as u8;
16440 *base.add(13).cast::<u8>() = (_rt::as_i32(day2)) as u8;
16441 }
16442 DbValue::Datetime(e) => {
16443 *base.add(0).cast::<u8>() = (15i32) as u8;
16444 let super::super::super::golem::rdbms::types::Timestamp {
16445 date: date3,
16446 time: time3,
16447 } = e;
16448 let super::super::super::golem::rdbms::types::Date {
16449 year: year4,
16450 month: month4,
16451 day: day4,
16452 } = date3;
16453 *base.add(8).cast::<i32>() = _rt::as_i32(year4);
16454 *base.add(12).cast::<u8>() = (_rt::as_i32(month4)) as u8;
16455 *base.add(13).cast::<u8>() = (_rt::as_i32(day4)) as u8;
16456 let super::super::super::golem::rdbms::types::Time {
16457 hour: hour5,
16458 minute: minute5,
16459 second: second5,
16460 nanosecond: nanosecond5,
16461 } = time3;
16462 *base.add(16).cast::<u8>() = (_rt::as_i32(hour5)) as u8;
16463 *base.add(17).cast::<u8>() = (_rt::as_i32(minute5)) as u8;
16464 *base.add(18).cast::<u8>() = (_rt::as_i32(second5)) as u8;
16465 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond5);
16466 }
16467 DbValue::Timestamp(e) => {
16468 *base.add(0).cast::<u8>() = (16i32) as u8;
16469 let super::super::super::golem::rdbms::types::Timestamp {
16470 date: date6,
16471 time: time6,
16472 } = e;
16473 let super::super::super::golem::rdbms::types::Date {
16474 year: year7,
16475 month: month7,
16476 day: day7,
16477 } = date6;
16478 *base.add(8).cast::<i32>() = _rt::as_i32(year7);
16479 *base.add(12).cast::<u8>() = (_rt::as_i32(month7)) as u8;
16480 *base.add(13).cast::<u8>() = (_rt::as_i32(day7)) as u8;
16481 let super::super::super::golem::rdbms::types::Time {
16482 hour: hour8,
16483 minute: minute8,
16484 second: second8,
16485 nanosecond: nanosecond8,
16486 } = time6;
16487 *base.add(16).cast::<u8>() = (_rt::as_i32(hour8)) as u8;
16488 *base.add(17).cast::<u8>() = (_rt::as_i32(minute8)) as u8;
16489 *base.add(18).cast::<u8>() = (_rt::as_i32(second8)) as u8;
16490 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond8);
16491 }
16492 DbValue::Time(e) => {
16493 *base.add(0).cast::<u8>() = (17i32) as u8;
16494 let super::super::super::golem::rdbms::types::Time {
16495 hour: hour9,
16496 minute: minute9,
16497 second: second9,
16498 nanosecond: nanosecond9,
16499 } = e;
16500 *base.add(8).cast::<u8>() = (_rt::as_i32(hour9)) as u8;
16501 *base.add(9).cast::<u8>() = (_rt::as_i32(minute9)) as u8;
16502 *base.add(10).cast::<u8>() = (_rt::as_i32(second9)) as u8;
16503 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond9);
16504 }
16505 DbValue::Year(e) => {
16506 *base.add(0).cast::<u8>() = (18i32) as u8;
16507 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
16508 }
16509 DbValue::Fixchar(e) => {
16510 *base.add(0).cast::<u8>() = (19i32) as u8;
16511 let vec10 = e;
16512 let ptr10 = vec10.as_ptr().cast::<u8>();
16513 let len10 = vec10.len();
16514 *base.add(12).cast::<usize>() = len10;
16515 *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
16516 }
16517 DbValue::Varchar(e) => {
16518 *base.add(0).cast::<u8>() = (20i32) as u8;
16519 let vec11 = e;
16520 let ptr11 = vec11.as_ptr().cast::<u8>();
16521 let len11 = vec11.len();
16522 *base.add(12).cast::<usize>() = len11;
16523 *base.add(8).cast::<*mut u8>() = ptr11.cast_mut();
16524 }
16525 DbValue::Tinytext(e) => {
16526 *base.add(0).cast::<u8>() = (21i32) as u8;
16527 let vec12 = e;
16528 let ptr12 = vec12.as_ptr().cast::<u8>();
16529 let len12 = vec12.len();
16530 *base.add(12).cast::<usize>() = len12;
16531 *base.add(8).cast::<*mut u8>() = ptr12.cast_mut();
16532 }
16533 DbValue::Text(e) => {
16534 *base.add(0).cast::<u8>() = (22i32) as u8;
16535 let vec13 = e;
16536 let ptr13 = vec13.as_ptr().cast::<u8>();
16537 let len13 = vec13.len();
16538 *base.add(12).cast::<usize>() = len13;
16539 *base.add(8).cast::<*mut u8>() = ptr13.cast_mut();
16540 }
16541 DbValue::Mediumtext(e) => {
16542 *base.add(0).cast::<u8>() = (23i32) as u8;
16543 let vec14 = e;
16544 let ptr14 = vec14.as_ptr().cast::<u8>();
16545 let len14 = vec14.len();
16546 *base.add(12).cast::<usize>() = len14;
16547 *base.add(8).cast::<*mut u8>() = ptr14.cast_mut();
16548 }
16549 DbValue::Longtext(e) => {
16550 *base.add(0).cast::<u8>() = (24i32) as u8;
16551 let vec15 = e;
16552 let ptr15 = vec15.as_ptr().cast::<u8>();
16553 let len15 = vec15.len();
16554 *base.add(12).cast::<usize>() = len15;
16555 *base.add(8).cast::<*mut u8>() = ptr15.cast_mut();
16556 }
16557 DbValue::Binary(e) => {
16558 *base.add(0).cast::<u8>() = (25i32) as u8;
16559 let vec16 = e;
16560 let ptr16 = vec16.as_ptr().cast::<u8>();
16561 let len16 = vec16.len();
16562 *base.add(12).cast::<usize>() = len16;
16563 *base.add(8).cast::<*mut u8>() = ptr16.cast_mut();
16564 }
16565 DbValue::Varbinary(e) => {
16566 *base.add(0).cast::<u8>() = (26i32) as u8;
16567 let vec17 = e;
16568 let ptr17 = vec17.as_ptr().cast::<u8>();
16569 let len17 = vec17.len();
16570 *base.add(12).cast::<usize>() = len17;
16571 *base.add(8).cast::<*mut u8>() = ptr17.cast_mut();
16572 }
16573 DbValue::Tinyblob(e) => {
16574 *base.add(0).cast::<u8>() = (27i32) as u8;
16575 let vec18 = e;
16576 let ptr18 = vec18.as_ptr().cast::<u8>();
16577 let len18 = vec18.len();
16578 *base.add(12).cast::<usize>() = len18;
16579 *base.add(8).cast::<*mut u8>() = ptr18.cast_mut();
16580 }
16581 DbValue::Blob(e) => {
16582 *base.add(0).cast::<u8>() = (28i32) as u8;
16583 let vec19 = e;
16584 let ptr19 = vec19.as_ptr().cast::<u8>();
16585 let len19 = vec19.len();
16586 *base.add(12).cast::<usize>() = len19;
16587 *base.add(8).cast::<*mut u8>() = ptr19.cast_mut();
16588 }
16589 DbValue::Mediumblob(e) => {
16590 *base.add(0).cast::<u8>() = (29i32) as u8;
16591 let vec20 = e;
16592 let ptr20 = vec20.as_ptr().cast::<u8>();
16593 let len20 = vec20.len();
16594 *base.add(12).cast::<usize>() = len20;
16595 *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
16596 }
16597 DbValue::Longblob(e) => {
16598 *base.add(0).cast::<u8>() = (30i32) as u8;
16599 let vec21 = e;
16600 let ptr21 = vec21.as_ptr().cast::<u8>();
16601 let len21 = vec21.len();
16602 *base.add(12).cast::<usize>() = len21;
16603 *base.add(8).cast::<*mut u8>() = ptr21.cast_mut();
16604 }
16605 DbValue::Enumeration(e) => {
16606 *base.add(0).cast::<u8>() = (31i32) as u8;
16607 let vec22 = e;
16608 let ptr22 = vec22.as_ptr().cast::<u8>();
16609 let len22 = vec22.len();
16610 *base.add(12).cast::<usize>() = len22;
16611 *base.add(8).cast::<*mut u8>() = ptr22.cast_mut();
16612 }
16613 DbValue::Set(e) => {
16614 *base.add(0).cast::<u8>() = (32i32) as u8;
16615 let vec23 = e;
16616 let ptr23 = vec23.as_ptr().cast::<u8>();
16617 let len23 = vec23.len();
16618 *base.add(12).cast::<usize>() = len23;
16619 *base.add(8).cast::<*mut u8>() = ptr23.cast_mut();
16620 }
16621 DbValue::Bit(e) => {
16622 *base.add(0).cast::<u8>() = (33i32) as u8;
16623 let vec24 = e;
16624 let len24 = vec24.len();
16625 let layout24 = _rt::alloc::Layout::from_size_align_unchecked(
16626 vec24.len() * 1,
16627 1,
16628 );
16629 let result24 = if layout24.size() != 0 {
16630 let ptr = _rt::alloc::alloc(layout24).cast::<u8>();
16631 if ptr.is_null() {
16632 _rt::alloc::handle_alloc_error(layout24);
16633 }
16634 ptr
16635 } else {
16636 ::core::ptr::null_mut()
16637 };
16638 for (i, e) in vec24.into_iter().enumerate() {
16639 let base = result24.add(i * 1);
16640 {
16641 *base.add(0).cast::<u8>() = (match e {
16642 true => 1,
16643 false => 0,
16644 }) as u8;
16645 }
16646 }
16647 *base.add(12).cast::<usize>() = len24;
16648 *base.add(8).cast::<*mut u8>() = result24;
16649 cleanup_list.extend_from_slice(&[(result24, layout24)]);
16650 }
16651 DbValue::Json(e) => {
16652 *base.add(0).cast::<u8>() = (34i32) as u8;
16653 let vec25 = e;
16654 let ptr25 = vec25.as_ptr().cast::<u8>();
16655 let len25 = vec25.len();
16656 *base.add(12).cast::<usize>() = len25;
16657 *base.add(8).cast::<*mut u8>() = ptr25.cast_mut();
16658 }
16659 DbValue::Null => {
16660 *base.add(0).cast::<u8>() = (35i32) as u8;
16661 }
16662 }
16663 }
16664 }
16665 let ptr27 = ret_area.0.as_mut_ptr().cast::<u8>();
16666 #[cfg(target_arch = "wasm32")]
16667 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
16668 extern "C" {
16669 #[link_name = "[method]db-transaction.execute"]
16670 fn wit_import(
16671 _: i32,
16672 _: *mut u8,
16673 _: usize,
16674 _: *mut u8,
16675 _: usize,
16676 _: *mut u8,
16677 );
16678 }
16679 #[cfg(not(target_arch = "wasm32"))]
16680 fn wit_import(
16681 _: i32,
16682 _: *mut u8,
16683 _: usize,
16684 _: *mut u8,
16685 _: usize,
16686 _: *mut u8,
16687 ) {
16688 unreachable!()
16689 }
16690 wit_import(
16691 (self).handle() as i32,
16692 ptr0.cast_mut(),
16693 len0,
16694 result26,
16695 len26,
16696 ptr27,
16697 );
16698 let l28 = i32::from(*ptr27.add(0).cast::<u8>());
16699 if layout26.size() != 0 {
16700 _rt::alloc::dealloc(result26.cast(), layout26);
16701 }
16702 for (ptr, layout) in cleanup_list {
16703 if layout.size() != 0 {
16704 _rt::alloc::dealloc(ptr.cast(), layout);
16705 }
16706 }
16707 match l28 {
16708 0 => {
16709 let e = {
16710 let l29 = *ptr27.add(8).cast::<i64>();
16711 l29 as u64
16712 };
16713 Ok(e)
16714 }
16715 1 => {
16716 let e = {
16717 let l30 = i32::from(*ptr27.add(8).cast::<u8>());
16718 let v46 = match l30 {
16719 0 => {
16720 let e46 = {
16721 let l31 = *ptr27.add(12).cast::<*mut u8>();
16722 let l32 = *ptr27.add(16).cast::<usize>();
16723 let len33 = l32;
16724 let bytes33 = _rt::Vec::from_raw_parts(
16725 l31.cast(),
16726 len33,
16727 len33,
16728 );
16729 _rt::string_lift(bytes33)
16730 };
16731 Error::ConnectionFailure(e46)
16732 }
16733 1 => {
16734 let e46 = {
16735 let l34 = *ptr27.add(12).cast::<*mut u8>();
16736 let l35 = *ptr27.add(16).cast::<usize>();
16737 let len36 = l35;
16738 let bytes36 = _rt::Vec::from_raw_parts(
16739 l34.cast(),
16740 len36,
16741 len36,
16742 );
16743 _rt::string_lift(bytes36)
16744 };
16745 Error::QueryParameterFailure(e46)
16746 }
16747 2 => {
16748 let e46 = {
16749 let l37 = *ptr27.add(12).cast::<*mut u8>();
16750 let l38 = *ptr27.add(16).cast::<usize>();
16751 let len39 = l38;
16752 let bytes39 = _rt::Vec::from_raw_parts(
16753 l37.cast(),
16754 len39,
16755 len39,
16756 );
16757 _rt::string_lift(bytes39)
16758 };
16759 Error::QueryExecutionFailure(e46)
16760 }
16761 3 => {
16762 let e46 = {
16763 let l40 = *ptr27.add(12).cast::<*mut u8>();
16764 let l41 = *ptr27.add(16).cast::<usize>();
16765 let len42 = l41;
16766 let bytes42 = _rt::Vec::from_raw_parts(
16767 l40.cast(),
16768 len42,
16769 len42,
16770 );
16771 _rt::string_lift(bytes42)
16772 };
16773 Error::QueryResponseFailure(e46)
16774 }
16775 n => {
16776 debug_assert_eq!(n, 4, "invalid enum discriminant");
16777 let e46 = {
16778 let l43 = *ptr27.add(12).cast::<*mut u8>();
16779 let l44 = *ptr27.add(16).cast::<usize>();
16780 let len45 = l44;
16781 let bytes45 = _rt::Vec::from_raw_parts(
16782 l43.cast(),
16783 len45,
16784 len45,
16785 );
16786 _rt::string_lift(bytes45)
16787 };
16788 Error::Other(e46)
16789 }
16790 };
16791 v46
16792 };
16793 Err(e)
16794 }
16795 _ => _rt::invalid_enum_discriminant(),
16796 }
16797 }
16798 }
16799 }
16800 impl DbTransaction {
16801 #[allow(unused_unsafe, clippy::all)]
16802 pub fn commit(&self) -> Result<(), Error> {
16803 unsafe {
16804 #[repr(align(4))]
16805 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
16806 let mut ret_area = RetArea(
16807 [::core::mem::MaybeUninit::uninit(); 16],
16808 );
16809 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
16810 #[cfg(target_arch = "wasm32")]
16811 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
16812 extern "C" {
16813 #[link_name = "[method]db-transaction.commit"]
16814 fn wit_import(_: i32, _: *mut u8);
16815 }
16816 #[cfg(not(target_arch = "wasm32"))]
16817 fn wit_import(_: i32, _: *mut u8) {
16818 unreachable!()
16819 }
16820 wit_import((self).handle() as i32, ptr0);
16821 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
16822 match l1 {
16823 0 => {
16824 let e = ();
16825 Ok(e)
16826 }
16827 1 => {
16828 let e = {
16829 let l2 = i32::from(*ptr0.add(4).cast::<u8>());
16830 let v18 = match l2 {
16831 0 => {
16832 let e18 = {
16833 let l3 = *ptr0.add(8).cast::<*mut u8>();
16834 let l4 = *ptr0.add(12).cast::<usize>();
16835 let len5 = l4;
16836 let bytes5 = _rt::Vec::from_raw_parts(
16837 l3.cast(),
16838 len5,
16839 len5,
16840 );
16841 _rt::string_lift(bytes5)
16842 };
16843 Error::ConnectionFailure(e18)
16844 }
16845 1 => {
16846 let e18 = {
16847 let l6 = *ptr0.add(8).cast::<*mut u8>();
16848 let l7 = *ptr0.add(12).cast::<usize>();
16849 let len8 = l7;
16850 let bytes8 = _rt::Vec::from_raw_parts(
16851 l6.cast(),
16852 len8,
16853 len8,
16854 );
16855 _rt::string_lift(bytes8)
16856 };
16857 Error::QueryParameterFailure(e18)
16858 }
16859 2 => {
16860 let e18 = {
16861 let l9 = *ptr0.add(8).cast::<*mut u8>();
16862 let l10 = *ptr0.add(12).cast::<usize>();
16863 let len11 = l10;
16864 let bytes11 = _rt::Vec::from_raw_parts(
16865 l9.cast(),
16866 len11,
16867 len11,
16868 );
16869 _rt::string_lift(bytes11)
16870 };
16871 Error::QueryExecutionFailure(e18)
16872 }
16873 3 => {
16874 let e18 = {
16875 let l12 = *ptr0.add(8).cast::<*mut u8>();
16876 let l13 = *ptr0.add(12).cast::<usize>();
16877 let len14 = l13;
16878 let bytes14 = _rt::Vec::from_raw_parts(
16879 l12.cast(),
16880 len14,
16881 len14,
16882 );
16883 _rt::string_lift(bytes14)
16884 };
16885 Error::QueryResponseFailure(e18)
16886 }
16887 n => {
16888 debug_assert_eq!(n, 4, "invalid enum discriminant");
16889 let e18 = {
16890 let l15 = *ptr0.add(8).cast::<*mut u8>();
16891 let l16 = *ptr0.add(12).cast::<usize>();
16892 let len17 = l16;
16893 let bytes17 = _rt::Vec::from_raw_parts(
16894 l15.cast(),
16895 len17,
16896 len17,
16897 );
16898 _rt::string_lift(bytes17)
16899 };
16900 Error::Other(e18)
16901 }
16902 };
16903 v18
16904 };
16905 Err(e)
16906 }
16907 _ => _rt::invalid_enum_discriminant(),
16908 }
16909 }
16910 }
16911 }
16912 impl DbTransaction {
16913 #[allow(unused_unsafe, clippy::all)]
16914 pub fn rollback(&self) -> Result<(), Error> {
16915 unsafe {
16916 #[repr(align(4))]
16917 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
16918 let mut ret_area = RetArea(
16919 [::core::mem::MaybeUninit::uninit(); 16],
16920 );
16921 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
16922 #[cfg(target_arch = "wasm32")]
16923 #[link(wasm_import_module = "golem:rdbms/mysql@0.0.1")]
16924 extern "C" {
16925 #[link_name = "[method]db-transaction.rollback"]
16926 fn wit_import(_: i32, _: *mut u8);
16927 }
16928 #[cfg(not(target_arch = "wasm32"))]
16929 fn wit_import(_: i32, _: *mut u8) {
16930 unreachable!()
16931 }
16932 wit_import((self).handle() as i32, ptr0);
16933 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
16934 match l1 {
16935 0 => {
16936 let e = ();
16937 Ok(e)
16938 }
16939 1 => {
16940 let e = {
16941 let l2 = i32::from(*ptr0.add(4).cast::<u8>());
16942 let v18 = match l2 {
16943 0 => {
16944 let e18 = {
16945 let l3 = *ptr0.add(8).cast::<*mut u8>();
16946 let l4 = *ptr0.add(12).cast::<usize>();
16947 let len5 = l4;
16948 let bytes5 = _rt::Vec::from_raw_parts(
16949 l3.cast(),
16950 len5,
16951 len5,
16952 );
16953 _rt::string_lift(bytes5)
16954 };
16955 Error::ConnectionFailure(e18)
16956 }
16957 1 => {
16958 let e18 = {
16959 let l6 = *ptr0.add(8).cast::<*mut u8>();
16960 let l7 = *ptr0.add(12).cast::<usize>();
16961 let len8 = l7;
16962 let bytes8 = _rt::Vec::from_raw_parts(
16963 l6.cast(),
16964 len8,
16965 len8,
16966 );
16967 _rt::string_lift(bytes8)
16968 };
16969 Error::QueryParameterFailure(e18)
16970 }
16971 2 => {
16972 let e18 = {
16973 let l9 = *ptr0.add(8).cast::<*mut u8>();
16974 let l10 = *ptr0.add(12).cast::<usize>();
16975 let len11 = l10;
16976 let bytes11 = _rt::Vec::from_raw_parts(
16977 l9.cast(),
16978 len11,
16979 len11,
16980 );
16981 _rt::string_lift(bytes11)
16982 };
16983 Error::QueryExecutionFailure(e18)
16984 }
16985 3 => {
16986 let e18 = {
16987 let l12 = *ptr0.add(8).cast::<*mut u8>();
16988 let l13 = *ptr0.add(12).cast::<usize>();
16989 let len14 = l13;
16990 let bytes14 = _rt::Vec::from_raw_parts(
16991 l12.cast(),
16992 len14,
16993 len14,
16994 );
16995 _rt::string_lift(bytes14)
16996 };
16997 Error::QueryResponseFailure(e18)
16998 }
16999 n => {
17000 debug_assert_eq!(n, 4, "invalid enum discriminant");
17001 let e18 = {
17002 let l15 = *ptr0.add(8).cast::<*mut u8>();
17003 let l16 = *ptr0.add(12).cast::<usize>();
17004 let len17 = l16;
17005 let bytes17 = _rt::Vec::from_raw_parts(
17006 l15.cast(),
17007 len17,
17008 len17,
17009 );
17010 _rt::string_lift(bytes17)
17011 };
17012 Error::Other(e18)
17013 }
17014 };
17015 v18
17016 };
17017 Err(e)
17018 }
17019 _ => _rt::invalid_enum_discriminant(),
17020 }
17021 }
17022 }
17023 }
17024 }
17025 #[allow(dead_code, clippy::all)]
17026 pub mod postgres {
17027 #[used]
17028 #[doc(hidden)]
17029 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
17030 use super::super::super::_rt;
17031 pub type Date = super::super::super::golem::rdbms::types::Date;
17032 pub type Time = super::super::super::golem::rdbms::types::Time;
17033 pub type Timetz = super::super::super::golem::rdbms::types::Timetz;
17034 pub type Timestamp = super::super::super::golem::rdbms::types::Timestamp;
17035 pub type Timestamptz = super::super::super::golem::rdbms::types::Timestamptz;
17036 pub type Uuid = super::super::super::golem::rdbms::types::Uuid;
17037 pub type IpAddress = super::super::super::golem::rdbms::types::IpAddress;
17038 pub type MacAddress = super::super::super::golem::rdbms::types::MacAddress;
17039 #[derive(Clone)]
17040 pub enum Error {
17041 ConnectionFailure(_rt::String),
17042 QueryParameterFailure(_rt::String),
17043 QueryExecutionFailure(_rt::String),
17044 QueryResponseFailure(_rt::String),
17045 Other(_rt::String),
17046 }
17047 impl ::core::fmt::Debug for Error {
17048 fn fmt(
17049 &self,
17050 f: &mut ::core::fmt::Formatter<'_>,
17051 ) -> ::core::fmt::Result {
17052 match self {
17053 Error::ConnectionFailure(e) => {
17054 f.debug_tuple("Error::ConnectionFailure").field(e).finish()
17055 }
17056 Error::QueryParameterFailure(e) => {
17057 f.debug_tuple("Error::QueryParameterFailure")
17058 .field(e)
17059 .finish()
17060 }
17061 Error::QueryExecutionFailure(e) => {
17062 f.debug_tuple("Error::QueryExecutionFailure")
17063 .field(e)
17064 .finish()
17065 }
17066 Error::QueryResponseFailure(e) => {
17067 f.debug_tuple("Error::QueryResponseFailure")
17068 .field(e)
17069 .finish()
17070 }
17071 Error::Other(e) => {
17072 f.debug_tuple("Error::Other").field(e).finish()
17073 }
17074 }
17075 }
17076 }
17077 impl ::core::fmt::Display for Error {
17078 fn fmt(
17079 &self,
17080 f: &mut ::core::fmt::Formatter<'_>,
17081 ) -> ::core::fmt::Result {
17082 write!(f, "{:?}", self)
17083 }
17084 }
17085 impl std::error::Error for Error {}
17086 #[repr(C)]
17087 #[derive(Clone, Copy)]
17088 pub struct Interval {
17089 pub months: i32,
17090 pub days: i32,
17091 pub microseconds: i64,
17092 }
17093 impl ::core::fmt::Debug for Interval {
17094 fn fmt(
17095 &self,
17096 f: &mut ::core::fmt::Formatter<'_>,
17097 ) -> ::core::fmt::Result {
17098 f.debug_struct("Interval")
17099 .field("months", &self.months)
17100 .field("days", &self.days)
17101 .field("microseconds", &self.microseconds)
17102 .finish()
17103 }
17104 }
17105 #[derive(Clone, Copy)]
17106 pub enum Int4bound {
17107 Included(i32),
17108 Excluded(i32),
17109 Unbounded,
17110 }
17111 impl ::core::fmt::Debug for Int4bound {
17112 fn fmt(
17113 &self,
17114 f: &mut ::core::fmt::Formatter<'_>,
17115 ) -> ::core::fmt::Result {
17116 match self {
17117 Int4bound::Included(e) => {
17118 f.debug_tuple("Int4bound::Included").field(e).finish()
17119 }
17120 Int4bound::Excluded(e) => {
17121 f.debug_tuple("Int4bound::Excluded").field(e).finish()
17122 }
17123 Int4bound::Unbounded => {
17124 f.debug_tuple("Int4bound::Unbounded").finish()
17125 }
17126 }
17127 }
17128 }
17129 #[derive(Clone, Copy)]
17130 pub enum Int8bound {
17131 Included(i64),
17132 Excluded(i64),
17133 Unbounded,
17134 }
17135 impl ::core::fmt::Debug for Int8bound {
17136 fn fmt(
17137 &self,
17138 f: &mut ::core::fmt::Formatter<'_>,
17139 ) -> ::core::fmt::Result {
17140 match self {
17141 Int8bound::Included(e) => {
17142 f.debug_tuple("Int8bound::Included").field(e).finish()
17143 }
17144 Int8bound::Excluded(e) => {
17145 f.debug_tuple("Int8bound::Excluded").field(e).finish()
17146 }
17147 Int8bound::Unbounded => {
17148 f.debug_tuple("Int8bound::Unbounded").finish()
17149 }
17150 }
17151 }
17152 }
17153 #[derive(Clone)]
17154 pub enum Numbound {
17155 Included(_rt::String),
17156 Excluded(_rt::String),
17157 Unbounded,
17158 }
17159 impl ::core::fmt::Debug for Numbound {
17160 fn fmt(
17161 &self,
17162 f: &mut ::core::fmt::Formatter<'_>,
17163 ) -> ::core::fmt::Result {
17164 match self {
17165 Numbound::Included(e) => {
17166 f.debug_tuple("Numbound::Included").field(e).finish()
17167 }
17168 Numbound::Excluded(e) => {
17169 f.debug_tuple("Numbound::Excluded").field(e).finish()
17170 }
17171 Numbound::Unbounded => {
17172 f.debug_tuple("Numbound::Unbounded").finish()
17173 }
17174 }
17175 }
17176 }
17177 #[derive(Clone, Copy)]
17178 pub enum Tsbound {
17179 Included(Timestamp),
17180 Excluded(Timestamp),
17181 Unbounded,
17182 }
17183 impl ::core::fmt::Debug for Tsbound {
17184 fn fmt(
17185 &self,
17186 f: &mut ::core::fmt::Formatter<'_>,
17187 ) -> ::core::fmt::Result {
17188 match self {
17189 Tsbound::Included(e) => {
17190 f.debug_tuple("Tsbound::Included").field(e).finish()
17191 }
17192 Tsbound::Excluded(e) => {
17193 f.debug_tuple("Tsbound::Excluded").field(e).finish()
17194 }
17195 Tsbound::Unbounded => {
17196 f.debug_tuple("Tsbound::Unbounded").finish()
17197 }
17198 }
17199 }
17200 }
17201 #[derive(Clone, Copy)]
17202 pub enum Tstzbound {
17203 Included(Timestamptz),
17204 Excluded(Timestamptz),
17205 Unbounded,
17206 }
17207 impl ::core::fmt::Debug for Tstzbound {
17208 fn fmt(
17209 &self,
17210 f: &mut ::core::fmt::Formatter<'_>,
17211 ) -> ::core::fmt::Result {
17212 match self {
17213 Tstzbound::Included(e) => {
17214 f.debug_tuple("Tstzbound::Included").field(e).finish()
17215 }
17216 Tstzbound::Excluded(e) => {
17217 f.debug_tuple("Tstzbound::Excluded").field(e).finish()
17218 }
17219 Tstzbound::Unbounded => {
17220 f.debug_tuple("Tstzbound::Unbounded").finish()
17221 }
17222 }
17223 }
17224 }
17225 #[derive(Clone, Copy)]
17226 pub enum Datebound {
17227 Included(Date),
17228 Excluded(Date),
17229 Unbounded,
17230 }
17231 impl ::core::fmt::Debug for Datebound {
17232 fn fmt(
17233 &self,
17234 f: &mut ::core::fmt::Formatter<'_>,
17235 ) -> ::core::fmt::Result {
17236 match self {
17237 Datebound::Included(e) => {
17238 f.debug_tuple("Datebound::Included").field(e).finish()
17239 }
17240 Datebound::Excluded(e) => {
17241 f.debug_tuple("Datebound::Excluded").field(e).finish()
17242 }
17243 Datebound::Unbounded => {
17244 f.debug_tuple("Datebound::Unbounded").finish()
17245 }
17246 }
17247 }
17248 }
17249 #[repr(C)]
17250 #[derive(Clone, Copy)]
17251 pub struct Int4range {
17252 pub start: Int4bound,
17253 pub end: Int4bound,
17254 }
17255 impl ::core::fmt::Debug for Int4range {
17256 fn fmt(
17257 &self,
17258 f: &mut ::core::fmt::Formatter<'_>,
17259 ) -> ::core::fmt::Result {
17260 f.debug_struct("Int4range")
17261 .field("start", &self.start)
17262 .field("end", &self.end)
17263 .finish()
17264 }
17265 }
17266 #[repr(C)]
17267 #[derive(Clone, Copy)]
17268 pub struct Int8range {
17269 pub start: Int8bound,
17270 pub end: Int8bound,
17271 }
17272 impl ::core::fmt::Debug for Int8range {
17273 fn fmt(
17274 &self,
17275 f: &mut ::core::fmt::Formatter<'_>,
17276 ) -> ::core::fmt::Result {
17277 f.debug_struct("Int8range")
17278 .field("start", &self.start)
17279 .field("end", &self.end)
17280 .finish()
17281 }
17282 }
17283 #[derive(Clone)]
17284 pub struct Numrange {
17285 pub start: Numbound,
17286 pub end: Numbound,
17287 }
17288 impl ::core::fmt::Debug for Numrange {
17289 fn fmt(
17290 &self,
17291 f: &mut ::core::fmt::Formatter<'_>,
17292 ) -> ::core::fmt::Result {
17293 f.debug_struct("Numrange")
17294 .field("start", &self.start)
17295 .field("end", &self.end)
17296 .finish()
17297 }
17298 }
17299 #[repr(C)]
17300 #[derive(Clone, Copy)]
17301 pub struct Tsrange {
17302 pub start: Tsbound,
17303 pub end: Tsbound,
17304 }
17305 impl ::core::fmt::Debug for Tsrange {
17306 fn fmt(
17307 &self,
17308 f: &mut ::core::fmt::Formatter<'_>,
17309 ) -> ::core::fmt::Result {
17310 f.debug_struct("Tsrange")
17311 .field("start", &self.start)
17312 .field("end", &self.end)
17313 .finish()
17314 }
17315 }
17316 #[repr(C)]
17317 #[derive(Clone, Copy)]
17318 pub struct Tstzrange {
17319 pub start: Tstzbound,
17320 pub end: Tstzbound,
17321 }
17322 impl ::core::fmt::Debug for Tstzrange {
17323 fn fmt(
17324 &self,
17325 f: &mut ::core::fmt::Formatter<'_>,
17326 ) -> ::core::fmt::Result {
17327 f.debug_struct("Tstzrange")
17328 .field("start", &self.start)
17329 .field("end", &self.end)
17330 .finish()
17331 }
17332 }
17333 #[repr(C)]
17334 #[derive(Clone, Copy)]
17335 pub struct Daterange {
17336 pub start: Datebound,
17337 pub end: Datebound,
17338 }
17339 impl ::core::fmt::Debug for Daterange {
17340 fn fmt(
17341 &self,
17342 f: &mut ::core::fmt::Formatter<'_>,
17343 ) -> ::core::fmt::Result {
17344 f.debug_struct("Daterange")
17345 .field("start", &self.start)
17346 .field("end", &self.end)
17347 .finish()
17348 }
17349 }
17350 #[derive(Clone)]
17351 pub struct EnumerationType {
17352 pub name: _rt::String,
17353 }
17354 impl ::core::fmt::Debug for EnumerationType {
17355 fn fmt(
17356 &self,
17357 f: &mut ::core::fmt::Formatter<'_>,
17358 ) -> ::core::fmt::Result {
17359 f.debug_struct("EnumerationType").field("name", &self.name).finish()
17360 }
17361 }
17362 #[derive(Clone)]
17363 pub struct Enumeration {
17364 pub name: _rt::String,
17365 pub value: _rt::String,
17366 }
17367 impl ::core::fmt::Debug for Enumeration {
17368 fn fmt(
17369 &self,
17370 f: &mut ::core::fmt::Formatter<'_>,
17371 ) -> ::core::fmt::Result {
17372 f.debug_struct("Enumeration")
17373 .field("name", &self.name)
17374 .field("value", &self.value)
17375 .finish()
17376 }
17377 }
17378 #[derive(Debug)]
17379 #[repr(transparent)]
17380 pub struct LazyDbValue {
17381 handle: _rt::Resource<LazyDbValue>,
17382 }
17383 impl LazyDbValue {
17384 #[doc(hidden)]
17385 pub unsafe fn from_handle(handle: u32) -> Self {
17386 Self {
17387 handle: _rt::Resource::from_handle(handle),
17388 }
17389 }
17390 #[doc(hidden)]
17391 pub fn take_handle(&self) -> u32 {
17392 _rt::Resource::take_handle(&self.handle)
17393 }
17394 #[doc(hidden)]
17395 pub fn handle(&self) -> u32 {
17396 _rt::Resource::handle(&self.handle)
17397 }
17398 }
17399 unsafe impl _rt::WasmResource for LazyDbValue {
17400 #[inline]
17401 unsafe fn drop(_handle: u32) {
17402 #[cfg(not(target_arch = "wasm32"))]
17403 unreachable!();
17404 #[cfg(target_arch = "wasm32")]
17405 {
17406 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
17407 extern "C" {
17408 #[link_name = "[resource-drop]lazy-db-value"]
17409 fn drop(_: u32);
17410 }
17411 drop(_handle);
17412 }
17413 }
17414 }
17415 pub struct Composite {
17416 pub name: _rt::String,
17417 pub values: _rt::Vec<LazyDbValue>,
17418 }
17419 impl ::core::fmt::Debug for Composite {
17420 fn fmt(
17421 &self,
17422 f: &mut ::core::fmt::Formatter<'_>,
17423 ) -> ::core::fmt::Result {
17424 f.debug_struct("Composite")
17425 .field("name", &self.name)
17426 .field("values", &self.values)
17427 .finish()
17428 }
17429 }
17430 pub struct Domain {
17431 pub name: _rt::String,
17432 pub value: LazyDbValue,
17433 }
17434 impl ::core::fmt::Debug for Domain {
17435 fn fmt(
17436 &self,
17437 f: &mut ::core::fmt::Formatter<'_>,
17438 ) -> ::core::fmt::Result {
17439 f.debug_struct("Domain")
17440 .field("name", &self.name)
17441 .field("value", &self.value)
17442 .finish()
17443 }
17444 }
17445 pub enum ValueBound {
17446 Included(LazyDbValue),
17447 Excluded(LazyDbValue),
17448 Unbounded,
17449 }
17450 impl ::core::fmt::Debug for ValueBound {
17451 fn fmt(
17452 &self,
17453 f: &mut ::core::fmt::Formatter<'_>,
17454 ) -> ::core::fmt::Result {
17455 match self {
17456 ValueBound::Included(e) => {
17457 f.debug_tuple("ValueBound::Included").field(e).finish()
17458 }
17459 ValueBound::Excluded(e) => {
17460 f.debug_tuple("ValueBound::Excluded").field(e).finish()
17461 }
17462 ValueBound::Unbounded => {
17463 f.debug_tuple("ValueBound::Unbounded").finish()
17464 }
17465 }
17466 }
17467 }
17468 pub struct ValuesRange {
17469 pub start: ValueBound,
17470 pub end: ValueBound,
17471 }
17472 impl ::core::fmt::Debug for ValuesRange {
17473 fn fmt(
17474 &self,
17475 f: &mut ::core::fmt::Formatter<'_>,
17476 ) -> ::core::fmt::Result {
17477 f.debug_struct("ValuesRange")
17478 .field("start", &self.start)
17479 .field("end", &self.end)
17480 .finish()
17481 }
17482 }
17483 pub struct Range {
17484 pub name: _rt::String,
17485 pub value: ValuesRange,
17486 }
17487 impl ::core::fmt::Debug for Range {
17488 fn fmt(
17489 &self,
17490 f: &mut ::core::fmt::Formatter<'_>,
17491 ) -> ::core::fmt::Result {
17492 f.debug_struct("Range")
17493 .field("name", &self.name)
17494 .field("value", &self.value)
17495 .finish()
17496 }
17497 }
17498 pub enum DbValue {
17499 Character(i8),
17500 Int2(i16),
17501 Int4(i32),
17502 Int8(i64),
17503 Float4(f32),
17504 Float8(f64),
17505 Numeric(_rt::String),
17506 Boolean(bool),
17507 Text(_rt::String),
17508 Varchar(_rt::String),
17509 Bpchar(_rt::String),
17510 Timestamp(Timestamp),
17511 Timestamptz(Timestamptz),
17512 Date(Date),
17513 Time(Time),
17514 Timetz(Timetz),
17515 Interval(Interval),
17516 Bytea(_rt::Vec<u8>),
17517 Json(_rt::String),
17518 Jsonb(_rt::String),
17519 Jsonpath(_rt::String),
17520 Xml(_rt::String),
17521 Uuid(Uuid),
17522 Inet(IpAddress),
17523 Cidr(IpAddress),
17524 Macaddr(MacAddress),
17525 Bit(_rt::Vec<bool>),
17526 Varbit(_rt::Vec<bool>),
17527 Int4range(Int4range),
17528 Int8range(Int8range),
17529 Numrange(Numrange),
17530 Tsrange(Tsrange),
17531 Tstzrange(Tstzrange),
17532 Daterange(Daterange),
17533 Money(i64),
17534 Oid(u32),
17535 Enumeration(Enumeration),
17536 Composite(Composite),
17537 Domain(Domain),
17538 Array(_rt::Vec<LazyDbValue>),
17539 Range(Range),
17540 Null,
17541 }
17542 impl ::core::fmt::Debug for DbValue {
17543 fn fmt(
17544 &self,
17545 f: &mut ::core::fmt::Formatter<'_>,
17546 ) -> ::core::fmt::Result {
17547 match self {
17548 DbValue::Character(e) => {
17549 f.debug_tuple("DbValue::Character").field(e).finish()
17550 }
17551 DbValue::Int2(e) => {
17552 f.debug_tuple("DbValue::Int2").field(e).finish()
17553 }
17554 DbValue::Int4(e) => {
17555 f.debug_tuple("DbValue::Int4").field(e).finish()
17556 }
17557 DbValue::Int8(e) => {
17558 f.debug_tuple("DbValue::Int8").field(e).finish()
17559 }
17560 DbValue::Float4(e) => {
17561 f.debug_tuple("DbValue::Float4").field(e).finish()
17562 }
17563 DbValue::Float8(e) => {
17564 f.debug_tuple("DbValue::Float8").field(e).finish()
17565 }
17566 DbValue::Numeric(e) => {
17567 f.debug_tuple("DbValue::Numeric").field(e).finish()
17568 }
17569 DbValue::Boolean(e) => {
17570 f.debug_tuple("DbValue::Boolean").field(e).finish()
17571 }
17572 DbValue::Text(e) => {
17573 f.debug_tuple("DbValue::Text").field(e).finish()
17574 }
17575 DbValue::Varchar(e) => {
17576 f.debug_tuple("DbValue::Varchar").field(e).finish()
17577 }
17578 DbValue::Bpchar(e) => {
17579 f.debug_tuple("DbValue::Bpchar").field(e).finish()
17580 }
17581 DbValue::Timestamp(e) => {
17582 f.debug_tuple("DbValue::Timestamp").field(e).finish()
17583 }
17584 DbValue::Timestamptz(e) => {
17585 f.debug_tuple("DbValue::Timestamptz").field(e).finish()
17586 }
17587 DbValue::Date(e) => {
17588 f.debug_tuple("DbValue::Date").field(e).finish()
17589 }
17590 DbValue::Time(e) => {
17591 f.debug_tuple("DbValue::Time").field(e).finish()
17592 }
17593 DbValue::Timetz(e) => {
17594 f.debug_tuple("DbValue::Timetz").field(e).finish()
17595 }
17596 DbValue::Interval(e) => {
17597 f.debug_tuple("DbValue::Interval").field(e).finish()
17598 }
17599 DbValue::Bytea(e) => {
17600 f.debug_tuple("DbValue::Bytea").field(e).finish()
17601 }
17602 DbValue::Json(e) => {
17603 f.debug_tuple("DbValue::Json").field(e).finish()
17604 }
17605 DbValue::Jsonb(e) => {
17606 f.debug_tuple("DbValue::Jsonb").field(e).finish()
17607 }
17608 DbValue::Jsonpath(e) => {
17609 f.debug_tuple("DbValue::Jsonpath").field(e).finish()
17610 }
17611 DbValue::Xml(e) => {
17612 f.debug_tuple("DbValue::Xml").field(e).finish()
17613 }
17614 DbValue::Uuid(e) => {
17615 f.debug_tuple("DbValue::Uuid").field(e).finish()
17616 }
17617 DbValue::Inet(e) => {
17618 f.debug_tuple("DbValue::Inet").field(e).finish()
17619 }
17620 DbValue::Cidr(e) => {
17621 f.debug_tuple("DbValue::Cidr").field(e).finish()
17622 }
17623 DbValue::Macaddr(e) => {
17624 f.debug_tuple("DbValue::Macaddr").field(e).finish()
17625 }
17626 DbValue::Bit(e) => {
17627 f.debug_tuple("DbValue::Bit").field(e).finish()
17628 }
17629 DbValue::Varbit(e) => {
17630 f.debug_tuple("DbValue::Varbit").field(e).finish()
17631 }
17632 DbValue::Int4range(e) => {
17633 f.debug_tuple("DbValue::Int4range").field(e).finish()
17634 }
17635 DbValue::Int8range(e) => {
17636 f.debug_tuple("DbValue::Int8range").field(e).finish()
17637 }
17638 DbValue::Numrange(e) => {
17639 f.debug_tuple("DbValue::Numrange").field(e).finish()
17640 }
17641 DbValue::Tsrange(e) => {
17642 f.debug_tuple("DbValue::Tsrange").field(e).finish()
17643 }
17644 DbValue::Tstzrange(e) => {
17645 f.debug_tuple("DbValue::Tstzrange").field(e).finish()
17646 }
17647 DbValue::Daterange(e) => {
17648 f.debug_tuple("DbValue::Daterange").field(e).finish()
17649 }
17650 DbValue::Money(e) => {
17651 f.debug_tuple("DbValue::Money").field(e).finish()
17652 }
17653 DbValue::Oid(e) => {
17654 f.debug_tuple("DbValue::Oid").field(e).finish()
17655 }
17656 DbValue::Enumeration(e) => {
17657 f.debug_tuple("DbValue::Enumeration").field(e).finish()
17658 }
17659 DbValue::Composite(e) => {
17660 f.debug_tuple("DbValue::Composite").field(e).finish()
17661 }
17662 DbValue::Domain(e) => {
17663 f.debug_tuple("DbValue::Domain").field(e).finish()
17664 }
17665 DbValue::Array(e) => {
17666 f.debug_tuple("DbValue::Array").field(e).finish()
17667 }
17668 DbValue::Range(e) => {
17669 f.debug_tuple("DbValue::Range").field(e).finish()
17670 }
17671 DbValue::Null => f.debug_tuple("DbValue::Null").finish(),
17672 }
17673 }
17674 }
17675 #[derive(Debug)]
17676 #[repr(transparent)]
17677 pub struct LazyDbColumnType {
17678 handle: _rt::Resource<LazyDbColumnType>,
17679 }
17680 impl LazyDbColumnType {
17681 #[doc(hidden)]
17682 pub unsafe fn from_handle(handle: u32) -> Self {
17683 Self {
17684 handle: _rt::Resource::from_handle(handle),
17685 }
17686 }
17687 #[doc(hidden)]
17688 pub fn take_handle(&self) -> u32 {
17689 _rt::Resource::take_handle(&self.handle)
17690 }
17691 #[doc(hidden)]
17692 pub fn handle(&self) -> u32 {
17693 _rt::Resource::handle(&self.handle)
17694 }
17695 }
17696 unsafe impl _rt::WasmResource for LazyDbColumnType {
17697 #[inline]
17698 unsafe fn drop(_handle: u32) {
17699 #[cfg(not(target_arch = "wasm32"))]
17700 unreachable!();
17701 #[cfg(target_arch = "wasm32")]
17702 {
17703 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
17704 extern "C" {
17705 #[link_name = "[resource-drop]lazy-db-column-type"]
17706 fn drop(_: u32);
17707 }
17708 drop(_handle);
17709 }
17710 }
17711 }
17712 pub struct CompositeType {
17713 pub name: _rt::String,
17714 pub attributes: _rt::Vec<(_rt::String, LazyDbColumnType)>,
17715 }
17716 impl ::core::fmt::Debug for CompositeType {
17717 fn fmt(
17718 &self,
17719 f: &mut ::core::fmt::Formatter<'_>,
17720 ) -> ::core::fmt::Result {
17721 f.debug_struct("CompositeType")
17722 .field("name", &self.name)
17723 .field("attributes", &self.attributes)
17724 .finish()
17725 }
17726 }
17727 pub struct DomainType {
17728 pub name: _rt::String,
17729 pub base_type: LazyDbColumnType,
17730 }
17731 impl ::core::fmt::Debug for DomainType {
17732 fn fmt(
17733 &self,
17734 f: &mut ::core::fmt::Formatter<'_>,
17735 ) -> ::core::fmt::Result {
17736 f.debug_struct("DomainType")
17737 .field("name", &self.name)
17738 .field("base-type", &self.base_type)
17739 .finish()
17740 }
17741 }
17742 pub struct RangeType {
17743 pub name: _rt::String,
17744 pub base_type: LazyDbColumnType,
17745 }
17746 impl ::core::fmt::Debug for RangeType {
17747 fn fmt(
17748 &self,
17749 f: &mut ::core::fmt::Formatter<'_>,
17750 ) -> ::core::fmt::Result {
17751 f.debug_struct("RangeType")
17752 .field("name", &self.name)
17753 .field("base-type", &self.base_type)
17754 .finish()
17755 }
17756 }
17757 pub enum DbColumnType {
17758 Character,
17759 Int2,
17760 Int4,
17761 Int8,
17762 Float4,
17763 Float8,
17764 Numeric,
17765 Boolean,
17766 Text,
17767 Varchar,
17768 Bpchar,
17769 Timestamp,
17770 Timestamptz,
17771 Date,
17772 Time,
17773 Timetz,
17774 Interval,
17775 Bytea,
17776 Uuid,
17777 Xml,
17778 Json,
17779 Jsonb,
17780 Jsonpath,
17781 Inet,
17782 Cidr,
17783 Macaddr,
17784 Bit,
17785 Varbit,
17786 Int4range,
17787 Int8range,
17788 Numrange,
17789 Tsrange,
17790 Tstzrange,
17791 Daterange,
17792 Money,
17793 Oid,
17794 Enumeration(EnumerationType),
17795 Composite(CompositeType),
17796 Domain(DomainType),
17797 Array(LazyDbColumnType),
17798 Range(RangeType),
17799 }
17800 impl ::core::fmt::Debug for DbColumnType {
17801 fn fmt(
17802 &self,
17803 f: &mut ::core::fmt::Formatter<'_>,
17804 ) -> ::core::fmt::Result {
17805 match self {
17806 DbColumnType::Character => {
17807 f.debug_tuple("DbColumnType::Character").finish()
17808 }
17809 DbColumnType::Int2 => {
17810 f.debug_tuple("DbColumnType::Int2").finish()
17811 }
17812 DbColumnType::Int4 => {
17813 f.debug_tuple("DbColumnType::Int4").finish()
17814 }
17815 DbColumnType::Int8 => {
17816 f.debug_tuple("DbColumnType::Int8").finish()
17817 }
17818 DbColumnType::Float4 => {
17819 f.debug_tuple("DbColumnType::Float4").finish()
17820 }
17821 DbColumnType::Float8 => {
17822 f.debug_tuple("DbColumnType::Float8").finish()
17823 }
17824 DbColumnType::Numeric => {
17825 f.debug_tuple("DbColumnType::Numeric").finish()
17826 }
17827 DbColumnType::Boolean => {
17828 f.debug_tuple("DbColumnType::Boolean").finish()
17829 }
17830 DbColumnType::Text => {
17831 f.debug_tuple("DbColumnType::Text").finish()
17832 }
17833 DbColumnType::Varchar => {
17834 f.debug_tuple("DbColumnType::Varchar").finish()
17835 }
17836 DbColumnType::Bpchar => {
17837 f.debug_tuple("DbColumnType::Bpchar").finish()
17838 }
17839 DbColumnType::Timestamp => {
17840 f.debug_tuple("DbColumnType::Timestamp").finish()
17841 }
17842 DbColumnType::Timestamptz => {
17843 f.debug_tuple("DbColumnType::Timestamptz").finish()
17844 }
17845 DbColumnType::Date => {
17846 f.debug_tuple("DbColumnType::Date").finish()
17847 }
17848 DbColumnType::Time => {
17849 f.debug_tuple("DbColumnType::Time").finish()
17850 }
17851 DbColumnType::Timetz => {
17852 f.debug_tuple("DbColumnType::Timetz").finish()
17853 }
17854 DbColumnType::Interval => {
17855 f.debug_tuple("DbColumnType::Interval").finish()
17856 }
17857 DbColumnType::Bytea => {
17858 f.debug_tuple("DbColumnType::Bytea").finish()
17859 }
17860 DbColumnType::Uuid => {
17861 f.debug_tuple("DbColumnType::Uuid").finish()
17862 }
17863 DbColumnType::Xml => f.debug_tuple("DbColumnType::Xml").finish(),
17864 DbColumnType::Json => {
17865 f.debug_tuple("DbColumnType::Json").finish()
17866 }
17867 DbColumnType::Jsonb => {
17868 f.debug_tuple("DbColumnType::Jsonb").finish()
17869 }
17870 DbColumnType::Jsonpath => {
17871 f.debug_tuple("DbColumnType::Jsonpath").finish()
17872 }
17873 DbColumnType::Inet => {
17874 f.debug_tuple("DbColumnType::Inet").finish()
17875 }
17876 DbColumnType::Cidr => {
17877 f.debug_tuple("DbColumnType::Cidr").finish()
17878 }
17879 DbColumnType::Macaddr => {
17880 f.debug_tuple("DbColumnType::Macaddr").finish()
17881 }
17882 DbColumnType::Bit => f.debug_tuple("DbColumnType::Bit").finish(),
17883 DbColumnType::Varbit => {
17884 f.debug_tuple("DbColumnType::Varbit").finish()
17885 }
17886 DbColumnType::Int4range => {
17887 f.debug_tuple("DbColumnType::Int4range").finish()
17888 }
17889 DbColumnType::Int8range => {
17890 f.debug_tuple("DbColumnType::Int8range").finish()
17891 }
17892 DbColumnType::Numrange => {
17893 f.debug_tuple("DbColumnType::Numrange").finish()
17894 }
17895 DbColumnType::Tsrange => {
17896 f.debug_tuple("DbColumnType::Tsrange").finish()
17897 }
17898 DbColumnType::Tstzrange => {
17899 f.debug_tuple("DbColumnType::Tstzrange").finish()
17900 }
17901 DbColumnType::Daterange => {
17902 f.debug_tuple("DbColumnType::Daterange").finish()
17903 }
17904 DbColumnType::Money => {
17905 f.debug_tuple("DbColumnType::Money").finish()
17906 }
17907 DbColumnType::Oid => f.debug_tuple("DbColumnType::Oid").finish(),
17908 DbColumnType::Enumeration(e) => {
17909 f.debug_tuple("DbColumnType::Enumeration").field(e).finish()
17910 }
17911 DbColumnType::Composite(e) => {
17912 f.debug_tuple("DbColumnType::Composite").field(e).finish()
17913 }
17914 DbColumnType::Domain(e) => {
17915 f.debug_tuple("DbColumnType::Domain").field(e).finish()
17916 }
17917 DbColumnType::Array(e) => {
17918 f.debug_tuple("DbColumnType::Array").field(e).finish()
17919 }
17920 DbColumnType::Range(e) => {
17921 f.debug_tuple("DbColumnType::Range").field(e).finish()
17922 }
17923 }
17924 }
17925 }
17926 pub struct DbColumn {
17927 pub ordinal: u64,
17928 pub name: _rt::String,
17929 pub db_type: DbColumnType,
17930 pub db_type_name: _rt::String,
17931 }
17932 impl ::core::fmt::Debug for DbColumn {
17933 fn fmt(
17934 &self,
17935 f: &mut ::core::fmt::Formatter<'_>,
17936 ) -> ::core::fmt::Result {
17937 f.debug_struct("DbColumn")
17938 .field("ordinal", &self.ordinal)
17939 .field("name", &self.name)
17940 .field("db-type", &self.db_type)
17941 .field("db-type-name", &self.db_type_name)
17942 .finish()
17943 }
17944 }
17945 /// A single row of values
17946 pub struct DbRow {
17947 pub values: _rt::Vec<DbValue>,
17948 }
17949 impl ::core::fmt::Debug for DbRow {
17950 fn fmt(
17951 &self,
17952 f: &mut ::core::fmt::Formatter<'_>,
17953 ) -> ::core::fmt::Result {
17954 f.debug_struct("DbRow").field("values", &self.values).finish()
17955 }
17956 }
17957 pub struct DbResult {
17958 pub columns: _rt::Vec<DbColumn>,
17959 pub rows: _rt::Vec<DbRow>,
17960 }
17961 impl ::core::fmt::Debug for DbResult {
17962 fn fmt(
17963 &self,
17964 f: &mut ::core::fmt::Formatter<'_>,
17965 ) -> ::core::fmt::Result {
17966 f.debug_struct("DbResult")
17967 .field("columns", &self.columns)
17968 .field("rows", &self.rows)
17969 .finish()
17970 }
17971 }
17972 /// A potentially very large and lazy stream of rows:
17973 #[derive(Debug)]
17974 #[repr(transparent)]
17975 pub struct DbResultStream {
17976 handle: _rt::Resource<DbResultStream>,
17977 }
17978 impl DbResultStream {
17979 #[doc(hidden)]
17980 pub unsafe fn from_handle(handle: u32) -> Self {
17981 Self {
17982 handle: _rt::Resource::from_handle(handle),
17983 }
17984 }
17985 #[doc(hidden)]
17986 pub fn take_handle(&self) -> u32 {
17987 _rt::Resource::take_handle(&self.handle)
17988 }
17989 #[doc(hidden)]
17990 pub fn handle(&self) -> u32 {
17991 _rt::Resource::handle(&self.handle)
17992 }
17993 }
17994 unsafe impl _rt::WasmResource for DbResultStream {
17995 #[inline]
17996 unsafe fn drop(_handle: u32) {
17997 #[cfg(not(target_arch = "wasm32"))]
17998 unreachable!();
17999 #[cfg(target_arch = "wasm32")]
18000 {
18001 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
18002 extern "C" {
18003 #[link_name = "[resource-drop]db-result-stream"]
18004 fn drop(_: u32);
18005 }
18006 drop(_handle);
18007 }
18008 }
18009 }
18010 #[derive(Debug)]
18011 #[repr(transparent)]
18012 pub struct DbConnection {
18013 handle: _rt::Resource<DbConnection>,
18014 }
18015 impl DbConnection {
18016 #[doc(hidden)]
18017 pub unsafe fn from_handle(handle: u32) -> Self {
18018 Self {
18019 handle: _rt::Resource::from_handle(handle),
18020 }
18021 }
18022 #[doc(hidden)]
18023 pub fn take_handle(&self) -> u32 {
18024 _rt::Resource::take_handle(&self.handle)
18025 }
18026 #[doc(hidden)]
18027 pub fn handle(&self) -> u32 {
18028 _rt::Resource::handle(&self.handle)
18029 }
18030 }
18031 unsafe impl _rt::WasmResource for DbConnection {
18032 #[inline]
18033 unsafe fn drop(_handle: u32) {
18034 #[cfg(not(target_arch = "wasm32"))]
18035 unreachable!();
18036 #[cfg(target_arch = "wasm32")]
18037 {
18038 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
18039 extern "C" {
18040 #[link_name = "[resource-drop]db-connection"]
18041 fn drop(_: u32);
18042 }
18043 drop(_handle);
18044 }
18045 }
18046 }
18047 #[derive(Debug)]
18048 #[repr(transparent)]
18049 pub struct DbTransaction {
18050 handle: _rt::Resource<DbTransaction>,
18051 }
18052 impl DbTransaction {
18053 #[doc(hidden)]
18054 pub unsafe fn from_handle(handle: u32) -> Self {
18055 Self {
18056 handle: _rt::Resource::from_handle(handle),
18057 }
18058 }
18059 #[doc(hidden)]
18060 pub fn take_handle(&self) -> u32 {
18061 _rt::Resource::take_handle(&self.handle)
18062 }
18063 #[doc(hidden)]
18064 pub fn handle(&self) -> u32 {
18065 _rt::Resource::handle(&self.handle)
18066 }
18067 }
18068 unsafe impl _rt::WasmResource for DbTransaction {
18069 #[inline]
18070 unsafe fn drop(_handle: u32) {
18071 #[cfg(not(target_arch = "wasm32"))]
18072 unreachable!();
18073 #[cfg(target_arch = "wasm32")]
18074 {
18075 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
18076 extern "C" {
18077 #[link_name = "[resource-drop]db-transaction"]
18078 fn drop(_: u32);
18079 }
18080 drop(_handle);
18081 }
18082 }
18083 }
18084 impl LazyDbValue {
18085 #[allow(unused_unsafe, clippy::all)]
18086 pub fn new(value: DbValue) -> Self {
18087 unsafe {
18088 let mut cleanup_list = _rt::Vec::new();
18089 #[repr(align(8))]
18090 struct RetArea([::core::mem::MaybeUninit<u8>; 56]);
18091 let mut ret_area = RetArea(
18092 [::core::mem::MaybeUninit::uninit(); 56],
18093 );
18094 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
18095 match &value {
18096 DbValue::Character(e) => {
18097 *ptr0.add(0).cast::<u8>() = (0i32) as u8;
18098 *ptr0.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
18099 }
18100 DbValue::Int2(e) => {
18101 *ptr0.add(0).cast::<u8>() = (1i32) as u8;
18102 *ptr0.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
18103 }
18104 DbValue::Int4(e) => {
18105 *ptr0.add(0).cast::<u8>() = (2i32) as u8;
18106 *ptr0.add(8).cast::<i32>() = _rt::as_i32(e);
18107 }
18108 DbValue::Int8(e) => {
18109 *ptr0.add(0).cast::<u8>() = (3i32) as u8;
18110 *ptr0.add(8).cast::<i64>() = _rt::as_i64(e);
18111 }
18112 DbValue::Float4(e) => {
18113 *ptr0.add(0).cast::<u8>() = (4i32) as u8;
18114 *ptr0.add(8).cast::<f32>() = _rt::as_f32(e);
18115 }
18116 DbValue::Float8(e) => {
18117 *ptr0.add(0).cast::<u8>() = (5i32) as u8;
18118 *ptr0.add(8).cast::<f64>() = _rt::as_f64(e);
18119 }
18120 DbValue::Numeric(e) => {
18121 *ptr0.add(0).cast::<u8>() = (6i32) as u8;
18122 let vec1 = e;
18123 let ptr1 = vec1.as_ptr().cast::<u8>();
18124 let len1 = vec1.len();
18125 *ptr0.add(12).cast::<usize>() = len1;
18126 *ptr0.add(8).cast::<*mut u8>() = ptr1.cast_mut();
18127 }
18128 DbValue::Boolean(e) => {
18129 *ptr0.add(0).cast::<u8>() = (7i32) as u8;
18130 *ptr0.add(8).cast::<u8>() = (match e {
18131 true => 1,
18132 false => 0,
18133 }) as u8;
18134 }
18135 DbValue::Text(e) => {
18136 *ptr0.add(0).cast::<u8>() = (8i32) as u8;
18137 let vec2 = e;
18138 let ptr2 = vec2.as_ptr().cast::<u8>();
18139 let len2 = vec2.len();
18140 *ptr0.add(12).cast::<usize>() = len2;
18141 *ptr0.add(8).cast::<*mut u8>() = ptr2.cast_mut();
18142 }
18143 DbValue::Varchar(e) => {
18144 *ptr0.add(0).cast::<u8>() = (9i32) as u8;
18145 let vec3 = e;
18146 let ptr3 = vec3.as_ptr().cast::<u8>();
18147 let len3 = vec3.len();
18148 *ptr0.add(12).cast::<usize>() = len3;
18149 *ptr0.add(8).cast::<*mut u8>() = ptr3.cast_mut();
18150 }
18151 DbValue::Bpchar(e) => {
18152 *ptr0.add(0).cast::<u8>() = (10i32) as u8;
18153 let vec4 = e;
18154 let ptr4 = vec4.as_ptr().cast::<u8>();
18155 let len4 = vec4.len();
18156 *ptr0.add(12).cast::<usize>() = len4;
18157 *ptr0.add(8).cast::<*mut u8>() = ptr4.cast_mut();
18158 }
18159 DbValue::Timestamp(e) => {
18160 *ptr0.add(0).cast::<u8>() = (11i32) as u8;
18161 let super::super::super::golem::rdbms::types::Timestamp {
18162 date: date5,
18163 time: time5,
18164 } = e;
18165 let super::super::super::golem::rdbms::types::Date {
18166 year: year6,
18167 month: month6,
18168 day: day6,
18169 } = date5;
18170 *ptr0.add(8).cast::<i32>() = _rt::as_i32(year6);
18171 *ptr0.add(12).cast::<u8>() = (_rt::as_i32(month6)) as u8;
18172 *ptr0.add(13).cast::<u8>() = (_rt::as_i32(day6)) as u8;
18173 let super::super::super::golem::rdbms::types::Time {
18174 hour: hour7,
18175 minute: minute7,
18176 second: second7,
18177 nanosecond: nanosecond7,
18178 } = time5;
18179 *ptr0.add(16).cast::<u8>() = (_rt::as_i32(hour7)) as u8;
18180 *ptr0.add(17).cast::<u8>() = (_rt::as_i32(minute7)) as u8;
18181 *ptr0.add(18).cast::<u8>() = (_rt::as_i32(second7)) as u8;
18182 *ptr0.add(20).cast::<i32>() = _rt::as_i32(nanosecond7);
18183 }
18184 DbValue::Timestamptz(e) => {
18185 *ptr0.add(0).cast::<u8>() = (12i32) as u8;
18186 let super::super::super::golem::rdbms::types::Timestamptz {
18187 timestamp: timestamp8,
18188 offset: offset8,
18189 } = e;
18190 let super::super::super::golem::rdbms::types::Timestamp {
18191 date: date9,
18192 time: time9,
18193 } = timestamp8;
18194 let super::super::super::golem::rdbms::types::Date {
18195 year: year10,
18196 month: month10,
18197 day: day10,
18198 } = date9;
18199 *ptr0.add(8).cast::<i32>() = _rt::as_i32(year10);
18200 *ptr0.add(12).cast::<u8>() = (_rt::as_i32(month10)) as u8;
18201 *ptr0.add(13).cast::<u8>() = (_rt::as_i32(day10)) as u8;
18202 let super::super::super::golem::rdbms::types::Time {
18203 hour: hour11,
18204 minute: minute11,
18205 second: second11,
18206 nanosecond: nanosecond11,
18207 } = time9;
18208 *ptr0.add(16).cast::<u8>() = (_rt::as_i32(hour11)) as u8;
18209 *ptr0.add(17).cast::<u8>() = (_rt::as_i32(minute11)) as u8;
18210 *ptr0.add(18).cast::<u8>() = (_rt::as_i32(second11)) as u8;
18211 *ptr0.add(20).cast::<i32>() = _rt::as_i32(nanosecond11);
18212 *ptr0.add(24).cast::<i32>() = _rt::as_i32(offset8);
18213 }
18214 DbValue::Date(e) => {
18215 *ptr0.add(0).cast::<u8>() = (13i32) as u8;
18216 let super::super::super::golem::rdbms::types::Date {
18217 year: year12,
18218 month: month12,
18219 day: day12,
18220 } = e;
18221 *ptr0.add(8).cast::<i32>() = _rt::as_i32(year12);
18222 *ptr0.add(12).cast::<u8>() = (_rt::as_i32(month12)) as u8;
18223 *ptr0.add(13).cast::<u8>() = (_rt::as_i32(day12)) as u8;
18224 }
18225 DbValue::Time(e) => {
18226 *ptr0.add(0).cast::<u8>() = (14i32) as u8;
18227 let super::super::super::golem::rdbms::types::Time {
18228 hour: hour13,
18229 minute: minute13,
18230 second: second13,
18231 nanosecond: nanosecond13,
18232 } = e;
18233 *ptr0.add(8).cast::<u8>() = (_rt::as_i32(hour13)) as u8;
18234 *ptr0.add(9).cast::<u8>() = (_rt::as_i32(minute13)) as u8;
18235 *ptr0.add(10).cast::<u8>() = (_rt::as_i32(second13)) as u8;
18236 *ptr0.add(12).cast::<i32>() = _rt::as_i32(nanosecond13);
18237 }
18238 DbValue::Timetz(e) => {
18239 *ptr0.add(0).cast::<u8>() = (15i32) as u8;
18240 let super::super::super::golem::rdbms::types::Timetz {
18241 time: time14,
18242 offset: offset14,
18243 } = e;
18244 let super::super::super::golem::rdbms::types::Time {
18245 hour: hour15,
18246 minute: minute15,
18247 second: second15,
18248 nanosecond: nanosecond15,
18249 } = time14;
18250 *ptr0.add(8).cast::<u8>() = (_rt::as_i32(hour15)) as u8;
18251 *ptr0.add(9).cast::<u8>() = (_rt::as_i32(minute15)) as u8;
18252 *ptr0.add(10).cast::<u8>() = (_rt::as_i32(second15)) as u8;
18253 *ptr0.add(12).cast::<i32>() = _rt::as_i32(nanosecond15);
18254 *ptr0.add(16).cast::<i32>() = _rt::as_i32(offset14);
18255 }
18256 DbValue::Interval(e) => {
18257 *ptr0.add(0).cast::<u8>() = (16i32) as u8;
18258 let Interval {
18259 months: months16,
18260 days: days16,
18261 microseconds: microseconds16,
18262 } = e;
18263 *ptr0.add(8).cast::<i32>() = _rt::as_i32(months16);
18264 *ptr0.add(12).cast::<i32>() = _rt::as_i32(days16);
18265 *ptr0.add(16).cast::<i64>() = _rt::as_i64(microseconds16);
18266 }
18267 DbValue::Bytea(e) => {
18268 *ptr0.add(0).cast::<u8>() = (17i32) as u8;
18269 let vec17 = e;
18270 let ptr17 = vec17.as_ptr().cast::<u8>();
18271 let len17 = vec17.len();
18272 *ptr0.add(12).cast::<usize>() = len17;
18273 *ptr0.add(8).cast::<*mut u8>() = ptr17.cast_mut();
18274 }
18275 DbValue::Json(e) => {
18276 *ptr0.add(0).cast::<u8>() = (18i32) as u8;
18277 let vec18 = e;
18278 let ptr18 = vec18.as_ptr().cast::<u8>();
18279 let len18 = vec18.len();
18280 *ptr0.add(12).cast::<usize>() = len18;
18281 *ptr0.add(8).cast::<*mut u8>() = ptr18.cast_mut();
18282 }
18283 DbValue::Jsonb(e) => {
18284 *ptr0.add(0).cast::<u8>() = (19i32) as u8;
18285 let vec19 = e;
18286 let ptr19 = vec19.as_ptr().cast::<u8>();
18287 let len19 = vec19.len();
18288 *ptr0.add(12).cast::<usize>() = len19;
18289 *ptr0.add(8).cast::<*mut u8>() = ptr19.cast_mut();
18290 }
18291 DbValue::Jsonpath(e) => {
18292 *ptr0.add(0).cast::<u8>() = (20i32) as u8;
18293 let vec20 = e;
18294 let ptr20 = vec20.as_ptr().cast::<u8>();
18295 let len20 = vec20.len();
18296 *ptr0.add(12).cast::<usize>() = len20;
18297 *ptr0.add(8).cast::<*mut u8>() = ptr20.cast_mut();
18298 }
18299 DbValue::Xml(e) => {
18300 *ptr0.add(0).cast::<u8>() = (21i32) as u8;
18301 let vec21 = e;
18302 let ptr21 = vec21.as_ptr().cast::<u8>();
18303 let len21 = vec21.len();
18304 *ptr0.add(12).cast::<usize>() = len21;
18305 *ptr0.add(8).cast::<*mut u8>() = ptr21.cast_mut();
18306 }
18307 DbValue::Uuid(e) => {
18308 *ptr0.add(0).cast::<u8>() = (22i32) as u8;
18309 let super::super::super::golem::rdbms::types::Uuid {
18310 high_bits: high_bits22,
18311 low_bits: low_bits22,
18312 } = e;
18313 *ptr0.add(8).cast::<i64>() = _rt::as_i64(high_bits22);
18314 *ptr0.add(16).cast::<i64>() = _rt::as_i64(low_bits22);
18315 }
18316 DbValue::Inet(e) => {
18317 *ptr0.add(0).cast::<u8>() = (23i32) as u8;
18318 use super::super::super::golem::rdbms::types::IpAddress as V25;
18319 match e {
18320 V25::Ipv4(e) => {
18321 *ptr0.add(8).cast::<u8>() = (0i32) as u8;
18322 let (t23_0, t23_1, t23_2, t23_3) = e;
18323 *ptr0.add(10).cast::<u8>() = (_rt::as_i32(t23_0)) as u8;
18324 *ptr0.add(11).cast::<u8>() = (_rt::as_i32(t23_1)) as u8;
18325 *ptr0.add(12).cast::<u8>() = (_rt::as_i32(t23_2)) as u8;
18326 *ptr0.add(13).cast::<u8>() = (_rt::as_i32(t23_3)) as u8;
18327 }
18328 V25::Ipv6(e) => {
18329 *ptr0.add(8).cast::<u8>() = (1i32) as u8;
18330 let (
18331 t24_0,
18332 t24_1,
18333 t24_2,
18334 t24_3,
18335 t24_4,
18336 t24_5,
18337 t24_6,
18338 t24_7,
18339 ) = e;
18340 *ptr0.add(10).cast::<u16>() = (_rt::as_i32(t24_0)) as u16;
18341 *ptr0.add(12).cast::<u16>() = (_rt::as_i32(t24_1)) as u16;
18342 *ptr0.add(14).cast::<u16>() = (_rt::as_i32(t24_2)) as u16;
18343 *ptr0.add(16).cast::<u16>() = (_rt::as_i32(t24_3)) as u16;
18344 *ptr0.add(18).cast::<u16>() = (_rt::as_i32(t24_4)) as u16;
18345 *ptr0.add(20).cast::<u16>() = (_rt::as_i32(t24_5)) as u16;
18346 *ptr0.add(22).cast::<u16>() = (_rt::as_i32(t24_6)) as u16;
18347 *ptr0.add(24).cast::<u16>() = (_rt::as_i32(t24_7)) as u16;
18348 }
18349 }
18350 }
18351 DbValue::Cidr(e) => {
18352 *ptr0.add(0).cast::<u8>() = (24i32) as u8;
18353 use super::super::super::golem::rdbms::types::IpAddress as V28;
18354 match e {
18355 V28::Ipv4(e) => {
18356 *ptr0.add(8).cast::<u8>() = (0i32) as u8;
18357 let (t26_0, t26_1, t26_2, t26_3) = e;
18358 *ptr0.add(10).cast::<u8>() = (_rt::as_i32(t26_0)) as u8;
18359 *ptr0.add(11).cast::<u8>() = (_rt::as_i32(t26_1)) as u8;
18360 *ptr0.add(12).cast::<u8>() = (_rt::as_i32(t26_2)) as u8;
18361 *ptr0.add(13).cast::<u8>() = (_rt::as_i32(t26_3)) as u8;
18362 }
18363 V28::Ipv6(e) => {
18364 *ptr0.add(8).cast::<u8>() = (1i32) as u8;
18365 let (
18366 t27_0,
18367 t27_1,
18368 t27_2,
18369 t27_3,
18370 t27_4,
18371 t27_5,
18372 t27_6,
18373 t27_7,
18374 ) = e;
18375 *ptr0.add(10).cast::<u16>() = (_rt::as_i32(t27_0)) as u16;
18376 *ptr0.add(12).cast::<u16>() = (_rt::as_i32(t27_1)) as u16;
18377 *ptr0.add(14).cast::<u16>() = (_rt::as_i32(t27_2)) as u16;
18378 *ptr0.add(16).cast::<u16>() = (_rt::as_i32(t27_3)) as u16;
18379 *ptr0.add(18).cast::<u16>() = (_rt::as_i32(t27_4)) as u16;
18380 *ptr0.add(20).cast::<u16>() = (_rt::as_i32(t27_5)) as u16;
18381 *ptr0.add(22).cast::<u16>() = (_rt::as_i32(t27_6)) as u16;
18382 *ptr0.add(24).cast::<u16>() = (_rt::as_i32(t27_7)) as u16;
18383 }
18384 }
18385 }
18386 DbValue::Macaddr(e) => {
18387 *ptr0.add(0).cast::<u8>() = (25i32) as u8;
18388 let super::super::super::golem::rdbms::types::MacAddress {
18389 octets: octets29,
18390 } = e;
18391 let (t30_0, t30_1, t30_2, t30_3, t30_4, t30_5) = octets29;
18392 *ptr0.add(8).cast::<u8>() = (_rt::as_i32(t30_0)) as u8;
18393 *ptr0.add(9).cast::<u8>() = (_rt::as_i32(t30_1)) as u8;
18394 *ptr0.add(10).cast::<u8>() = (_rt::as_i32(t30_2)) as u8;
18395 *ptr0.add(11).cast::<u8>() = (_rt::as_i32(t30_3)) as u8;
18396 *ptr0.add(12).cast::<u8>() = (_rt::as_i32(t30_4)) as u8;
18397 *ptr0.add(13).cast::<u8>() = (_rt::as_i32(t30_5)) as u8;
18398 }
18399 DbValue::Bit(e) => {
18400 *ptr0.add(0).cast::<u8>() = (26i32) as u8;
18401 let vec31 = e;
18402 let len31 = vec31.len();
18403 let layout31 = _rt::alloc::Layout::from_size_align_unchecked(
18404 vec31.len() * 1,
18405 1,
18406 );
18407 let result31 = if layout31.size() != 0 {
18408 let ptr = _rt::alloc::alloc(layout31).cast::<u8>();
18409 if ptr.is_null() {
18410 _rt::alloc::handle_alloc_error(layout31);
18411 }
18412 ptr
18413 } else {
18414 ::core::ptr::null_mut()
18415 };
18416 for (i, e) in vec31.into_iter().enumerate() {
18417 let base = result31.add(i * 1);
18418 {
18419 *base.add(0).cast::<u8>() = (match e {
18420 true => 1,
18421 false => 0,
18422 }) as u8;
18423 }
18424 }
18425 *ptr0.add(12).cast::<usize>() = len31;
18426 *ptr0.add(8).cast::<*mut u8>() = result31;
18427 cleanup_list.extend_from_slice(&[(result31, layout31)]);
18428 }
18429 DbValue::Varbit(e) => {
18430 *ptr0.add(0).cast::<u8>() = (27i32) as u8;
18431 let vec32 = e;
18432 let len32 = vec32.len();
18433 let layout32 = _rt::alloc::Layout::from_size_align_unchecked(
18434 vec32.len() * 1,
18435 1,
18436 );
18437 let result32 = if layout32.size() != 0 {
18438 let ptr = _rt::alloc::alloc(layout32).cast::<u8>();
18439 if ptr.is_null() {
18440 _rt::alloc::handle_alloc_error(layout32);
18441 }
18442 ptr
18443 } else {
18444 ::core::ptr::null_mut()
18445 };
18446 for (i, e) in vec32.into_iter().enumerate() {
18447 let base = result32.add(i * 1);
18448 {
18449 *base.add(0).cast::<u8>() = (match e {
18450 true => 1,
18451 false => 0,
18452 }) as u8;
18453 }
18454 }
18455 *ptr0.add(12).cast::<usize>() = len32;
18456 *ptr0.add(8).cast::<*mut u8>() = result32;
18457 cleanup_list.extend_from_slice(&[(result32, layout32)]);
18458 }
18459 DbValue::Int4range(e) => {
18460 *ptr0.add(0).cast::<u8>() = (28i32) as u8;
18461 let Int4range { start: start33, end: end33 } = e;
18462 match start33 {
18463 Int4bound::Included(e) => {
18464 *ptr0.add(8).cast::<u8>() = (0i32) as u8;
18465 *ptr0.add(12).cast::<i32>() = _rt::as_i32(e);
18466 }
18467 Int4bound::Excluded(e) => {
18468 *ptr0.add(8).cast::<u8>() = (1i32) as u8;
18469 *ptr0.add(12).cast::<i32>() = _rt::as_i32(e);
18470 }
18471 Int4bound::Unbounded => {
18472 *ptr0.add(8).cast::<u8>() = (2i32) as u8;
18473 }
18474 }
18475 match end33 {
18476 Int4bound::Included(e) => {
18477 *ptr0.add(16).cast::<u8>() = (0i32) as u8;
18478 *ptr0.add(20).cast::<i32>() = _rt::as_i32(e);
18479 }
18480 Int4bound::Excluded(e) => {
18481 *ptr0.add(16).cast::<u8>() = (1i32) as u8;
18482 *ptr0.add(20).cast::<i32>() = _rt::as_i32(e);
18483 }
18484 Int4bound::Unbounded => {
18485 *ptr0.add(16).cast::<u8>() = (2i32) as u8;
18486 }
18487 }
18488 }
18489 DbValue::Int8range(e) => {
18490 *ptr0.add(0).cast::<u8>() = (29i32) as u8;
18491 let Int8range { start: start34, end: end34 } = e;
18492 match start34 {
18493 Int8bound::Included(e) => {
18494 *ptr0.add(8).cast::<u8>() = (0i32) as u8;
18495 *ptr0.add(16).cast::<i64>() = _rt::as_i64(e);
18496 }
18497 Int8bound::Excluded(e) => {
18498 *ptr0.add(8).cast::<u8>() = (1i32) as u8;
18499 *ptr0.add(16).cast::<i64>() = _rt::as_i64(e);
18500 }
18501 Int8bound::Unbounded => {
18502 *ptr0.add(8).cast::<u8>() = (2i32) as u8;
18503 }
18504 }
18505 match end34 {
18506 Int8bound::Included(e) => {
18507 *ptr0.add(24).cast::<u8>() = (0i32) as u8;
18508 *ptr0.add(32).cast::<i64>() = _rt::as_i64(e);
18509 }
18510 Int8bound::Excluded(e) => {
18511 *ptr0.add(24).cast::<u8>() = (1i32) as u8;
18512 *ptr0.add(32).cast::<i64>() = _rt::as_i64(e);
18513 }
18514 Int8bound::Unbounded => {
18515 *ptr0.add(24).cast::<u8>() = (2i32) as u8;
18516 }
18517 }
18518 }
18519 DbValue::Numrange(e) => {
18520 *ptr0.add(0).cast::<u8>() = (30i32) as u8;
18521 let Numrange { start: start35, end: end35 } = e;
18522 match start35 {
18523 Numbound::Included(e) => {
18524 *ptr0.add(8).cast::<u8>() = (0i32) as u8;
18525 let vec36 = e;
18526 let ptr36 = vec36.as_ptr().cast::<u8>();
18527 let len36 = vec36.len();
18528 *ptr0.add(16).cast::<usize>() = len36;
18529 *ptr0.add(12).cast::<*mut u8>() = ptr36.cast_mut();
18530 }
18531 Numbound::Excluded(e) => {
18532 *ptr0.add(8).cast::<u8>() = (1i32) as u8;
18533 let vec37 = e;
18534 let ptr37 = vec37.as_ptr().cast::<u8>();
18535 let len37 = vec37.len();
18536 *ptr0.add(16).cast::<usize>() = len37;
18537 *ptr0.add(12).cast::<*mut u8>() = ptr37.cast_mut();
18538 }
18539 Numbound::Unbounded => {
18540 *ptr0.add(8).cast::<u8>() = (2i32) as u8;
18541 }
18542 }
18543 match end35 {
18544 Numbound::Included(e) => {
18545 *ptr0.add(20).cast::<u8>() = (0i32) as u8;
18546 let vec38 = e;
18547 let ptr38 = vec38.as_ptr().cast::<u8>();
18548 let len38 = vec38.len();
18549 *ptr0.add(28).cast::<usize>() = len38;
18550 *ptr0.add(24).cast::<*mut u8>() = ptr38.cast_mut();
18551 }
18552 Numbound::Excluded(e) => {
18553 *ptr0.add(20).cast::<u8>() = (1i32) as u8;
18554 let vec39 = e;
18555 let ptr39 = vec39.as_ptr().cast::<u8>();
18556 let len39 = vec39.len();
18557 *ptr0.add(28).cast::<usize>() = len39;
18558 *ptr0.add(24).cast::<*mut u8>() = ptr39.cast_mut();
18559 }
18560 Numbound::Unbounded => {
18561 *ptr0.add(20).cast::<u8>() = (2i32) as u8;
18562 }
18563 }
18564 }
18565 DbValue::Tsrange(e) => {
18566 *ptr0.add(0).cast::<u8>() = (31i32) as u8;
18567 let Tsrange { start: start40, end: end40 } = e;
18568 match start40 {
18569 Tsbound::Included(e) => {
18570 *ptr0.add(8).cast::<u8>() = (0i32) as u8;
18571 let super::super::super::golem::rdbms::types::Timestamp {
18572 date: date41,
18573 time: time41,
18574 } = e;
18575 let super::super::super::golem::rdbms::types::Date {
18576 year: year42,
18577 month: month42,
18578 day: day42,
18579 } = date41;
18580 *ptr0.add(12).cast::<i32>() = _rt::as_i32(year42);
18581 *ptr0.add(16).cast::<u8>() = (_rt::as_i32(month42)) as u8;
18582 *ptr0.add(17).cast::<u8>() = (_rt::as_i32(day42)) as u8;
18583 let super::super::super::golem::rdbms::types::Time {
18584 hour: hour43,
18585 minute: minute43,
18586 second: second43,
18587 nanosecond: nanosecond43,
18588 } = time41;
18589 *ptr0.add(20).cast::<u8>() = (_rt::as_i32(hour43)) as u8;
18590 *ptr0.add(21).cast::<u8>() = (_rt::as_i32(minute43)) as u8;
18591 *ptr0.add(22).cast::<u8>() = (_rt::as_i32(second43)) as u8;
18592 *ptr0.add(24).cast::<i32>() = _rt::as_i32(nanosecond43);
18593 }
18594 Tsbound::Excluded(e) => {
18595 *ptr0.add(8).cast::<u8>() = (1i32) as u8;
18596 let super::super::super::golem::rdbms::types::Timestamp {
18597 date: date44,
18598 time: time44,
18599 } = e;
18600 let super::super::super::golem::rdbms::types::Date {
18601 year: year45,
18602 month: month45,
18603 day: day45,
18604 } = date44;
18605 *ptr0.add(12).cast::<i32>() = _rt::as_i32(year45);
18606 *ptr0.add(16).cast::<u8>() = (_rt::as_i32(month45)) as u8;
18607 *ptr0.add(17).cast::<u8>() = (_rt::as_i32(day45)) as u8;
18608 let super::super::super::golem::rdbms::types::Time {
18609 hour: hour46,
18610 minute: minute46,
18611 second: second46,
18612 nanosecond: nanosecond46,
18613 } = time44;
18614 *ptr0.add(20).cast::<u8>() = (_rt::as_i32(hour46)) as u8;
18615 *ptr0.add(21).cast::<u8>() = (_rt::as_i32(minute46)) as u8;
18616 *ptr0.add(22).cast::<u8>() = (_rt::as_i32(second46)) as u8;
18617 *ptr0.add(24).cast::<i32>() = _rt::as_i32(nanosecond46);
18618 }
18619 Tsbound::Unbounded => {
18620 *ptr0.add(8).cast::<u8>() = (2i32) as u8;
18621 }
18622 }
18623 match end40 {
18624 Tsbound::Included(e) => {
18625 *ptr0.add(28).cast::<u8>() = (0i32) as u8;
18626 let super::super::super::golem::rdbms::types::Timestamp {
18627 date: date47,
18628 time: time47,
18629 } = e;
18630 let super::super::super::golem::rdbms::types::Date {
18631 year: year48,
18632 month: month48,
18633 day: day48,
18634 } = date47;
18635 *ptr0.add(32).cast::<i32>() = _rt::as_i32(year48);
18636 *ptr0.add(36).cast::<u8>() = (_rt::as_i32(month48)) as u8;
18637 *ptr0.add(37).cast::<u8>() = (_rt::as_i32(day48)) as u8;
18638 let super::super::super::golem::rdbms::types::Time {
18639 hour: hour49,
18640 minute: minute49,
18641 second: second49,
18642 nanosecond: nanosecond49,
18643 } = time47;
18644 *ptr0.add(40).cast::<u8>() = (_rt::as_i32(hour49)) as u8;
18645 *ptr0.add(41).cast::<u8>() = (_rt::as_i32(minute49)) as u8;
18646 *ptr0.add(42).cast::<u8>() = (_rt::as_i32(second49)) as u8;
18647 *ptr0.add(44).cast::<i32>() = _rt::as_i32(nanosecond49);
18648 }
18649 Tsbound::Excluded(e) => {
18650 *ptr0.add(28).cast::<u8>() = (1i32) as u8;
18651 let super::super::super::golem::rdbms::types::Timestamp {
18652 date: date50,
18653 time: time50,
18654 } = e;
18655 let super::super::super::golem::rdbms::types::Date {
18656 year: year51,
18657 month: month51,
18658 day: day51,
18659 } = date50;
18660 *ptr0.add(32).cast::<i32>() = _rt::as_i32(year51);
18661 *ptr0.add(36).cast::<u8>() = (_rt::as_i32(month51)) as u8;
18662 *ptr0.add(37).cast::<u8>() = (_rt::as_i32(day51)) as u8;
18663 let super::super::super::golem::rdbms::types::Time {
18664 hour: hour52,
18665 minute: minute52,
18666 second: second52,
18667 nanosecond: nanosecond52,
18668 } = time50;
18669 *ptr0.add(40).cast::<u8>() = (_rt::as_i32(hour52)) as u8;
18670 *ptr0.add(41).cast::<u8>() = (_rt::as_i32(minute52)) as u8;
18671 *ptr0.add(42).cast::<u8>() = (_rt::as_i32(second52)) as u8;
18672 *ptr0.add(44).cast::<i32>() = _rt::as_i32(nanosecond52);
18673 }
18674 Tsbound::Unbounded => {
18675 *ptr0.add(28).cast::<u8>() = (2i32) as u8;
18676 }
18677 }
18678 }
18679 DbValue::Tstzrange(e) => {
18680 *ptr0.add(0).cast::<u8>() = (32i32) as u8;
18681 let Tstzrange { start: start53, end: end53 } = e;
18682 match start53 {
18683 Tstzbound::Included(e) => {
18684 *ptr0.add(8).cast::<u8>() = (0i32) as u8;
18685 let super::super::super::golem::rdbms::types::Timestamptz {
18686 timestamp: timestamp54,
18687 offset: offset54,
18688 } = e;
18689 let super::super::super::golem::rdbms::types::Timestamp {
18690 date: date55,
18691 time: time55,
18692 } = timestamp54;
18693 let super::super::super::golem::rdbms::types::Date {
18694 year: year56,
18695 month: month56,
18696 day: day56,
18697 } = date55;
18698 *ptr0.add(12).cast::<i32>() = _rt::as_i32(year56);
18699 *ptr0.add(16).cast::<u8>() = (_rt::as_i32(month56)) as u8;
18700 *ptr0.add(17).cast::<u8>() = (_rt::as_i32(day56)) as u8;
18701 let super::super::super::golem::rdbms::types::Time {
18702 hour: hour57,
18703 minute: minute57,
18704 second: second57,
18705 nanosecond: nanosecond57,
18706 } = time55;
18707 *ptr0.add(20).cast::<u8>() = (_rt::as_i32(hour57)) as u8;
18708 *ptr0.add(21).cast::<u8>() = (_rt::as_i32(minute57)) as u8;
18709 *ptr0.add(22).cast::<u8>() = (_rt::as_i32(second57)) as u8;
18710 *ptr0.add(24).cast::<i32>() = _rt::as_i32(nanosecond57);
18711 *ptr0.add(28).cast::<i32>() = _rt::as_i32(offset54);
18712 }
18713 Tstzbound::Excluded(e) => {
18714 *ptr0.add(8).cast::<u8>() = (1i32) as u8;
18715 let super::super::super::golem::rdbms::types::Timestamptz {
18716 timestamp: timestamp58,
18717 offset: offset58,
18718 } = e;
18719 let super::super::super::golem::rdbms::types::Timestamp {
18720 date: date59,
18721 time: time59,
18722 } = timestamp58;
18723 let super::super::super::golem::rdbms::types::Date {
18724 year: year60,
18725 month: month60,
18726 day: day60,
18727 } = date59;
18728 *ptr0.add(12).cast::<i32>() = _rt::as_i32(year60);
18729 *ptr0.add(16).cast::<u8>() = (_rt::as_i32(month60)) as u8;
18730 *ptr0.add(17).cast::<u8>() = (_rt::as_i32(day60)) as u8;
18731 let super::super::super::golem::rdbms::types::Time {
18732 hour: hour61,
18733 minute: minute61,
18734 second: second61,
18735 nanosecond: nanosecond61,
18736 } = time59;
18737 *ptr0.add(20).cast::<u8>() = (_rt::as_i32(hour61)) as u8;
18738 *ptr0.add(21).cast::<u8>() = (_rt::as_i32(minute61)) as u8;
18739 *ptr0.add(22).cast::<u8>() = (_rt::as_i32(second61)) as u8;
18740 *ptr0.add(24).cast::<i32>() = _rt::as_i32(nanosecond61);
18741 *ptr0.add(28).cast::<i32>() = _rt::as_i32(offset58);
18742 }
18743 Tstzbound::Unbounded => {
18744 *ptr0.add(8).cast::<u8>() = (2i32) as u8;
18745 }
18746 }
18747 match end53 {
18748 Tstzbound::Included(e) => {
18749 *ptr0.add(32).cast::<u8>() = (0i32) as u8;
18750 let super::super::super::golem::rdbms::types::Timestamptz {
18751 timestamp: timestamp62,
18752 offset: offset62,
18753 } = e;
18754 let super::super::super::golem::rdbms::types::Timestamp {
18755 date: date63,
18756 time: time63,
18757 } = timestamp62;
18758 let super::super::super::golem::rdbms::types::Date {
18759 year: year64,
18760 month: month64,
18761 day: day64,
18762 } = date63;
18763 *ptr0.add(36).cast::<i32>() = _rt::as_i32(year64);
18764 *ptr0.add(40).cast::<u8>() = (_rt::as_i32(month64)) as u8;
18765 *ptr0.add(41).cast::<u8>() = (_rt::as_i32(day64)) as u8;
18766 let super::super::super::golem::rdbms::types::Time {
18767 hour: hour65,
18768 minute: minute65,
18769 second: second65,
18770 nanosecond: nanosecond65,
18771 } = time63;
18772 *ptr0.add(44).cast::<u8>() = (_rt::as_i32(hour65)) as u8;
18773 *ptr0.add(45).cast::<u8>() = (_rt::as_i32(minute65)) as u8;
18774 *ptr0.add(46).cast::<u8>() = (_rt::as_i32(second65)) as u8;
18775 *ptr0.add(48).cast::<i32>() = _rt::as_i32(nanosecond65);
18776 *ptr0.add(52).cast::<i32>() = _rt::as_i32(offset62);
18777 }
18778 Tstzbound::Excluded(e) => {
18779 *ptr0.add(32).cast::<u8>() = (1i32) as u8;
18780 let super::super::super::golem::rdbms::types::Timestamptz {
18781 timestamp: timestamp66,
18782 offset: offset66,
18783 } = e;
18784 let super::super::super::golem::rdbms::types::Timestamp {
18785 date: date67,
18786 time: time67,
18787 } = timestamp66;
18788 let super::super::super::golem::rdbms::types::Date {
18789 year: year68,
18790 month: month68,
18791 day: day68,
18792 } = date67;
18793 *ptr0.add(36).cast::<i32>() = _rt::as_i32(year68);
18794 *ptr0.add(40).cast::<u8>() = (_rt::as_i32(month68)) as u8;
18795 *ptr0.add(41).cast::<u8>() = (_rt::as_i32(day68)) as u8;
18796 let super::super::super::golem::rdbms::types::Time {
18797 hour: hour69,
18798 minute: minute69,
18799 second: second69,
18800 nanosecond: nanosecond69,
18801 } = time67;
18802 *ptr0.add(44).cast::<u8>() = (_rt::as_i32(hour69)) as u8;
18803 *ptr0.add(45).cast::<u8>() = (_rt::as_i32(minute69)) as u8;
18804 *ptr0.add(46).cast::<u8>() = (_rt::as_i32(second69)) as u8;
18805 *ptr0.add(48).cast::<i32>() = _rt::as_i32(nanosecond69);
18806 *ptr0.add(52).cast::<i32>() = _rt::as_i32(offset66);
18807 }
18808 Tstzbound::Unbounded => {
18809 *ptr0.add(32).cast::<u8>() = (2i32) as u8;
18810 }
18811 }
18812 }
18813 DbValue::Daterange(e) => {
18814 *ptr0.add(0).cast::<u8>() = (33i32) as u8;
18815 let Daterange { start: start70, end: end70 } = e;
18816 match start70 {
18817 Datebound::Included(e) => {
18818 *ptr0.add(8).cast::<u8>() = (0i32) as u8;
18819 let super::super::super::golem::rdbms::types::Date {
18820 year: year71,
18821 month: month71,
18822 day: day71,
18823 } = e;
18824 *ptr0.add(12).cast::<i32>() = _rt::as_i32(year71);
18825 *ptr0.add(16).cast::<u8>() = (_rt::as_i32(month71)) as u8;
18826 *ptr0.add(17).cast::<u8>() = (_rt::as_i32(day71)) as u8;
18827 }
18828 Datebound::Excluded(e) => {
18829 *ptr0.add(8).cast::<u8>() = (1i32) as u8;
18830 let super::super::super::golem::rdbms::types::Date {
18831 year: year72,
18832 month: month72,
18833 day: day72,
18834 } = e;
18835 *ptr0.add(12).cast::<i32>() = _rt::as_i32(year72);
18836 *ptr0.add(16).cast::<u8>() = (_rt::as_i32(month72)) as u8;
18837 *ptr0.add(17).cast::<u8>() = (_rt::as_i32(day72)) as u8;
18838 }
18839 Datebound::Unbounded => {
18840 *ptr0.add(8).cast::<u8>() = (2i32) as u8;
18841 }
18842 }
18843 match end70 {
18844 Datebound::Included(e) => {
18845 *ptr0.add(20).cast::<u8>() = (0i32) as u8;
18846 let super::super::super::golem::rdbms::types::Date {
18847 year: year73,
18848 month: month73,
18849 day: day73,
18850 } = e;
18851 *ptr0.add(24).cast::<i32>() = _rt::as_i32(year73);
18852 *ptr0.add(28).cast::<u8>() = (_rt::as_i32(month73)) as u8;
18853 *ptr0.add(29).cast::<u8>() = (_rt::as_i32(day73)) as u8;
18854 }
18855 Datebound::Excluded(e) => {
18856 *ptr0.add(20).cast::<u8>() = (1i32) as u8;
18857 let super::super::super::golem::rdbms::types::Date {
18858 year: year74,
18859 month: month74,
18860 day: day74,
18861 } = e;
18862 *ptr0.add(24).cast::<i32>() = _rt::as_i32(year74);
18863 *ptr0.add(28).cast::<u8>() = (_rt::as_i32(month74)) as u8;
18864 *ptr0.add(29).cast::<u8>() = (_rt::as_i32(day74)) as u8;
18865 }
18866 Datebound::Unbounded => {
18867 *ptr0.add(20).cast::<u8>() = (2i32) as u8;
18868 }
18869 }
18870 }
18871 DbValue::Money(e) => {
18872 *ptr0.add(0).cast::<u8>() = (34i32) as u8;
18873 *ptr0.add(8).cast::<i64>() = _rt::as_i64(e);
18874 }
18875 DbValue::Oid(e) => {
18876 *ptr0.add(0).cast::<u8>() = (35i32) as u8;
18877 *ptr0.add(8).cast::<i32>() = _rt::as_i32(e);
18878 }
18879 DbValue::Enumeration(e) => {
18880 *ptr0.add(0).cast::<u8>() = (36i32) as u8;
18881 let Enumeration { name: name75, value: value75 } = e;
18882 let vec76 = name75;
18883 let ptr76 = vec76.as_ptr().cast::<u8>();
18884 let len76 = vec76.len();
18885 *ptr0.add(12).cast::<usize>() = len76;
18886 *ptr0.add(8).cast::<*mut u8>() = ptr76.cast_mut();
18887 let vec77 = value75;
18888 let ptr77 = vec77.as_ptr().cast::<u8>();
18889 let len77 = vec77.len();
18890 *ptr0.add(20).cast::<usize>() = len77;
18891 *ptr0.add(16).cast::<*mut u8>() = ptr77.cast_mut();
18892 }
18893 DbValue::Composite(e) => {
18894 *ptr0.add(0).cast::<u8>() = (37i32) as u8;
18895 let Composite { name: name78, values: values78 } = e;
18896 let vec79 = name78;
18897 let ptr79 = vec79.as_ptr().cast::<u8>();
18898 let len79 = vec79.len();
18899 *ptr0.add(12).cast::<usize>() = len79;
18900 *ptr0.add(8).cast::<*mut u8>() = ptr79.cast_mut();
18901 let vec80 = values78;
18902 let len80 = vec80.len();
18903 let layout80 = _rt::alloc::Layout::from_size_align_unchecked(
18904 vec80.len() * 4,
18905 4,
18906 );
18907 let result80 = if layout80.size() != 0 {
18908 let ptr = _rt::alloc::alloc(layout80).cast::<u8>();
18909 if ptr.is_null() {
18910 _rt::alloc::handle_alloc_error(layout80);
18911 }
18912 ptr
18913 } else {
18914 ::core::ptr::null_mut()
18915 };
18916 for (i, e) in vec80.into_iter().enumerate() {
18917 let base = result80.add(i * 4);
18918 {
18919 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
18920 }
18921 }
18922 *ptr0.add(20).cast::<usize>() = len80;
18923 *ptr0.add(16).cast::<*mut u8>() = result80;
18924 cleanup_list.extend_from_slice(&[(result80, layout80)]);
18925 }
18926 DbValue::Domain(e) => {
18927 *ptr0.add(0).cast::<u8>() = (38i32) as u8;
18928 let Domain { name: name81, value: value81 } = e;
18929 let vec82 = name81;
18930 let ptr82 = vec82.as_ptr().cast::<u8>();
18931 let len82 = vec82.len();
18932 *ptr0.add(12).cast::<usize>() = len82;
18933 *ptr0.add(8).cast::<*mut u8>() = ptr82.cast_mut();
18934 *ptr0.add(16).cast::<i32>() = (value81).take_handle()
18935 as i32;
18936 }
18937 DbValue::Array(e) => {
18938 *ptr0.add(0).cast::<u8>() = (39i32) as u8;
18939 let vec83 = e;
18940 let len83 = vec83.len();
18941 let layout83 = _rt::alloc::Layout::from_size_align_unchecked(
18942 vec83.len() * 4,
18943 4,
18944 );
18945 let result83 = if layout83.size() != 0 {
18946 let ptr = _rt::alloc::alloc(layout83).cast::<u8>();
18947 if ptr.is_null() {
18948 _rt::alloc::handle_alloc_error(layout83);
18949 }
18950 ptr
18951 } else {
18952 ::core::ptr::null_mut()
18953 };
18954 for (i, e) in vec83.into_iter().enumerate() {
18955 let base = result83.add(i * 4);
18956 {
18957 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
18958 }
18959 }
18960 *ptr0.add(12).cast::<usize>() = len83;
18961 *ptr0.add(8).cast::<*mut u8>() = result83;
18962 cleanup_list.extend_from_slice(&[(result83, layout83)]);
18963 }
18964 DbValue::Range(e) => {
18965 *ptr0.add(0).cast::<u8>() = (40i32) as u8;
18966 let Range { name: name84, value: value84 } = e;
18967 let vec85 = name84;
18968 let ptr85 = vec85.as_ptr().cast::<u8>();
18969 let len85 = vec85.len();
18970 *ptr0.add(12).cast::<usize>() = len85;
18971 *ptr0.add(8).cast::<*mut u8>() = ptr85.cast_mut();
18972 let ValuesRange { start: start86, end: end86 } = value84;
18973 match start86 {
18974 ValueBound::Included(e) => {
18975 *ptr0.add(16).cast::<u8>() = (0i32) as u8;
18976 *ptr0.add(20).cast::<i32>() = (e).take_handle() as i32;
18977 }
18978 ValueBound::Excluded(e) => {
18979 *ptr0.add(16).cast::<u8>() = (1i32) as u8;
18980 *ptr0.add(20).cast::<i32>() = (e).take_handle() as i32;
18981 }
18982 ValueBound::Unbounded => {
18983 *ptr0.add(16).cast::<u8>() = (2i32) as u8;
18984 }
18985 }
18986 match end86 {
18987 ValueBound::Included(e) => {
18988 *ptr0.add(24).cast::<u8>() = (0i32) as u8;
18989 *ptr0.add(28).cast::<i32>() = (e).take_handle() as i32;
18990 }
18991 ValueBound::Excluded(e) => {
18992 *ptr0.add(24).cast::<u8>() = (1i32) as u8;
18993 *ptr0.add(28).cast::<i32>() = (e).take_handle() as i32;
18994 }
18995 ValueBound::Unbounded => {
18996 *ptr0.add(24).cast::<u8>() = (2i32) as u8;
18997 }
18998 }
18999 }
19000 DbValue::Null => {
19001 *ptr0.add(0).cast::<u8>() = (41i32) as u8;
19002 }
19003 }
19004 #[cfg(target_arch = "wasm32")]
19005 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
19006 extern "C" {
19007 #[link_name = "[constructor]lazy-db-value"]
19008 fn wit_import(_: *mut u8) -> i32;
19009 }
19010 #[cfg(not(target_arch = "wasm32"))]
19011 fn wit_import(_: *mut u8) -> i32 {
19012 unreachable!()
19013 }
19014 let ret = wit_import(ptr0);
19015 for (ptr, layout) in cleanup_list {
19016 if layout.size() != 0 {
19017 _rt::alloc::dealloc(ptr.cast(), layout);
19018 }
19019 }
19020 LazyDbValue::from_handle(ret as u32)
19021 }
19022 }
19023 }
19024 impl LazyDbValue {
19025 #[allow(unused_unsafe, clippy::all)]
19026 pub fn get(&self) -> DbValue {
19027 unsafe {
19028 #[repr(align(8))]
19029 struct RetArea([::core::mem::MaybeUninit<u8>; 56]);
19030 let mut ret_area = RetArea(
19031 [::core::mem::MaybeUninit::uninit(); 56],
19032 );
19033 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
19034 #[cfg(target_arch = "wasm32")]
19035 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
19036 extern "C" {
19037 #[link_name = "[method]lazy-db-value.get"]
19038 fn wit_import(_: i32, _: *mut u8);
19039 }
19040 #[cfg(not(target_arch = "wasm32"))]
19041 fn wit_import(_: i32, _: *mut u8) {
19042 unreachable!()
19043 }
19044 wit_import((self).handle() as i32, ptr0);
19045 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
19046 let v260 = match l1 {
19047 0 => {
19048 let e260 = {
19049 let l2 = i32::from(*ptr0.add(8).cast::<i8>());
19050 l2 as i8
19051 };
19052 DbValue::Character(e260)
19053 }
19054 1 => {
19055 let e260 = {
19056 let l3 = i32::from(*ptr0.add(8).cast::<i16>());
19057 l3 as i16
19058 };
19059 DbValue::Int2(e260)
19060 }
19061 2 => {
19062 let e260 = {
19063 let l4 = *ptr0.add(8).cast::<i32>();
19064 l4
19065 };
19066 DbValue::Int4(e260)
19067 }
19068 3 => {
19069 let e260 = {
19070 let l5 = *ptr0.add(8).cast::<i64>();
19071 l5
19072 };
19073 DbValue::Int8(e260)
19074 }
19075 4 => {
19076 let e260 = {
19077 let l6 = *ptr0.add(8).cast::<f32>();
19078 l6
19079 };
19080 DbValue::Float4(e260)
19081 }
19082 5 => {
19083 let e260 = {
19084 let l7 = *ptr0.add(8).cast::<f64>();
19085 l7
19086 };
19087 DbValue::Float8(e260)
19088 }
19089 6 => {
19090 let e260 = {
19091 let l8 = *ptr0.add(8).cast::<*mut u8>();
19092 let l9 = *ptr0.add(12).cast::<usize>();
19093 let len10 = l9;
19094 let bytes10 = _rt::Vec::from_raw_parts(
19095 l8.cast(),
19096 len10,
19097 len10,
19098 );
19099 _rt::string_lift(bytes10)
19100 };
19101 DbValue::Numeric(e260)
19102 }
19103 7 => {
19104 let e260 = {
19105 let l11 = i32::from(*ptr0.add(8).cast::<u8>());
19106 _rt::bool_lift(l11 as u8)
19107 };
19108 DbValue::Boolean(e260)
19109 }
19110 8 => {
19111 let e260 = {
19112 let l12 = *ptr0.add(8).cast::<*mut u8>();
19113 let l13 = *ptr0.add(12).cast::<usize>();
19114 let len14 = l13;
19115 let bytes14 = _rt::Vec::from_raw_parts(
19116 l12.cast(),
19117 len14,
19118 len14,
19119 );
19120 _rt::string_lift(bytes14)
19121 };
19122 DbValue::Text(e260)
19123 }
19124 9 => {
19125 let e260 = {
19126 let l15 = *ptr0.add(8).cast::<*mut u8>();
19127 let l16 = *ptr0.add(12).cast::<usize>();
19128 let len17 = l16;
19129 let bytes17 = _rt::Vec::from_raw_parts(
19130 l15.cast(),
19131 len17,
19132 len17,
19133 );
19134 _rt::string_lift(bytes17)
19135 };
19136 DbValue::Varchar(e260)
19137 }
19138 10 => {
19139 let e260 = {
19140 let l18 = *ptr0.add(8).cast::<*mut u8>();
19141 let l19 = *ptr0.add(12).cast::<usize>();
19142 let len20 = l19;
19143 let bytes20 = _rt::Vec::from_raw_parts(
19144 l18.cast(),
19145 len20,
19146 len20,
19147 );
19148 _rt::string_lift(bytes20)
19149 };
19150 DbValue::Bpchar(e260)
19151 }
19152 11 => {
19153 let e260 = {
19154 let l21 = *ptr0.add(8).cast::<i32>();
19155 let l22 = i32::from(*ptr0.add(12).cast::<u8>());
19156 let l23 = i32::from(*ptr0.add(13).cast::<u8>());
19157 let l24 = i32::from(*ptr0.add(16).cast::<u8>());
19158 let l25 = i32::from(*ptr0.add(17).cast::<u8>());
19159 let l26 = i32::from(*ptr0.add(18).cast::<u8>());
19160 let l27 = *ptr0.add(20).cast::<i32>();
19161 super::super::super::golem::rdbms::types::Timestamp {
19162 date: super::super::super::golem::rdbms::types::Date {
19163 year: l21,
19164 month: l22 as u8,
19165 day: l23 as u8,
19166 },
19167 time: super::super::super::golem::rdbms::types::Time {
19168 hour: l24 as u8,
19169 minute: l25 as u8,
19170 second: l26 as u8,
19171 nanosecond: l27 as u32,
19172 },
19173 }
19174 };
19175 DbValue::Timestamp(e260)
19176 }
19177 12 => {
19178 let e260 = {
19179 let l28 = *ptr0.add(8).cast::<i32>();
19180 let l29 = i32::from(*ptr0.add(12).cast::<u8>());
19181 let l30 = i32::from(*ptr0.add(13).cast::<u8>());
19182 let l31 = i32::from(*ptr0.add(16).cast::<u8>());
19183 let l32 = i32::from(*ptr0.add(17).cast::<u8>());
19184 let l33 = i32::from(*ptr0.add(18).cast::<u8>());
19185 let l34 = *ptr0.add(20).cast::<i32>();
19186 let l35 = *ptr0.add(24).cast::<i32>();
19187 super::super::super::golem::rdbms::types::Timestamptz {
19188 timestamp: super::super::super::golem::rdbms::types::Timestamp {
19189 date: super::super::super::golem::rdbms::types::Date {
19190 year: l28,
19191 month: l29 as u8,
19192 day: l30 as u8,
19193 },
19194 time: super::super::super::golem::rdbms::types::Time {
19195 hour: l31 as u8,
19196 minute: l32 as u8,
19197 second: l33 as u8,
19198 nanosecond: l34 as u32,
19199 },
19200 },
19201 offset: l35,
19202 }
19203 };
19204 DbValue::Timestamptz(e260)
19205 }
19206 13 => {
19207 let e260 = {
19208 let l36 = *ptr0.add(8).cast::<i32>();
19209 let l37 = i32::from(*ptr0.add(12).cast::<u8>());
19210 let l38 = i32::from(*ptr0.add(13).cast::<u8>());
19211 super::super::super::golem::rdbms::types::Date {
19212 year: l36,
19213 month: l37 as u8,
19214 day: l38 as u8,
19215 }
19216 };
19217 DbValue::Date(e260)
19218 }
19219 14 => {
19220 let e260 = {
19221 let l39 = i32::from(*ptr0.add(8).cast::<u8>());
19222 let l40 = i32::from(*ptr0.add(9).cast::<u8>());
19223 let l41 = i32::from(*ptr0.add(10).cast::<u8>());
19224 let l42 = *ptr0.add(12).cast::<i32>();
19225 super::super::super::golem::rdbms::types::Time {
19226 hour: l39 as u8,
19227 minute: l40 as u8,
19228 second: l41 as u8,
19229 nanosecond: l42 as u32,
19230 }
19231 };
19232 DbValue::Time(e260)
19233 }
19234 15 => {
19235 let e260 = {
19236 let l43 = i32::from(*ptr0.add(8).cast::<u8>());
19237 let l44 = i32::from(*ptr0.add(9).cast::<u8>());
19238 let l45 = i32::from(*ptr0.add(10).cast::<u8>());
19239 let l46 = *ptr0.add(12).cast::<i32>();
19240 let l47 = *ptr0.add(16).cast::<i32>();
19241 super::super::super::golem::rdbms::types::Timetz {
19242 time: super::super::super::golem::rdbms::types::Time {
19243 hour: l43 as u8,
19244 minute: l44 as u8,
19245 second: l45 as u8,
19246 nanosecond: l46 as u32,
19247 },
19248 offset: l47,
19249 }
19250 };
19251 DbValue::Timetz(e260)
19252 }
19253 16 => {
19254 let e260 = {
19255 let l48 = *ptr0.add(8).cast::<i32>();
19256 let l49 = *ptr0.add(12).cast::<i32>();
19257 let l50 = *ptr0.add(16).cast::<i64>();
19258 Interval {
19259 months: l48,
19260 days: l49,
19261 microseconds: l50,
19262 }
19263 };
19264 DbValue::Interval(e260)
19265 }
19266 17 => {
19267 let e260 = {
19268 let l51 = *ptr0.add(8).cast::<*mut u8>();
19269 let l52 = *ptr0.add(12).cast::<usize>();
19270 let len53 = l52;
19271 _rt::Vec::from_raw_parts(l51.cast(), len53, len53)
19272 };
19273 DbValue::Bytea(e260)
19274 }
19275 18 => {
19276 let e260 = {
19277 let l54 = *ptr0.add(8).cast::<*mut u8>();
19278 let l55 = *ptr0.add(12).cast::<usize>();
19279 let len56 = l55;
19280 let bytes56 = _rt::Vec::from_raw_parts(
19281 l54.cast(),
19282 len56,
19283 len56,
19284 );
19285 _rt::string_lift(bytes56)
19286 };
19287 DbValue::Json(e260)
19288 }
19289 19 => {
19290 let e260 = {
19291 let l57 = *ptr0.add(8).cast::<*mut u8>();
19292 let l58 = *ptr0.add(12).cast::<usize>();
19293 let len59 = l58;
19294 let bytes59 = _rt::Vec::from_raw_parts(
19295 l57.cast(),
19296 len59,
19297 len59,
19298 );
19299 _rt::string_lift(bytes59)
19300 };
19301 DbValue::Jsonb(e260)
19302 }
19303 20 => {
19304 let e260 = {
19305 let l60 = *ptr0.add(8).cast::<*mut u8>();
19306 let l61 = *ptr0.add(12).cast::<usize>();
19307 let len62 = l61;
19308 let bytes62 = _rt::Vec::from_raw_parts(
19309 l60.cast(),
19310 len62,
19311 len62,
19312 );
19313 _rt::string_lift(bytes62)
19314 };
19315 DbValue::Jsonpath(e260)
19316 }
19317 21 => {
19318 let e260 = {
19319 let l63 = *ptr0.add(8).cast::<*mut u8>();
19320 let l64 = *ptr0.add(12).cast::<usize>();
19321 let len65 = l64;
19322 let bytes65 = _rt::Vec::from_raw_parts(
19323 l63.cast(),
19324 len65,
19325 len65,
19326 );
19327 _rt::string_lift(bytes65)
19328 };
19329 DbValue::Xml(e260)
19330 }
19331 22 => {
19332 let e260 = {
19333 let l66 = *ptr0.add(8).cast::<i64>();
19334 let l67 = *ptr0.add(16).cast::<i64>();
19335 super::super::super::golem::rdbms::types::Uuid {
19336 high_bits: l66 as u64,
19337 low_bits: l67 as u64,
19338 }
19339 };
19340 DbValue::Uuid(e260)
19341 }
19342 23 => {
19343 let e260 = {
19344 let l68 = i32::from(*ptr0.add(8).cast::<u8>());
19345 use super::super::super::golem::rdbms::types::IpAddress as V81;
19346 let v81 = match l68 {
19347 0 => {
19348 let e81 = {
19349 let l69 = i32::from(*ptr0.add(10).cast::<u8>());
19350 let l70 = i32::from(*ptr0.add(11).cast::<u8>());
19351 let l71 = i32::from(*ptr0.add(12).cast::<u8>());
19352 let l72 = i32::from(*ptr0.add(13).cast::<u8>());
19353 (l69 as u8, l70 as u8, l71 as u8, l72 as u8)
19354 };
19355 V81::Ipv4(e81)
19356 }
19357 n => {
19358 debug_assert_eq!(n, 1, "invalid enum discriminant");
19359 let e81 = {
19360 let l73 = i32::from(*ptr0.add(10).cast::<u16>());
19361 let l74 = i32::from(*ptr0.add(12).cast::<u16>());
19362 let l75 = i32::from(*ptr0.add(14).cast::<u16>());
19363 let l76 = i32::from(*ptr0.add(16).cast::<u16>());
19364 let l77 = i32::from(*ptr0.add(18).cast::<u16>());
19365 let l78 = i32::from(*ptr0.add(20).cast::<u16>());
19366 let l79 = i32::from(*ptr0.add(22).cast::<u16>());
19367 let l80 = i32::from(*ptr0.add(24).cast::<u16>());
19368 (
19369 l73 as u16,
19370 l74 as u16,
19371 l75 as u16,
19372 l76 as u16,
19373 l77 as u16,
19374 l78 as u16,
19375 l79 as u16,
19376 l80 as u16,
19377 )
19378 };
19379 V81::Ipv6(e81)
19380 }
19381 };
19382 v81
19383 };
19384 DbValue::Inet(e260)
19385 }
19386 24 => {
19387 let e260 = {
19388 let l82 = i32::from(*ptr0.add(8).cast::<u8>());
19389 use super::super::super::golem::rdbms::types::IpAddress as V95;
19390 let v95 = match l82 {
19391 0 => {
19392 let e95 = {
19393 let l83 = i32::from(*ptr0.add(10).cast::<u8>());
19394 let l84 = i32::from(*ptr0.add(11).cast::<u8>());
19395 let l85 = i32::from(*ptr0.add(12).cast::<u8>());
19396 let l86 = i32::from(*ptr0.add(13).cast::<u8>());
19397 (l83 as u8, l84 as u8, l85 as u8, l86 as u8)
19398 };
19399 V95::Ipv4(e95)
19400 }
19401 n => {
19402 debug_assert_eq!(n, 1, "invalid enum discriminant");
19403 let e95 = {
19404 let l87 = i32::from(*ptr0.add(10).cast::<u16>());
19405 let l88 = i32::from(*ptr0.add(12).cast::<u16>());
19406 let l89 = i32::from(*ptr0.add(14).cast::<u16>());
19407 let l90 = i32::from(*ptr0.add(16).cast::<u16>());
19408 let l91 = i32::from(*ptr0.add(18).cast::<u16>());
19409 let l92 = i32::from(*ptr0.add(20).cast::<u16>());
19410 let l93 = i32::from(*ptr0.add(22).cast::<u16>());
19411 let l94 = i32::from(*ptr0.add(24).cast::<u16>());
19412 (
19413 l87 as u16,
19414 l88 as u16,
19415 l89 as u16,
19416 l90 as u16,
19417 l91 as u16,
19418 l92 as u16,
19419 l93 as u16,
19420 l94 as u16,
19421 )
19422 };
19423 V95::Ipv6(e95)
19424 }
19425 };
19426 v95
19427 };
19428 DbValue::Cidr(e260)
19429 }
19430 25 => {
19431 let e260 = {
19432 let l96 = i32::from(*ptr0.add(8).cast::<u8>());
19433 let l97 = i32::from(*ptr0.add(9).cast::<u8>());
19434 let l98 = i32::from(*ptr0.add(10).cast::<u8>());
19435 let l99 = i32::from(*ptr0.add(11).cast::<u8>());
19436 let l100 = i32::from(*ptr0.add(12).cast::<u8>());
19437 let l101 = i32::from(*ptr0.add(13).cast::<u8>());
19438 super::super::super::golem::rdbms::types::MacAddress {
19439 octets: (
19440 l96 as u8,
19441 l97 as u8,
19442 l98 as u8,
19443 l99 as u8,
19444 l100 as u8,
19445 l101 as u8,
19446 ),
19447 }
19448 };
19449 DbValue::Macaddr(e260)
19450 }
19451 26 => {
19452 let e260 = {
19453 let l102 = *ptr0.add(8).cast::<*mut u8>();
19454 let l103 = *ptr0.add(12).cast::<usize>();
19455 let base105 = l102;
19456 let len105 = l103;
19457 let mut result105 = _rt::Vec::with_capacity(len105);
19458 for i in 0..len105 {
19459 let base = base105.add(i * 1);
19460 let e105 = {
19461 let l104 = i32::from(*base.add(0).cast::<u8>());
19462 _rt::bool_lift(l104 as u8)
19463 };
19464 result105.push(e105);
19465 }
19466 _rt::cabi_dealloc(base105, len105 * 1, 1);
19467 result105
19468 };
19469 DbValue::Bit(e260)
19470 }
19471 27 => {
19472 let e260 = {
19473 let l106 = *ptr0.add(8).cast::<*mut u8>();
19474 let l107 = *ptr0.add(12).cast::<usize>();
19475 let base109 = l106;
19476 let len109 = l107;
19477 let mut result109 = _rt::Vec::with_capacity(len109);
19478 for i in 0..len109 {
19479 let base = base109.add(i * 1);
19480 let e109 = {
19481 let l108 = i32::from(*base.add(0).cast::<u8>());
19482 _rt::bool_lift(l108 as u8)
19483 };
19484 result109.push(e109);
19485 }
19486 _rt::cabi_dealloc(base109, len109 * 1, 1);
19487 result109
19488 };
19489 DbValue::Varbit(e260)
19490 }
19491 28 => {
19492 let e260 = {
19493 let l110 = i32::from(*ptr0.add(8).cast::<u8>());
19494 let v113 = match l110 {
19495 0 => {
19496 let e113 = {
19497 let l111 = *ptr0.add(12).cast::<i32>();
19498 l111
19499 };
19500 Int4bound::Included(e113)
19501 }
19502 1 => {
19503 let e113 = {
19504 let l112 = *ptr0.add(12).cast::<i32>();
19505 l112
19506 };
19507 Int4bound::Excluded(e113)
19508 }
19509 n => {
19510 debug_assert_eq!(n, 2, "invalid enum discriminant");
19511 Int4bound::Unbounded
19512 }
19513 };
19514 let l114 = i32::from(*ptr0.add(16).cast::<u8>());
19515 let v117 = match l114 {
19516 0 => {
19517 let e117 = {
19518 let l115 = *ptr0.add(20).cast::<i32>();
19519 l115
19520 };
19521 Int4bound::Included(e117)
19522 }
19523 1 => {
19524 let e117 = {
19525 let l116 = *ptr0.add(20).cast::<i32>();
19526 l116
19527 };
19528 Int4bound::Excluded(e117)
19529 }
19530 n => {
19531 debug_assert_eq!(n, 2, "invalid enum discriminant");
19532 Int4bound::Unbounded
19533 }
19534 };
19535 Int4range {
19536 start: v113,
19537 end: v117,
19538 }
19539 };
19540 DbValue::Int4range(e260)
19541 }
19542 29 => {
19543 let e260 = {
19544 let l118 = i32::from(*ptr0.add(8).cast::<u8>());
19545 let v121 = match l118 {
19546 0 => {
19547 let e121 = {
19548 let l119 = *ptr0.add(16).cast::<i64>();
19549 l119
19550 };
19551 Int8bound::Included(e121)
19552 }
19553 1 => {
19554 let e121 = {
19555 let l120 = *ptr0.add(16).cast::<i64>();
19556 l120
19557 };
19558 Int8bound::Excluded(e121)
19559 }
19560 n => {
19561 debug_assert_eq!(n, 2, "invalid enum discriminant");
19562 Int8bound::Unbounded
19563 }
19564 };
19565 let l122 = i32::from(*ptr0.add(24).cast::<u8>());
19566 let v125 = match l122 {
19567 0 => {
19568 let e125 = {
19569 let l123 = *ptr0.add(32).cast::<i64>();
19570 l123
19571 };
19572 Int8bound::Included(e125)
19573 }
19574 1 => {
19575 let e125 = {
19576 let l124 = *ptr0.add(32).cast::<i64>();
19577 l124
19578 };
19579 Int8bound::Excluded(e125)
19580 }
19581 n => {
19582 debug_assert_eq!(n, 2, "invalid enum discriminant");
19583 Int8bound::Unbounded
19584 }
19585 };
19586 Int8range {
19587 start: v121,
19588 end: v125,
19589 }
19590 };
19591 DbValue::Int8range(e260)
19592 }
19593 30 => {
19594 let e260 = {
19595 let l126 = i32::from(*ptr0.add(8).cast::<u8>());
19596 let v133 = match l126 {
19597 0 => {
19598 let e133 = {
19599 let l127 = *ptr0.add(12).cast::<*mut u8>();
19600 let l128 = *ptr0.add(16).cast::<usize>();
19601 let len129 = l128;
19602 let bytes129 = _rt::Vec::from_raw_parts(
19603 l127.cast(),
19604 len129,
19605 len129,
19606 );
19607 _rt::string_lift(bytes129)
19608 };
19609 Numbound::Included(e133)
19610 }
19611 1 => {
19612 let e133 = {
19613 let l130 = *ptr0.add(12).cast::<*mut u8>();
19614 let l131 = *ptr0.add(16).cast::<usize>();
19615 let len132 = l131;
19616 let bytes132 = _rt::Vec::from_raw_parts(
19617 l130.cast(),
19618 len132,
19619 len132,
19620 );
19621 _rt::string_lift(bytes132)
19622 };
19623 Numbound::Excluded(e133)
19624 }
19625 n => {
19626 debug_assert_eq!(n, 2, "invalid enum discriminant");
19627 Numbound::Unbounded
19628 }
19629 };
19630 let l134 = i32::from(*ptr0.add(20).cast::<u8>());
19631 let v141 = match l134 {
19632 0 => {
19633 let e141 = {
19634 let l135 = *ptr0.add(24).cast::<*mut u8>();
19635 let l136 = *ptr0.add(28).cast::<usize>();
19636 let len137 = l136;
19637 let bytes137 = _rt::Vec::from_raw_parts(
19638 l135.cast(),
19639 len137,
19640 len137,
19641 );
19642 _rt::string_lift(bytes137)
19643 };
19644 Numbound::Included(e141)
19645 }
19646 1 => {
19647 let e141 = {
19648 let l138 = *ptr0.add(24).cast::<*mut u8>();
19649 let l139 = *ptr0.add(28).cast::<usize>();
19650 let len140 = l139;
19651 let bytes140 = _rt::Vec::from_raw_parts(
19652 l138.cast(),
19653 len140,
19654 len140,
19655 );
19656 _rt::string_lift(bytes140)
19657 };
19658 Numbound::Excluded(e141)
19659 }
19660 n => {
19661 debug_assert_eq!(n, 2, "invalid enum discriminant");
19662 Numbound::Unbounded
19663 }
19664 };
19665 Numrange { start: v133, end: v141 }
19666 };
19667 DbValue::Numrange(e260)
19668 }
19669 31 => {
19670 let e260 = {
19671 let l142 = i32::from(*ptr0.add(8).cast::<u8>());
19672 let v157 = match l142 {
19673 0 => {
19674 let e157 = {
19675 let l143 = *ptr0.add(12).cast::<i32>();
19676 let l144 = i32::from(*ptr0.add(16).cast::<u8>());
19677 let l145 = i32::from(*ptr0.add(17).cast::<u8>());
19678 let l146 = i32::from(*ptr0.add(20).cast::<u8>());
19679 let l147 = i32::from(*ptr0.add(21).cast::<u8>());
19680 let l148 = i32::from(*ptr0.add(22).cast::<u8>());
19681 let l149 = *ptr0.add(24).cast::<i32>();
19682 super::super::super::golem::rdbms::types::Timestamp {
19683 date: super::super::super::golem::rdbms::types::Date {
19684 year: l143,
19685 month: l144 as u8,
19686 day: l145 as u8,
19687 },
19688 time: super::super::super::golem::rdbms::types::Time {
19689 hour: l146 as u8,
19690 minute: l147 as u8,
19691 second: l148 as u8,
19692 nanosecond: l149 as u32,
19693 },
19694 }
19695 };
19696 Tsbound::Included(e157)
19697 }
19698 1 => {
19699 let e157 = {
19700 let l150 = *ptr0.add(12).cast::<i32>();
19701 let l151 = i32::from(*ptr0.add(16).cast::<u8>());
19702 let l152 = i32::from(*ptr0.add(17).cast::<u8>());
19703 let l153 = i32::from(*ptr0.add(20).cast::<u8>());
19704 let l154 = i32::from(*ptr0.add(21).cast::<u8>());
19705 let l155 = i32::from(*ptr0.add(22).cast::<u8>());
19706 let l156 = *ptr0.add(24).cast::<i32>();
19707 super::super::super::golem::rdbms::types::Timestamp {
19708 date: super::super::super::golem::rdbms::types::Date {
19709 year: l150,
19710 month: l151 as u8,
19711 day: l152 as u8,
19712 },
19713 time: super::super::super::golem::rdbms::types::Time {
19714 hour: l153 as u8,
19715 minute: l154 as u8,
19716 second: l155 as u8,
19717 nanosecond: l156 as u32,
19718 },
19719 }
19720 };
19721 Tsbound::Excluded(e157)
19722 }
19723 n => {
19724 debug_assert_eq!(n, 2, "invalid enum discriminant");
19725 Tsbound::Unbounded
19726 }
19727 };
19728 let l158 = i32::from(*ptr0.add(28).cast::<u8>());
19729 let v173 = match l158 {
19730 0 => {
19731 let e173 = {
19732 let l159 = *ptr0.add(32).cast::<i32>();
19733 let l160 = i32::from(*ptr0.add(36).cast::<u8>());
19734 let l161 = i32::from(*ptr0.add(37).cast::<u8>());
19735 let l162 = i32::from(*ptr0.add(40).cast::<u8>());
19736 let l163 = i32::from(*ptr0.add(41).cast::<u8>());
19737 let l164 = i32::from(*ptr0.add(42).cast::<u8>());
19738 let l165 = *ptr0.add(44).cast::<i32>();
19739 super::super::super::golem::rdbms::types::Timestamp {
19740 date: super::super::super::golem::rdbms::types::Date {
19741 year: l159,
19742 month: l160 as u8,
19743 day: l161 as u8,
19744 },
19745 time: super::super::super::golem::rdbms::types::Time {
19746 hour: l162 as u8,
19747 minute: l163 as u8,
19748 second: l164 as u8,
19749 nanosecond: l165 as u32,
19750 },
19751 }
19752 };
19753 Tsbound::Included(e173)
19754 }
19755 1 => {
19756 let e173 = {
19757 let l166 = *ptr0.add(32).cast::<i32>();
19758 let l167 = i32::from(*ptr0.add(36).cast::<u8>());
19759 let l168 = i32::from(*ptr0.add(37).cast::<u8>());
19760 let l169 = i32::from(*ptr0.add(40).cast::<u8>());
19761 let l170 = i32::from(*ptr0.add(41).cast::<u8>());
19762 let l171 = i32::from(*ptr0.add(42).cast::<u8>());
19763 let l172 = *ptr0.add(44).cast::<i32>();
19764 super::super::super::golem::rdbms::types::Timestamp {
19765 date: super::super::super::golem::rdbms::types::Date {
19766 year: l166,
19767 month: l167 as u8,
19768 day: l168 as u8,
19769 },
19770 time: super::super::super::golem::rdbms::types::Time {
19771 hour: l169 as u8,
19772 minute: l170 as u8,
19773 second: l171 as u8,
19774 nanosecond: l172 as u32,
19775 },
19776 }
19777 };
19778 Tsbound::Excluded(e173)
19779 }
19780 n => {
19781 debug_assert_eq!(n, 2, "invalid enum discriminant");
19782 Tsbound::Unbounded
19783 }
19784 };
19785 Tsrange { start: v157, end: v173 }
19786 };
19787 DbValue::Tsrange(e260)
19788 }
19789 32 => {
19790 let e260 = {
19791 let l174 = i32::from(*ptr0.add(8).cast::<u8>());
19792 let v191 = match l174 {
19793 0 => {
19794 let e191 = {
19795 let l175 = *ptr0.add(12).cast::<i32>();
19796 let l176 = i32::from(*ptr0.add(16).cast::<u8>());
19797 let l177 = i32::from(*ptr0.add(17).cast::<u8>());
19798 let l178 = i32::from(*ptr0.add(20).cast::<u8>());
19799 let l179 = i32::from(*ptr0.add(21).cast::<u8>());
19800 let l180 = i32::from(*ptr0.add(22).cast::<u8>());
19801 let l181 = *ptr0.add(24).cast::<i32>();
19802 let l182 = *ptr0.add(28).cast::<i32>();
19803 super::super::super::golem::rdbms::types::Timestamptz {
19804 timestamp: super::super::super::golem::rdbms::types::Timestamp {
19805 date: super::super::super::golem::rdbms::types::Date {
19806 year: l175,
19807 month: l176 as u8,
19808 day: l177 as u8,
19809 },
19810 time: super::super::super::golem::rdbms::types::Time {
19811 hour: l178 as u8,
19812 minute: l179 as u8,
19813 second: l180 as u8,
19814 nanosecond: l181 as u32,
19815 },
19816 },
19817 offset: l182,
19818 }
19819 };
19820 Tstzbound::Included(e191)
19821 }
19822 1 => {
19823 let e191 = {
19824 let l183 = *ptr0.add(12).cast::<i32>();
19825 let l184 = i32::from(*ptr0.add(16).cast::<u8>());
19826 let l185 = i32::from(*ptr0.add(17).cast::<u8>());
19827 let l186 = i32::from(*ptr0.add(20).cast::<u8>());
19828 let l187 = i32::from(*ptr0.add(21).cast::<u8>());
19829 let l188 = i32::from(*ptr0.add(22).cast::<u8>());
19830 let l189 = *ptr0.add(24).cast::<i32>();
19831 let l190 = *ptr0.add(28).cast::<i32>();
19832 super::super::super::golem::rdbms::types::Timestamptz {
19833 timestamp: super::super::super::golem::rdbms::types::Timestamp {
19834 date: super::super::super::golem::rdbms::types::Date {
19835 year: l183,
19836 month: l184 as u8,
19837 day: l185 as u8,
19838 },
19839 time: super::super::super::golem::rdbms::types::Time {
19840 hour: l186 as u8,
19841 minute: l187 as u8,
19842 second: l188 as u8,
19843 nanosecond: l189 as u32,
19844 },
19845 },
19846 offset: l190,
19847 }
19848 };
19849 Tstzbound::Excluded(e191)
19850 }
19851 n => {
19852 debug_assert_eq!(n, 2, "invalid enum discriminant");
19853 Tstzbound::Unbounded
19854 }
19855 };
19856 let l192 = i32::from(*ptr0.add(32).cast::<u8>());
19857 let v209 = match l192 {
19858 0 => {
19859 let e209 = {
19860 let l193 = *ptr0.add(36).cast::<i32>();
19861 let l194 = i32::from(*ptr0.add(40).cast::<u8>());
19862 let l195 = i32::from(*ptr0.add(41).cast::<u8>());
19863 let l196 = i32::from(*ptr0.add(44).cast::<u8>());
19864 let l197 = i32::from(*ptr0.add(45).cast::<u8>());
19865 let l198 = i32::from(*ptr0.add(46).cast::<u8>());
19866 let l199 = *ptr0.add(48).cast::<i32>();
19867 let l200 = *ptr0.add(52).cast::<i32>();
19868 super::super::super::golem::rdbms::types::Timestamptz {
19869 timestamp: super::super::super::golem::rdbms::types::Timestamp {
19870 date: super::super::super::golem::rdbms::types::Date {
19871 year: l193,
19872 month: l194 as u8,
19873 day: l195 as u8,
19874 },
19875 time: super::super::super::golem::rdbms::types::Time {
19876 hour: l196 as u8,
19877 minute: l197 as u8,
19878 second: l198 as u8,
19879 nanosecond: l199 as u32,
19880 },
19881 },
19882 offset: l200,
19883 }
19884 };
19885 Tstzbound::Included(e209)
19886 }
19887 1 => {
19888 let e209 = {
19889 let l201 = *ptr0.add(36).cast::<i32>();
19890 let l202 = i32::from(*ptr0.add(40).cast::<u8>());
19891 let l203 = i32::from(*ptr0.add(41).cast::<u8>());
19892 let l204 = i32::from(*ptr0.add(44).cast::<u8>());
19893 let l205 = i32::from(*ptr0.add(45).cast::<u8>());
19894 let l206 = i32::from(*ptr0.add(46).cast::<u8>());
19895 let l207 = *ptr0.add(48).cast::<i32>();
19896 let l208 = *ptr0.add(52).cast::<i32>();
19897 super::super::super::golem::rdbms::types::Timestamptz {
19898 timestamp: super::super::super::golem::rdbms::types::Timestamp {
19899 date: super::super::super::golem::rdbms::types::Date {
19900 year: l201,
19901 month: l202 as u8,
19902 day: l203 as u8,
19903 },
19904 time: super::super::super::golem::rdbms::types::Time {
19905 hour: l204 as u8,
19906 minute: l205 as u8,
19907 second: l206 as u8,
19908 nanosecond: l207 as u32,
19909 },
19910 },
19911 offset: l208,
19912 }
19913 };
19914 Tstzbound::Excluded(e209)
19915 }
19916 n => {
19917 debug_assert_eq!(n, 2, "invalid enum discriminant");
19918 Tstzbound::Unbounded
19919 }
19920 };
19921 Tstzrange {
19922 start: v191,
19923 end: v209,
19924 }
19925 };
19926 DbValue::Tstzrange(e260)
19927 }
19928 33 => {
19929 let e260 = {
19930 let l210 = i32::from(*ptr0.add(8).cast::<u8>());
19931 let v217 = match l210 {
19932 0 => {
19933 let e217 = {
19934 let l211 = *ptr0.add(12).cast::<i32>();
19935 let l212 = i32::from(*ptr0.add(16).cast::<u8>());
19936 let l213 = i32::from(*ptr0.add(17).cast::<u8>());
19937 super::super::super::golem::rdbms::types::Date {
19938 year: l211,
19939 month: l212 as u8,
19940 day: l213 as u8,
19941 }
19942 };
19943 Datebound::Included(e217)
19944 }
19945 1 => {
19946 let e217 = {
19947 let l214 = *ptr0.add(12).cast::<i32>();
19948 let l215 = i32::from(*ptr0.add(16).cast::<u8>());
19949 let l216 = i32::from(*ptr0.add(17).cast::<u8>());
19950 super::super::super::golem::rdbms::types::Date {
19951 year: l214,
19952 month: l215 as u8,
19953 day: l216 as u8,
19954 }
19955 };
19956 Datebound::Excluded(e217)
19957 }
19958 n => {
19959 debug_assert_eq!(n, 2, "invalid enum discriminant");
19960 Datebound::Unbounded
19961 }
19962 };
19963 let l218 = i32::from(*ptr0.add(20).cast::<u8>());
19964 let v225 = match l218 {
19965 0 => {
19966 let e225 = {
19967 let l219 = *ptr0.add(24).cast::<i32>();
19968 let l220 = i32::from(*ptr0.add(28).cast::<u8>());
19969 let l221 = i32::from(*ptr0.add(29).cast::<u8>());
19970 super::super::super::golem::rdbms::types::Date {
19971 year: l219,
19972 month: l220 as u8,
19973 day: l221 as u8,
19974 }
19975 };
19976 Datebound::Included(e225)
19977 }
19978 1 => {
19979 let e225 = {
19980 let l222 = *ptr0.add(24).cast::<i32>();
19981 let l223 = i32::from(*ptr0.add(28).cast::<u8>());
19982 let l224 = i32::from(*ptr0.add(29).cast::<u8>());
19983 super::super::super::golem::rdbms::types::Date {
19984 year: l222,
19985 month: l223 as u8,
19986 day: l224 as u8,
19987 }
19988 };
19989 Datebound::Excluded(e225)
19990 }
19991 n => {
19992 debug_assert_eq!(n, 2, "invalid enum discriminant");
19993 Datebound::Unbounded
19994 }
19995 };
19996 Daterange {
19997 start: v217,
19998 end: v225,
19999 }
20000 };
20001 DbValue::Daterange(e260)
20002 }
20003 34 => {
20004 let e260 = {
20005 let l226 = *ptr0.add(8).cast::<i64>();
20006 l226
20007 };
20008 DbValue::Money(e260)
20009 }
20010 35 => {
20011 let e260 = {
20012 let l227 = *ptr0.add(8).cast::<i32>();
20013 l227 as u32
20014 };
20015 DbValue::Oid(e260)
20016 }
20017 36 => {
20018 let e260 = {
20019 let l228 = *ptr0.add(8).cast::<*mut u8>();
20020 let l229 = *ptr0.add(12).cast::<usize>();
20021 let len230 = l229;
20022 let bytes230 = _rt::Vec::from_raw_parts(
20023 l228.cast(),
20024 len230,
20025 len230,
20026 );
20027 let l231 = *ptr0.add(16).cast::<*mut u8>();
20028 let l232 = *ptr0.add(20).cast::<usize>();
20029 let len233 = l232;
20030 let bytes233 = _rt::Vec::from_raw_parts(
20031 l231.cast(),
20032 len233,
20033 len233,
20034 );
20035 Enumeration {
20036 name: _rt::string_lift(bytes230),
20037 value: _rt::string_lift(bytes233),
20038 }
20039 };
20040 DbValue::Enumeration(e260)
20041 }
20042 37 => {
20043 let e260 = {
20044 let l234 = *ptr0.add(8).cast::<*mut u8>();
20045 let l235 = *ptr0.add(12).cast::<usize>();
20046 let len236 = l235;
20047 let bytes236 = _rt::Vec::from_raw_parts(
20048 l234.cast(),
20049 len236,
20050 len236,
20051 );
20052 let l237 = *ptr0.add(16).cast::<*mut u8>();
20053 let l238 = *ptr0.add(20).cast::<usize>();
20054 let base240 = l237;
20055 let len240 = l238;
20056 let mut result240 = _rt::Vec::with_capacity(len240);
20057 for i in 0..len240 {
20058 let base = base240.add(i * 4);
20059 let e240 = {
20060 let l239 = *base.add(0).cast::<i32>();
20061 LazyDbValue::from_handle(l239 as u32)
20062 };
20063 result240.push(e240);
20064 }
20065 _rt::cabi_dealloc(base240, len240 * 4, 4);
20066 Composite {
20067 name: _rt::string_lift(bytes236),
20068 values: result240,
20069 }
20070 };
20071 DbValue::Composite(e260)
20072 }
20073 38 => {
20074 let e260 = {
20075 let l241 = *ptr0.add(8).cast::<*mut u8>();
20076 let l242 = *ptr0.add(12).cast::<usize>();
20077 let len243 = l242;
20078 let bytes243 = _rt::Vec::from_raw_parts(
20079 l241.cast(),
20080 len243,
20081 len243,
20082 );
20083 let l244 = *ptr0.add(16).cast::<i32>();
20084 Domain {
20085 name: _rt::string_lift(bytes243),
20086 value: LazyDbValue::from_handle(l244 as u32),
20087 }
20088 };
20089 DbValue::Domain(e260)
20090 }
20091 39 => {
20092 let e260 = {
20093 let l245 = *ptr0.add(8).cast::<*mut u8>();
20094 let l246 = *ptr0.add(12).cast::<usize>();
20095 let base248 = l245;
20096 let len248 = l246;
20097 let mut result248 = _rt::Vec::with_capacity(len248);
20098 for i in 0..len248 {
20099 let base = base248.add(i * 4);
20100 let e248 = {
20101 let l247 = *base.add(0).cast::<i32>();
20102 LazyDbValue::from_handle(l247 as u32)
20103 };
20104 result248.push(e248);
20105 }
20106 _rt::cabi_dealloc(base248, len248 * 4, 4);
20107 result248
20108 };
20109 DbValue::Array(e260)
20110 }
20111 40 => {
20112 let e260 = {
20113 let l249 = *ptr0.add(8).cast::<*mut u8>();
20114 let l250 = *ptr0.add(12).cast::<usize>();
20115 let len251 = l250;
20116 let bytes251 = _rt::Vec::from_raw_parts(
20117 l249.cast(),
20118 len251,
20119 len251,
20120 );
20121 let l252 = i32::from(*ptr0.add(16).cast::<u8>());
20122 let v255 = match l252 {
20123 0 => {
20124 let e255 = {
20125 let l253 = *ptr0.add(20).cast::<i32>();
20126 LazyDbValue::from_handle(l253 as u32)
20127 };
20128 ValueBound::Included(e255)
20129 }
20130 1 => {
20131 let e255 = {
20132 let l254 = *ptr0.add(20).cast::<i32>();
20133 LazyDbValue::from_handle(l254 as u32)
20134 };
20135 ValueBound::Excluded(e255)
20136 }
20137 n => {
20138 debug_assert_eq!(n, 2, "invalid enum discriminant");
20139 ValueBound::Unbounded
20140 }
20141 };
20142 let l256 = i32::from(*ptr0.add(24).cast::<u8>());
20143 let v259 = match l256 {
20144 0 => {
20145 let e259 = {
20146 let l257 = *ptr0.add(28).cast::<i32>();
20147 LazyDbValue::from_handle(l257 as u32)
20148 };
20149 ValueBound::Included(e259)
20150 }
20151 1 => {
20152 let e259 = {
20153 let l258 = *ptr0.add(28).cast::<i32>();
20154 LazyDbValue::from_handle(l258 as u32)
20155 };
20156 ValueBound::Excluded(e259)
20157 }
20158 n => {
20159 debug_assert_eq!(n, 2, "invalid enum discriminant");
20160 ValueBound::Unbounded
20161 }
20162 };
20163 Range {
20164 name: _rt::string_lift(bytes251),
20165 value: ValuesRange {
20166 start: v255,
20167 end: v259,
20168 },
20169 }
20170 };
20171 DbValue::Range(e260)
20172 }
20173 n => {
20174 debug_assert_eq!(n, 41, "invalid enum discriminant");
20175 DbValue::Null
20176 }
20177 };
20178 v260
20179 }
20180 }
20181 }
20182 impl LazyDbColumnType {
20183 #[allow(unused_unsafe, clippy::all)]
20184 pub fn new(value: DbColumnType) -> Self {
20185 unsafe {
20186 let mut cleanup_list = _rt::Vec::new();
20187 let (
20188 result11_0,
20189 result11_1,
20190 result11_2,
20191 result11_3,
20192 result11_4,
20193 ) = match &value {
20194 DbColumnType::Character => {
20195 (
20196 0i32,
20197 ::core::ptr::null_mut(),
20198 0usize,
20199 ::core::ptr::null_mut(),
20200 0usize,
20201 )
20202 }
20203 DbColumnType::Int2 => {
20204 (
20205 1i32,
20206 ::core::ptr::null_mut(),
20207 0usize,
20208 ::core::ptr::null_mut(),
20209 0usize,
20210 )
20211 }
20212 DbColumnType::Int4 => {
20213 (
20214 2i32,
20215 ::core::ptr::null_mut(),
20216 0usize,
20217 ::core::ptr::null_mut(),
20218 0usize,
20219 )
20220 }
20221 DbColumnType::Int8 => {
20222 (
20223 3i32,
20224 ::core::ptr::null_mut(),
20225 0usize,
20226 ::core::ptr::null_mut(),
20227 0usize,
20228 )
20229 }
20230 DbColumnType::Float4 => {
20231 (
20232 4i32,
20233 ::core::ptr::null_mut(),
20234 0usize,
20235 ::core::ptr::null_mut(),
20236 0usize,
20237 )
20238 }
20239 DbColumnType::Float8 => {
20240 (
20241 5i32,
20242 ::core::ptr::null_mut(),
20243 0usize,
20244 ::core::ptr::null_mut(),
20245 0usize,
20246 )
20247 }
20248 DbColumnType::Numeric => {
20249 (
20250 6i32,
20251 ::core::ptr::null_mut(),
20252 0usize,
20253 ::core::ptr::null_mut(),
20254 0usize,
20255 )
20256 }
20257 DbColumnType::Boolean => {
20258 (
20259 7i32,
20260 ::core::ptr::null_mut(),
20261 0usize,
20262 ::core::ptr::null_mut(),
20263 0usize,
20264 )
20265 }
20266 DbColumnType::Text => {
20267 (
20268 8i32,
20269 ::core::ptr::null_mut(),
20270 0usize,
20271 ::core::ptr::null_mut(),
20272 0usize,
20273 )
20274 }
20275 DbColumnType::Varchar => {
20276 (
20277 9i32,
20278 ::core::ptr::null_mut(),
20279 0usize,
20280 ::core::ptr::null_mut(),
20281 0usize,
20282 )
20283 }
20284 DbColumnType::Bpchar => {
20285 (
20286 10i32,
20287 ::core::ptr::null_mut(),
20288 0usize,
20289 ::core::ptr::null_mut(),
20290 0usize,
20291 )
20292 }
20293 DbColumnType::Timestamp => {
20294 (
20295 11i32,
20296 ::core::ptr::null_mut(),
20297 0usize,
20298 ::core::ptr::null_mut(),
20299 0usize,
20300 )
20301 }
20302 DbColumnType::Timestamptz => {
20303 (
20304 12i32,
20305 ::core::ptr::null_mut(),
20306 0usize,
20307 ::core::ptr::null_mut(),
20308 0usize,
20309 )
20310 }
20311 DbColumnType::Date => {
20312 (
20313 13i32,
20314 ::core::ptr::null_mut(),
20315 0usize,
20316 ::core::ptr::null_mut(),
20317 0usize,
20318 )
20319 }
20320 DbColumnType::Time => {
20321 (
20322 14i32,
20323 ::core::ptr::null_mut(),
20324 0usize,
20325 ::core::ptr::null_mut(),
20326 0usize,
20327 )
20328 }
20329 DbColumnType::Timetz => {
20330 (
20331 15i32,
20332 ::core::ptr::null_mut(),
20333 0usize,
20334 ::core::ptr::null_mut(),
20335 0usize,
20336 )
20337 }
20338 DbColumnType::Interval => {
20339 (
20340 16i32,
20341 ::core::ptr::null_mut(),
20342 0usize,
20343 ::core::ptr::null_mut(),
20344 0usize,
20345 )
20346 }
20347 DbColumnType::Bytea => {
20348 (
20349 17i32,
20350 ::core::ptr::null_mut(),
20351 0usize,
20352 ::core::ptr::null_mut(),
20353 0usize,
20354 )
20355 }
20356 DbColumnType::Uuid => {
20357 (
20358 18i32,
20359 ::core::ptr::null_mut(),
20360 0usize,
20361 ::core::ptr::null_mut(),
20362 0usize,
20363 )
20364 }
20365 DbColumnType::Xml => {
20366 (
20367 19i32,
20368 ::core::ptr::null_mut(),
20369 0usize,
20370 ::core::ptr::null_mut(),
20371 0usize,
20372 )
20373 }
20374 DbColumnType::Json => {
20375 (
20376 20i32,
20377 ::core::ptr::null_mut(),
20378 0usize,
20379 ::core::ptr::null_mut(),
20380 0usize,
20381 )
20382 }
20383 DbColumnType::Jsonb => {
20384 (
20385 21i32,
20386 ::core::ptr::null_mut(),
20387 0usize,
20388 ::core::ptr::null_mut(),
20389 0usize,
20390 )
20391 }
20392 DbColumnType::Jsonpath => {
20393 (
20394 22i32,
20395 ::core::ptr::null_mut(),
20396 0usize,
20397 ::core::ptr::null_mut(),
20398 0usize,
20399 )
20400 }
20401 DbColumnType::Inet => {
20402 (
20403 23i32,
20404 ::core::ptr::null_mut(),
20405 0usize,
20406 ::core::ptr::null_mut(),
20407 0usize,
20408 )
20409 }
20410 DbColumnType::Cidr => {
20411 (
20412 24i32,
20413 ::core::ptr::null_mut(),
20414 0usize,
20415 ::core::ptr::null_mut(),
20416 0usize,
20417 )
20418 }
20419 DbColumnType::Macaddr => {
20420 (
20421 25i32,
20422 ::core::ptr::null_mut(),
20423 0usize,
20424 ::core::ptr::null_mut(),
20425 0usize,
20426 )
20427 }
20428 DbColumnType::Bit => {
20429 (
20430 26i32,
20431 ::core::ptr::null_mut(),
20432 0usize,
20433 ::core::ptr::null_mut(),
20434 0usize,
20435 )
20436 }
20437 DbColumnType::Varbit => {
20438 (
20439 27i32,
20440 ::core::ptr::null_mut(),
20441 0usize,
20442 ::core::ptr::null_mut(),
20443 0usize,
20444 )
20445 }
20446 DbColumnType::Int4range => {
20447 (
20448 28i32,
20449 ::core::ptr::null_mut(),
20450 0usize,
20451 ::core::ptr::null_mut(),
20452 0usize,
20453 )
20454 }
20455 DbColumnType::Int8range => {
20456 (
20457 29i32,
20458 ::core::ptr::null_mut(),
20459 0usize,
20460 ::core::ptr::null_mut(),
20461 0usize,
20462 )
20463 }
20464 DbColumnType::Numrange => {
20465 (
20466 30i32,
20467 ::core::ptr::null_mut(),
20468 0usize,
20469 ::core::ptr::null_mut(),
20470 0usize,
20471 )
20472 }
20473 DbColumnType::Tsrange => {
20474 (
20475 31i32,
20476 ::core::ptr::null_mut(),
20477 0usize,
20478 ::core::ptr::null_mut(),
20479 0usize,
20480 )
20481 }
20482 DbColumnType::Tstzrange => {
20483 (
20484 32i32,
20485 ::core::ptr::null_mut(),
20486 0usize,
20487 ::core::ptr::null_mut(),
20488 0usize,
20489 )
20490 }
20491 DbColumnType::Daterange => {
20492 (
20493 33i32,
20494 ::core::ptr::null_mut(),
20495 0usize,
20496 ::core::ptr::null_mut(),
20497 0usize,
20498 )
20499 }
20500 DbColumnType::Money => {
20501 (
20502 34i32,
20503 ::core::ptr::null_mut(),
20504 0usize,
20505 ::core::ptr::null_mut(),
20506 0usize,
20507 )
20508 }
20509 DbColumnType::Oid => {
20510 (
20511 35i32,
20512 ::core::ptr::null_mut(),
20513 0usize,
20514 ::core::ptr::null_mut(),
20515 0usize,
20516 )
20517 }
20518 DbColumnType::Enumeration(e) => {
20519 let EnumerationType { name: name0 } = e;
20520 let vec1 = name0;
20521 let ptr1 = vec1.as_ptr().cast::<u8>();
20522 let len1 = vec1.len();
20523 (
20524 36i32,
20525 ptr1.cast_mut(),
20526 len1,
20527 ::core::ptr::null_mut(),
20528 0usize,
20529 )
20530 }
20531 DbColumnType::Composite(e) => {
20532 let CompositeType {
20533 name: name2,
20534 attributes: attributes2,
20535 } = e;
20536 let vec3 = name2;
20537 let ptr3 = vec3.as_ptr().cast::<u8>();
20538 let len3 = vec3.len();
20539 let vec6 = attributes2;
20540 let len6 = vec6.len();
20541 let layout6 = _rt::alloc::Layout::from_size_align_unchecked(
20542 vec6.len() * 12,
20543 4,
20544 );
20545 let result6 = if layout6.size() != 0 {
20546 let ptr = _rt::alloc::alloc(layout6).cast::<u8>();
20547 if ptr.is_null() {
20548 _rt::alloc::handle_alloc_error(layout6);
20549 }
20550 ptr
20551 } else {
20552 ::core::ptr::null_mut()
20553 };
20554 for (i, e) in vec6.into_iter().enumerate() {
20555 let base = result6.add(i * 12);
20556 {
20557 let (t4_0, t4_1) = e;
20558 let vec5 = t4_0;
20559 let ptr5 = vec5.as_ptr().cast::<u8>();
20560 let len5 = vec5.len();
20561 *base.add(4).cast::<usize>() = len5;
20562 *base.add(0).cast::<*mut u8>() = ptr5.cast_mut();
20563 *base.add(8).cast::<i32>() = (t4_1).take_handle() as i32;
20564 }
20565 }
20566 cleanup_list.extend_from_slice(&[(result6, layout6)]);
20567 (37i32, ptr3.cast_mut(), len3, result6, len6)
20568 }
20569 DbColumnType::Domain(e) => {
20570 let DomainType { name: name7, base_type: base_type7 } = e;
20571 let vec8 = name7;
20572 let ptr8 = vec8.as_ptr().cast::<u8>();
20573 let len8 = vec8.len();
20574 (
20575 38i32,
20576 ptr8.cast_mut(),
20577 len8,
20578 (base_type7).take_handle() as i32 as *mut u8,
20579 0usize,
20580 )
20581 }
20582 DbColumnType::Array(e) => {
20583 (
20584 39i32,
20585 (e).take_handle() as i32 as *mut u8,
20586 0usize,
20587 ::core::ptr::null_mut(),
20588 0usize,
20589 )
20590 }
20591 DbColumnType::Range(e) => {
20592 let RangeType { name: name9, base_type: base_type9 } = e;
20593 let vec10 = name9;
20594 let ptr10 = vec10.as_ptr().cast::<u8>();
20595 let len10 = vec10.len();
20596 (
20597 40i32,
20598 ptr10.cast_mut(),
20599 len10,
20600 (base_type9).take_handle() as i32 as *mut u8,
20601 0usize,
20602 )
20603 }
20604 };
20605 #[cfg(target_arch = "wasm32")]
20606 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
20607 extern "C" {
20608 #[link_name = "[constructor]lazy-db-column-type"]
20609 fn wit_import(
20610 _: i32,
20611 _: *mut u8,
20612 _: usize,
20613 _: *mut u8,
20614 _: usize,
20615 ) -> i32;
20616 }
20617 #[cfg(not(target_arch = "wasm32"))]
20618 fn wit_import(
20619 _: i32,
20620 _: *mut u8,
20621 _: usize,
20622 _: *mut u8,
20623 _: usize,
20624 ) -> i32 {
20625 unreachable!()
20626 }
20627 let ret = wit_import(
20628 result11_0,
20629 result11_1,
20630 result11_2,
20631 result11_3,
20632 result11_4,
20633 );
20634 for (ptr, layout) in cleanup_list {
20635 if layout.size() != 0 {
20636 _rt::alloc::dealloc(ptr.cast(), layout);
20637 }
20638 }
20639 LazyDbColumnType::from_handle(ret as u32)
20640 }
20641 }
20642 }
20643 impl LazyDbColumnType {
20644 #[allow(unused_unsafe, clippy::all)]
20645 pub fn get(&self) -> DbColumnType {
20646 unsafe {
20647 #[repr(align(4))]
20648 struct RetArea([::core::mem::MaybeUninit<u8>; 20]);
20649 let mut ret_area = RetArea(
20650 [::core::mem::MaybeUninit::uninit(); 20],
20651 );
20652 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
20653 #[cfg(target_arch = "wasm32")]
20654 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
20655 extern "C" {
20656 #[link_name = "[method]lazy-db-column-type.get"]
20657 fn wit_import(_: i32, _: *mut u8);
20658 }
20659 #[cfg(not(target_arch = "wasm32"))]
20660 fn wit_import(_: i32, _: *mut u8) {
20661 unreachable!()
20662 }
20663 wit_import((self).handle() as i32, ptr0);
20664 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
20665 let v24 = match l1 {
20666 0 => DbColumnType::Character,
20667 1 => DbColumnType::Int2,
20668 2 => DbColumnType::Int4,
20669 3 => DbColumnType::Int8,
20670 4 => DbColumnType::Float4,
20671 5 => DbColumnType::Float8,
20672 6 => DbColumnType::Numeric,
20673 7 => DbColumnType::Boolean,
20674 8 => DbColumnType::Text,
20675 9 => DbColumnType::Varchar,
20676 10 => DbColumnType::Bpchar,
20677 11 => DbColumnType::Timestamp,
20678 12 => DbColumnType::Timestamptz,
20679 13 => DbColumnType::Date,
20680 14 => DbColumnType::Time,
20681 15 => DbColumnType::Timetz,
20682 16 => DbColumnType::Interval,
20683 17 => DbColumnType::Bytea,
20684 18 => DbColumnType::Uuid,
20685 19 => DbColumnType::Xml,
20686 20 => DbColumnType::Json,
20687 21 => DbColumnType::Jsonb,
20688 22 => DbColumnType::Jsonpath,
20689 23 => DbColumnType::Inet,
20690 24 => DbColumnType::Cidr,
20691 25 => DbColumnType::Macaddr,
20692 26 => DbColumnType::Bit,
20693 27 => DbColumnType::Varbit,
20694 28 => DbColumnType::Int4range,
20695 29 => DbColumnType::Int8range,
20696 30 => DbColumnType::Numrange,
20697 31 => DbColumnType::Tsrange,
20698 32 => DbColumnType::Tstzrange,
20699 33 => DbColumnType::Daterange,
20700 34 => DbColumnType::Money,
20701 35 => DbColumnType::Oid,
20702 36 => {
20703 let e24 = {
20704 let l2 = *ptr0.add(4).cast::<*mut u8>();
20705 let l3 = *ptr0.add(8).cast::<usize>();
20706 let len4 = l3;
20707 let bytes4 = _rt::Vec::from_raw_parts(
20708 l2.cast(),
20709 len4,
20710 len4,
20711 );
20712 EnumerationType {
20713 name: _rt::string_lift(bytes4),
20714 }
20715 };
20716 DbColumnType::Enumeration(e24)
20717 }
20718 37 => {
20719 let e24 = {
20720 let l5 = *ptr0.add(4).cast::<*mut u8>();
20721 let l6 = *ptr0.add(8).cast::<usize>();
20722 let len7 = l6;
20723 let bytes7 = _rt::Vec::from_raw_parts(
20724 l5.cast(),
20725 len7,
20726 len7,
20727 );
20728 let l8 = *ptr0.add(12).cast::<*mut u8>();
20729 let l9 = *ptr0.add(16).cast::<usize>();
20730 let base14 = l8;
20731 let len14 = l9;
20732 let mut result14 = _rt::Vec::with_capacity(len14);
20733 for i in 0..len14 {
20734 let base = base14.add(i * 12);
20735 let e14 = {
20736 let l10 = *base.add(0).cast::<*mut u8>();
20737 let l11 = *base.add(4).cast::<usize>();
20738 let len12 = l11;
20739 let bytes12 = _rt::Vec::from_raw_parts(
20740 l10.cast(),
20741 len12,
20742 len12,
20743 );
20744 let l13 = *base.add(8).cast::<i32>();
20745 (
20746 _rt::string_lift(bytes12),
20747 LazyDbColumnType::from_handle(l13 as u32),
20748 )
20749 };
20750 result14.push(e14);
20751 }
20752 _rt::cabi_dealloc(base14, len14 * 12, 4);
20753 CompositeType {
20754 name: _rt::string_lift(bytes7),
20755 attributes: result14,
20756 }
20757 };
20758 DbColumnType::Composite(e24)
20759 }
20760 38 => {
20761 let e24 = {
20762 let l15 = *ptr0.add(4).cast::<*mut u8>();
20763 let l16 = *ptr0.add(8).cast::<usize>();
20764 let len17 = l16;
20765 let bytes17 = _rt::Vec::from_raw_parts(
20766 l15.cast(),
20767 len17,
20768 len17,
20769 );
20770 let l18 = *ptr0.add(12).cast::<i32>();
20771 DomainType {
20772 name: _rt::string_lift(bytes17),
20773 base_type: LazyDbColumnType::from_handle(l18 as u32),
20774 }
20775 };
20776 DbColumnType::Domain(e24)
20777 }
20778 39 => {
20779 let e24 = {
20780 let l19 = *ptr0.add(4).cast::<i32>();
20781 LazyDbColumnType::from_handle(l19 as u32)
20782 };
20783 DbColumnType::Array(e24)
20784 }
20785 n => {
20786 debug_assert_eq!(n, 40, "invalid enum discriminant");
20787 let e24 = {
20788 let l20 = *ptr0.add(4).cast::<*mut u8>();
20789 let l21 = *ptr0.add(8).cast::<usize>();
20790 let len22 = l21;
20791 let bytes22 = _rt::Vec::from_raw_parts(
20792 l20.cast(),
20793 len22,
20794 len22,
20795 );
20796 let l23 = *ptr0.add(12).cast::<i32>();
20797 RangeType {
20798 name: _rt::string_lift(bytes22),
20799 base_type: LazyDbColumnType::from_handle(l23 as u32),
20800 }
20801 };
20802 DbColumnType::Range(e24)
20803 }
20804 };
20805 v24
20806 }
20807 }
20808 }
20809 impl DbResultStream {
20810 #[allow(unused_unsafe, clippy::all)]
20811 pub fn get_columns(&self) -> _rt::Vec<DbColumn> {
20812 unsafe {
20813 #[repr(align(4))]
20814 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
20815 let mut ret_area = RetArea(
20816 [::core::mem::MaybeUninit::uninit(); 8],
20817 );
20818 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
20819 #[cfg(target_arch = "wasm32")]
20820 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
20821 extern "C" {
20822 #[link_name = "[method]db-result-stream.get-columns"]
20823 fn wit_import(_: i32, _: *mut u8);
20824 }
20825 #[cfg(not(target_arch = "wasm32"))]
20826 fn wit_import(_: i32, _: *mut u8) {
20827 unreachable!()
20828 }
20829 wit_import((self).handle() as i32, ptr0);
20830 let l1 = *ptr0.add(0).cast::<*mut u8>();
20831 let l2 = *ptr0.add(4).cast::<usize>();
20832 let base34 = l1;
20833 let len34 = l2;
20834 let mut result34 = _rt::Vec::with_capacity(len34);
20835 for i in 0..len34 {
20836 let base = base34.add(i * 48);
20837 let e34 = {
20838 let l3 = *base.add(0).cast::<i64>();
20839 let l4 = *base.add(8).cast::<*mut u8>();
20840 let l5 = *base.add(12).cast::<usize>();
20841 let len6 = l5;
20842 let bytes6 = _rt::Vec::from_raw_parts(
20843 l4.cast(),
20844 len6,
20845 len6,
20846 );
20847 let l7 = i32::from(*base.add(16).cast::<u8>());
20848 let v30 = match l7 {
20849 0 => DbColumnType::Character,
20850 1 => DbColumnType::Int2,
20851 2 => DbColumnType::Int4,
20852 3 => DbColumnType::Int8,
20853 4 => DbColumnType::Float4,
20854 5 => DbColumnType::Float8,
20855 6 => DbColumnType::Numeric,
20856 7 => DbColumnType::Boolean,
20857 8 => DbColumnType::Text,
20858 9 => DbColumnType::Varchar,
20859 10 => DbColumnType::Bpchar,
20860 11 => DbColumnType::Timestamp,
20861 12 => DbColumnType::Timestamptz,
20862 13 => DbColumnType::Date,
20863 14 => DbColumnType::Time,
20864 15 => DbColumnType::Timetz,
20865 16 => DbColumnType::Interval,
20866 17 => DbColumnType::Bytea,
20867 18 => DbColumnType::Uuid,
20868 19 => DbColumnType::Xml,
20869 20 => DbColumnType::Json,
20870 21 => DbColumnType::Jsonb,
20871 22 => DbColumnType::Jsonpath,
20872 23 => DbColumnType::Inet,
20873 24 => DbColumnType::Cidr,
20874 25 => DbColumnType::Macaddr,
20875 26 => DbColumnType::Bit,
20876 27 => DbColumnType::Varbit,
20877 28 => DbColumnType::Int4range,
20878 29 => DbColumnType::Int8range,
20879 30 => DbColumnType::Numrange,
20880 31 => DbColumnType::Tsrange,
20881 32 => DbColumnType::Tstzrange,
20882 33 => DbColumnType::Daterange,
20883 34 => DbColumnType::Money,
20884 35 => DbColumnType::Oid,
20885 36 => {
20886 let e30 = {
20887 let l8 = *base.add(20).cast::<*mut u8>();
20888 let l9 = *base.add(24).cast::<usize>();
20889 let len10 = l9;
20890 let bytes10 = _rt::Vec::from_raw_parts(
20891 l8.cast(),
20892 len10,
20893 len10,
20894 );
20895 EnumerationType {
20896 name: _rt::string_lift(bytes10),
20897 }
20898 };
20899 DbColumnType::Enumeration(e30)
20900 }
20901 37 => {
20902 let e30 = {
20903 let l11 = *base.add(20).cast::<*mut u8>();
20904 let l12 = *base.add(24).cast::<usize>();
20905 let len13 = l12;
20906 let bytes13 = _rt::Vec::from_raw_parts(
20907 l11.cast(),
20908 len13,
20909 len13,
20910 );
20911 let l14 = *base.add(28).cast::<*mut u8>();
20912 let l15 = *base.add(32).cast::<usize>();
20913 let base20 = l14;
20914 let len20 = l15;
20915 let mut result20 = _rt::Vec::with_capacity(len20);
20916 for i in 0..len20 {
20917 let base = base20.add(i * 12);
20918 let e20 = {
20919 let l16 = *base.add(0).cast::<*mut u8>();
20920 let l17 = *base.add(4).cast::<usize>();
20921 let len18 = l17;
20922 let bytes18 = _rt::Vec::from_raw_parts(
20923 l16.cast(),
20924 len18,
20925 len18,
20926 );
20927 let l19 = *base.add(8).cast::<i32>();
20928 (
20929 _rt::string_lift(bytes18),
20930 LazyDbColumnType::from_handle(l19 as u32),
20931 )
20932 };
20933 result20.push(e20);
20934 }
20935 _rt::cabi_dealloc(base20, len20 * 12, 4);
20936 CompositeType {
20937 name: _rt::string_lift(bytes13),
20938 attributes: result20,
20939 }
20940 };
20941 DbColumnType::Composite(e30)
20942 }
20943 38 => {
20944 let e30 = {
20945 let l21 = *base.add(20).cast::<*mut u8>();
20946 let l22 = *base.add(24).cast::<usize>();
20947 let len23 = l22;
20948 let bytes23 = _rt::Vec::from_raw_parts(
20949 l21.cast(),
20950 len23,
20951 len23,
20952 );
20953 let l24 = *base.add(28).cast::<i32>();
20954 DomainType {
20955 name: _rt::string_lift(bytes23),
20956 base_type: LazyDbColumnType::from_handle(l24 as u32),
20957 }
20958 };
20959 DbColumnType::Domain(e30)
20960 }
20961 39 => {
20962 let e30 = {
20963 let l25 = *base.add(20).cast::<i32>();
20964 LazyDbColumnType::from_handle(l25 as u32)
20965 };
20966 DbColumnType::Array(e30)
20967 }
20968 n => {
20969 debug_assert_eq!(n, 40, "invalid enum discriminant");
20970 let e30 = {
20971 let l26 = *base.add(20).cast::<*mut u8>();
20972 let l27 = *base.add(24).cast::<usize>();
20973 let len28 = l27;
20974 let bytes28 = _rt::Vec::from_raw_parts(
20975 l26.cast(),
20976 len28,
20977 len28,
20978 );
20979 let l29 = *base.add(28).cast::<i32>();
20980 RangeType {
20981 name: _rt::string_lift(bytes28),
20982 base_type: LazyDbColumnType::from_handle(l29 as u32),
20983 }
20984 };
20985 DbColumnType::Range(e30)
20986 }
20987 };
20988 let l31 = *base.add(36).cast::<*mut u8>();
20989 let l32 = *base.add(40).cast::<usize>();
20990 let len33 = l32;
20991 let bytes33 = _rt::Vec::from_raw_parts(
20992 l31.cast(),
20993 len33,
20994 len33,
20995 );
20996 DbColumn {
20997 ordinal: l3 as u64,
20998 name: _rt::string_lift(bytes6),
20999 db_type: v30,
21000 db_type_name: _rt::string_lift(bytes33),
21001 }
21002 };
21003 result34.push(e34);
21004 }
21005 _rt::cabi_dealloc(base34, len34 * 48, 8);
21006 result34
21007 }
21008 }
21009 }
21010 impl DbResultStream {
21011 #[allow(unused_unsafe, clippy::all)]
21012 pub fn get_next(&self) -> Option<_rt::Vec<DbRow>> {
21013 unsafe {
21014 #[repr(align(4))]
21015 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
21016 let mut ret_area = RetArea(
21017 [::core::mem::MaybeUninit::uninit(); 12],
21018 );
21019 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
21020 #[cfg(target_arch = "wasm32")]
21021 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
21022 extern "C" {
21023 #[link_name = "[method]db-result-stream.get-next"]
21024 fn wit_import(_: i32, _: *mut u8);
21025 }
21026 #[cfg(not(target_arch = "wasm32"))]
21027 fn wit_import(_: i32, _: *mut u8) {
21028 unreachable!()
21029 }
21030 wit_import((self).handle() as i32, ptr0);
21031 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
21032 match l1 {
21033 0 => None,
21034 1 => {
21035 let e = {
21036 let l2 = *ptr0.add(4).cast::<*mut u8>();
21037 let l3 = *ptr0.add(8).cast::<usize>();
21038 let base267 = l2;
21039 let len267 = l3;
21040 let mut result267 = _rt::Vec::with_capacity(len267);
21041 for i in 0..len267 {
21042 let base = base267.add(i * 8);
21043 let e267 = {
21044 let l4 = *base.add(0).cast::<*mut u8>();
21045 let l5 = *base.add(4).cast::<usize>();
21046 let base266 = l4;
21047 let len266 = l5;
21048 let mut result266 = _rt::Vec::with_capacity(len266);
21049 for i in 0..len266 {
21050 let base = base266.add(i * 56);
21051 let e266 = {
21052 let l6 = i32::from(*base.add(0).cast::<u8>());
21053 let v265 = match l6 {
21054 0 => {
21055 let e265 = {
21056 let l7 = i32::from(*base.add(8).cast::<i8>());
21057 l7 as i8
21058 };
21059 DbValue::Character(e265)
21060 }
21061 1 => {
21062 let e265 = {
21063 let l8 = i32::from(*base.add(8).cast::<i16>());
21064 l8 as i16
21065 };
21066 DbValue::Int2(e265)
21067 }
21068 2 => {
21069 let e265 = {
21070 let l9 = *base.add(8).cast::<i32>();
21071 l9
21072 };
21073 DbValue::Int4(e265)
21074 }
21075 3 => {
21076 let e265 = {
21077 let l10 = *base.add(8).cast::<i64>();
21078 l10
21079 };
21080 DbValue::Int8(e265)
21081 }
21082 4 => {
21083 let e265 = {
21084 let l11 = *base.add(8).cast::<f32>();
21085 l11
21086 };
21087 DbValue::Float4(e265)
21088 }
21089 5 => {
21090 let e265 = {
21091 let l12 = *base.add(8).cast::<f64>();
21092 l12
21093 };
21094 DbValue::Float8(e265)
21095 }
21096 6 => {
21097 let e265 = {
21098 let l13 = *base.add(8).cast::<*mut u8>();
21099 let l14 = *base.add(12).cast::<usize>();
21100 let len15 = l14;
21101 let bytes15 = _rt::Vec::from_raw_parts(
21102 l13.cast(),
21103 len15,
21104 len15,
21105 );
21106 _rt::string_lift(bytes15)
21107 };
21108 DbValue::Numeric(e265)
21109 }
21110 7 => {
21111 let e265 = {
21112 let l16 = i32::from(*base.add(8).cast::<u8>());
21113 _rt::bool_lift(l16 as u8)
21114 };
21115 DbValue::Boolean(e265)
21116 }
21117 8 => {
21118 let e265 = {
21119 let l17 = *base.add(8).cast::<*mut u8>();
21120 let l18 = *base.add(12).cast::<usize>();
21121 let len19 = l18;
21122 let bytes19 = _rt::Vec::from_raw_parts(
21123 l17.cast(),
21124 len19,
21125 len19,
21126 );
21127 _rt::string_lift(bytes19)
21128 };
21129 DbValue::Text(e265)
21130 }
21131 9 => {
21132 let e265 = {
21133 let l20 = *base.add(8).cast::<*mut u8>();
21134 let l21 = *base.add(12).cast::<usize>();
21135 let len22 = l21;
21136 let bytes22 = _rt::Vec::from_raw_parts(
21137 l20.cast(),
21138 len22,
21139 len22,
21140 );
21141 _rt::string_lift(bytes22)
21142 };
21143 DbValue::Varchar(e265)
21144 }
21145 10 => {
21146 let e265 = {
21147 let l23 = *base.add(8).cast::<*mut u8>();
21148 let l24 = *base.add(12).cast::<usize>();
21149 let len25 = l24;
21150 let bytes25 = _rt::Vec::from_raw_parts(
21151 l23.cast(),
21152 len25,
21153 len25,
21154 );
21155 _rt::string_lift(bytes25)
21156 };
21157 DbValue::Bpchar(e265)
21158 }
21159 11 => {
21160 let e265 = {
21161 let l26 = *base.add(8).cast::<i32>();
21162 let l27 = i32::from(*base.add(12).cast::<u8>());
21163 let l28 = i32::from(*base.add(13).cast::<u8>());
21164 let l29 = i32::from(*base.add(16).cast::<u8>());
21165 let l30 = i32::from(*base.add(17).cast::<u8>());
21166 let l31 = i32::from(*base.add(18).cast::<u8>());
21167 let l32 = *base.add(20).cast::<i32>();
21168 super::super::super::golem::rdbms::types::Timestamp {
21169 date: super::super::super::golem::rdbms::types::Date {
21170 year: l26,
21171 month: l27 as u8,
21172 day: l28 as u8,
21173 },
21174 time: super::super::super::golem::rdbms::types::Time {
21175 hour: l29 as u8,
21176 minute: l30 as u8,
21177 second: l31 as u8,
21178 nanosecond: l32 as u32,
21179 },
21180 }
21181 };
21182 DbValue::Timestamp(e265)
21183 }
21184 12 => {
21185 let e265 = {
21186 let l33 = *base.add(8).cast::<i32>();
21187 let l34 = i32::from(*base.add(12).cast::<u8>());
21188 let l35 = i32::from(*base.add(13).cast::<u8>());
21189 let l36 = i32::from(*base.add(16).cast::<u8>());
21190 let l37 = i32::from(*base.add(17).cast::<u8>());
21191 let l38 = i32::from(*base.add(18).cast::<u8>());
21192 let l39 = *base.add(20).cast::<i32>();
21193 let l40 = *base.add(24).cast::<i32>();
21194 super::super::super::golem::rdbms::types::Timestamptz {
21195 timestamp: super::super::super::golem::rdbms::types::Timestamp {
21196 date: super::super::super::golem::rdbms::types::Date {
21197 year: l33,
21198 month: l34 as u8,
21199 day: l35 as u8,
21200 },
21201 time: super::super::super::golem::rdbms::types::Time {
21202 hour: l36 as u8,
21203 minute: l37 as u8,
21204 second: l38 as u8,
21205 nanosecond: l39 as u32,
21206 },
21207 },
21208 offset: l40,
21209 }
21210 };
21211 DbValue::Timestamptz(e265)
21212 }
21213 13 => {
21214 let e265 = {
21215 let l41 = *base.add(8).cast::<i32>();
21216 let l42 = i32::from(*base.add(12).cast::<u8>());
21217 let l43 = i32::from(*base.add(13).cast::<u8>());
21218 super::super::super::golem::rdbms::types::Date {
21219 year: l41,
21220 month: l42 as u8,
21221 day: l43 as u8,
21222 }
21223 };
21224 DbValue::Date(e265)
21225 }
21226 14 => {
21227 let e265 = {
21228 let l44 = i32::from(*base.add(8).cast::<u8>());
21229 let l45 = i32::from(*base.add(9).cast::<u8>());
21230 let l46 = i32::from(*base.add(10).cast::<u8>());
21231 let l47 = *base.add(12).cast::<i32>();
21232 super::super::super::golem::rdbms::types::Time {
21233 hour: l44 as u8,
21234 minute: l45 as u8,
21235 second: l46 as u8,
21236 nanosecond: l47 as u32,
21237 }
21238 };
21239 DbValue::Time(e265)
21240 }
21241 15 => {
21242 let e265 = {
21243 let l48 = i32::from(*base.add(8).cast::<u8>());
21244 let l49 = i32::from(*base.add(9).cast::<u8>());
21245 let l50 = i32::from(*base.add(10).cast::<u8>());
21246 let l51 = *base.add(12).cast::<i32>();
21247 let l52 = *base.add(16).cast::<i32>();
21248 super::super::super::golem::rdbms::types::Timetz {
21249 time: super::super::super::golem::rdbms::types::Time {
21250 hour: l48 as u8,
21251 minute: l49 as u8,
21252 second: l50 as u8,
21253 nanosecond: l51 as u32,
21254 },
21255 offset: l52,
21256 }
21257 };
21258 DbValue::Timetz(e265)
21259 }
21260 16 => {
21261 let e265 = {
21262 let l53 = *base.add(8).cast::<i32>();
21263 let l54 = *base.add(12).cast::<i32>();
21264 let l55 = *base.add(16).cast::<i64>();
21265 Interval {
21266 months: l53,
21267 days: l54,
21268 microseconds: l55,
21269 }
21270 };
21271 DbValue::Interval(e265)
21272 }
21273 17 => {
21274 let e265 = {
21275 let l56 = *base.add(8).cast::<*mut u8>();
21276 let l57 = *base.add(12).cast::<usize>();
21277 let len58 = l57;
21278 _rt::Vec::from_raw_parts(l56.cast(), len58, len58)
21279 };
21280 DbValue::Bytea(e265)
21281 }
21282 18 => {
21283 let e265 = {
21284 let l59 = *base.add(8).cast::<*mut u8>();
21285 let l60 = *base.add(12).cast::<usize>();
21286 let len61 = l60;
21287 let bytes61 = _rt::Vec::from_raw_parts(
21288 l59.cast(),
21289 len61,
21290 len61,
21291 );
21292 _rt::string_lift(bytes61)
21293 };
21294 DbValue::Json(e265)
21295 }
21296 19 => {
21297 let e265 = {
21298 let l62 = *base.add(8).cast::<*mut u8>();
21299 let l63 = *base.add(12).cast::<usize>();
21300 let len64 = l63;
21301 let bytes64 = _rt::Vec::from_raw_parts(
21302 l62.cast(),
21303 len64,
21304 len64,
21305 );
21306 _rt::string_lift(bytes64)
21307 };
21308 DbValue::Jsonb(e265)
21309 }
21310 20 => {
21311 let e265 = {
21312 let l65 = *base.add(8).cast::<*mut u8>();
21313 let l66 = *base.add(12).cast::<usize>();
21314 let len67 = l66;
21315 let bytes67 = _rt::Vec::from_raw_parts(
21316 l65.cast(),
21317 len67,
21318 len67,
21319 );
21320 _rt::string_lift(bytes67)
21321 };
21322 DbValue::Jsonpath(e265)
21323 }
21324 21 => {
21325 let e265 = {
21326 let l68 = *base.add(8).cast::<*mut u8>();
21327 let l69 = *base.add(12).cast::<usize>();
21328 let len70 = l69;
21329 let bytes70 = _rt::Vec::from_raw_parts(
21330 l68.cast(),
21331 len70,
21332 len70,
21333 );
21334 _rt::string_lift(bytes70)
21335 };
21336 DbValue::Xml(e265)
21337 }
21338 22 => {
21339 let e265 = {
21340 let l71 = *base.add(8).cast::<i64>();
21341 let l72 = *base.add(16).cast::<i64>();
21342 super::super::super::golem::rdbms::types::Uuid {
21343 high_bits: l71 as u64,
21344 low_bits: l72 as u64,
21345 }
21346 };
21347 DbValue::Uuid(e265)
21348 }
21349 23 => {
21350 let e265 = {
21351 let l73 = i32::from(*base.add(8).cast::<u8>());
21352 use super::super::super::golem::rdbms::types::IpAddress as V86;
21353 let v86 = match l73 {
21354 0 => {
21355 let e86 = {
21356 let l74 = i32::from(*base.add(10).cast::<u8>());
21357 let l75 = i32::from(*base.add(11).cast::<u8>());
21358 let l76 = i32::from(*base.add(12).cast::<u8>());
21359 let l77 = i32::from(*base.add(13).cast::<u8>());
21360 (l74 as u8, l75 as u8, l76 as u8, l77 as u8)
21361 };
21362 V86::Ipv4(e86)
21363 }
21364 n => {
21365 debug_assert_eq!(n, 1, "invalid enum discriminant");
21366 let e86 = {
21367 let l78 = i32::from(*base.add(10).cast::<u16>());
21368 let l79 = i32::from(*base.add(12).cast::<u16>());
21369 let l80 = i32::from(*base.add(14).cast::<u16>());
21370 let l81 = i32::from(*base.add(16).cast::<u16>());
21371 let l82 = i32::from(*base.add(18).cast::<u16>());
21372 let l83 = i32::from(*base.add(20).cast::<u16>());
21373 let l84 = i32::from(*base.add(22).cast::<u16>());
21374 let l85 = i32::from(*base.add(24).cast::<u16>());
21375 (
21376 l78 as u16,
21377 l79 as u16,
21378 l80 as u16,
21379 l81 as u16,
21380 l82 as u16,
21381 l83 as u16,
21382 l84 as u16,
21383 l85 as u16,
21384 )
21385 };
21386 V86::Ipv6(e86)
21387 }
21388 };
21389 v86
21390 };
21391 DbValue::Inet(e265)
21392 }
21393 24 => {
21394 let e265 = {
21395 let l87 = i32::from(*base.add(8).cast::<u8>());
21396 use super::super::super::golem::rdbms::types::IpAddress as V100;
21397 let v100 = match l87 {
21398 0 => {
21399 let e100 = {
21400 let l88 = i32::from(*base.add(10).cast::<u8>());
21401 let l89 = i32::from(*base.add(11).cast::<u8>());
21402 let l90 = i32::from(*base.add(12).cast::<u8>());
21403 let l91 = i32::from(*base.add(13).cast::<u8>());
21404 (l88 as u8, l89 as u8, l90 as u8, l91 as u8)
21405 };
21406 V100::Ipv4(e100)
21407 }
21408 n => {
21409 debug_assert_eq!(n, 1, "invalid enum discriminant");
21410 let e100 = {
21411 let l92 = i32::from(*base.add(10).cast::<u16>());
21412 let l93 = i32::from(*base.add(12).cast::<u16>());
21413 let l94 = i32::from(*base.add(14).cast::<u16>());
21414 let l95 = i32::from(*base.add(16).cast::<u16>());
21415 let l96 = i32::from(*base.add(18).cast::<u16>());
21416 let l97 = i32::from(*base.add(20).cast::<u16>());
21417 let l98 = i32::from(*base.add(22).cast::<u16>());
21418 let l99 = i32::from(*base.add(24).cast::<u16>());
21419 (
21420 l92 as u16,
21421 l93 as u16,
21422 l94 as u16,
21423 l95 as u16,
21424 l96 as u16,
21425 l97 as u16,
21426 l98 as u16,
21427 l99 as u16,
21428 )
21429 };
21430 V100::Ipv6(e100)
21431 }
21432 };
21433 v100
21434 };
21435 DbValue::Cidr(e265)
21436 }
21437 25 => {
21438 let e265 = {
21439 let l101 = i32::from(*base.add(8).cast::<u8>());
21440 let l102 = i32::from(*base.add(9).cast::<u8>());
21441 let l103 = i32::from(*base.add(10).cast::<u8>());
21442 let l104 = i32::from(*base.add(11).cast::<u8>());
21443 let l105 = i32::from(*base.add(12).cast::<u8>());
21444 let l106 = i32::from(*base.add(13).cast::<u8>());
21445 super::super::super::golem::rdbms::types::MacAddress {
21446 octets: (
21447 l101 as u8,
21448 l102 as u8,
21449 l103 as u8,
21450 l104 as u8,
21451 l105 as u8,
21452 l106 as u8,
21453 ),
21454 }
21455 };
21456 DbValue::Macaddr(e265)
21457 }
21458 26 => {
21459 let e265 = {
21460 let l107 = *base.add(8).cast::<*mut u8>();
21461 let l108 = *base.add(12).cast::<usize>();
21462 let base110 = l107;
21463 let len110 = l108;
21464 let mut result110 = _rt::Vec::with_capacity(len110);
21465 for i in 0..len110 {
21466 let base = base110.add(i * 1);
21467 let e110 = {
21468 let l109 = i32::from(*base.add(0).cast::<u8>());
21469 _rt::bool_lift(l109 as u8)
21470 };
21471 result110.push(e110);
21472 }
21473 _rt::cabi_dealloc(base110, len110 * 1, 1);
21474 result110
21475 };
21476 DbValue::Bit(e265)
21477 }
21478 27 => {
21479 let e265 = {
21480 let l111 = *base.add(8).cast::<*mut u8>();
21481 let l112 = *base.add(12).cast::<usize>();
21482 let base114 = l111;
21483 let len114 = l112;
21484 let mut result114 = _rt::Vec::with_capacity(len114);
21485 for i in 0..len114 {
21486 let base = base114.add(i * 1);
21487 let e114 = {
21488 let l113 = i32::from(*base.add(0).cast::<u8>());
21489 _rt::bool_lift(l113 as u8)
21490 };
21491 result114.push(e114);
21492 }
21493 _rt::cabi_dealloc(base114, len114 * 1, 1);
21494 result114
21495 };
21496 DbValue::Varbit(e265)
21497 }
21498 28 => {
21499 let e265 = {
21500 let l115 = i32::from(*base.add(8).cast::<u8>());
21501 let v118 = match l115 {
21502 0 => {
21503 let e118 = {
21504 let l116 = *base.add(12).cast::<i32>();
21505 l116
21506 };
21507 Int4bound::Included(e118)
21508 }
21509 1 => {
21510 let e118 = {
21511 let l117 = *base.add(12).cast::<i32>();
21512 l117
21513 };
21514 Int4bound::Excluded(e118)
21515 }
21516 n => {
21517 debug_assert_eq!(n, 2, "invalid enum discriminant");
21518 Int4bound::Unbounded
21519 }
21520 };
21521 let l119 = i32::from(*base.add(16).cast::<u8>());
21522 let v122 = match l119 {
21523 0 => {
21524 let e122 = {
21525 let l120 = *base.add(20).cast::<i32>();
21526 l120
21527 };
21528 Int4bound::Included(e122)
21529 }
21530 1 => {
21531 let e122 = {
21532 let l121 = *base.add(20).cast::<i32>();
21533 l121
21534 };
21535 Int4bound::Excluded(e122)
21536 }
21537 n => {
21538 debug_assert_eq!(n, 2, "invalid enum discriminant");
21539 Int4bound::Unbounded
21540 }
21541 };
21542 Int4range {
21543 start: v118,
21544 end: v122,
21545 }
21546 };
21547 DbValue::Int4range(e265)
21548 }
21549 29 => {
21550 let e265 = {
21551 let l123 = i32::from(*base.add(8).cast::<u8>());
21552 let v126 = match l123 {
21553 0 => {
21554 let e126 = {
21555 let l124 = *base.add(16).cast::<i64>();
21556 l124
21557 };
21558 Int8bound::Included(e126)
21559 }
21560 1 => {
21561 let e126 = {
21562 let l125 = *base.add(16).cast::<i64>();
21563 l125
21564 };
21565 Int8bound::Excluded(e126)
21566 }
21567 n => {
21568 debug_assert_eq!(n, 2, "invalid enum discriminant");
21569 Int8bound::Unbounded
21570 }
21571 };
21572 let l127 = i32::from(*base.add(24).cast::<u8>());
21573 let v130 = match l127 {
21574 0 => {
21575 let e130 = {
21576 let l128 = *base.add(32).cast::<i64>();
21577 l128
21578 };
21579 Int8bound::Included(e130)
21580 }
21581 1 => {
21582 let e130 = {
21583 let l129 = *base.add(32).cast::<i64>();
21584 l129
21585 };
21586 Int8bound::Excluded(e130)
21587 }
21588 n => {
21589 debug_assert_eq!(n, 2, "invalid enum discriminant");
21590 Int8bound::Unbounded
21591 }
21592 };
21593 Int8range {
21594 start: v126,
21595 end: v130,
21596 }
21597 };
21598 DbValue::Int8range(e265)
21599 }
21600 30 => {
21601 let e265 = {
21602 let l131 = i32::from(*base.add(8).cast::<u8>());
21603 let v138 = match l131 {
21604 0 => {
21605 let e138 = {
21606 let l132 = *base.add(12).cast::<*mut u8>();
21607 let l133 = *base.add(16).cast::<usize>();
21608 let len134 = l133;
21609 let bytes134 = _rt::Vec::from_raw_parts(
21610 l132.cast(),
21611 len134,
21612 len134,
21613 );
21614 _rt::string_lift(bytes134)
21615 };
21616 Numbound::Included(e138)
21617 }
21618 1 => {
21619 let e138 = {
21620 let l135 = *base.add(12).cast::<*mut u8>();
21621 let l136 = *base.add(16).cast::<usize>();
21622 let len137 = l136;
21623 let bytes137 = _rt::Vec::from_raw_parts(
21624 l135.cast(),
21625 len137,
21626 len137,
21627 );
21628 _rt::string_lift(bytes137)
21629 };
21630 Numbound::Excluded(e138)
21631 }
21632 n => {
21633 debug_assert_eq!(n, 2, "invalid enum discriminant");
21634 Numbound::Unbounded
21635 }
21636 };
21637 let l139 = i32::from(*base.add(20).cast::<u8>());
21638 let v146 = match l139 {
21639 0 => {
21640 let e146 = {
21641 let l140 = *base.add(24).cast::<*mut u8>();
21642 let l141 = *base.add(28).cast::<usize>();
21643 let len142 = l141;
21644 let bytes142 = _rt::Vec::from_raw_parts(
21645 l140.cast(),
21646 len142,
21647 len142,
21648 );
21649 _rt::string_lift(bytes142)
21650 };
21651 Numbound::Included(e146)
21652 }
21653 1 => {
21654 let e146 = {
21655 let l143 = *base.add(24).cast::<*mut u8>();
21656 let l144 = *base.add(28).cast::<usize>();
21657 let len145 = l144;
21658 let bytes145 = _rt::Vec::from_raw_parts(
21659 l143.cast(),
21660 len145,
21661 len145,
21662 );
21663 _rt::string_lift(bytes145)
21664 };
21665 Numbound::Excluded(e146)
21666 }
21667 n => {
21668 debug_assert_eq!(n, 2, "invalid enum discriminant");
21669 Numbound::Unbounded
21670 }
21671 };
21672 Numrange { start: v138, end: v146 }
21673 };
21674 DbValue::Numrange(e265)
21675 }
21676 31 => {
21677 let e265 = {
21678 let l147 = i32::from(*base.add(8).cast::<u8>());
21679 let v162 = match l147 {
21680 0 => {
21681 let e162 = {
21682 let l148 = *base.add(12).cast::<i32>();
21683 let l149 = i32::from(*base.add(16).cast::<u8>());
21684 let l150 = i32::from(*base.add(17).cast::<u8>());
21685 let l151 = i32::from(*base.add(20).cast::<u8>());
21686 let l152 = i32::from(*base.add(21).cast::<u8>());
21687 let l153 = i32::from(*base.add(22).cast::<u8>());
21688 let l154 = *base.add(24).cast::<i32>();
21689 super::super::super::golem::rdbms::types::Timestamp {
21690 date: super::super::super::golem::rdbms::types::Date {
21691 year: l148,
21692 month: l149 as u8,
21693 day: l150 as u8,
21694 },
21695 time: super::super::super::golem::rdbms::types::Time {
21696 hour: l151 as u8,
21697 minute: l152 as u8,
21698 second: l153 as u8,
21699 nanosecond: l154 as u32,
21700 },
21701 }
21702 };
21703 Tsbound::Included(e162)
21704 }
21705 1 => {
21706 let e162 = {
21707 let l155 = *base.add(12).cast::<i32>();
21708 let l156 = i32::from(*base.add(16).cast::<u8>());
21709 let l157 = i32::from(*base.add(17).cast::<u8>());
21710 let l158 = i32::from(*base.add(20).cast::<u8>());
21711 let l159 = i32::from(*base.add(21).cast::<u8>());
21712 let l160 = i32::from(*base.add(22).cast::<u8>());
21713 let l161 = *base.add(24).cast::<i32>();
21714 super::super::super::golem::rdbms::types::Timestamp {
21715 date: super::super::super::golem::rdbms::types::Date {
21716 year: l155,
21717 month: l156 as u8,
21718 day: l157 as u8,
21719 },
21720 time: super::super::super::golem::rdbms::types::Time {
21721 hour: l158 as u8,
21722 minute: l159 as u8,
21723 second: l160 as u8,
21724 nanosecond: l161 as u32,
21725 },
21726 }
21727 };
21728 Tsbound::Excluded(e162)
21729 }
21730 n => {
21731 debug_assert_eq!(n, 2, "invalid enum discriminant");
21732 Tsbound::Unbounded
21733 }
21734 };
21735 let l163 = i32::from(*base.add(28).cast::<u8>());
21736 let v178 = match l163 {
21737 0 => {
21738 let e178 = {
21739 let l164 = *base.add(32).cast::<i32>();
21740 let l165 = i32::from(*base.add(36).cast::<u8>());
21741 let l166 = i32::from(*base.add(37).cast::<u8>());
21742 let l167 = i32::from(*base.add(40).cast::<u8>());
21743 let l168 = i32::from(*base.add(41).cast::<u8>());
21744 let l169 = i32::from(*base.add(42).cast::<u8>());
21745 let l170 = *base.add(44).cast::<i32>();
21746 super::super::super::golem::rdbms::types::Timestamp {
21747 date: super::super::super::golem::rdbms::types::Date {
21748 year: l164,
21749 month: l165 as u8,
21750 day: l166 as u8,
21751 },
21752 time: super::super::super::golem::rdbms::types::Time {
21753 hour: l167 as u8,
21754 minute: l168 as u8,
21755 second: l169 as u8,
21756 nanosecond: l170 as u32,
21757 },
21758 }
21759 };
21760 Tsbound::Included(e178)
21761 }
21762 1 => {
21763 let e178 = {
21764 let l171 = *base.add(32).cast::<i32>();
21765 let l172 = i32::from(*base.add(36).cast::<u8>());
21766 let l173 = i32::from(*base.add(37).cast::<u8>());
21767 let l174 = i32::from(*base.add(40).cast::<u8>());
21768 let l175 = i32::from(*base.add(41).cast::<u8>());
21769 let l176 = i32::from(*base.add(42).cast::<u8>());
21770 let l177 = *base.add(44).cast::<i32>();
21771 super::super::super::golem::rdbms::types::Timestamp {
21772 date: super::super::super::golem::rdbms::types::Date {
21773 year: l171,
21774 month: l172 as u8,
21775 day: l173 as u8,
21776 },
21777 time: super::super::super::golem::rdbms::types::Time {
21778 hour: l174 as u8,
21779 minute: l175 as u8,
21780 second: l176 as u8,
21781 nanosecond: l177 as u32,
21782 },
21783 }
21784 };
21785 Tsbound::Excluded(e178)
21786 }
21787 n => {
21788 debug_assert_eq!(n, 2, "invalid enum discriminant");
21789 Tsbound::Unbounded
21790 }
21791 };
21792 Tsrange { start: v162, end: v178 }
21793 };
21794 DbValue::Tsrange(e265)
21795 }
21796 32 => {
21797 let e265 = {
21798 let l179 = i32::from(*base.add(8).cast::<u8>());
21799 let v196 = match l179 {
21800 0 => {
21801 let e196 = {
21802 let l180 = *base.add(12).cast::<i32>();
21803 let l181 = i32::from(*base.add(16).cast::<u8>());
21804 let l182 = i32::from(*base.add(17).cast::<u8>());
21805 let l183 = i32::from(*base.add(20).cast::<u8>());
21806 let l184 = i32::from(*base.add(21).cast::<u8>());
21807 let l185 = i32::from(*base.add(22).cast::<u8>());
21808 let l186 = *base.add(24).cast::<i32>();
21809 let l187 = *base.add(28).cast::<i32>();
21810 super::super::super::golem::rdbms::types::Timestamptz {
21811 timestamp: super::super::super::golem::rdbms::types::Timestamp {
21812 date: super::super::super::golem::rdbms::types::Date {
21813 year: l180,
21814 month: l181 as u8,
21815 day: l182 as u8,
21816 },
21817 time: super::super::super::golem::rdbms::types::Time {
21818 hour: l183 as u8,
21819 minute: l184 as u8,
21820 second: l185 as u8,
21821 nanosecond: l186 as u32,
21822 },
21823 },
21824 offset: l187,
21825 }
21826 };
21827 Tstzbound::Included(e196)
21828 }
21829 1 => {
21830 let e196 = {
21831 let l188 = *base.add(12).cast::<i32>();
21832 let l189 = i32::from(*base.add(16).cast::<u8>());
21833 let l190 = i32::from(*base.add(17).cast::<u8>());
21834 let l191 = i32::from(*base.add(20).cast::<u8>());
21835 let l192 = i32::from(*base.add(21).cast::<u8>());
21836 let l193 = i32::from(*base.add(22).cast::<u8>());
21837 let l194 = *base.add(24).cast::<i32>();
21838 let l195 = *base.add(28).cast::<i32>();
21839 super::super::super::golem::rdbms::types::Timestamptz {
21840 timestamp: super::super::super::golem::rdbms::types::Timestamp {
21841 date: super::super::super::golem::rdbms::types::Date {
21842 year: l188,
21843 month: l189 as u8,
21844 day: l190 as u8,
21845 },
21846 time: super::super::super::golem::rdbms::types::Time {
21847 hour: l191 as u8,
21848 minute: l192 as u8,
21849 second: l193 as u8,
21850 nanosecond: l194 as u32,
21851 },
21852 },
21853 offset: l195,
21854 }
21855 };
21856 Tstzbound::Excluded(e196)
21857 }
21858 n => {
21859 debug_assert_eq!(n, 2, "invalid enum discriminant");
21860 Tstzbound::Unbounded
21861 }
21862 };
21863 let l197 = i32::from(*base.add(32).cast::<u8>());
21864 let v214 = match l197 {
21865 0 => {
21866 let e214 = {
21867 let l198 = *base.add(36).cast::<i32>();
21868 let l199 = i32::from(*base.add(40).cast::<u8>());
21869 let l200 = i32::from(*base.add(41).cast::<u8>());
21870 let l201 = i32::from(*base.add(44).cast::<u8>());
21871 let l202 = i32::from(*base.add(45).cast::<u8>());
21872 let l203 = i32::from(*base.add(46).cast::<u8>());
21873 let l204 = *base.add(48).cast::<i32>();
21874 let l205 = *base.add(52).cast::<i32>();
21875 super::super::super::golem::rdbms::types::Timestamptz {
21876 timestamp: super::super::super::golem::rdbms::types::Timestamp {
21877 date: super::super::super::golem::rdbms::types::Date {
21878 year: l198,
21879 month: l199 as u8,
21880 day: l200 as u8,
21881 },
21882 time: super::super::super::golem::rdbms::types::Time {
21883 hour: l201 as u8,
21884 minute: l202 as u8,
21885 second: l203 as u8,
21886 nanosecond: l204 as u32,
21887 },
21888 },
21889 offset: l205,
21890 }
21891 };
21892 Tstzbound::Included(e214)
21893 }
21894 1 => {
21895 let e214 = {
21896 let l206 = *base.add(36).cast::<i32>();
21897 let l207 = i32::from(*base.add(40).cast::<u8>());
21898 let l208 = i32::from(*base.add(41).cast::<u8>());
21899 let l209 = i32::from(*base.add(44).cast::<u8>());
21900 let l210 = i32::from(*base.add(45).cast::<u8>());
21901 let l211 = i32::from(*base.add(46).cast::<u8>());
21902 let l212 = *base.add(48).cast::<i32>();
21903 let l213 = *base.add(52).cast::<i32>();
21904 super::super::super::golem::rdbms::types::Timestamptz {
21905 timestamp: super::super::super::golem::rdbms::types::Timestamp {
21906 date: super::super::super::golem::rdbms::types::Date {
21907 year: l206,
21908 month: l207 as u8,
21909 day: l208 as u8,
21910 },
21911 time: super::super::super::golem::rdbms::types::Time {
21912 hour: l209 as u8,
21913 minute: l210 as u8,
21914 second: l211 as u8,
21915 nanosecond: l212 as u32,
21916 },
21917 },
21918 offset: l213,
21919 }
21920 };
21921 Tstzbound::Excluded(e214)
21922 }
21923 n => {
21924 debug_assert_eq!(n, 2, "invalid enum discriminant");
21925 Tstzbound::Unbounded
21926 }
21927 };
21928 Tstzrange {
21929 start: v196,
21930 end: v214,
21931 }
21932 };
21933 DbValue::Tstzrange(e265)
21934 }
21935 33 => {
21936 let e265 = {
21937 let l215 = i32::from(*base.add(8).cast::<u8>());
21938 let v222 = match l215 {
21939 0 => {
21940 let e222 = {
21941 let l216 = *base.add(12).cast::<i32>();
21942 let l217 = i32::from(*base.add(16).cast::<u8>());
21943 let l218 = i32::from(*base.add(17).cast::<u8>());
21944 super::super::super::golem::rdbms::types::Date {
21945 year: l216,
21946 month: l217 as u8,
21947 day: l218 as u8,
21948 }
21949 };
21950 Datebound::Included(e222)
21951 }
21952 1 => {
21953 let e222 = {
21954 let l219 = *base.add(12).cast::<i32>();
21955 let l220 = i32::from(*base.add(16).cast::<u8>());
21956 let l221 = i32::from(*base.add(17).cast::<u8>());
21957 super::super::super::golem::rdbms::types::Date {
21958 year: l219,
21959 month: l220 as u8,
21960 day: l221 as u8,
21961 }
21962 };
21963 Datebound::Excluded(e222)
21964 }
21965 n => {
21966 debug_assert_eq!(n, 2, "invalid enum discriminant");
21967 Datebound::Unbounded
21968 }
21969 };
21970 let l223 = i32::from(*base.add(20).cast::<u8>());
21971 let v230 = match l223 {
21972 0 => {
21973 let e230 = {
21974 let l224 = *base.add(24).cast::<i32>();
21975 let l225 = i32::from(*base.add(28).cast::<u8>());
21976 let l226 = i32::from(*base.add(29).cast::<u8>());
21977 super::super::super::golem::rdbms::types::Date {
21978 year: l224,
21979 month: l225 as u8,
21980 day: l226 as u8,
21981 }
21982 };
21983 Datebound::Included(e230)
21984 }
21985 1 => {
21986 let e230 = {
21987 let l227 = *base.add(24).cast::<i32>();
21988 let l228 = i32::from(*base.add(28).cast::<u8>());
21989 let l229 = i32::from(*base.add(29).cast::<u8>());
21990 super::super::super::golem::rdbms::types::Date {
21991 year: l227,
21992 month: l228 as u8,
21993 day: l229 as u8,
21994 }
21995 };
21996 Datebound::Excluded(e230)
21997 }
21998 n => {
21999 debug_assert_eq!(n, 2, "invalid enum discriminant");
22000 Datebound::Unbounded
22001 }
22002 };
22003 Daterange {
22004 start: v222,
22005 end: v230,
22006 }
22007 };
22008 DbValue::Daterange(e265)
22009 }
22010 34 => {
22011 let e265 = {
22012 let l231 = *base.add(8).cast::<i64>();
22013 l231
22014 };
22015 DbValue::Money(e265)
22016 }
22017 35 => {
22018 let e265 = {
22019 let l232 = *base.add(8).cast::<i32>();
22020 l232 as u32
22021 };
22022 DbValue::Oid(e265)
22023 }
22024 36 => {
22025 let e265 = {
22026 let l233 = *base.add(8).cast::<*mut u8>();
22027 let l234 = *base.add(12).cast::<usize>();
22028 let len235 = l234;
22029 let bytes235 = _rt::Vec::from_raw_parts(
22030 l233.cast(),
22031 len235,
22032 len235,
22033 );
22034 let l236 = *base.add(16).cast::<*mut u8>();
22035 let l237 = *base.add(20).cast::<usize>();
22036 let len238 = l237;
22037 let bytes238 = _rt::Vec::from_raw_parts(
22038 l236.cast(),
22039 len238,
22040 len238,
22041 );
22042 Enumeration {
22043 name: _rt::string_lift(bytes235),
22044 value: _rt::string_lift(bytes238),
22045 }
22046 };
22047 DbValue::Enumeration(e265)
22048 }
22049 37 => {
22050 let e265 = {
22051 let l239 = *base.add(8).cast::<*mut u8>();
22052 let l240 = *base.add(12).cast::<usize>();
22053 let len241 = l240;
22054 let bytes241 = _rt::Vec::from_raw_parts(
22055 l239.cast(),
22056 len241,
22057 len241,
22058 );
22059 let l242 = *base.add(16).cast::<*mut u8>();
22060 let l243 = *base.add(20).cast::<usize>();
22061 let base245 = l242;
22062 let len245 = l243;
22063 let mut result245 = _rt::Vec::with_capacity(len245);
22064 for i in 0..len245 {
22065 let base = base245.add(i * 4);
22066 let e245 = {
22067 let l244 = *base.add(0).cast::<i32>();
22068 LazyDbValue::from_handle(l244 as u32)
22069 };
22070 result245.push(e245);
22071 }
22072 _rt::cabi_dealloc(base245, len245 * 4, 4);
22073 Composite {
22074 name: _rt::string_lift(bytes241),
22075 values: result245,
22076 }
22077 };
22078 DbValue::Composite(e265)
22079 }
22080 38 => {
22081 let e265 = {
22082 let l246 = *base.add(8).cast::<*mut u8>();
22083 let l247 = *base.add(12).cast::<usize>();
22084 let len248 = l247;
22085 let bytes248 = _rt::Vec::from_raw_parts(
22086 l246.cast(),
22087 len248,
22088 len248,
22089 );
22090 let l249 = *base.add(16).cast::<i32>();
22091 Domain {
22092 name: _rt::string_lift(bytes248),
22093 value: LazyDbValue::from_handle(l249 as u32),
22094 }
22095 };
22096 DbValue::Domain(e265)
22097 }
22098 39 => {
22099 let e265 = {
22100 let l250 = *base.add(8).cast::<*mut u8>();
22101 let l251 = *base.add(12).cast::<usize>();
22102 let base253 = l250;
22103 let len253 = l251;
22104 let mut result253 = _rt::Vec::with_capacity(len253);
22105 for i in 0..len253 {
22106 let base = base253.add(i * 4);
22107 let e253 = {
22108 let l252 = *base.add(0).cast::<i32>();
22109 LazyDbValue::from_handle(l252 as u32)
22110 };
22111 result253.push(e253);
22112 }
22113 _rt::cabi_dealloc(base253, len253 * 4, 4);
22114 result253
22115 };
22116 DbValue::Array(e265)
22117 }
22118 40 => {
22119 let e265 = {
22120 let l254 = *base.add(8).cast::<*mut u8>();
22121 let l255 = *base.add(12).cast::<usize>();
22122 let len256 = l255;
22123 let bytes256 = _rt::Vec::from_raw_parts(
22124 l254.cast(),
22125 len256,
22126 len256,
22127 );
22128 let l257 = i32::from(*base.add(16).cast::<u8>());
22129 let v260 = match l257 {
22130 0 => {
22131 let e260 = {
22132 let l258 = *base.add(20).cast::<i32>();
22133 LazyDbValue::from_handle(l258 as u32)
22134 };
22135 ValueBound::Included(e260)
22136 }
22137 1 => {
22138 let e260 = {
22139 let l259 = *base.add(20).cast::<i32>();
22140 LazyDbValue::from_handle(l259 as u32)
22141 };
22142 ValueBound::Excluded(e260)
22143 }
22144 n => {
22145 debug_assert_eq!(n, 2, "invalid enum discriminant");
22146 ValueBound::Unbounded
22147 }
22148 };
22149 let l261 = i32::from(*base.add(24).cast::<u8>());
22150 let v264 = match l261 {
22151 0 => {
22152 let e264 = {
22153 let l262 = *base.add(28).cast::<i32>();
22154 LazyDbValue::from_handle(l262 as u32)
22155 };
22156 ValueBound::Included(e264)
22157 }
22158 1 => {
22159 let e264 = {
22160 let l263 = *base.add(28).cast::<i32>();
22161 LazyDbValue::from_handle(l263 as u32)
22162 };
22163 ValueBound::Excluded(e264)
22164 }
22165 n => {
22166 debug_assert_eq!(n, 2, "invalid enum discriminant");
22167 ValueBound::Unbounded
22168 }
22169 };
22170 Range {
22171 name: _rt::string_lift(bytes256),
22172 value: ValuesRange {
22173 start: v260,
22174 end: v264,
22175 },
22176 }
22177 };
22178 DbValue::Range(e265)
22179 }
22180 n => {
22181 debug_assert_eq!(n, 41, "invalid enum discriminant");
22182 DbValue::Null
22183 }
22184 };
22185 v265
22186 };
22187 result266.push(e266);
22188 }
22189 _rt::cabi_dealloc(base266, len266 * 56, 8);
22190 DbRow { values: result266 }
22191 };
22192 result267.push(e267);
22193 }
22194 _rt::cabi_dealloc(base267, len267 * 8, 4);
22195 result267
22196 };
22197 Some(e)
22198 }
22199 _ => _rt::invalid_enum_discriminant(),
22200 }
22201 }
22202 }
22203 }
22204 impl DbConnection {
22205 #[allow(unused_unsafe, clippy::all)]
22206 pub fn open(address: &str) -> Result<DbConnection, Error> {
22207 unsafe {
22208 #[repr(align(4))]
22209 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
22210 let mut ret_area = RetArea(
22211 [::core::mem::MaybeUninit::uninit(); 16],
22212 );
22213 let vec0 = address;
22214 let ptr0 = vec0.as_ptr().cast::<u8>();
22215 let len0 = vec0.len();
22216 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
22217 #[cfg(target_arch = "wasm32")]
22218 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
22219 extern "C" {
22220 #[link_name = "[static]db-connection.open"]
22221 fn wit_import(_: *mut u8, _: usize, _: *mut u8);
22222 }
22223 #[cfg(not(target_arch = "wasm32"))]
22224 fn wit_import(_: *mut u8, _: usize, _: *mut u8) {
22225 unreachable!()
22226 }
22227 wit_import(ptr0.cast_mut(), len0, ptr1);
22228 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
22229 match l2 {
22230 0 => {
22231 let e = {
22232 let l3 = *ptr1.add(4).cast::<i32>();
22233 DbConnection::from_handle(l3 as u32)
22234 };
22235 Ok(e)
22236 }
22237 1 => {
22238 let e = {
22239 let l4 = i32::from(*ptr1.add(4).cast::<u8>());
22240 let v20 = match l4 {
22241 0 => {
22242 let e20 = {
22243 let l5 = *ptr1.add(8).cast::<*mut u8>();
22244 let l6 = *ptr1.add(12).cast::<usize>();
22245 let len7 = l6;
22246 let bytes7 = _rt::Vec::from_raw_parts(
22247 l5.cast(),
22248 len7,
22249 len7,
22250 );
22251 _rt::string_lift(bytes7)
22252 };
22253 Error::ConnectionFailure(e20)
22254 }
22255 1 => {
22256 let e20 = {
22257 let l8 = *ptr1.add(8).cast::<*mut u8>();
22258 let l9 = *ptr1.add(12).cast::<usize>();
22259 let len10 = l9;
22260 let bytes10 = _rt::Vec::from_raw_parts(
22261 l8.cast(),
22262 len10,
22263 len10,
22264 );
22265 _rt::string_lift(bytes10)
22266 };
22267 Error::QueryParameterFailure(e20)
22268 }
22269 2 => {
22270 let e20 = {
22271 let l11 = *ptr1.add(8).cast::<*mut u8>();
22272 let l12 = *ptr1.add(12).cast::<usize>();
22273 let len13 = l12;
22274 let bytes13 = _rt::Vec::from_raw_parts(
22275 l11.cast(),
22276 len13,
22277 len13,
22278 );
22279 _rt::string_lift(bytes13)
22280 };
22281 Error::QueryExecutionFailure(e20)
22282 }
22283 3 => {
22284 let e20 = {
22285 let l14 = *ptr1.add(8).cast::<*mut u8>();
22286 let l15 = *ptr1.add(12).cast::<usize>();
22287 let len16 = l15;
22288 let bytes16 = _rt::Vec::from_raw_parts(
22289 l14.cast(),
22290 len16,
22291 len16,
22292 );
22293 _rt::string_lift(bytes16)
22294 };
22295 Error::QueryResponseFailure(e20)
22296 }
22297 n => {
22298 debug_assert_eq!(n, 4, "invalid enum discriminant");
22299 let e20 = {
22300 let l17 = *ptr1.add(8).cast::<*mut u8>();
22301 let l18 = *ptr1.add(12).cast::<usize>();
22302 let len19 = l18;
22303 let bytes19 = _rt::Vec::from_raw_parts(
22304 l17.cast(),
22305 len19,
22306 len19,
22307 );
22308 _rt::string_lift(bytes19)
22309 };
22310 Error::Other(e20)
22311 }
22312 };
22313 v20
22314 };
22315 Err(e)
22316 }
22317 _ => _rt::invalid_enum_discriminant(),
22318 }
22319 }
22320 }
22321 }
22322 impl DbConnection {
22323 #[allow(unused_unsafe, clippy::all)]
22324 pub fn query(
22325 &self,
22326 statement: &str,
22327 params: _rt::Vec<DbValue>,
22328 ) -> Result<DbResult, Error> {
22329 unsafe {
22330 let mut cleanup_list = _rt::Vec::new();
22331 #[repr(align(4))]
22332 struct RetArea([::core::mem::MaybeUninit<u8>; 20]);
22333 let mut ret_area = RetArea(
22334 [::core::mem::MaybeUninit::uninit(); 20],
22335 );
22336 let vec0 = statement;
22337 let ptr0 = vec0.as_ptr().cast::<u8>();
22338 let len0 = vec0.len();
22339 let vec87 = ¶ms;
22340 let len87 = vec87.len();
22341 let layout87 = _rt::alloc::Layout::from_size_align_unchecked(
22342 vec87.len() * 56,
22343 8,
22344 );
22345 let result87 = if layout87.size() != 0 {
22346 let ptr = _rt::alloc::alloc(layout87).cast::<u8>();
22347 if ptr.is_null() {
22348 _rt::alloc::handle_alloc_error(layout87);
22349 }
22350 ptr
22351 } else {
22352 ::core::ptr::null_mut()
22353 };
22354 for (i, e) in vec87.into_iter().enumerate() {
22355 let base = result87.add(i * 56);
22356 {
22357 match e {
22358 DbValue::Character(e) => {
22359 *base.add(0).cast::<u8>() = (0i32) as u8;
22360 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
22361 }
22362 DbValue::Int2(e) => {
22363 *base.add(0).cast::<u8>() = (1i32) as u8;
22364 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
22365 }
22366 DbValue::Int4(e) => {
22367 *base.add(0).cast::<u8>() = (2i32) as u8;
22368 *base.add(8).cast::<i32>() = _rt::as_i32(e);
22369 }
22370 DbValue::Int8(e) => {
22371 *base.add(0).cast::<u8>() = (3i32) as u8;
22372 *base.add(8).cast::<i64>() = _rt::as_i64(e);
22373 }
22374 DbValue::Float4(e) => {
22375 *base.add(0).cast::<u8>() = (4i32) as u8;
22376 *base.add(8).cast::<f32>() = _rt::as_f32(e);
22377 }
22378 DbValue::Float8(e) => {
22379 *base.add(0).cast::<u8>() = (5i32) as u8;
22380 *base.add(8).cast::<f64>() = _rt::as_f64(e);
22381 }
22382 DbValue::Numeric(e) => {
22383 *base.add(0).cast::<u8>() = (6i32) as u8;
22384 let vec1 = e;
22385 let ptr1 = vec1.as_ptr().cast::<u8>();
22386 let len1 = vec1.len();
22387 *base.add(12).cast::<usize>() = len1;
22388 *base.add(8).cast::<*mut u8>() = ptr1.cast_mut();
22389 }
22390 DbValue::Boolean(e) => {
22391 *base.add(0).cast::<u8>() = (7i32) as u8;
22392 *base.add(8).cast::<u8>() = (match e {
22393 true => 1,
22394 false => 0,
22395 }) as u8;
22396 }
22397 DbValue::Text(e) => {
22398 *base.add(0).cast::<u8>() = (8i32) as u8;
22399 let vec2 = e;
22400 let ptr2 = vec2.as_ptr().cast::<u8>();
22401 let len2 = vec2.len();
22402 *base.add(12).cast::<usize>() = len2;
22403 *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
22404 }
22405 DbValue::Varchar(e) => {
22406 *base.add(0).cast::<u8>() = (9i32) as u8;
22407 let vec3 = e;
22408 let ptr3 = vec3.as_ptr().cast::<u8>();
22409 let len3 = vec3.len();
22410 *base.add(12).cast::<usize>() = len3;
22411 *base.add(8).cast::<*mut u8>() = ptr3.cast_mut();
22412 }
22413 DbValue::Bpchar(e) => {
22414 *base.add(0).cast::<u8>() = (10i32) as u8;
22415 let vec4 = e;
22416 let ptr4 = vec4.as_ptr().cast::<u8>();
22417 let len4 = vec4.len();
22418 *base.add(12).cast::<usize>() = len4;
22419 *base.add(8).cast::<*mut u8>() = ptr4.cast_mut();
22420 }
22421 DbValue::Timestamp(e) => {
22422 *base.add(0).cast::<u8>() = (11i32) as u8;
22423 let super::super::super::golem::rdbms::types::Timestamp {
22424 date: date5,
22425 time: time5,
22426 } = e;
22427 let super::super::super::golem::rdbms::types::Date {
22428 year: year6,
22429 month: month6,
22430 day: day6,
22431 } = date5;
22432 *base.add(8).cast::<i32>() = _rt::as_i32(year6);
22433 *base.add(12).cast::<u8>() = (_rt::as_i32(month6)) as u8;
22434 *base.add(13).cast::<u8>() = (_rt::as_i32(day6)) as u8;
22435 let super::super::super::golem::rdbms::types::Time {
22436 hour: hour7,
22437 minute: minute7,
22438 second: second7,
22439 nanosecond: nanosecond7,
22440 } = time5;
22441 *base.add(16).cast::<u8>() = (_rt::as_i32(hour7)) as u8;
22442 *base.add(17).cast::<u8>() = (_rt::as_i32(minute7)) as u8;
22443 *base.add(18).cast::<u8>() = (_rt::as_i32(second7)) as u8;
22444 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond7);
22445 }
22446 DbValue::Timestamptz(e) => {
22447 *base.add(0).cast::<u8>() = (12i32) as u8;
22448 let super::super::super::golem::rdbms::types::Timestamptz {
22449 timestamp: timestamp8,
22450 offset: offset8,
22451 } = e;
22452 let super::super::super::golem::rdbms::types::Timestamp {
22453 date: date9,
22454 time: time9,
22455 } = timestamp8;
22456 let super::super::super::golem::rdbms::types::Date {
22457 year: year10,
22458 month: month10,
22459 day: day10,
22460 } = date9;
22461 *base.add(8).cast::<i32>() = _rt::as_i32(year10);
22462 *base.add(12).cast::<u8>() = (_rt::as_i32(month10)) as u8;
22463 *base.add(13).cast::<u8>() = (_rt::as_i32(day10)) as u8;
22464 let super::super::super::golem::rdbms::types::Time {
22465 hour: hour11,
22466 minute: minute11,
22467 second: second11,
22468 nanosecond: nanosecond11,
22469 } = time9;
22470 *base.add(16).cast::<u8>() = (_rt::as_i32(hour11)) as u8;
22471 *base.add(17).cast::<u8>() = (_rt::as_i32(minute11)) as u8;
22472 *base.add(18).cast::<u8>() = (_rt::as_i32(second11)) as u8;
22473 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond11);
22474 *base.add(24).cast::<i32>() = _rt::as_i32(offset8);
22475 }
22476 DbValue::Date(e) => {
22477 *base.add(0).cast::<u8>() = (13i32) as u8;
22478 let super::super::super::golem::rdbms::types::Date {
22479 year: year12,
22480 month: month12,
22481 day: day12,
22482 } = e;
22483 *base.add(8).cast::<i32>() = _rt::as_i32(year12);
22484 *base.add(12).cast::<u8>() = (_rt::as_i32(month12)) as u8;
22485 *base.add(13).cast::<u8>() = (_rt::as_i32(day12)) as u8;
22486 }
22487 DbValue::Time(e) => {
22488 *base.add(0).cast::<u8>() = (14i32) as u8;
22489 let super::super::super::golem::rdbms::types::Time {
22490 hour: hour13,
22491 minute: minute13,
22492 second: second13,
22493 nanosecond: nanosecond13,
22494 } = e;
22495 *base.add(8).cast::<u8>() = (_rt::as_i32(hour13)) as u8;
22496 *base.add(9).cast::<u8>() = (_rt::as_i32(minute13)) as u8;
22497 *base.add(10).cast::<u8>() = (_rt::as_i32(second13)) as u8;
22498 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond13);
22499 }
22500 DbValue::Timetz(e) => {
22501 *base.add(0).cast::<u8>() = (15i32) as u8;
22502 let super::super::super::golem::rdbms::types::Timetz {
22503 time: time14,
22504 offset: offset14,
22505 } = e;
22506 let super::super::super::golem::rdbms::types::Time {
22507 hour: hour15,
22508 minute: minute15,
22509 second: second15,
22510 nanosecond: nanosecond15,
22511 } = time14;
22512 *base.add(8).cast::<u8>() = (_rt::as_i32(hour15)) as u8;
22513 *base.add(9).cast::<u8>() = (_rt::as_i32(minute15)) as u8;
22514 *base.add(10).cast::<u8>() = (_rt::as_i32(second15)) as u8;
22515 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond15);
22516 *base.add(16).cast::<i32>() = _rt::as_i32(offset14);
22517 }
22518 DbValue::Interval(e) => {
22519 *base.add(0).cast::<u8>() = (16i32) as u8;
22520 let Interval {
22521 months: months16,
22522 days: days16,
22523 microseconds: microseconds16,
22524 } = e;
22525 *base.add(8).cast::<i32>() = _rt::as_i32(months16);
22526 *base.add(12).cast::<i32>() = _rt::as_i32(days16);
22527 *base.add(16).cast::<i64>() = _rt::as_i64(microseconds16);
22528 }
22529 DbValue::Bytea(e) => {
22530 *base.add(0).cast::<u8>() = (17i32) as u8;
22531 let vec17 = e;
22532 let ptr17 = vec17.as_ptr().cast::<u8>();
22533 let len17 = vec17.len();
22534 *base.add(12).cast::<usize>() = len17;
22535 *base.add(8).cast::<*mut u8>() = ptr17.cast_mut();
22536 }
22537 DbValue::Json(e) => {
22538 *base.add(0).cast::<u8>() = (18i32) as u8;
22539 let vec18 = e;
22540 let ptr18 = vec18.as_ptr().cast::<u8>();
22541 let len18 = vec18.len();
22542 *base.add(12).cast::<usize>() = len18;
22543 *base.add(8).cast::<*mut u8>() = ptr18.cast_mut();
22544 }
22545 DbValue::Jsonb(e) => {
22546 *base.add(0).cast::<u8>() = (19i32) as u8;
22547 let vec19 = e;
22548 let ptr19 = vec19.as_ptr().cast::<u8>();
22549 let len19 = vec19.len();
22550 *base.add(12).cast::<usize>() = len19;
22551 *base.add(8).cast::<*mut u8>() = ptr19.cast_mut();
22552 }
22553 DbValue::Jsonpath(e) => {
22554 *base.add(0).cast::<u8>() = (20i32) as u8;
22555 let vec20 = e;
22556 let ptr20 = vec20.as_ptr().cast::<u8>();
22557 let len20 = vec20.len();
22558 *base.add(12).cast::<usize>() = len20;
22559 *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
22560 }
22561 DbValue::Xml(e) => {
22562 *base.add(0).cast::<u8>() = (21i32) as u8;
22563 let vec21 = e;
22564 let ptr21 = vec21.as_ptr().cast::<u8>();
22565 let len21 = vec21.len();
22566 *base.add(12).cast::<usize>() = len21;
22567 *base.add(8).cast::<*mut u8>() = ptr21.cast_mut();
22568 }
22569 DbValue::Uuid(e) => {
22570 *base.add(0).cast::<u8>() = (22i32) as u8;
22571 let super::super::super::golem::rdbms::types::Uuid {
22572 high_bits: high_bits22,
22573 low_bits: low_bits22,
22574 } = e;
22575 *base.add(8).cast::<i64>() = _rt::as_i64(high_bits22);
22576 *base.add(16).cast::<i64>() = _rt::as_i64(low_bits22);
22577 }
22578 DbValue::Inet(e) => {
22579 *base.add(0).cast::<u8>() = (23i32) as u8;
22580 use super::super::super::golem::rdbms::types::IpAddress as V25;
22581 match e {
22582 V25::Ipv4(e) => {
22583 *base.add(8).cast::<u8>() = (0i32) as u8;
22584 let (t23_0, t23_1, t23_2, t23_3) = e;
22585 *base.add(10).cast::<u8>() = (_rt::as_i32(t23_0)) as u8;
22586 *base.add(11).cast::<u8>() = (_rt::as_i32(t23_1)) as u8;
22587 *base.add(12).cast::<u8>() = (_rt::as_i32(t23_2)) as u8;
22588 *base.add(13).cast::<u8>() = (_rt::as_i32(t23_3)) as u8;
22589 }
22590 V25::Ipv6(e) => {
22591 *base.add(8).cast::<u8>() = (1i32) as u8;
22592 let (
22593 t24_0,
22594 t24_1,
22595 t24_2,
22596 t24_3,
22597 t24_4,
22598 t24_5,
22599 t24_6,
22600 t24_7,
22601 ) = e;
22602 *base.add(10).cast::<u16>() = (_rt::as_i32(t24_0)) as u16;
22603 *base.add(12).cast::<u16>() = (_rt::as_i32(t24_1)) as u16;
22604 *base.add(14).cast::<u16>() = (_rt::as_i32(t24_2)) as u16;
22605 *base.add(16).cast::<u16>() = (_rt::as_i32(t24_3)) as u16;
22606 *base.add(18).cast::<u16>() = (_rt::as_i32(t24_4)) as u16;
22607 *base.add(20).cast::<u16>() = (_rt::as_i32(t24_5)) as u16;
22608 *base.add(22).cast::<u16>() = (_rt::as_i32(t24_6)) as u16;
22609 *base.add(24).cast::<u16>() = (_rt::as_i32(t24_7)) as u16;
22610 }
22611 }
22612 }
22613 DbValue::Cidr(e) => {
22614 *base.add(0).cast::<u8>() = (24i32) as u8;
22615 use super::super::super::golem::rdbms::types::IpAddress as V28;
22616 match e {
22617 V28::Ipv4(e) => {
22618 *base.add(8).cast::<u8>() = (0i32) as u8;
22619 let (t26_0, t26_1, t26_2, t26_3) = e;
22620 *base.add(10).cast::<u8>() = (_rt::as_i32(t26_0)) as u8;
22621 *base.add(11).cast::<u8>() = (_rt::as_i32(t26_1)) as u8;
22622 *base.add(12).cast::<u8>() = (_rt::as_i32(t26_2)) as u8;
22623 *base.add(13).cast::<u8>() = (_rt::as_i32(t26_3)) as u8;
22624 }
22625 V28::Ipv6(e) => {
22626 *base.add(8).cast::<u8>() = (1i32) as u8;
22627 let (
22628 t27_0,
22629 t27_1,
22630 t27_2,
22631 t27_3,
22632 t27_4,
22633 t27_5,
22634 t27_6,
22635 t27_7,
22636 ) = e;
22637 *base.add(10).cast::<u16>() = (_rt::as_i32(t27_0)) as u16;
22638 *base.add(12).cast::<u16>() = (_rt::as_i32(t27_1)) as u16;
22639 *base.add(14).cast::<u16>() = (_rt::as_i32(t27_2)) as u16;
22640 *base.add(16).cast::<u16>() = (_rt::as_i32(t27_3)) as u16;
22641 *base.add(18).cast::<u16>() = (_rt::as_i32(t27_4)) as u16;
22642 *base.add(20).cast::<u16>() = (_rt::as_i32(t27_5)) as u16;
22643 *base.add(22).cast::<u16>() = (_rt::as_i32(t27_6)) as u16;
22644 *base.add(24).cast::<u16>() = (_rt::as_i32(t27_7)) as u16;
22645 }
22646 }
22647 }
22648 DbValue::Macaddr(e) => {
22649 *base.add(0).cast::<u8>() = (25i32) as u8;
22650 let super::super::super::golem::rdbms::types::MacAddress {
22651 octets: octets29,
22652 } = e;
22653 let (t30_0, t30_1, t30_2, t30_3, t30_4, t30_5) = octets29;
22654 *base.add(8).cast::<u8>() = (_rt::as_i32(t30_0)) as u8;
22655 *base.add(9).cast::<u8>() = (_rt::as_i32(t30_1)) as u8;
22656 *base.add(10).cast::<u8>() = (_rt::as_i32(t30_2)) as u8;
22657 *base.add(11).cast::<u8>() = (_rt::as_i32(t30_3)) as u8;
22658 *base.add(12).cast::<u8>() = (_rt::as_i32(t30_4)) as u8;
22659 *base.add(13).cast::<u8>() = (_rt::as_i32(t30_5)) as u8;
22660 }
22661 DbValue::Bit(e) => {
22662 *base.add(0).cast::<u8>() = (26i32) as u8;
22663 let vec31 = e;
22664 let len31 = vec31.len();
22665 let layout31 = _rt::alloc::Layout::from_size_align_unchecked(
22666 vec31.len() * 1,
22667 1,
22668 );
22669 let result31 = if layout31.size() != 0 {
22670 let ptr = _rt::alloc::alloc(layout31).cast::<u8>();
22671 if ptr.is_null() {
22672 _rt::alloc::handle_alloc_error(layout31);
22673 }
22674 ptr
22675 } else {
22676 ::core::ptr::null_mut()
22677 };
22678 for (i, e) in vec31.into_iter().enumerate() {
22679 let base = result31.add(i * 1);
22680 {
22681 *base.add(0).cast::<u8>() = (match e {
22682 true => 1,
22683 false => 0,
22684 }) as u8;
22685 }
22686 }
22687 *base.add(12).cast::<usize>() = len31;
22688 *base.add(8).cast::<*mut u8>() = result31;
22689 cleanup_list.extend_from_slice(&[(result31, layout31)]);
22690 }
22691 DbValue::Varbit(e) => {
22692 *base.add(0).cast::<u8>() = (27i32) as u8;
22693 let vec32 = e;
22694 let len32 = vec32.len();
22695 let layout32 = _rt::alloc::Layout::from_size_align_unchecked(
22696 vec32.len() * 1,
22697 1,
22698 );
22699 let result32 = if layout32.size() != 0 {
22700 let ptr = _rt::alloc::alloc(layout32).cast::<u8>();
22701 if ptr.is_null() {
22702 _rt::alloc::handle_alloc_error(layout32);
22703 }
22704 ptr
22705 } else {
22706 ::core::ptr::null_mut()
22707 };
22708 for (i, e) in vec32.into_iter().enumerate() {
22709 let base = result32.add(i * 1);
22710 {
22711 *base.add(0).cast::<u8>() = (match e {
22712 true => 1,
22713 false => 0,
22714 }) as u8;
22715 }
22716 }
22717 *base.add(12).cast::<usize>() = len32;
22718 *base.add(8).cast::<*mut u8>() = result32;
22719 cleanup_list.extend_from_slice(&[(result32, layout32)]);
22720 }
22721 DbValue::Int4range(e) => {
22722 *base.add(0).cast::<u8>() = (28i32) as u8;
22723 let Int4range { start: start33, end: end33 } = e;
22724 match start33 {
22725 Int4bound::Included(e) => {
22726 *base.add(8).cast::<u8>() = (0i32) as u8;
22727 *base.add(12).cast::<i32>() = _rt::as_i32(e);
22728 }
22729 Int4bound::Excluded(e) => {
22730 *base.add(8).cast::<u8>() = (1i32) as u8;
22731 *base.add(12).cast::<i32>() = _rt::as_i32(e);
22732 }
22733 Int4bound::Unbounded => {
22734 *base.add(8).cast::<u8>() = (2i32) as u8;
22735 }
22736 }
22737 match end33 {
22738 Int4bound::Included(e) => {
22739 *base.add(16).cast::<u8>() = (0i32) as u8;
22740 *base.add(20).cast::<i32>() = _rt::as_i32(e);
22741 }
22742 Int4bound::Excluded(e) => {
22743 *base.add(16).cast::<u8>() = (1i32) as u8;
22744 *base.add(20).cast::<i32>() = _rt::as_i32(e);
22745 }
22746 Int4bound::Unbounded => {
22747 *base.add(16).cast::<u8>() = (2i32) as u8;
22748 }
22749 }
22750 }
22751 DbValue::Int8range(e) => {
22752 *base.add(0).cast::<u8>() = (29i32) as u8;
22753 let Int8range { start: start34, end: end34 } = e;
22754 match start34 {
22755 Int8bound::Included(e) => {
22756 *base.add(8).cast::<u8>() = (0i32) as u8;
22757 *base.add(16).cast::<i64>() = _rt::as_i64(e);
22758 }
22759 Int8bound::Excluded(e) => {
22760 *base.add(8).cast::<u8>() = (1i32) as u8;
22761 *base.add(16).cast::<i64>() = _rt::as_i64(e);
22762 }
22763 Int8bound::Unbounded => {
22764 *base.add(8).cast::<u8>() = (2i32) as u8;
22765 }
22766 }
22767 match end34 {
22768 Int8bound::Included(e) => {
22769 *base.add(24).cast::<u8>() = (0i32) as u8;
22770 *base.add(32).cast::<i64>() = _rt::as_i64(e);
22771 }
22772 Int8bound::Excluded(e) => {
22773 *base.add(24).cast::<u8>() = (1i32) as u8;
22774 *base.add(32).cast::<i64>() = _rt::as_i64(e);
22775 }
22776 Int8bound::Unbounded => {
22777 *base.add(24).cast::<u8>() = (2i32) as u8;
22778 }
22779 }
22780 }
22781 DbValue::Numrange(e) => {
22782 *base.add(0).cast::<u8>() = (30i32) as u8;
22783 let Numrange { start: start35, end: end35 } = e;
22784 match start35 {
22785 Numbound::Included(e) => {
22786 *base.add(8).cast::<u8>() = (0i32) as u8;
22787 let vec36 = e;
22788 let ptr36 = vec36.as_ptr().cast::<u8>();
22789 let len36 = vec36.len();
22790 *base.add(16).cast::<usize>() = len36;
22791 *base.add(12).cast::<*mut u8>() = ptr36.cast_mut();
22792 }
22793 Numbound::Excluded(e) => {
22794 *base.add(8).cast::<u8>() = (1i32) as u8;
22795 let vec37 = e;
22796 let ptr37 = vec37.as_ptr().cast::<u8>();
22797 let len37 = vec37.len();
22798 *base.add(16).cast::<usize>() = len37;
22799 *base.add(12).cast::<*mut u8>() = ptr37.cast_mut();
22800 }
22801 Numbound::Unbounded => {
22802 *base.add(8).cast::<u8>() = (2i32) as u8;
22803 }
22804 }
22805 match end35 {
22806 Numbound::Included(e) => {
22807 *base.add(20).cast::<u8>() = (0i32) as u8;
22808 let vec38 = e;
22809 let ptr38 = vec38.as_ptr().cast::<u8>();
22810 let len38 = vec38.len();
22811 *base.add(28).cast::<usize>() = len38;
22812 *base.add(24).cast::<*mut u8>() = ptr38.cast_mut();
22813 }
22814 Numbound::Excluded(e) => {
22815 *base.add(20).cast::<u8>() = (1i32) as u8;
22816 let vec39 = e;
22817 let ptr39 = vec39.as_ptr().cast::<u8>();
22818 let len39 = vec39.len();
22819 *base.add(28).cast::<usize>() = len39;
22820 *base.add(24).cast::<*mut u8>() = ptr39.cast_mut();
22821 }
22822 Numbound::Unbounded => {
22823 *base.add(20).cast::<u8>() = (2i32) as u8;
22824 }
22825 }
22826 }
22827 DbValue::Tsrange(e) => {
22828 *base.add(0).cast::<u8>() = (31i32) as u8;
22829 let Tsrange { start: start40, end: end40 } = e;
22830 match start40 {
22831 Tsbound::Included(e) => {
22832 *base.add(8).cast::<u8>() = (0i32) as u8;
22833 let super::super::super::golem::rdbms::types::Timestamp {
22834 date: date41,
22835 time: time41,
22836 } = e;
22837 let super::super::super::golem::rdbms::types::Date {
22838 year: year42,
22839 month: month42,
22840 day: day42,
22841 } = date41;
22842 *base.add(12).cast::<i32>() = _rt::as_i32(year42);
22843 *base.add(16).cast::<u8>() = (_rt::as_i32(month42)) as u8;
22844 *base.add(17).cast::<u8>() = (_rt::as_i32(day42)) as u8;
22845 let super::super::super::golem::rdbms::types::Time {
22846 hour: hour43,
22847 minute: minute43,
22848 second: second43,
22849 nanosecond: nanosecond43,
22850 } = time41;
22851 *base.add(20).cast::<u8>() = (_rt::as_i32(hour43)) as u8;
22852 *base.add(21).cast::<u8>() = (_rt::as_i32(minute43)) as u8;
22853 *base.add(22).cast::<u8>() = (_rt::as_i32(second43)) as u8;
22854 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond43);
22855 }
22856 Tsbound::Excluded(e) => {
22857 *base.add(8).cast::<u8>() = (1i32) as u8;
22858 let super::super::super::golem::rdbms::types::Timestamp {
22859 date: date44,
22860 time: time44,
22861 } = e;
22862 let super::super::super::golem::rdbms::types::Date {
22863 year: year45,
22864 month: month45,
22865 day: day45,
22866 } = date44;
22867 *base.add(12).cast::<i32>() = _rt::as_i32(year45);
22868 *base.add(16).cast::<u8>() = (_rt::as_i32(month45)) as u8;
22869 *base.add(17).cast::<u8>() = (_rt::as_i32(day45)) as u8;
22870 let super::super::super::golem::rdbms::types::Time {
22871 hour: hour46,
22872 minute: minute46,
22873 second: second46,
22874 nanosecond: nanosecond46,
22875 } = time44;
22876 *base.add(20).cast::<u8>() = (_rt::as_i32(hour46)) as u8;
22877 *base.add(21).cast::<u8>() = (_rt::as_i32(minute46)) as u8;
22878 *base.add(22).cast::<u8>() = (_rt::as_i32(second46)) as u8;
22879 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond46);
22880 }
22881 Tsbound::Unbounded => {
22882 *base.add(8).cast::<u8>() = (2i32) as u8;
22883 }
22884 }
22885 match end40 {
22886 Tsbound::Included(e) => {
22887 *base.add(28).cast::<u8>() = (0i32) as u8;
22888 let super::super::super::golem::rdbms::types::Timestamp {
22889 date: date47,
22890 time: time47,
22891 } = e;
22892 let super::super::super::golem::rdbms::types::Date {
22893 year: year48,
22894 month: month48,
22895 day: day48,
22896 } = date47;
22897 *base.add(32).cast::<i32>() = _rt::as_i32(year48);
22898 *base.add(36).cast::<u8>() = (_rt::as_i32(month48)) as u8;
22899 *base.add(37).cast::<u8>() = (_rt::as_i32(day48)) as u8;
22900 let super::super::super::golem::rdbms::types::Time {
22901 hour: hour49,
22902 minute: minute49,
22903 second: second49,
22904 nanosecond: nanosecond49,
22905 } = time47;
22906 *base.add(40).cast::<u8>() = (_rt::as_i32(hour49)) as u8;
22907 *base.add(41).cast::<u8>() = (_rt::as_i32(minute49)) as u8;
22908 *base.add(42).cast::<u8>() = (_rt::as_i32(second49)) as u8;
22909 *base.add(44).cast::<i32>() = _rt::as_i32(nanosecond49);
22910 }
22911 Tsbound::Excluded(e) => {
22912 *base.add(28).cast::<u8>() = (1i32) as u8;
22913 let super::super::super::golem::rdbms::types::Timestamp {
22914 date: date50,
22915 time: time50,
22916 } = e;
22917 let super::super::super::golem::rdbms::types::Date {
22918 year: year51,
22919 month: month51,
22920 day: day51,
22921 } = date50;
22922 *base.add(32).cast::<i32>() = _rt::as_i32(year51);
22923 *base.add(36).cast::<u8>() = (_rt::as_i32(month51)) as u8;
22924 *base.add(37).cast::<u8>() = (_rt::as_i32(day51)) as u8;
22925 let super::super::super::golem::rdbms::types::Time {
22926 hour: hour52,
22927 minute: minute52,
22928 second: second52,
22929 nanosecond: nanosecond52,
22930 } = time50;
22931 *base.add(40).cast::<u8>() = (_rt::as_i32(hour52)) as u8;
22932 *base.add(41).cast::<u8>() = (_rt::as_i32(minute52)) as u8;
22933 *base.add(42).cast::<u8>() = (_rt::as_i32(second52)) as u8;
22934 *base.add(44).cast::<i32>() = _rt::as_i32(nanosecond52);
22935 }
22936 Tsbound::Unbounded => {
22937 *base.add(28).cast::<u8>() = (2i32) as u8;
22938 }
22939 }
22940 }
22941 DbValue::Tstzrange(e) => {
22942 *base.add(0).cast::<u8>() = (32i32) as u8;
22943 let Tstzrange { start: start53, end: end53 } = e;
22944 match start53 {
22945 Tstzbound::Included(e) => {
22946 *base.add(8).cast::<u8>() = (0i32) as u8;
22947 let super::super::super::golem::rdbms::types::Timestamptz {
22948 timestamp: timestamp54,
22949 offset: offset54,
22950 } = e;
22951 let super::super::super::golem::rdbms::types::Timestamp {
22952 date: date55,
22953 time: time55,
22954 } = timestamp54;
22955 let super::super::super::golem::rdbms::types::Date {
22956 year: year56,
22957 month: month56,
22958 day: day56,
22959 } = date55;
22960 *base.add(12).cast::<i32>() = _rt::as_i32(year56);
22961 *base.add(16).cast::<u8>() = (_rt::as_i32(month56)) as u8;
22962 *base.add(17).cast::<u8>() = (_rt::as_i32(day56)) as u8;
22963 let super::super::super::golem::rdbms::types::Time {
22964 hour: hour57,
22965 minute: minute57,
22966 second: second57,
22967 nanosecond: nanosecond57,
22968 } = time55;
22969 *base.add(20).cast::<u8>() = (_rt::as_i32(hour57)) as u8;
22970 *base.add(21).cast::<u8>() = (_rt::as_i32(minute57)) as u8;
22971 *base.add(22).cast::<u8>() = (_rt::as_i32(second57)) as u8;
22972 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond57);
22973 *base.add(28).cast::<i32>() = _rt::as_i32(offset54);
22974 }
22975 Tstzbound::Excluded(e) => {
22976 *base.add(8).cast::<u8>() = (1i32) as u8;
22977 let super::super::super::golem::rdbms::types::Timestamptz {
22978 timestamp: timestamp58,
22979 offset: offset58,
22980 } = e;
22981 let super::super::super::golem::rdbms::types::Timestamp {
22982 date: date59,
22983 time: time59,
22984 } = timestamp58;
22985 let super::super::super::golem::rdbms::types::Date {
22986 year: year60,
22987 month: month60,
22988 day: day60,
22989 } = date59;
22990 *base.add(12).cast::<i32>() = _rt::as_i32(year60);
22991 *base.add(16).cast::<u8>() = (_rt::as_i32(month60)) as u8;
22992 *base.add(17).cast::<u8>() = (_rt::as_i32(day60)) as u8;
22993 let super::super::super::golem::rdbms::types::Time {
22994 hour: hour61,
22995 minute: minute61,
22996 second: second61,
22997 nanosecond: nanosecond61,
22998 } = time59;
22999 *base.add(20).cast::<u8>() = (_rt::as_i32(hour61)) as u8;
23000 *base.add(21).cast::<u8>() = (_rt::as_i32(minute61)) as u8;
23001 *base.add(22).cast::<u8>() = (_rt::as_i32(second61)) as u8;
23002 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond61);
23003 *base.add(28).cast::<i32>() = _rt::as_i32(offset58);
23004 }
23005 Tstzbound::Unbounded => {
23006 *base.add(8).cast::<u8>() = (2i32) as u8;
23007 }
23008 }
23009 match end53 {
23010 Tstzbound::Included(e) => {
23011 *base.add(32).cast::<u8>() = (0i32) as u8;
23012 let super::super::super::golem::rdbms::types::Timestamptz {
23013 timestamp: timestamp62,
23014 offset: offset62,
23015 } = e;
23016 let super::super::super::golem::rdbms::types::Timestamp {
23017 date: date63,
23018 time: time63,
23019 } = timestamp62;
23020 let super::super::super::golem::rdbms::types::Date {
23021 year: year64,
23022 month: month64,
23023 day: day64,
23024 } = date63;
23025 *base.add(36).cast::<i32>() = _rt::as_i32(year64);
23026 *base.add(40).cast::<u8>() = (_rt::as_i32(month64)) as u8;
23027 *base.add(41).cast::<u8>() = (_rt::as_i32(day64)) as u8;
23028 let super::super::super::golem::rdbms::types::Time {
23029 hour: hour65,
23030 minute: minute65,
23031 second: second65,
23032 nanosecond: nanosecond65,
23033 } = time63;
23034 *base.add(44).cast::<u8>() = (_rt::as_i32(hour65)) as u8;
23035 *base.add(45).cast::<u8>() = (_rt::as_i32(minute65)) as u8;
23036 *base.add(46).cast::<u8>() = (_rt::as_i32(second65)) as u8;
23037 *base.add(48).cast::<i32>() = _rt::as_i32(nanosecond65);
23038 *base.add(52).cast::<i32>() = _rt::as_i32(offset62);
23039 }
23040 Tstzbound::Excluded(e) => {
23041 *base.add(32).cast::<u8>() = (1i32) as u8;
23042 let super::super::super::golem::rdbms::types::Timestamptz {
23043 timestamp: timestamp66,
23044 offset: offset66,
23045 } = e;
23046 let super::super::super::golem::rdbms::types::Timestamp {
23047 date: date67,
23048 time: time67,
23049 } = timestamp66;
23050 let super::super::super::golem::rdbms::types::Date {
23051 year: year68,
23052 month: month68,
23053 day: day68,
23054 } = date67;
23055 *base.add(36).cast::<i32>() = _rt::as_i32(year68);
23056 *base.add(40).cast::<u8>() = (_rt::as_i32(month68)) as u8;
23057 *base.add(41).cast::<u8>() = (_rt::as_i32(day68)) as u8;
23058 let super::super::super::golem::rdbms::types::Time {
23059 hour: hour69,
23060 minute: minute69,
23061 second: second69,
23062 nanosecond: nanosecond69,
23063 } = time67;
23064 *base.add(44).cast::<u8>() = (_rt::as_i32(hour69)) as u8;
23065 *base.add(45).cast::<u8>() = (_rt::as_i32(minute69)) as u8;
23066 *base.add(46).cast::<u8>() = (_rt::as_i32(second69)) as u8;
23067 *base.add(48).cast::<i32>() = _rt::as_i32(nanosecond69);
23068 *base.add(52).cast::<i32>() = _rt::as_i32(offset66);
23069 }
23070 Tstzbound::Unbounded => {
23071 *base.add(32).cast::<u8>() = (2i32) as u8;
23072 }
23073 }
23074 }
23075 DbValue::Daterange(e) => {
23076 *base.add(0).cast::<u8>() = (33i32) as u8;
23077 let Daterange { start: start70, end: end70 } = e;
23078 match start70 {
23079 Datebound::Included(e) => {
23080 *base.add(8).cast::<u8>() = (0i32) as u8;
23081 let super::super::super::golem::rdbms::types::Date {
23082 year: year71,
23083 month: month71,
23084 day: day71,
23085 } = e;
23086 *base.add(12).cast::<i32>() = _rt::as_i32(year71);
23087 *base.add(16).cast::<u8>() = (_rt::as_i32(month71)) as u8;
23088 *base.add(17).cast::<u8>() = (_rt::as_i32(day71)) as u8;
23089 }
23090 Datebound::Excluded(e) => {
23091 *base.add(8).cast::<u8>() = (1i32) as u8;
23092 let super::super::super::golem::rdbms::types::Date {
23093 year: year72,
23094 month: month72,
23095 day: day72,
23096 } = e;
23097 *base.add(12).cast::<i32>() = _rt::as_i32(year72);
23098 *base.add(16).cast::<u8>() = (_rt::as_i32(month72)) as u8;
23099 *base.add(17).cast::<u8>() = (_rt::as_i32(day72)) as u8;
23100 }
23101 Datebound::Unbounded => {
23102 *base.add(8).cast::<u8>() = (2i32) as u8;
23103 }
23104 }
23105 match end70 {
23106 Datebound::Included(e) => {
23107 *base.add(20).cast::<u8>() = (0i32) as u8;
23108 let super::super::super::golem::rdbms::types::Date {
23109 year: year73,
23110 month: month73,
23111 day: day73,
23112 } = e;
23113 *base.add(24).cast::<i32>() = _rt::as_i32(year73);
23114 *base.add(28).cast::<u8>() = (_rt::as_i32(month73)) as u8;
23115 *base.add(29).cast::<u8>() = (_rt::as_i32(day73)) as u8;
23116 }
23117 Datebound::Excluded(e) => {
23118 *base.add(20).cast::<u8>() = (1i32) as u8;
23119 let super::super::super::golem::rdbms::types::Date {
23120 year: year74,
23121 month: month74,
23122 day: day74,
23123 } = e;
23124 *base.add(24).cast::<i32>() = _rt::as_i32(year74);
23125 *base.add(28).cast::<u8>() = (_rt::as_i32(month74)) as u8;
23126 *base.add(29).cast::<u8>() = (_rt::as_i32(day74)) as u8;
23127 }
23128 Datebound::Unbounded => {
23129 *base.add(20).cast::<u8>() = (2i32) as u8;
23130 }
23131 }
23132 }
23133 DbValue::Money(e) => {
23134 *base.add(0).cast::<u8>() = (34i32) as u8;
23135 *base.add(8).cast::<i64>() = _rt::as_i64(e);
23136 }
23137 DbValue::Oid(e) => {
23138 *base.add(0).cast::<u8>() = (35i32) as u8;
23139 *base.add(8).cast::<i32>() = _rt::as_i32(e);
23140 }
23141 DbValue::Enumeration(e) => {
23142 *base.add(0).cast::<u8>() = (36i32) as u8;
23143 let Enumeration { name: name75, value: value75 } = e;
23144 let vec76 = name75;
23145 let ptr76 = vec76.as_ptr().cast::<u8>();
23146 let len76 = vec76.len();
23147 *base.add(12).cast::<usize>() = len76;
23148 *base.add(8).cast::<*mut u8>() = ptr76.cast_mut();
23149 let vec77 = value75;
23150 let ptr77 = vec77.as_ptr().cast::<u8>();
23151 let len77 = vec77.len();
23152 *base.add(20).cast::<usize>() = len77;
23153 *base.add(16).cast::<*mut u8>() = ptr77.cast_mut();
23154 }
23155 DbValue::Composite(e) => {
23156 *base.add(0).cast::<u8>() = (37i32) as u8;
23157 let Composite { name: name78, values: values78 } = e;
23158 let vec79 = name78;
23159 let ptr79 = vec79.as_ptr().cast::<u8>();
23160 let len79 = vec79.len();
23161 *base.add(12).cast::<usize>() = len79;
23162 *base.add(8).cast::<*mut u8>() = ptr79.cast_mut();
23163 let vec80 = values78;
23164 let len80 = vec80.len();
23165 let layout80 = _rt::alloc::Layout::from_size_align_unchecked(
23166 vec80.len() * 4,
23167 4,
23168 );
23169 let result80 = if layout80.size() != 0 {
23170 let ptr = _rt::alloc::alloc(layout80).cast::<u8>();
23171 if ptr.is_null() {
23172 _rt::alloc::handle_alloc_error(layout80);
23173 }
23174 ptr
23175 } else {
23176 ::core::ptr::null_mut()
23177 };
23178 for (i, e) in vec80.into_iter().enumerate() {
23179 let base = result80.add(i * 4);
23180 {
23181 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
23182 }
23183 }
23184 *base.add(20).cast::<usize>() = len80;
23185 *base.add(16).cast::<*mut u8>() = result80;
23186 cleanup_list.extend_from_slice(&[(result80, layout80)]);
23187 }
23188 DbValue::Domain(e) => {
23189 *base.add(0).cast::<u8>() = (38i32) as u8;
23190 let Domain { name: name81, value: value81 } = e;
23191 let vec82 = name81;
23192 let ptr82 = vec82.as_ptr().cast::<u8>();
23193 let len82 = vec82.len();
23194 *base.add(12).cast::<usize>() = len82;
23195 *base.add(8).cast::<*mut u8>() = ptr82.cast_mut();
23196 *base.add(16).cast::<i32>() = (value81).take_handle()
23197 as i32;
23198 }
23199 DbValue::Array(e) => {
23200 *base.add(0).cast::<u8>() = (39i32) as u8;
23201 let vec83 = e;
23202 let len83 = vec83.len();
23203 let layout83 = _rt::alloc::Layout::from_size_align_unchecked(
23204 vec83.len() * 4,
23205 4,
23206 );
23207 let result83 = if layout83.size() != 0 {
23208 let ptr = _rt::alloc::alloc(layout83).cast::<u8>();
23209 if ptr.is_null() {
23210 _rt::alloc::handle_alloc_error(layout83);
23211 }
23212 ptr
23213 } else {
23214 ::core::ptr::null_mut()
23215 };
23216 for (i, e) in vec83.into_iter().enumerate() {
23217 let base = result83.add(i * 4);
23218 {
23219 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
23220 }
23221 }
23222 *base.add(12).cast::<usize>() = len83;
23223 *base.add(8).cast::<*mut u8>() = result83;
23224 cleanup_list.extend_from_slice(&[(result83, layout83)]);
23225 }
23226 DbValue::Range(e) => {
23227 *base.add(0).cast::<u8>() = (40i32) as u8;
23228 let Range { name: name84, value: value84 } = e;
23229 let vec85 = name84;
23230 let ptr85 = vec85.as_ptr().cast::<u8>();
23231 let len85 = vec85.len();
23232 *base.add(12).cast::<usize>() = len85;
23233 *base.add(8).cast::<*mut u8>() = ptr85.cast_mut();
23234 let ValuesRange { start: start86, end: end86 } = value84;
23235 match start86 {
23236 ValueBound::Included(e) => {
23237 *base.add(16).cast::<u8>() = (0i32) as u8;
23238 *base.add(20).cast::<i32>() = (e).take_handle() as i32;
23239 }
23240 ValueBound::Excluded(e) => {
23241 *base.add(16).cast::<u8>() = (1i32) as u8;
23242 *base.add(20).cast::<i32>() = (e).take_handle() as i32;
23243 }
23244 ValueBound::Unbounded => {
23245 *base.add(16).cast::<u8>() = (2i32) as u8;
23246 }
23247 }
23248 match end86 {
23249 ValueBound::Included(e) => {
23250 *base.add(24).cast::<u8>() = (0i32) as u8;
23251 *base.add(28).cast::<i32>() = (e).take_handle() as i32;
23252 }
23253 ValueBound::Excluded(e) => {
23254 *base.add(24).cast::<u8>() = (1i32) as u8;
23255 *base.add(28).cast::<i32>() = (e).take_handle() as i32;
23256 }
23257 ValueBound::Unbounded => {
23258 *base.add(24).cast::<u8>() = (2i32) as u8;
23259 }
23260 }
23261 }
23262 DbValue::Null => {
23263 *base.add(0).cast::<u8>() = (41i32) as u8;
23264 }
23265 }
23266 }
23267 }
23268 let ptr88 = ret_area.0.as_mut_ptr().cast::<u8>();
23269 #[cfg(target_arch = "wasm32")]
23270 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
23271 extern "C" {
23272 #[link_name = "[method]db-connection.query"]
23273 fn wit_import(
23274 _: i32,
23275 _: *mut u8,
23276 _: usize,
23277 _: *mut u8,
23278 _: usize,
23279 _: *mut u8,
23280 );
23281 }
23282 #[cfg(not(target_arch = "wasm32"))]
23283 fn wit_import(
23284 _: i32,
23285 _: *mut u8,
23286 _: usize,
23287 _: *mut u8,
23288 _: usize,
23289 _: *mut u8,
23290 ) {
23291 unreachable!()
23292 }
23293 wit_import(
23294 (self).handle() as i32,
23295 ptr0.cast_mut(),
23296 len0,
23297 result87,
23298 len87,
23299 ptr88,
23300 );
23301 let l89 = i32::from(*ptr88.add(0).cast::<u8>());
23302 if layout87.size() != 0 {
23303 _rt::alloc::dealloc(result87.cast(), layout87);
23304 }
23305 for (ptr, layout) in cleanup_list {
23306 if layout.size() != 0 {
23307 _rt::alloc::dealloc(ptr.cast(), layout);
23308 }
23309 }
23310 match l89 {
23311 0 => {
23312 let e = {
23313 let l90 = *ptr88.add(4).cast::<*mut u8>();
23314 let l91 = *ptr88.add(8).cast::<usize>();
23315 let base123 = l90;
23316 let len123 = l91;
23317 let mut result123 = _rt::Vec::with_capacity(len123);
23318 for i in 0..len123 {
23319 let base = base123.add(i * 48);
23320 let e123 = {
23321 let l92 = *base.add(0).cast::<i64>();
23322 let l93 = *base.add(8).cast::<*mut u8>();
23323 let l94 = *base.add(12).cast::<usize>();
23324 let len95 = l94;
23325 let bytes95 = _rt::Vec::from_raw_parts(
23326 l93.cast(),
23327 len95,
23328 len95,
23329 );
23330 let l96 = i32::from(*base.add(16).cast::<u8>());
23331 let v119 = match l96 {
23332 0 => DbColumnType::Character,
23333 1 => DbColumnType::Int2,
23334 2 => DbColumnType::Int4,
23335 3 => DbColumnType::Int8,
23336 4 => DbColumnType::Float4,
23337 5 => DbColumnType::Float8,
23338 6 => DbColumnType::Numeric,
23339 7 => DbColumnType::Boolean,
23340 8 => DbColumnType::Text,
23341 9 => DbColumnType::Varchar,
23342 10 => DbColumnType::Bpchar,
23343 11 => DbColumnType::Timestamp,
23344 12 => DbColumnType::Timestamptz,
23345 13 => DbColumnType::Date,
23346 14 => DbColumnType::Time,
23347 15 => DbColumnType::Timetz,
23348 16 => DbColumnType::Interval,
23349 17 => DbColumnType::Bytea,
23350 18 => DbColumnType::Uuid,
23351 19 => DbColumnType::Xml,
23352 20 => DbColumnType::Json,
23353 21 => DbColumnType::Jsonb,
23354 22 => DbColumnType::Jsonpath,
23355 23 => DbColumnType::Inet,
23356 24 => DbColumnType::Cidr,
23357 25 => DbColumnType::Macaddr,
23358 26 => DbColumnType::Bit,
23359 27 => DbColumnType::Varbit,
23360 28 => DbColumnType::Int4range,
23361 29 => DbColumnType::Int8range,
23362 30 => DbColumnType::Numrange,
23363 31 => DbColumnType::Tsrange,
23364 32 => DbColumnType::Tstzrange,
23365 33 => DbColumnType::Daterange,
23366 34 => DbColumnType::Money,
23367 35 => DbColumnType::Oid,
23368 36 => {
23369 let e119 = {
23370 let l97 = *base.add(20).cast::<*mut u8>();
23371 let l98 = *base.add(24).cast::<usize>();
23372 let len99 = l98;
23373 let bytes99 = _rt::Vec::from_raw_parts(
23374 l97.cast(),
23375 len99,
23376 len99,
23377 );
23378 EnumerationType {
23379 name: _rt::string_lift(bytes99),
23380 }
23381 };
23382 DbColumnType::Enumeration(e119)
23383 }
23384 37 => {
23385 let e119 = {
23386 let l100 = *base.add(20).cast::<*mut u8>();
23387 let l101 = *base.add(24).cast::<usize>();
23388 let len102 = l101;
23389 let bytes102 = _rt::Vec::from_raw_parts(
23390 l100.cast(),
23391 len102,
23392 len102,
23393 );
23394 let l103 = *base.add(28).cast::<*mut u8>();
23395 let l104 = *base.add(32).cast::<usize>();
23396 let base109 = l103;
23397 let len109 = l104;
23398 let mut result109 = _rt::Vec::with_capacity(len109);
23399 for i in 0..len109 {
23400 let base = base109.add(i * 12);
23401 let e109 = {
23402 let l105 = *base.add(0).cast::<*mut u8>();
23403 let l106 = *base.add(4).cast::<usize>();
23404 let len107 = l106;
23405 let bytes107 = _rt::Vec::from_raw_parts(
23406 l105.cast(),
23407 len107,
23408 len107,
23409 );
23410 let l108 = *base.add(8).cast::<i32>();
23411 (
23412 _rt::string_lift(bytes107),
23413 LazyDbColumnType::from_handle(l108 as u32),
23414 )
23415 };
23416 result109.push(e109);
23417 }
23418 _rt::cabi_dealloc(base109, len109 * 12, 4);
23419 CompositeType {
23420 name: _rt::string_lift(bytes102),
23421 attributes: result109,
23422 }
23423 };
23424 DbColumnType::Composite(e119)
23425 }
23426 38 => {
23427 let e119 = {
23428 let l110 = *base.add(20).cast::<*mut u8>();
23429 let l111 = *base.add(24).cast::<usize>();
23430 let len112 = l111;
23431 let bytes112 = _rt::Vec::from_raw_parts(
23432 l110.cast(),
23433 len112,
23434 len112,
23435 );
23436 let l113 = *base.add(28).cast::<i32>();
23437 DomainType {
23438 name: _rt::string_lift(bytes112),
23439 base_type: LazyDbColumnType::from_handle(l113 as u32),
23440 }
23441 };
23442 DbColumnType::Domain(e119)
23443 }
23444 39 => {
23445 let e119 = {
23446 let l114 = *base.add(20).cast::<i32>();
23447 LazyDbColumnType::from_handle(l114 as u32)
23448 };
23449 DbColumnType::Array(e119)
23450 }
23451 n => {
23452 debug_assert_eq!(n, 40, "invalid enum discriminant");
23453 let e119 = {
23454 let l115 = *base.add(20).cast::<*mut u8>();
23455 let l116 = *base.add(24).cast::<usize>();
23456 let len117 = l116;
23457 let bytes117 = _rt::Vec::from_raw_parts(
23458 l115.cast(),
23459 len117,
23460 len117,
23461 );
23462 let l118 = *base.add(28).cast::<i32>();
23463 RangeType {
23464 name: _rt::string_lift(bytes117),
23465 base_type: LazyDbColumnType::from_handle(l118 as u32),
23466 }
23467 };
23468 DbColumnType::Range(e119)
23469 }
23470 };
23471 let l120 = *base.add(36).cast::<*mut u8>();
23472 let l121 = *base.add(40).cast::<usize>();
23473 let len122 = l121;
23474 let bytes122 = _rt::Vec::from_raw_parts(
23475 l120.cast(),
23476 len122,
23477 len122,
23478 );
23479 DbColumn {
23480 ordinal: l92 as u64,
23481 name: _rt::string_lift(bytes95),
23482 db_type: v119,
23483 db_type_name: _rt::string_lift(bytes122),
23484 }
23485 };
23486 result123.push(e123);
23487 }
23488 _rt::cabi_dealloc(base123, len123 * 48, 8);
23489 let l124 = *ptr88.add(12).cast::<*mut u8>();
23490 let l125 = *ptr88.add(16).cast::<usize>();
23491 let base389 = l124;
23492 let len389 = l125;
23493 let mut result389 = _rt::Vec::with_capacity(len389);
23494 for i in 0..len389 {
23495 let base = base389.add(i * 8);
23496 let e389 = {
23497 let l126 = *base.add(0).cast::<*mut u8>();
23498 let l127 = *base.add(4).cast::<usize>();
23499 let base388 = l126;
23500 let len388 = l127;
23501 let mut result388 = _rt::Vec::with_capacity(len388);
23502 for i in 0..len388 {
23503 let base = base388.add(i * 56);
23504 let e388 = {
23505 let l128 = i32::from(*base.add(0).cast::<u8>());
23506 let v387 = match l128 {
23507 0 => {
23508 let e387 = {
23509 let l129 = i32::from(*base.add(8).cast::<i8>());
23510 l129 as i8
23511 };
23512 DbValue::Character(e387)
23513 }
23514 1 => {
23515 let e387 = {
23516 let l130 = i32::from(*base.add(8).cast::<i16>());
23517 l130 as i16
23518 };
23519 DbValue::Int2(e387)
23520 }
23521 2 => {
23522 let e387 = {
23523 let l131 = *base.add(8).cast::<i32>();
23524 l131
23525 };
23526 DbValue::Int4(e387)
23527 }
23528 3 => {
23529 let e387 = {
23530 let l132 = *base.add(8).cast::<i64>();
23531 l132
23532 };
23533 DbValue::Int8(e387)
23534 }
23535 4 => {
23536 let e387 = {
23537 let l133 = *base.add(8).cast::<f32>();
23538 l133
23539 };
23540 DbValue::Float4(e387)
23541 }
23542 5 => {
23543 let e387 = {
23544 let l134 = *base.add(8).cast::<f64>();
23545 l134
23546 };
23547 DbValue::Float8(e387)
23548 }
23549 6 => {
23550 let e387 = {
23551 let l135 = *base.add(8).cast::<*mut u8>();
23552 let l136 = *base.add(12).cast::<usize>();
23553 let len137 = l136;
23554 let bytes137 = _rt::Vec::from_raw_parts(
23555 l135.cast(),
23556 len137,
23557 len137,
23558 );
23559 _rt::string_lift(bytes137)
23560 };
23561 DbValue::Numeric(e387)
23562 }
23563 7 => {
23564 let e387 = {
23565 let l138 = i32::from(*base.add(8).cast::<u8>());
23566 _rt::bool_lift(l138 as u8)
23567 };
23568 DbValue::Boolean(e387)
23569 }
23570 8 => {
23571 let e387 = {
23572 let l139 = *base.add(8).cast::<*mut u8>();
23573 let l140 = *base.add(12).cast::<usize>();
23574 let len141 = l140;
23575 let bytes141 = _rt::Vec::from_raw_parts(
23576 l139.cast(),
23577 len141,
23578 len141,
23579 );
23580 _rt::string_lift(bytes141)
23581 };
23582 DbValue::Text(e387)
23583 }
23584 9 => {
23585 let e387 = {
23586 let l142 = *base.add(8).cast::<*mut u8>();
23587 let l143 = *base.add(12).cast::<usize>();
23588 let len144 = l143;
23589 let bytes144 = _rt::Vec::from_raw_parts(
23590 l142.cast(),
23591 len144,
23592 len144,
23593 );
23594 _rt::string_lift(bytes144)
23595 };
23596 DbValue::Varchar(e387)
23597 }
23598 10 => {
23599 let e387 = {
23600 let l145 = *base.add(8).cast::<*mut u8>();
23601 let l146 = *base.add(12).cast::<usize>();
23602 let len147 = l146;
23603 let bytes147 = _rt::Vec::from_raw_parts(
23604 l145.cast(),
23605 len147,
23606 len147,
23607 );
23608 _rt::string_lift(bytes147)
23609 };
23610 DbValue::Bpchar(e387)
23611 }
23612 11 => {
23613 let e387 = {
23614 let l148 = *base.add(8).cast::<i32>();
23615 let l149 = i32::from(*base.add(12).cast::<u8>());
23616 let l150 = i32::from(*base.add(13).cast::<u8>());
23617 let l151 = i32::from(*base.add(16).cast::<u8>());
23618 let l152 = i32::from(*base.add(17).cast::<u8>());
23619 let l153 = i32::from(*base.add(18).cast::<u8>());
23620 let l154 = *base.add(20).cast::<i32>();
23621 super::super::super::golem::rdbms::types::Timestamp {
23622 date: super::super::super::golem::rdbms::types::Date {
23623 year: l148,
23624 month: l149 as u8,
23625 day: l150 as u8,
23626 },
23627 time: super::super::super::golem::rdbms::types::Time {
23628 hour: l151 as u8,
23629 minute: l152 as u8,
23630 second: l153 as u8,
23631 nanosecond: l154 as u32,
23632 },
23633 }
23634 };
23635 DbValue::Timestamp(e387)
23636 }
23637 12 => {
23638 let e387 = {
23639 let l155 = *base.add(8).cast::<i32>();
23640 let l156 = i32::from(*base.add(12).cast::<u8>());
23641 let l157 = i32::from(*base.add(13).cast::<u8>());
23642 let l158 = i32::from(*base.add(16).cast::<u8>());
23643 let l159 = i32::from(*base.add(17).cast::<u8>());
23644 let l160 = i32::from(*base.add(18).cast::<u8>());
23645 let l161 = *base.add(20).cast::<i32>();
23646 let l162 = *base.add(24).cast::<i32>();
23647 super::super::super::golem::rdbms::types::Timestamptz {
23648 timestamp: super::super::super::golem::rdbms::types::Timestamp {
23649 date: super::super::super::golem::rdbms::types::Date {
23650 year: l155,
23651 month: l156 as u8,
23652 day: l157 as u8,
23653 },
23654 time: super::super::super::golem::rdbms::types::Time {
23655 hour: l158 as u8,
23656 minute: l159 as u8,
23657 second: l160 as u8,
23658 nanosecond: l161 as u32,
23659 },
23660 },
23661 offset: l162,
23662 }
23663 };
23664 DbValue::Timestamptz(e387)
23665 }
23666 13 => {
23667 let e387 = {
23668 let l163 = *base.add(8).cast::<i32>();
23669 let l164 = i32::from(*base.add(12).cast::<u8>());
23670 let l165 = i32::from(*base.add(13).cast::<u8>());
23671 super::super::super::golem::rdbms::types::Date {
23672 year: l163,
23673 month: l164 as u8,
23674 day: l165 as u8,
23675 }
23676 };
23677 DbValue::Date(e387)
23678 }
23679 14 => {
23680 let e387 = {
23681 let l166 = i32::from(*base.add(8).cast::<u8>());
23682 let l167 = i32::from(*base.add(9).cast::<u8>());
23683 let l168 = i32::from(*base.add(10).cast::<u8>());
23684 let l169 = *base.add(12).cast::<i32>();
23685 super::super::super::golem::rdbms::types::Time {
23686 hour: l166 as u8,
23687 minute: l167 as u8,
23688 second: l168 as u8,
23689 nanosecond: l169 as u32,
23690 }
23691 };
23692 DbValue::Time(e387)
23693 }
23694 15 => {
23695 let e387 = {
23696 let l170 = i32::from(*base.add(8).cast::<u8>());
23697 let l171 = i32::from(*base.add(9).cast::<u8>());
23698 let l172 = i32::from(*base.add(10).cast::<u8>());
23699 let l173 = *base.add(12).cast::<i32>();
23700 let l174 = *base.add(16).cast::<i32>();
23701 super::super::super::golem::rdbms::types::Timetz {
23702 time: super::super::super::golem::rdbms::types::Time {
23703 hour: l170 as u8,
23704 minute: l171 as u8,
23705 second: l172 as u8,
23706 nanosecond: l173 as u32,
23707 },
23708 offset: l174,
23709 }
23710 };
23711 DbValue::Timetz(e387)
23712 }
23713 16 => {
23714 let e387 = {
23715 let l175 = *base.add(8).cast::<i32>();
23716 let l176 = *base.add(12).cast::<i32>();
23717 let l177 = *base.add(16).cast::<i64>();
23718 Interval {
23719 months: l175,
23720 days: l176,
23721 microseconds: l177,
23722 }
23723 };
23724 DbValue::Interval(e387)
23725 }
23726 17 => {
23727 let e387 = {
23728 let l178 = *base.add(8).cast::<*mut u8>();
23729 let l179 = *base.add(12).cast::<usize>();
23730 let len180 = l179;
23731 _rt::Vec::from_raw_parts(l178.cast(), len180, len180)
23732 };
23733 DbValue::Bytea(e387)
23734 }
23735 18 => {
23736 let e387 = {
23737 let l181 = *base.add(8).cast::<*mut u8>();
23738 let l182 = *base.add(12).cast::<usize>();
23739 let len183 = l182;
23740 let bytes183 = _rt::Vec::from_raw_parts(
23741 l181.cast(),
23742 len183,
23743 len183,
23744 );
23745 _rt::string_lift(bytes183)
23746 };
23747 DbValue::Json(e387)
23748 }
23749 19 => {
23750 let e387 = {
23751 let l184 = *base.add(8).cast::<*mut u8>();
23752 let l185 = *base.add(12).cast::<usize>();
23753 let len186 = l185;
23754 let bytes186 = _rt::Vec::from_raw_parts(
23755 l184.cast(),
23756 len186,
23757 len186,
23758 );
23759 _rt::string_lift(bytes186)
23760 };
23761 DbValue::Jsonb(e387)
23762 }
23763 20 => {
23764 let e387 = {
23765 let l187 = *base.add(8).cast::<*mut u8>();
23766 let l188 = *base.add(12).cast::<usize>();
23767 let len189 = l188;
23768 let bytes189 = _rt::Vec::from_raw_parts(
23769 l187.cast(),
23770 len189,
23771 len189,
23772 );
23773 _rt::string_lift(bytes189)
23774 };
23775 DbValue::Jsonpath(e387)
23776 }
23777 21 => {
23778 let e387 = {
23779 let l190 = *base.add(8).cast::<*mut u8>();
23780 let l191 = *base.add(12).cast::<usize>();
23781 let len192 = l191;
23782 let bytes192 = _rt::Vec::from_raw_parts(
23783 l190.cast(),
23784 len192,
23785 len192,
23786 );
23787 _rt::string_lift(bytes192)
23788 };
23789 DbValue::Xml(e387)
23790 }
23791 22 => {
23792 let e387 = {
23793 let l193 = *base.add(8).cast::<i64>();
23794 let l194 = *base.add(16).cast::<i64>();
23795 super::super::super::golem::rdbms::types::Uuid {
23796 high_bits: l193 as u64,
23797 low_bits: l194 as u64,
23798 }
23799 };
23800 DbValue::Uuid(e387)
23801 }
23802 23 => {
23803 let e387 = {
23804 let l195 = i32::from(*base.add(8).cast::<u8>());
23805 use super::super::super::golem::rdbms::types::IpAddress as V208;
23806 let v208 = match l195 {
23807 0 => {
23808 let e208 = {
23809 let l196 = i32::from(*base.add(10).cast::<u8>());
23810 let l197 = i32::from(*base.add(11).cast::<u8>());
23811 let l198 = i32::from(*base.add(12).cast::<u8>());
23812 let l199 = i32::from(*base.add(13).cast::<u8>());
23813 (l196 as u8, l197 as u8, l198 as u8, l199 as u8)
23814 };
23815 V208::Ipv4(e208)
23816 }
23817 n => {
23818 debug_assert_eq!(n, 1, "invalid enum discriminant");
23819 let e208 = {
23820 let l200 = i32::from(*base.add(10).cast::<u16>());
23821 let l201 = i32::from(*base.add(12).cast::<u16>());
23822 let l202 = i32::from(*base.add(14).cast::<u16>());
23823 let l203 = i32::from(*base.add(16).cast::<u16>());
23824 let l204 = i32::from(*base.add(18).cast::<u16>());
23825 let l205 = i32::from(*base.add(20).cast::<u16>());
23826 let l206 = i32::from(*base.add(22).cast::<u16>());
23827 let l207 = i32::from(*base.add(24).cast::<u16>());
23828 (
23829 l200 as u16,
23830 l201 as u16,
23831 l202 as u16,
23832 l203 as u16,
23833 l204 as u16,
23834 l205 as u16,
23835 l206 as u16,
23836 l207 as u16,
23837 )
23838 };
23839 V208::Ipv6(e208)
23840 }
23841 };
23842 v208
23843 };
23844 DbValue::Inet(e387)
23845 }
23846 24 => {
23847 let e387 = {
23848 let l209 = i32::from(*base.add(8).cast::<u8>());
23849 use super::super::super::golem::rdbms::types::IpAddress as V222;
23850 let v222 = match l209 {
23851 0 => {
23852 let e222 = {
23853 let l210 = i32::from(*base.add(10).cast::<u8>());
23854 let l211 = i32::from(*base.add(11).cast::<u8>());
23855 let l212 = i32::from(*base.add(12).cast::<u8>());
23856 let l213 = i32::from(*base.add(13).cast::<u8>());
23857 (l210 as u8, l211 as u8, l212 as u8, l213 as u8)
23858 };
23859 V222::Ipv4(e222)
23860 }
23861 n => {
23862 debug_assert_eq!(n, 1, "invalid enum discriminant");
23863 let e222 = {
23864 let l214 = i32::from(*base.add(10).cast::<u16>());
23865 let l215 = i32::from(*base.add(12).cast::<u16>());
23866 let l216 = i32::from(*base.add(14).cast::<u16>());
23867 let l217 = i32::from(*base.add(16).cast::<u16>());
23868 let l218 = i32::from(*base.add(18).cast::<u16>());
23869 let l219 = i32::from(*base.add(20).cast::<u16>());
23870 let l220 = i32::from(*base.add(22).cast::<u16>());
23871 let l221 = i32::from(*base.add(24).cast::<u16>());
23872 (
23873 l214 as u16,
23874 l215 as u16,
23875 l216 as u16,
23876 l217 as u16,
23877 l218 as u16,
23878 l219 as u16,
23879 l220 as u16,
23880 l221 as u16,
23881 )
23882 };
23883 V222::Ipv6(e222)
23884 }
23885 };
23886 v222
23887 };
23888 DbValue::Cidr(e387)
23889 }
23890 25 => {
23891 let e387 = {
23892 let l223 = i32::from(*base.add(8).cast::<u8>());
23893 let l224 = i32::from(*base.add(9).cast::<u8>());
23894 let l225 = i32::from(*base.add(10).cast::<u8>());
23895 let l226 = i32::from(*base.add(11).cast::<u8>());
23896 let l227 = i32::from(*base.add(12).cast::<u8>());
23897 let l228 = i32::from(*base.add(13).cast::<u8>());
23898 super::super::super::golem::rdbms::types::MacAddress {
23899 octets: (
23900 l223 as u8,
23901 l224 as u8,
23902 l225 as u8,
23903 l226 as u8,
23904 l227 as u8,
23905 l228 as u8,
23906 ),
23907 }
23908 };
23909 DbValue::Macaddr(e387)
23910 }
23911 26 => {
23912 let e387 = {
23913 let l229 = *base.add(8).cast::<*mut u8>();
23914 let l230 = *base.add(12).cast::<usize>();
23915 let base232 = l229;
23916 let len232 = l230;
23917 let mut result232 = _rt::Vec::with_capacity(len232);
23918 for i in 0..len232 {
23919 let base = base232.add(i * 1);
23920 let e232 = {
23921 let l231 = i32::from(*base.add(0).cast::<u8>());
23922 _rt::bool_lift(l231 as u8)
23923 };
23924 result232.push(e232);
23925 }
23926 _rt::cabi_dealloc(base232, len232 * 1, 1);
23927 result232
23928 };
23929 DbValue::Bit(e387)
23930 }
23931 27 => {
23932 let e387 = {
23933 let l233 = *base.add(8).cast::<*mut u8>();
23934 let l234 = *base.add(12).cast::<usize>();
23935 let base236 = l233;
23936 let len236 = l234;
23937 let mut result236 = _rt::Vec::with_capacity(len236);
23938 for i in 0..len236 {
23939 let base = base236.add(i * 1);
23940 let e236 = {
23941 let l235 = i32::from(*base.add(0).cast::<u8>());
23942 _rt::bool_lift(l235 as u8)
23943 };
23944 result236.push(e236);
23945 }
23946 _rt::cabi_dealloc(base236, len236 * 1, 1);
23947 result236
23948 };
23949 DbValue::Varbit(e387)
23950 }
23951 28 => {
23952 let e387 = {
23953 let l237 = i32::from(*base.add(8).cast::<u8>());
23954 let v240 = match l237 {
23955 0 => {
23956 let e240 = {
23957 let l238 = *base.add(12).cast::<i32>();
23958 l238
23959 };
23960 Int4bound::Included(e240)
23961 }
23962 1 => {
23963 let e240 = {
23964 let l239 = *base.add(12).cast::<i32>();
23965 l239
23966 };
23967 Int4bound::Excluded(e240)
23968 }
23969 n => {
23970 debug_assert_eq!(n, 2, "invalid enum discriminant");
23971 Int4bound::Unbounded
23972 }
23973 };
23974 let l241 = i32::from(*base.add(16).cast::<u8>());
23975 let v244 = match l241 {
23976 0 => {
23977 let e244 = {
23978 let l242 = *base.add(20).cast::<i32>();
23979 l242
23980 };
23981 Int4bound::Included(e244)
23982 }
23983 1 => {
23984 let e244 = {
23985 let l243 = *base.add(20).cast::<i32>();
23986 l243
23987 };
23988 Int4bound::Excluded(e244)
23989 }
23990 n => {
23991 debug_assert_eq!(n, 2, "invalid enum discriminant");
23992 Int4bound::Unbounded
23993 }
23994 };
23995 Int4range {
23996 start: v240,
23997 end: v244,
23998 }
23999 };
24000 DbValue::Int4range(e387)
24001 }
24002 29 => {
24003 let e387 = {
24004 let l245 = i32::from(*base.add(8).cast::<u8>());
24005 let v248 = match l245 {
24006 0 => {
24007 let e248 = {
24008 let l246 = *base.add(16).cast::<i64>();
24009 l246
24010 };
24011 Int8bound::Included(e248)
24012 }
24013 1 => {
24014 let e248 = {
24015 let l247 = *base.add(16).cast::<i64>();
24016 l247
24017 };
24018 Int8bound::Excluded(e248)
24019 }
24020 n => {
24021 debug_assert_eq!(n, 2, "invalid enum discriminant");
24022 Int8bound::Unbounded
24023 }
24024 };
24025 let l249 = i32::from(*base.add(24).cast::<u8>());
24026 let v252 = match l249 {
24027 0 => {
24028 let e252 = {
24029 let l250 = *base.add(32).cast::<i64>();
24030 l250
24031 };
24032 Int8bound::Included(e252)
24033 }
24034 1 => {
24035 let e252 = {
24036 let l251 = *base.add(32).cast::<i64>();
24037 l251
24038 };
24039 Int8bound::Excluded(e252)
24040 }
24041 n => {
24042 debug_assert_eq!(n, 2, "invalid enum discriminant");
24043 Int8bound::Unbounded
24044 }
24045 };
24046 Int8range {
24047 start: v248,
24048 end: v252,
24049 }
24050 };
24051 DbValue::Int8range(e387)
24052 }
24053 30 => {
24054 let e387 = {
24055 let l253 = i32::from(*base.add(8).cast::<u8>());
24056 let v260 = match l253 {
24057 0 => {
24058 let e260 = {
24059 let l254 = *base.add(12).cast::<*mut u8>();
24060 let l255 = *base.add(16).cast::<usize>();
24061 let len256 = l255;
24062 let bytes256 = _rt::Vec::from_raw_parts(
24063 l254.cast(),
24064 len256,
24065 len256,
24066 );
24067 _rt::string_lift(bytes256)
24068 };
24069 Numbound::Included(e260)
24070 }
24071 1 => {
24072 let e260 = {
24073 let l257 = *base.add(12).cast::<*mut u8>();
24074 let l258 = *base.add(16).cast::<usize>();
24075 let len259 = l258;
24076 let bytes259 = _rt::Vec::from_raw_parts(
24077 l257.cast(),
24078 len259,
24079 len259,
24080 );
24081 _rt::string_lift(bytes259)
24082 };
24083 Numbound::Excluded(e260)
24084 }
24085 n => {
24086 debug_assert_eq!(n, 2, "invalid enum discriminant");
24087 Numbound::Unbounded
24088 }
24089 };
24090 let l261 = i32::from(*base.add(20).cast::<u8>());
24091 let v268 = match l261 {
24092 0 => {
24093 let e268 = {
24094 let l262 = *base.add(24).cast::<*mut u8>();
24095 let l263 = *base.add(28).cast::<usize>();
24096 let len264 = l263;
24097 let bytes264 = _rt::Vec::from_raw_parts(
24098 l262.cast(),
24099 len264,
24100 len264,
24101 );
24102 _rt::string_lift(bytes264)
24103 };
24104 Numbound::Included(e268)
24105 }
24106 1 => {
24107 let e268 = {
24108 let l265 = *base.add(24).cast::<*mut u8>();
24109 let l266 = *base.add(28).cast::<usize>();
24110 let len267 = l266;
24111 let bytes267 = _rt::Vec::from_raw_parts(
24112 l265.cast(),
24113 len267,
24114 len267,
24115 );
24116 _rt::string_lift(bytes267)
24117 };
24118 Numbound::Excluded(e268)
24119 }
24120 n => {
24121 debug_assert_eq!(n, 2, "invalid enum discriminant");
24122 Numbound::Unbounded
24123 }
24124 };
24125 Numrange { start: v260, end: v268 }
24126 };
24127 DbValue::Numrange(e387)
24128 }
24129 31 => {
24130 let e387 = {
24131 let l269 = i32::from(*base.add(8).cast::<u8>());
24132 let v284 = match l269 {
24133 0 => {
24134 let e284 = {
24135 let l270 = *base.add(12).cast::<i32>();
24136 let l271 = i32::from(*base.add(16).cast::<u8>());
24137 let l272 = i32::from(*base.add(17).cast::<u8>());
24138 let l273 = i32::from(*base.add(20).cast::<u8>());
24139 let l274 = i32::from(*base.add(21).cast::<u8>());
24140 let l275 = i32::from(*base.add(22).cast::<u8>());
24141 let l276 = *base.add(24).cast::<i32>();
24142 super::super::super::golem::rdbms::types::Timestamp {
24143 date: super::super::super::golem::rdbms::types::Date {
24144 year: l270,
24145 month: l271 as u8,
24146 day: l272 as u8,
24147 },
24148 time: super::super::super::golem::rdbms::types::Time {
24149 hour: l273 as u8,
24150 minute: l274 as u8,
24151 second: l275 as u8,
24152 nanosecond: l276 as u32,
24153 },
24154 }
24155 };
24156 Tsbound::Included(e284)
24157 }
24158 1 => {
24159 let e284 = {
24160 let l277 = *base.add(12).cast::<i32>();
24161 let l278 = i32::from(*base.add(16).cast::<u8>());
24162 let l279 = i32::from(*base.add(17).cast::<u8>());
24163 let l280 = i32::from(*base.add(20).cast::<u8>());
24164 let l281 = i32::from(*base.add(21).cast::<u8>());
24165 let l282 = i32::from(*base.add(22).cast::<u8>());
24166 let l283 = *base.add(24).cast::<i32>();
24167 super::super::super::golem::rdbms::types::Timestamp {
24168 date: super::super::super::golem::rdbms::types::Date {
24169 year: l277,
24170 month: l278 as u8,
24171 day: l279 as u8,
24172 },
24173 time: super::super::super::golem::rdbms::types::Time {
24174 hour: l280 as u8,
24175 minute: l281 as u8,
24176 second: l282 as u8,
24177 nanosecond: l283 as u32,
24178 },
24179 }
24180 };
24181 Tsbound::Excluded(e284)
24182 }
24183 n => {
24184 debug_assert_eq!(n, 2, "invalid enum discriminant");
24185 Tsbound::Unbounded
24186 }
24187 };
24188 let l285 = i32::from(*base.add(28).cast::<u8>());
24189 let v300 = match l285 {
24190 0 => {
24191 let e300 = {
24192 let l286 = *base.add(32).cast::<i32>();
24193 let l287 = i32::from(*base.add(36).cast::<u8>());
24194 let l288 = i32::from(*base.add(37).cast::<u8>());
24195 let l289 = i32::from(*base.add(40).cast::<u8>());
24196 let l290 = i32::from(*base.add(41).cast::<u8>());
24197 let l291 = i32::from(*base.add(42).cast::<u8>());
24198 let l292 = *base.add(44).cast::<i32>();
24199 super::super::super::golem::rdbms::types::Timestamp {
24200 date: super::super::super::golem::rdbms::types::Date {
24201 year: l286,
24202 month: l287 as u8,
24203 day: l288 as u8,
24204 },
24205 time: super::super::super::golem::rdbms::types::Time {
24206 hour: l289 as u8,
24207 minute: l290 as u8,
24208 second: l291 as u8,
24209 nanosecond: l292 as u32,
24210 },
24211 }
24212 };
24213 Tsbound::Included(e300)
24214 }
24215 1 => {
24216 let e300 = {
24217 let l293 = *base.add(32).cast::<i32>();
24218 let l294 = i32::from(*base.add(36).cast::<u8>());
24219 let l295 = i32::from(*base.add(37).cast::<u8>());
24220 let l296 = i32::from(*base.add(40).cast::<u8>());
24221 let l297 = i32::from(*base.add(41).cast::<u8>());
24222 let l298 = i32::from(*base.add(42).cast::<u8>());
24223 let l299 = *base.add(44).cast::<i32>();
24224 super::super::super::golem::rdbms::types::Timestamp {
24225 date: super::super::super::golem::rdbms::types::Date {
24226 year: l293,
24227 month: l294 as u8,
24228 day: l295 as u8,
24229 },
24230 time: super::super::super::golem::rdbms::types::Time {
24231 hour: l296 as u8,
24232 minute: l297 as u8,
24233 second: l298 as u8,
24234 nanosecond: l299 as u32,
24235 },
24236 }
24237 };
24238 Tsbound::Excluded(e300)
24239 }
24240 n => {
24241 debug_assert_eq!(n, 2, "invalid enum discriminant");
24242 Tsbound::Unbounded
24243 }
24244 };
24245 Tsrange { start: v284, end: v300 }
24246 };
24247 DbValue::Tsrange(e387)
24248 }
24249 32 => {
24250 let e387 = {
24251 let l301 = i32::from(*base.add(8).cast::<u8>());
24252 let v318 = match l301 {
24253 0 => {
24254 let e318 = {
24255 let l302 = *base.add(12).cast::<i32>();
24256 let l303 = i32::from(*base.add(16).cast::<u8>());
24257 let l304 = i32::from(*base.add(17).cast::<u8>());
24258 let l305 = i32::from(*base.add(20).cast::<u8>());
24259 let l306 = i32::from(*base.add(21).cast::<u8>());
24260 let l307 = i32::from(*base.add(22).cast::<u8>());
24261 let l308 = *base.add(24).cast::<i32>();
24262 let l309 = *base.add(28).cast::<i32>();
24263 super::super::super::golem::rdbms::types::Timestamptz {
24264 timestamp: super::super::super::golem::rdbms::types::Timestamp {
24265 date: super::super::super::golem::rdbms::types::Date {
24266 year: l302,
24267 month: l303 as u8,
24268 day: l304 as u8,
24269 },
24270 time: super::super::super::golem::rdbms::types::Time {
24271 hour: l305 as u8,
24272 minute: l306 as u8,
24273 second: l307 as u8,
24274 nanosecond: l308 as u32,
24275 },
24276 },
24277 offset: l309,
24278 }
24279 };
24280 Tstzbound::Included(e318)
24281 }
24282 1 => {
24283 let e318 = {
24284 let l310 = *base.add(12).cast::<i32>();
24285 let l311 = i32::from(*base.add(16).cast::<u8>());
24286 let l312 = i32::from(*base.add(17).cast::<u8>());
24287 let l313 = i32::from(*base.add(20).cast::<u8>());
24288 let l314 = i32::from(*base.add(21).cast::<u8>());
24289 let l315 = i32::from(*base.add(22).cast::<u8>());
24290 let l316 = *base.add(24).cast::<i32>();
24291 let l317 = *base.add(28).cast::<i32>();
24292 super::super::super::golem::rdbms::types::Timestamptz {
24293 timestamp: super::super::super::golem::rdbms::types::Timestamp {
24294 date: super::super::super::golem::rdbms::types::Date {
24295 year: l310,
24296 month: l311 as u8,
24297 day: l312 as u8,
24298 },
24299 time: super::super::super::golem::rdbms::types::Time {
24300 hour: l313 as u8,
24301 minute: l314 as u8,
24302 second: l315 as u8,
24303 nanosecond: l316 as u32,
24304 },
24305 },
24306 offset: l317,
24307 }
24308 };
24309 Tstzbound::Excluded(e318)
24310 }
24311 n => {
24312 debug_assert_eq!(n, 2, "invalid enum discriminant");
24313 Tstzbound::Unbounded
24314 }
24315 };
24316 let l319 = i32::from(*base.add(32).cast::<u8>());
24317 let v336 = match l319 {
24318 0 => {
24319 let e336 = {
24320 let l320 = *base.add(36).cast::<i32>();
24321 let l321 = i32::from(*base.add(40).cast::<u8>());
24322 let l322 = i32::from(*base.add(41).cast::<u8>());
24323 let l323 = i32::from(*base.add(44).cast::<u8>());
24324 let l324 = i32::from(*base.add(45).cast::<u8>());
24325 let l325 = i32::from(*base.add(46).cast::<u8>());
24326 let l326 = *base.add(48).cast::<i32>();
24327 let l327 = *base.add(52).cast::<i32>();
24328 super::super::super::golem::rdbms::types::Timestamptz {
24329 timestamp: super::super::super::golem::rdbms::types::Timestamp {
24330 date: super::super::super::golem::rdbms::types::Date {
24331 year: l320,
24332 month: l321 as u8,
24333 day: l322 as u8,
24334 },
24335 time: super::super::super::golem::rdbms::types::Time {
24336 hour: l323 as u8,
24337 minute: l324 as u8,
24338 second: l325 as u8,
24339 nanosecond: l326 as u32,
24340 },
24341 },
24342 offset: l327,
24343 }
24344 };
24345 Tstzbound::Included(e336)
24346 }
24347 1 => {
24348 let e336 = {
24349 let l328 = *base.add(36).cast::<i32>();
24350 let l329 = i32::from(*base.add(40).cast::<u8>());
24351 let l330 = i32::from(*base.add(41).cast::<u8>());
24352 let l331 = i32::from(*base.add(44).cast::<u8>());
24353 let l332 = i32::from(*base.add(45).cast::<u8>());
24354 let l333 = i32::from(*base.add(46).cast::<u8>());
24355 let l334 = *base.add(48).cast::<i32>();
24356 let l335 = *base.add(52).cast::<i32>();
24357 super::super::super::golem::rdbms::types::Timestamptz {
24358 timestamp: super::super::super::golem::rdbms::types::Timestamp {
24359 date: super::super::super::golem::rdbms::types::Date {
24360 year: l328,
24361 month: l329 as u8,
24362 day: l330 as u8,
24363 },
24364 time: super::super::super::golem::rdbms::types::Time {
24365 hour: l331 as u8,
24366 minute: l332 as u8,
24367 second: l333 as u8,
24368 nanosecond: l334 as u32,
24369 },
24370 },
24371 offset: l335,
24372 }
24373 };
24374 Tstzbound::Excluded(e336)
24375 }
24376 n => {
24377 debug_assert_eq!(n, 2, "invalid enum discriminant");
24378 Tstzbound::Unbounded
24379 }
24380 };
24381 Tstzrange {
24382 start: v318,
24383 end: v336,
24384 }
24385 };
24386 DbValue::Tstzrange(e387)
24387 }
24388 33 => {
24389 let e387 = {
24390 let l337 = i32::from(*base.add(8).cast::<u8>());
24391 let v344 = match l337 {
24392 0 => {
24393 let e344 = {
24394 let l338 = *base.add(12).cast::<i32>();
24395 let l339 = i32::from(*base.add(16).cast::<u8>());
24396 let l340 = i32::from(*base.add(17).cast::<u8>());
24397 super::super::super::golem::rdbms::types::Date {
24398 year: l338,
24399 month: l339 as u8,
24400 day: l340 as u8,
24401 }
24402 };
24403 Datebound::Included(e344)
24404 }
24405 1 => {
24406 let e344 = {
24407 let l341 = *base.add(12).cast::<i32>();
24408 let l342 = i32::from(*base.add(16).cast::<u8>());
24409 let l343 = i32::from(*base.add(17).cast::<u8>());
24410 super::super::super::golem::rdbms::types::Date {
24411 year: l341,
24412 month: l342 as u8,
24413 day: l343 as u8,
24414 }
24415 };
24416 Datebound::Excluded(e344)
24417 }
24418 n => {
24419 debug_assert_eq!(n, 2, "invalid enum discriminant");
24420 Datebound::Unbounded
24421 }
24422 };
24423 let l345 = i32::from(*base.add(20).cast::<u8>());
24424 let v352 = match l345 {
24425 0 => {
24426 let e352 = {
24427 let l346 = *base.add(24).cast::<i32>();
24428 let l347 = i32::from(*base.add(28).cast::<u8>());
24429 let l348 = i32::from(*base.add(29).cast::<u8>());
24430 super::super::super::golem::rdbms::types::Date {
24431 year: l346,
24432 month: l347 as u8,
24433 day: l348 as u8,
24434 }
24435 };
24436 Datebound::Included(e352)
24437 }
24438 1 => {
24439 let e352 = {
24440 let l349 = *base.add(24).cast::<i32>();
24441 let l350 = i32::from(*base.add(28).cast::<u8>());
24442 let l351 = i32::from(*base.add(29).cast::<u8>());
24443 super::super::super::golem::rdbms::types::Date {
24444 year: l349,
24445 month: l350 as u8,
24446 day: l351 as u8,
24447 }
24448 };
24449 Datebound::Excluded(e352)
24450 }
24451 n => {
24452 debug_assert_eq!(n, 2, "invalid enum discriminant");
24453 Datebound::Unbounded
24454 }
24455 };
24456 Daterange {
24457 start: v344,
24458 end: v352,
24459 }
24460 };
24461 DbValue::Daterange(e387)
24462 }
24463 34 => {
24464 let e387 = {
24465 let l353 = *base.add(8).cast::<i64>();
24466 l353
24467 };
24468 DbValue::Money(e387)
24469 }
24470 35 => {
24471 let e387 = {
24472 let l354 = *base.add(8).cast::<i32>();
24473 l354 as u32
24474 };
24475 DbValue::Oid(e387)
24476 }
24477 36 => {
24478 let e387 = {
24479 let l355 = *base.add(8).cast::<*mut u8>();
24480 let l356 = *base.add(12).cast::<usize>();
24481 let len357 = l356;
24482 let bytes357 = _rt::Vec::from_raw_parts(
24483 l355.cast(),
24484 len357,
24485 len357,
24486 );
24487 let l358 = *base.add(16).cast::<*mut u8>();
24488 let l359 = *base.add(20).cast::<usize>();
24489 let len360 = l359;
24490 let bytes360 = _rt::Vec::from_raw_parts(
24491 l358.cast(),
24492 len360,
24493 len360,
24494 );
24495 Enumeration {
24496 name: _rt::string_lift(bytes357),
24497 value: _rt::string_lift(bytes360),
24498 }
24499 };
24500 DbValue::Enumeration(e387)
24501 }
24502 37 => {
24503 let e387 = {
24504 let l361 = *base.add(8).cast::<*mut u8>();
24505 let l362 = *base.add(12).cast::<usize>();
24506 let len363 = l362;
24507 let bytes363 = _rt::Vec::from_raw_parts(
24508 l361.cast(),
24509 len363,
24510 len363,
24511 );
24512 let l364 = *base.add(16).cast::<*mut u8>();
24513 let l365 = *base.add(20).cast::<usize>();
24514 let base367 = l364;
24515 let len367 = l365;
24516 let mut result367 = _rt::Vec::with_capacity(len367);
24517 for i in 0..len367 {
24518 let base = base367.add(i * 4);
24519 let e367 = {
24520 let l366 = *base.add(0).cast::<i32>();
24521 LazyDbValue::from_handle(l366 as u32)
24522 };
24523 result367.push(e367);
24524 }
24525 _rt::cabi_dealloc(base367, len367 * 4, 4);
24526 Composite {
24527 name: _rt::string_lift(bytes363),
24528 values: result367,
24529 }
24530 };
24531 DbValue::Composite(e387)
24532 }
24533 38 => {
24534 let e387 = {
24535 let l368 = *base.add(8).cast::<*mut u8>();
24536 let l369 = *base.add(12).cast::<usize>();
24537 let len370 = l369;
24538 let bytes370 = _rt::Vec::from_raw_parts(
24539 l368.cast(),
24540 len370,
24541 len370,
24542 );
24543 let l371 = *base.add(16).cast::<i32>();
24544 Domain {
24545 name: _rt::string_lift(bytes370),
24546 value: LazyDbValue::from_handle(l371 as u32),
24547 }
24548 };
24549 DbValue::Domain(e387)
24550 }
24551 39 => {
24552 let e387 = {
24553 let l372 = *base.add(8).cast::<*mut u8>();
24554 let l373 = *base.add(12).cast::<usize>();
24555 let base375 = l372;
24556 let len375 = l373;
24557 let mut result375 = _rt::Vec::with_capacity(len375);
24558 for i in 0..len375 {
24559 let base = base375.add(i * 4);
24560 let e375 = {
24561 let l374 = *base.add(0).cast::<i32>();
24562 LazyDbValue::from_handle(l374 as u32)
24563 };
24564 result375.push(e375);
24565 }
24566 _rt::cabi_dealloc(base375, len375 * 4, 4);
24567 result375
24568 };
24569 DbValue::Array(e387)
24570 }
24571 40 => {
24572 let e387 = {
24573 let l376 = *base.add(8).cast::<*mut u8>();
24574 let l377 = *base.add(12).cast::<usize>();
24575 let len378 = l377;
24576 let bytes378 = _rt::Vec::from_raw_parts(
24577 l376.cast(),
24578 len378,
24579 len378,
24580 );
24581 let l379 = i32::from(*base.add(16).cast::<u8>());
24582 let v382 = match l379 {
24583 0 => {
24584 let e382 = {
24585 let l380 = *base.add(20).cast::<i32>();
24586 LazyDbValue::from_handle(l380 as u32)
24587 };
24588 ValueBound::Included(e382)
24589 }
24590 1 => {
24591 let e382 = {
24592 let l381 = *base.add(20).cast::<i32>();
24593 LazyDbValue::from_handle(l381 as u32)
24594 };
24595 ValueBound::Excluded(e382)
24596 }
24597 n => {
24598 debug_assert_eq!(n, 2, "invalid enum discriminant");
24599 ValueBound::Unbounded
24600 }
24601 };
24602 let l383 = i32::from(*base.add(24).cast::<u8>());
24603 let v386 = match l383 {
24604 0 => {
24605 let e386 = {
24606 let l384 = *base.add(28).cast::<i32>();
24607 LazyDbValue::from_handle(l384 as u32)
24608 };
24609 ValueBound::Included(e386)
24610 }
24611 1 => {
24612 let e386 = {
24613 let l385 = *base.add(28).cast::<i32>();
24614 LazyDbValue::from_handle(l385 as u32)
24615 };
24616 ValueBound::Excluded(e386)
24617 }
24618 n => {
24619 debug_assert_eq!(n, 2, "invalid enum discriminant");
24620 ValueBound::Unbounded
24621 }
24622 };
24623 Range {
24624 name: _rt::string_lift(bytes378),
24625 value: ValuesRange {
24626 start: v382,
24627 end: v386,
24628 },
24629 }
24630 };
24631 DbValue::Range(e387)
24632 }
24633 n => {
24634 debug_assert_eq!(n, 41, "invalid enum discriminant");
24635 DbValue::Null
24636 }
24637 };
24638 v387
24639 };
24640 result388.push(e388);
24641 }
24642 _rt::cabi_dealloc(base388, len388 * 56, 8);
24643 DbRow { values: result388 }
24644 };
24645 result389.push(e389);
24646 }
24647 _rt::cabi_dealloc(base389, len389 * 8, 4);
24648 DbResult {
24649 columns: result123,
24650 rows: result389,
24651 }
24652 };
24653 Ok(e)
24654 }
24655 1 => {
24656 let e = {
24657 let l390 = i32::from(*ptr88.add(4).cast::<u8>());
24658 let v406 = match l390 {
24659 0 => {
24660 let e406 = {
24661 let l391 = *ptr88.add(8).cast::<*mut u8>();
24662 let l392 = *ptr88.add(12).cast::<usize>();
24663 let len393 = l392;
24664 let bytes393 = _rt::Vec::from_raw_parts(
24665 l391.cast(),
24666 len393,
24667 len393,
24668 );
24669 _rt::string_lift(bytes393)
24670 };
24671 Error::ConnectionFailure(e406)
24672 }
24673 1 => {
24674 let e406 = {
24675 let l394 = *ptr88.add(8).cast::<*mut u8>();
24676 let l395 = *ptr88.add(12).cast::<usize>();
24677 let len396 = l395;
24678 let bytes396 = _rt::Vec::from_raw_parts(
24679 l394.cast(),
24680 len396,
24681 len396,
24682 );
24683 _rt::string_lift(bytes396)
24684 };
24685 Error::QueryParameterFailure(e406)
24686 }
24687 2 => {
24688 let e406 = {
24689 let l397 = *ptr88.add(8).cast::<*mut u8>();
24690 let l398 = *ptr88.add(12).cast::<usize>();
24691 let len399 = l398;
24692 let bytes399 = _rt::Vec::from_raw_parts(
24693 l397.cast(),
24694 len399,
24695 len399,
24696 );
24697 _rt::string_lift(bytes399)
24698 };
24699 Error::QueryExecutionFailure(e406)
24700 }
24701 3 => {
24702 let e406 = {
24703 let l400 = *ptr88.add(8).cast::<*mut u8>();
24704 let l401 = *ptr88.add(12).cast::<usize>();
24705 let len402 = l401;
24706 let bytes402 = _rt::Vec::from_raw_parts(
24707 l400.cast(),
24708 len402,
24709 len402,
24710 );
24711 _rt::string_lift(bytes402)
24712 };
24713 Error::QueryResponseFailure(e406)
24714 }
24715 n => {
24716 debug_assert_eq!(n, 4, "invalid enum discriminant");
24717 let e406 = {
24718 let l403 = *ptr88.add(8).cast::<*mut u8>();
24719 let l404 = *ptr88.add(12).cast::<usize>();
24720 let len405 = l404;
24721 let bytes405 = _rt::Vec::from_raw_parts(
24722 l403.cast(),
24723 len405,
24724 len405,
24725 );
24726 _rt::string_lift(bytes405)
24727 };
24728 Error::Other(e406)
24729 }
24730 };
24731 v406
24732 };
24733 Err(e)
24734 }
24735 _ => _rt::invalid_enum_discriminant(),
24736 }
24737 }
24738 }
24739 }
24740 impl DbConnection {
24741 #[allow(unused_unsafe, clippy::all)]
24742 pub fn query_stream(
24743 &self,
24744 statement: &str,
24745 params: _rt::Vec<DbValue>,
24746 ) -> Result<DbResultStream, Error> {
24747 unsafe {
24748 let mut cleanup_list = _rt::Vec::new();
24749 #[repr(align(4))]
24750 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
24751 let mut ret_area = RetArea(
24752 [::core::mem::MaybeUninit::uninit(); 16],
24753 );
24754 let vec0 = statement;
24755 let ptr0 = vec0.as_ptr().cast::<u8>();
24756 let len0 = vec0.len();
24757 let vec87 = ¶ms;
24758 let len87 = vec87.len();
24759 let layout87 = _rt::alloc::Layout::from_size_align_unchecked(
24760 vec87.len() * 56,
24761 8,
24762 );
24763 let result87 = if layout87.size() != 0 {
24764 let ptr = _rt::alloc::alloc(layout87).cast::<u8>();
24765 if ptr.is_null() {
24766 _rt::alloc::handle_alloc_error(layout87);
24767 }
24768 ptr
24769 } else {
24770 ::core::ptr::null_mut()
24771 };
24772 for (i, e) in vec87.into_iter().enumerate() {
24773 let base = result87.add(i * 56);
24774 {
24775 match e {
24776 DbValue::Character(e) => {
24777 *base.add(0).cast::<u8>() = (0i32) as u8;
24778 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
24779 }
24780 DbValue::Int2(e) => {
24781 *base.add(0).cast::<u8>() = (1i32) as u8;
24782 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
24783 }
24784 DbValue::Int4(e) => {
24785 *base.add(0).cast::<u8>() = (2i32) as u8;
24786 *base.add(8).cast::<i32>() = _rt::as_i32(e);
24787 }
24788 DbValue::Int8(e) => {
24789 *base.add(0).cast::<u8>() = (3i32) as u8;
24790 *base.add(8).cast::<i64>() = _rt::as_i64(e);
24791 }
24792 DbValue::Float4(e) => {
24793 *base.add(0).cast::<u8>() = (4i32) as u8;
24794 *base.add(8).cast::<f32>() = _rt::as_f32(e);
24795 }
24796 DbValue::Float8(e) => {
24797 *base.add(0).cast::<u8>() = (5i32) as u8;
24798 *base.add(8).cast::<f64>() = _rt::as_f64(e);
24799 }
24800 DbValue::Numeric(e) => {
24801 *base.add(0).cast::<u8>() = (6i32) as u8;
24802 let vec1 = e;
24803 let ptr1 = vec1.as_ptr().cast::<u8>();
24804 let len1 = vec1.len();
24805 *base.add(12).cast::<usize>() = len1;
24806 *base.add(8).cast::<*mut u8>() = ptr1.cast_mut();
24807 }
24808 DbValue::Boolean(e) => {
24809 *base.add(0).cast::<u8>() = (7i32) as u8;
24810 *base.add(8).cast::<u8>() = (match e {
24811 true => 1,
24812 false => 0,
24813 }) as u8;
24814 }
24815 DbValue::Text(e) => {
24816 *base.add(0).cast::<u8>() = (8i32) as u8;
24817 let vec2 = e;
24818 let ptr2 = vec2.as_ptr().cast::<u8>();
24819 let len2 = vec2.len();
24820 *base.add(12).cast::<usize>() = len2;
24821 *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
24822 }
24823 DbValue::Varchar(e) => {
24824 *base.add(0).cast::<u8>() = (9i32) as u8;
24825 let vec3 = e;
24826 let ptr3 = vec3.as_ptr().cast::<u8>();
24827 let len3 = vec3.len();
24828 *base.add(12).cast::<usize>() = len3;
24829 *base.add(8).cast::<*mut u8>() = ptr3.cast_mut();
24830 }
24831 DbValue::Bpchar(e) => {
24832 *base.add(0).cast::<u8>() = (10i32) as u8;
24833 let vec4 = e;
24834 let ptr4 = vec4.as_ptr().cast::<u8>();
24835 let len4 = vec4.len();
24836 *base.add(12).cast::<usize>() = len4;
24837 *base.add(8).cast::<*mut u8>() = ptr4.cast_mut();
24838 }
24839 DbValue::Timestamp(e) => {
24840 *base.add(0).cast::<u8>() = (11i32) as u8;
24841 let super::super::super::golem::rdbms::types::Timestamp {
24842 date: date5,
24843 time: time5,
24844 } = e;
24845 let super::super::super::golem::rdbms::types::Date {
24846 year: year6,
24847 month: month6,
24848 day: day6,
24849 } = date5;
24850 *base.add(8).cast::<i32>() = _rt::as_i32(year6);
24851 *base.add(12).cast::<u8>() = (_rt::as_i32(month6)) as u8;
24852 *base.add(13).cast::<u8>() = (_rt::as_i32(day6)) as u8;
24853 let super::super::super::golem::rdbms::types::Time {
24854 hour: hour7,
24855 minute: minute7,
24856 second: second7,
24857 nanosecond: nanosecond7,
24858 } = time5;
24859 *base.add(16).cast::<u8>() = (_rt::as_i32(hour7)) as u8;
24860 *base.add(17).cast::<u8>() = (_rt::as_i32(minute7)) as u8;
24861 *base.add(18).cast::<u8>() = (_rt::as_i32(second7)) as u8;
24862 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond7);
24863 }
24864 DbValue::Timestamptz(e) => {
24865 *base.add(0).cast::<u8>() = (12i32) as u8;
24866 let super::super::super::golem::rdbms::types::Timestamptz {
24867 timestamp: timestamp8,
24868 offset: offset8,
24869 } = e;
24870 let super::super::super::golem::rdbms::types::Timestamp {
24871 date: date9,
24872 time: time9,
24873 } = timestamp8;
24874 let super::super::super::golem::rdbms::types::Date {
24875 year: year10,
24876 month: month10,
24877 day: day10,
24878 } = date9;
24879 *base.add(8).cast::<i32>() = _rt::as_i32(year10);
24880 *base.add(12).cast::<u8>() = (_rt::as_i32(month10)) as u8;
24881 *base.add(13).cast::<u8>() = (_rt::as_i32(day10)) as u8;
24882 let super::super::super::golem::rdbms::types::Time {
24883 hour: hour11,
24884 minute: minute11,
24885 second: second11,
24886 nanosecond: nanosecond11,
24887 } = time9;
24888 *base.add(16).cast::<u8>() = (_rt::as_i32(hour11)) as u8;
24889 *base.add(17).cast::<u8>() = (_rt::as_i32(minute11)) as u8;
24890 *base.add(18).cast::<u8>() = (_rt::as_i32(second11)) as u8;
24891 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond11);
24892 *base.add(24).cast::<i32>() = _rt::as_i32(offset8);
24893 }
24894 DbValue::Date(e) => {
24895 *base.add(0).cast::<u8>() = (13i32) as u8;
24896 let super::super::super::golem::rdbms::types::Date {
24897 year: year12,
24898 month: month12,
24899 day: day12,
24900 } = e;
24901 *base.add(8).cast::<i32>() = _rt::as_i32(year12);
24902 *base.add(12).cast::<u8>() = (_rt::as_i32(month12)) as u8;
24903 *base.add(13).cast::<u8>() = (_rt::as_i32(day12)) as u8;
24904 }
24905 DbValue::Time(e) => {
24906 *base.add(0).cast::<u8>() = (14i32) as u8;
24907 let super::super::super::golem::rdbms::types::Time {
24908 hour: hour13,
24909 minute: minute13,
24910 second: second13,
24911 nanosecond: nanosecond13,
24912 } = e;
24913 *base.add(8).cast::<u8>() = (_rt::as_i32(hour13)) as u8;
24914 *base.add(9).cast::<u8>() = (_rt::as_i32(minute13)) as u8;
24915 *base.add(10).cast::<u8>() = (_rt::as_i32(second13)) as u8;
24916 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond13);
24917 }
24918 DbValue::Timetz(e) => {
24919 *base.add(0).cast::<u8>() = (15i32) as u8;
24920 let super::super::super::golem::rdbms::types::Timetz {
24921 time: time14,
24922 offset: offset14,
24923 } = e;
24924 let super::super::super::golem::rdbms::types::Time {
24925 hour: hour15,
24926 minute: minute15,
24927 second: second15,
24928 nanosecond: nanosecond15,
24929 } = time14;
24930 *base.add(8).cast::<u8>() = (_rt::as_i32(hour15)) as u8;
24931 *base.add(9).cast::<u8>() = (_rt::as_i32(minute15)) as u8;
24932 *base.add(10).cast::<u8>() = (_rt::as_i32(second15)) as u8;
24933 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond15);
24934 *base.add(16).cast::<i32>() = _rt::as_i32(offset14);
24935 }
24936 DbValue::Interval(e) => {
24937 *base.add(0).cast::<u8>() = (16i32) as u8;
24938 let Interval {
24939 months: months16,
24940 days: days16,
24941 microseconds: microseconds16,
24942 } = e;
24943 *base.add(8).cast::<i32>() = _rt::as_i32(months16);
24944 *base.add(12).cast::<i32>() = _rt::as_i32(days16);
24945 *base.add(16).cast::<i64>() = _rt::as_i64(microseconds16);
24946 }
24947 DbValue::Bytea(e) => {
24948 *base.add(0).cast::<u8>() = (17i32) as u8;
24949 let vec17 = e;
24950 let ptr17 = vec17.as_ptr().cast::<u8>();
24951 let len17 = vec17.len();
24952 *base.add(12).cast::<usize>() = len17;
24953 *base.add(8).cast::<*mut u8>() = ptr17.cast_mut();
24954 }
24955 DbValue::Json(e) => {
24956 *base.add(0).cast::<u8>() = (18i32) as u8;
24957 let vec18 = e;
24958 let ptr18 = vec18.as_ptr().cast::<u8>();
24959 let len18 = vec18.len();
24960 *base.add(12).cast::<usize>() = len18;
24961 *base.add(8).cast::<*mut u8>() = ptr18.cast_mut();
24962 }
24963 DbValue::Jsonb(e) => {
24964 *base.add(0).cast::<u8>() = (19i32) as u8;
24965 let vec19 = e;
24966 let ptr19 = vec19.as_ptr().cast::<u8>();
24967 let len19 = vec19.len();
24968 *base.add(12).cast::<usize>() = len19;
24969 *base.add(8).cast::<*mut u8>() = ptr19.cast_mut();
24970 }
24971 DbValue::Jsonpath(e) => {
24972 *base.add(0).cast::<u8>() = (20i32) as u8;
24973 let vec20 = e;
24974 let ptr20 = vec20.as_ptr().cast::<u8>();
24975 let len20 = vec20.len();
24976 *base.add(12).cast::<usize>() = len20;
24977 *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
24978 }
24979 DbValue::Xml(e) => {
24980 *base.add(0).cast::<u8>() = (21i32) as u8;
24981 let vec21 = e;
24982 let ptr21 = vec21.as_ptr().cast::<u8>();
24983 let len21 = vec21.len();
24984 *base.add(12).cast::<usize>() = len21;
24985 *base.add(8).cast::<*mut u8>() = ptr21.cast_mut();
24986 }
24987 DbValue::Uuid(e) => {
24988 *base.add(0).cast::<u8>() = (22i32) as u8;
24989 let super::super::super::golem::rdbms::types::Uuid {
24990 high_bits: high_bits22,
24991 low_bits: low_bits22,
24992 } = e;
24993 *base.add(8).cast::<i64>() = _rt::as_i64(high_bits22);
24994 *base.add(16).cast::<i64>() = _rt::as_i64(low_bits22);
24995 }
24996 DbValue::Inet(e) => {
24997 *base.add(0).cast::<u8>() = (23i32) as u8;
24998 use super::super::super::golem::rdbms::types::IpAddress as V25;
24999 match e {
25000 V25::Ipv4(e) => {
25001 *base.add(8).cast::<u8>() = (0i32) as u8;
25002 let (t23_0, t23_1, t23_2, t23_3) = e;
25003 *base.add(10).cast::<u8>() = (_rt::as_i32(t23_0)) as u8;
25004 *base.add(11).cast::<u8>() = (_rt::as_i32(t23_1)) as u8;
25005 *base.add(12).cast::<u8>() = (_rt::as_i32(t23_2)) as u8;
25006 *base.add(13).cast::<u8>() = (_rt::as_i32(t23_3)) as u8;
25007 }
25008 V25::Ipv6(e) => {
25009 *base.add(8).cast::<u8>() = (1i32) as u8;
25010 let (
25011 t24_0,
25012 t24_1,
25013 t24_2,
25014 t24_3,
25015 t24_4,
25016 t24_5,
25017 t24_6,
25018 t24_7,
25019 ) = e;
25020 *base.add(10).cast::<u16>() = (_rt::as_i32(t24_0)) as u16;
25021 *base.add(12).cast::<u16>() = (_rt::as_i32(t24_1)) as u16;
25022 *base.add(14).cast::<u16>() = (_rt::as_i32(t24_2)) as u16;
25023 *base.add(16).cast::<u16>() = (_rt::as_i32(t24_3)) as u16;
25024 *base.add(18).cast::<u16>() = (_rt::as_i32(t24_4)) as u16;
25025 *base.add(20).cast::<u16>() = (_rt::as_i32(t24_5)) as u16;
25026 *base.add(22).cast::<u16>() = (_rt::as_i32(t24_6)) as u16;
25027 *base.add(24).cast::<u16>() = (_rt::as_i32(t24_7)) as u16;
25028 }
25029 }
25030 }
25031 DbValue::Cidr(e) => {
25032 *base.add(0).cast::<u8>() = (24i32) as u8;
25033 use super::super::super::golem::rdbms::types::IpAddress as V28;
25034 match e {
25035 V28::Ipv4(e) => {
25036 *base.add(8).cast::<u8>() = (0i32) as u8;
25037 let (t26_0, t26_1, t26_2, t26_3) = e;
25038 *base.add(10).cast::<u8>() = (_rt::as_i32(t26_0)) as u8;
25039 *base.add(11).cast::<u8>() = (_rt::as_i32(t26_1)) as u8;
25040 *base.add(12).cast::<u8>() = (_rt::as_i32(t26_2)) as u8;
25041 *base.add(13).cast::<u8>() = (_rt::as_i32(t26_3)) as u8;
25042 }
25043 V28::Ipv6(e) => {
25044 *base.add(8).cast::<u8>() = (1i32) as u8;
25045 let (
25046 t27_0,
25047 t27_1,
25048 t27_2,
25049 t27_3,
25050 t27_4,
25051 t27_5,
25052 t27_6,
25053 t27_7,
25054 ) = e;
25055 *base.add(10).cast::<u16>() = (_rt::as_i32(t27_0)) as u16;
25056 *base.add(12).cast::<u16>() = (_rt::as_i32(t27_1)) as u16;
25057 *base.add(14).cast::<u16>() = (_rt::as_i32(t27_2)) as u16;
25058 *base.add(16).cast::<u16>() = (_rt::as_i32(t27_3)) as u16;
25059 *base.add(18).cast::<u16>() = (_rt::as_i32(t27_4)) as u16;
25060 *base.add(20).cast::<u16>() = (_rt::as_i32(t27_5)) as u16;
25061 *base.add(22).cast::<u16>() = (_rt::as_i32(t27_6)) as u16;
25062 *base.add(24).cast::<u16>() = (_rt::as_i32(t27_7)) as u16;
25063 }
25064 }
25065 }
25066 DbValue::Macaddr(e) => {
25067 *base.add(0).cast::<u8>() = (25i32) as u8;
25068 let super::super::super::golem::rdbms::types::MacAddress {
25069 octets: octets29,
25070 } = e;
25071 let (t30_0, t30_1, t30_2, t30_3, t30_4, t30_5) = octets29;
25072 *base.add(8).cast::<u8>() = (_rt::as_i32(t30_0)) as u8;
25073 *base.add(9).cast::<u8>() = (_rt::as_i32(t30_1)) as u8;
25074 *base.add(10).cast::<u8>() = (_rt::as_i32(t30_2)) as u8;
25075 *base.add(11).cast::<u8>() = (_rt::as_i32(t30_3)) as u8;
25076 *base.add(12).cast::<u8>() = (_rt::as_i32(t30_4)) as u8;
25077 *base.add(13).cast::<u8>() = (_rt::as_i32(t30_5)) as u8;
25078 }
25079 DbValue::Bit(e) => {
25080 *base.add(0).cast::<u8>() = (26i32) as u8;
25081 let vec31 = e;
25082 let len31 = vec31.len();
25083 let layout31 = _rt::alloc::Layout::from_size_align_unchecked(
25084 vec31.len() * 1,
25085 1,
25086 );
25087 let result31 = if layout31.size() != 0 {
25088 let ptr = _rt::alloc::alloc(layout31).cast::<u8>();
25089 if ptr.is_null() {
25090 _rt::alloc::handle_alloc_error(layout31);
25091 }
25092 ptr
25093 } else {
25094 ::core::ptr::null_mut()
25095 };
25096 for (i, e) in vec31.into_iter().enumerate() {
25097 let base = result31.add(i * 1);
25098 {
25099 *base.add(0).cast::<u8>() = (match e {
25100 true => 1,
25101 false => 0,
25102 }) as u8;
25103 }
25104 }
25105 *base.add(12).cast::<usize>() = len31;
25106 *base.add(8).cast::<*mut u8>() = result31;
25107 cleanup_list.extend_from_slice(&[(result31, layout31)]);
25108 }
25109 DbValue::Varbit(e) => {
25110 *base.add(0).cast::<u8>() = (27i32) as u8;
25111 let vec32 = e;
25112 let len32 = vec32.len();
25113 let layout32 = _rt::alloc::Layout::from_size_align_unchecked(
25114 vec32.len() * 1,
25115 1,
25116 );
25117 let result32 = if layout32.size() != 0 {
25118 let ptr = _rt::alloc::alloc(layout32).cast::<u8>();
25119 if ptr.is_null() {
25120 _rt::alloc::handle_alloc_error(layout32);
25121 }
25122 ptr
25123 } else {
25124 ::core::ptr::null_mut()
25125 };
25126 for (i, e) in vec32.into_iter().enumerate() {
25127 let base = result32.add(i * 1);
25128 {
25129 *base.add(0).cast::<u8>() = (match e {
25130 true => 1,
25131 false => 0,
25132 }) as u8;
25133 }
25134 }
25135 *base.add(12).cast::<usize>() = len32;
25136 *base.add(8).cast::<*mut u8>() = result32;
25137 cleanup_list.extend_from_slice(&[(result32, layout32)]);
25138 }
25139 DbValue::Int4range(e) => {
25140 *base.add(0).cast::<u8>() = (28i32) as u8;
25141 let Int4range { start: start33, end: end33 } = e;
25142 match start33 {
25143 Int4bound::Included(e) => {
25144 *base.add(8).cast::<u8>() = (0i32) as u8;
25145 *base.add(12).cast::<i32>() = _rt::as_i32(e);
25146 }
25147 Int4bound::Excluded(e) => {
25148 *base.add(8).cast::<u8>() = (1i32) as u8;
25149 *base.add(12).cast::<i32>() = _rt::as_i32(e);
25150 }
25151 Int4bound::Unbounded => {
25152 *base.add(8).cast::<u8>() = (2i32) as u8;
25153 }
25154 }
25155 match end33 {
25156 Int4bound::Included(e) => {
25157 *base.add(16).cast::<u8>() = (0i32) as u8;
25158 *base.add(20).cast::<i32>() = _rt::as_i32(e);
25159 }
25160 Int4bound::Excluded(e) => {
25161 *base.add(16).cast::<u8>() = (1i32) as u8;
25162 *base.add(20).cast::<i32>() = _rt::as_i32(e);
25163 }
25164 Int4bound::Unbounded => {
25165 *base.add(16).cast::<u8>() = (2i32) as u8;
25166 }
25167 }
25168 }
25169 DbValue::Int8range(e) => {
25170 *base.add(0).cast::<u8>() = (29i32) as u8;
25171 let Int8range { start: start34, end: end34 } = e;
25172 match start34 {
25173 Int8bound::Included(e) => {
25174 *base.add(8).cast::<u8>() = (0i32) as u8;
25175 *base.add(16).cast::<i64>() = _rt::as_i64(e);
25176 }
25177 Int8bound::Excluded(e) => {
25178 *base.add(8).cast::<u8>() = (1i32) as u8;
25179 *base.add(16).cast::<i64>() = _rt::as_i64(e);
25180 }
25181 Int8bound::Unbounded => {
25182 *base.add(8).cast::<u8>() = (2i32) as u8;
25183 }
25184 }
25185 match end34 {
25186 Int8bound::Included(e) => {
25187 *base.add(24).cast::<u8>() = (0i32) as u8;
25188 *base.add(32).cast::<i64>() = _rt::as_i64(e);
25189 }
25190 Int8bound::Excluded(e) => {
25191 *base.add(24).cast::<u8>() = (1i32) as u8;
25192 *base.add(32).cast::<i64>() = _rt::as_i64(e);
25193 }
25194 Int8bound::Unbounded => {
25195 *base.add(24).cast::<u8>() = (2i32) as u8;
25196 }
25197 }
25198 }
25199 DbValue::Numrange(e) => {
25200 *base.add(0).cast::<u8>() = (30i32) as u8;
25201 let Numrange { start: start35, end: end35 } = e;
25202 match start35 {
25203 Numbound::Included(e) => {
25204 *base.add(8).cast::<u8>() = (0i32) as u8;
25205 let vec36 = e;
25206 let ptr36 = vec36.as_ptr().cast::<u8>();
25207 let len36 = vec36.len();
25208 *base.add(16).cast::<usize>() = len36;
25209 *base.add(12).cast::<*mut u8>() = ptr36.cast_mut();
25210 }
25211 Numbound::Excluded(e) => {
25212 *base.add(8).cast::<u8>() = (1i32) as u8;
25213 let vec37 = e;
25214 let ptr37 = vec37.as_ptr().cast::<u8>();
25215 let len37 = vec37.len();
25216 *base.add(16).cast::<usize>() = len37;
25217 *base.add(12).cast::<*mut u8>() = ptr37.cast_mut();
25218 }
25219 Numbound::Unbounded => {
25220 *base.add(8).cast::<u8>() = (2i32) as u8;
25221 }
25222 }
25223 match end35 {
25224 Numbound::Included(e) => {
25225 *base.add(20).cast::<u8>() = (0i32) as u8;
25226 let vec38 = e;
25227 let ptr38 = vec38.as_ptr().cast::<u8>();
25228 let len38 = vec38.len();
25229 *base.add(28).cast::<usize>() = len38;
25230 *base.add(24).cast::<*mut u8>() = ptr38.cast_mut();
25231 }
25232 Numbound::Excluded(e) => {
25233 *base.add(20).cast::<u8>() = (1i32) as u8;
25234 let vec39 = e;
25235 let ptr39 = vec39.as_ptr().cast::<u8>();
25236 let len39 = vec39.len();
25237 *base.add(28).cast::<usize>() = len39;
25238 *base.add(24).cast::<*mut u8>() = ptr39.cast_mut();
25239 }
25240 Numbound::Unbounded => {
25241 *base.add(20).cast::<u8>() = (2i32) as u8;
25242 }
25243 }
25244 }
25245 DbValue::Tsrange(e) => {
25246 *base.add(0).cast::<u8>() = (31i32) as u8;
25247 let Tsrange { start: start40, end: end40 } = e;
25248 match start40 {
25249 Tsbound::Included(e) => {
25250 *base.add(8).cast::<u8>() = (0i32) as u8;
25251 let super::super::super::golem::rdbms::types::Timestamp {
25252 date: date41,
25253 time: time41,
25254 } = e;
25255 let super::super::super::golem::rdbms::types::Date {
25256 year: year42,
25257 month: month42,
25258 day: day42,
25259 } = date41;
25260 *base.add(12).cast::<i32>() = _rt::as_i32(year42);
25261 *base.add(16).cast::<u8>() = (_rt::as_i32(month42)) as u8;
25262 *base.add(17).cast::<u8>() = (_rt::as_i32(day42)) as u8;
25263 let super::super::super::golem::rdbms::types::Time {
25264 hour: hour43,
25265 minute: minute43,
25266 second: second43,
25267 nanosecond: nanosecond43,
25268 } = time41;
25269 *base.add(20).cast::<u8>() = (_rt::as_i32(hour43)) as u8;
25270 *base.add(21).cast::<u8>() = (_rt::as_i32(minute43)) as u8;
25271 *base.add(22).cast::<u8>() = (_rt::as_i32(second43)) as u8;
25272 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond43);
25273 }
25274 Tsbound::Excluded(e) => {
25275 *base.add(8).cast::<u8>() = (1i32) as u8;
25276 let super::super::super::golem::rdbms::types::Timestamp {
25277 date: date44,
25278 time: time44,
25279 } = e;
25280 let super::super::super::golem::rdbms::types::Date {
25281 year: year45,
25282 month: month45,
25283 day: day45,
25284 } = date44;
25285 *base.add(12).cast::<i32>() = _rt::as_i32(year45);
25286 *base.add(16).cast::<u8>() = (_rt::as_i32(month45)) as u8;
25287 *base.add(17).cast::<u8>() = (_rt::as_i32(day45)) as u8;
25288 let super::super::super::golem::rdbms::types::Time {
25289 hour: hour46,
25290 minute: minute46,
25291 second: second46,
25292 nanosecond: nanosecond46,
25293 } = time44;
25294 *base.add(20).cast::<u8>() = (_rt::as_i32(hour46)) as u8;
25295 *base.add(21).cast::<u8>() = (_rt::as_i32(minute46)) as u8;
25296 *base.add(22).cast::<u8>() = (_rt::as_i32(second46)) as u8;
25297 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond46);
25298 }
25299 Tsbound::Unbounded => {
25300 *base.add(8).cast::<u8>() = (2i32) as u8;
25301 }
25302 }
25303 match end40 {
25304 Tsbound::Included(e) => {
25305 *base.add(28).cast::<u8>() = (0i32) as u8;
25306 let super::super::super::golem::rdbms::types::Timestamp {
25307 date: date47,
25308 time: time47,
25309 } = e;
25310 let super::super::super::golem::rdbms::types::Date {
25311 year: year48,
25312 month: month48,
25313 day: day48,
25314 } = date47;
25315 *base.add(32).cast::<i32>() = _rt::as_i32(year48);
25316 *base.add(36).cast::<u8>() = (_rt::as_i32(month48)) as u8;
25317 *base.add(37).cast::<u8>() = (_rt::as_i32(day48)) as u8;
25318 let super::super::super::golem::rdbms::types::Time {
25319 hour: hour49,
25320 minute: minute49,
25321 second: second49,
25322 nanosecond: nanosecond49,
25323 } = time47;
25324 *base.add(40).cast::<u8>() = (_rt::as_i32(hour49)) as u8;
25325 *base.add(41).cast::<u8>() = (_rt::as_i32(minute49)) as u8;
25326 *base.add(42).cast::<u8>() = (_rt::as_i32(second49)) as u8;
25327 *base.add(44).cast::<i32>() = _rt::as_i32(nanosecond49);
25328 }
25329 Tsbound::Excluded(e) => {
25330 *base.add(28).cast::<u8>() = (1i32) as u8;
25331 let super::super::super::golem::rdbms::types::Timestamp {
25332 date: date50,
25333 time: time50,
25334 } = e;
25335 let super::super::super::golem::rdbms::types::Date {
25336 year: year51,
25337 month: month51,
25338 day: day51,
25339 } = date50;
25340 *base.add(32).cast::<i32>() = _rt::as_i32(year51);
25341 *base.add(36).cast::<u8>() = (_rt::as_i32(month51)) as u8;
25342 *base.add(37).cast::<u8>() = (_rt::as_i32(day51)) as u8;
25343 let super::super::super::golem::rdbms::types::Time {
25344 hour: hour52,
25345 minute: minute52,
25346 second: second52,
25347 nanosecond: nanosecond52,
25348 } = time50;
25349 *base.add(40).cast::<u8>() = (_rt::as_i32(hour52)) as u8;
25350 *base.add(41).cast::<u8>() = (_rt::as_i32(minute52)) as u8;
25351 *base.add(42).cast::<u8>() = (_rt::as_i32(second52)) as u8;
25352 *base.add(44).cast::<i32>() = _rt::as_i32(nanosecond52);
25353 }
25354 Tsbound::Unbounded => {
25355 *base.add(28).cast::<u8>() = (2i32) as u8;
25356 }
25357 }
25358 }
25359 DbValue::Tstzrange(e) => {
25360 *base.add(0).cast::<u8>() = (32i32) as u8;
25361 let Tstzrange { start: start53, end: end53 } = e;
25362 match start53 {
25363 Tstzbound::Included(e) => {
25364 *base.add(8).cast::<u8>() = (0i32) as u8;
25365 let super::super::super::golem::rdbms::types::Timestamptz {
25366 timestamp: timestamp54,
25367 offset: offset54,
25368 } = e;
25369 let super::super::super::golem::rdbms::types::Timestamp {
25370 date: date55,
25371 time: time55,
25372 } = timestamp54;
25373 let super::super::super::golem::rdbms::types::Date {
25374 year: year56,
25375 month: month56,
25376 day: day56,
25377 } = date55;
25378 *base.add(12).cast::<i32>() = _rt::as_i32(year56);
25379 *base.add(16).cast::<u8>() = (_rt::as_i32(month56)) as u8;
25380 *base.add(17).cast::<u8>() = (_rt::as_i32(day56)) as u8;
25381 let super::super::super::golem::rdbms::types::Time {
25382 hour: hour57,
25383 minute: minute57,
25384 second: second57,
25385 nanosecond: nanosecond57,
25386 } = time55;
25387 *base.add(20).cast::<u8>() = (_rt::as_i32(hour57)) as u8;
25388 *base.add(21).cast::<u8>() = (_rt::as_i32(minute57)) as u8;
25389 *base.add(22).cast::<u8>() = (_rt::as_i32(second57)) as u8;
25390 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond57);
25391 *base.add(28).cast::<i32>() = _rt::as_i32(offset54);
25392 }
25393 Tstzbound::Excluded(e) => {
25394 *base.add(8).cast::<u8>() = (1i32) as u8;
25395 let super::super::super::golem::rdbms::types::Timestamptz {
25396 timestamp: timestamp58,
25397 offset: offset58,
25398 } = e;
25399 let super::super::super::golem::rdbms::types::Timestamp {
25400 date: date59,
25401 time: time59,
25402 } = timestamp58;
25403 let super::super::super::golem::rdbms::types::Date {
25404 year: year60,
25405 month: month60,
25406 day: day60,
25407 } = date59;
25408 *base.add(12).cast::<i32>() = _rt::as_i32(year60);
25409 *base.add(16).cast::<u8>() = (_rt::as_i32(month60)) as u8;
25410 *base.add(17).cast::<u8>() = (_rt::as_i32(day60)) as u8;
25411 let super::super::super::golem::rdbms::types::Time {
25412 hour: hour61,
25413 minute: minute61,
25414 second: second61,
25415 nanosecond: nanosecond61,
25416 } = time59;
25417 *base.add(20).cast::<u8>() = (_rt::as_i32(hour61)) as u8;
25418 *base.add(21).cast::<u8>() = (_rt::as_i32(minute61)) as u8;
25419 *base.add(22).cast::<u8>() = (_rt::as_i32(second61)) as u8;
25420 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond61);
25421 *base.add(28).cast::<i32>() = _rt::as_i32(offset58);
25422 }
25423 Tstzbound::Unbounded => {
25424 *base.add(8).cast::<u8>() = (2i32) as u8;
25425 }
25426 }
25427 match end53 {
25428 Tstzbound::Included(e) => {
25429 *base.add(32).cast::<u8>() = (0i32) as u8;
25430 let super::super::super::golem::rdbms::types::Timestamptz {
25431 timestamp: timestamp62,
25432 offset: offset62,
25433 } = e;
25434 let super::super::super::golem::rdbms::types::Timestamp {
25435 date: date63,
25436 time: time63,
25437 } = timestamp62;
25438 let super::super::super::golem::rdbms::types::Date {
25439 year: year64,
25440 month: month64,
25441 day: day64,
25442 } = date63;
25443 *base.add(36).cast::<i32>() = _rt::as_i32(year64);
25444 *base.add(40).cast::<u8>() = (_rt::as_i32(month64)) as u8;
25445 *base.add(41).cast::<u8>() = (_rt::as_i32(day64)) as u8;
25446 let super::super::super::golem::rdbms::types::Time {
25447 hour: hour65,
25448 minute: minute65,
25449 second: second65,
25450 nanosecond: nanosecond65,
25451 } = time63;
25452 *base.add(44).cast::<u8>() = (_rt::as_i32(hour65)) as u8;
25453 *base.add(45).cast::<u8>() = (_rt::as_i32(minute65)) as u8;
25454 *base.add(46).cast::<u8>() = (_rt::as_i32(second65)) as u8;
25455 *base.add(48).cast::<i32>() = _rt::as_i32(nanosecond65);
25456 *base.add(52).cast::<i32>() = _rt::as_i32(offset62);
25457 }
25458 Tstzbound::Excluded(e) => {
25459 *base.add(32).cast::<u8>() = (1i32) as u8;
25460 let super::super::super::golem::rdbms::types::Timestamptz {
25461 timestamp: timestamp66,
25462 offset: offset66,
25463 } = e;
25464 let super::super::super::golem::rdbms::types::Timestamp {
25465 date: date67,
25466 time: time67,
25467 } = timestamp66;
25468 let super::super::super::golem::rdbms::types::Date {
25469 year: year68,
25470 month: month68,
25471 day: day68,
25472 } = date67;
25473 *base.add(36).cast::<i32>() = _rt::as_i32(year68);
25474 *base.add(40).cast::<u8>() = (_rt::as_i32(month68)) as u8;
25475 *base.add(41).cast::<u8>() = (_rt::as_i32(day68)) as u8;
25476 let super::super::super::golem::rdbms::types::Time {
25477 hour: hour69,
25478 minute: minute69,
25479 second: second69,
25480 nanosecond: nanosecond69,
25481 } = time67;
25482 *base.add(44).cast::<u8>() = (_rt::as_i32(hour69)) as u8;
25483 *base.add(45).cast::<u8>() = (_rt::as_i32(minute69)) as u8;
25484 *base.add(46).cast::<u8>() = (_rt::as_i32(second69)) as u8;
25485 *base.add(48).cast::<i32>() = _rt::as_i32(nanosecond69);
25486 *base.add(52).cast::<i32>() = _rt::as_i32(offset66);
25487 }
25488 Tstzbound::Unbounded => {
25489 *base.add(32).cast::<u8>() = (2i32) as u8;
25490 }
25491 }
25492 }
25493 DbValue::Daterange(e) => {
25494 *base.add(0).cast::<u8>() = (33i32) as u8;
25495 let Daterange { start: start70, end: end70 } = e;
25496 match start70 {
25497 Datebound::Included(e) => {
25498 *base.add(8).cast::<u8>() = (0i32) as u8;
25499 let super::super::super::golem::rdbms::types::Date {
25500 year: year71,
25501 month: month71,
25502 day: day71,
25503 } = e;
25504 *base.add(12).cast::<i32>() = _rt::as_i32(year71);
25505 *base.add(16).cast::<u8>() = (_rt::as_i32(month71)) as u8;
25506 *base.add(17).cast::<u8>() = (_rt::as_i32(day71)) as u8;
25507 }
25508 Datebound::Excluded(e) => {
25509 *base.add(8).cast::<u8>() = (1i32) as u8;
25510 let super::super::super::golem::rdbms::types::Date {
25511 year: year72,
25512 month: month72,
25513 day: day72,
25514 } = e;
25515 *base.add(12).cast::<i32>() = _rt::as_i32(year72);
25516 *base.add(16).cast::<u8>() = (_rt::as_i32(month72)) as u8;
25517 *base.add(17).cast::<u8>() = (_rt::as_i32(day72)) as u8;
25518 }
25519 Datebound::Unbounded => {
25520 *base.add(8).cast::<u8>() = (2i32) as u8;
25521 }
25522 }
25523 match end70 {
25524 Datebound::Included(e) => {
25525 *base.add(20).cast::<u8>() = (0i32) as u8;
25526 let super::super::super::golem::rdbms::types::Date {
25527 year: year73,
25528 month: month73,
25529 day: day73,
25530 } = e;
25531 *base.add(24).cast::<i32>() = _rt::as_i32(year73);
25532 *base.add(28).cast::<u8>() = (_rt::as_i32(month73)) as u8;
25533 *base.add(29).cast::<u8>() = (_rt::as_i32(day73)) as u8;
25534 }
25535 Datebound::Excluded(e) => {
25536 *base.add(20).cast::<u8>() = (1i32) as u8;
25537 let super::super::super::golem::rdbms::types::Date {
25538 year: year74,
25539 month: month74,
25540 day: day74,
25541 } = e;
25542 *base.add(24).cast::<i32>() = _rt::as_i32(year74);
25543 *base.add(28).cast::<u8>() = (_rt::as_i32(month74)) as u8;
25544 *base.add(29).cast::<u8>() = (_rt::as_i32(day74)) as u8;
25545 }
25546 Datebound::Unbounded => {
25547 *base.add(20).cast::<u8>() = (2i32) as u8;
25548 }
25549 }
25550 }
25551 DbValue::Money(e) => {
25552 *base.add(0).cast::<u8>() = (34i32) as u8;
25553 *base.add(8).cast::<i64>() = _rt::as_i64(e);
25554 }
25555 DbValue::Oid(e) => {
25556 *base.add(0).cast::<u8>() = (35i32) as u8;
25557 *base.add(8).cast::<i32>() = _rt::as_i32(e);
25558 }
25559 DbValue::Enumeration(e) => {
25560 *base.add(0).cast::<u8>() = (36i32) as u8;
25561 let Enumeration { name: name75, value: value75 } = e;
25562 let vec76 = name75;
25563 let ptr76 = vec76.as_ptr().cast::<u8>();
25564 let len76 = vec76.len();
25565 *base.add(12).cast::<usize>() = len76;
25566 *base.add(8).cast::<*mut u8>() = ptr76.cast_mut();
25567 let vec77 = value75;
25568 let ptr77 = vec77.as_ptr().cast::<u8>();
25569 let len77 = vec77.len();
25570 *base.add(20).cast::<usize>() = len77;
25571 *base.add(16).cast::<*mut u8>() = ptr77.cast_mut();
25572 }
25573 DbValue::Composite(e) => {
25574 *base.add(0).cast::<u8>() = (37i32) as u8;
25575 let Composite { name: name78, values: values78 } = e;
25576 let vec79 = name78;
25577 let ptr79 = vec79.as_ptr().cast::<u8>();
25578 let len79 = vec79.len();
25579 *base.add(12).cast::<usize>() = len79;
25580 *base.add(8).cast::<*mut u8>() = ptr79.cast_mut();
25581 let vec80 = values78;
25582 let len80 = vec80.len();
25583 let layout80 = _rt::alloc::Layout::from_size_align_unchecked(
25584 vec80.len() * 4,
25585 4,
25586 );
25587 let result80 = if layout80.size() != 0 {
25588 let ptr = _rt::alloc::alloc(layout80).cast::<u8>();
25589 if ptr.is_null() {
25590 _rt::alloc::handle_alloc_error(layout80);
25591 }
25592 ptr
25593 } else {
25594 ::core::ptr::null_mut()
25595 };
25596 for (i, e) in vec80.into_iter().enumerate() {
25597 let base = result80.add(i * 4);
25598 {
25599 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
25600 }
25601 }
25602 *base.add(20).cast::<usize>() = len80;
25603 *base.add(16).cast::<*mut u8>() = result80;
25604 cleanup_list.extend_from_slice(&[(result80, layout80)]);
25605 }
25606 DbValue::Domain(e) => {
25607 *base.add(0).cast::<u8>() = (38i32) as u8;
25608 let Domain { name: name81, value: value81 } = e;
25609 let vec82 = name81;
25610 let ptr82 = vec82.as_ptr().cast::<u8>();
25611 let len82 = vec82.len();
25612 *base.add(12).cast::<usize>() = len82;
25613 *base.add(8).cast::<*mut u8>() = ptr82.cast_mut();
25614 *base.add(16).cast::<i32>() = (value81).take_handle()
25615 as i32;
25616 }
25617 DbValue::Array(e) => {
25618 *base.add(0).cast::<u8>() = (39i32) as u8;
25619 let vec83 = e;
25620 let len83 = vec83.len();
25621 let layout83 = _rt::alloc::Layout::from_size_align_unchecked(
25622 vec83.len() * 4,
25623 4,
25624 );
25625 let result83 = if layout83.size() != 0 {
25626 let ptr = _rt::alloc::alloc(layout83).cast::<u8>();
25627 if ptr.is_null() {
25628 _rt::alloc::handle_alloc_error(layout83);
25629 }
25630 ptr
25631 } else {
25632 ::core::ptr::null_mut()
25633 };
25634 for (i, e) in vec83.into_iter().enumerate() {
25635 let base = result83.add(i * 4);
25636 {
25637 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
25638 }
25639 }
25640 *base.add(12).cast::<usize>() = len83;
25641 *base.add(8).cast::<*mut u8>() = result83;
25642 cleanup_list.extend_from_slice(&[(result83, layout83)]);
25643 }
25644 DbValue::Range(e) => {
25645 *base.add(0).cast::<u8>() = (40i32) as u8;
25646 let Range { name: name84, value: value84 } = e;
25647 let vec85 = name84;
25648 let ptr85 = vec85.as_ptr().cast::<u8>();
25649 let len85 = vec85.len();
25650 *base.add(12).cast::<usize>() = len85;
25651 *base.add(8).cast::<*mut u8>() = ptr85.cast_mut();
25652 let ValuesRange { start: start86, end: end86 } = value84;
25653 match start86 {
25654 ValueBound::Included(e) => {
25655 *base.add(16).cast::<u8>() = (0i32) as u8;
25656 *base.add(20).cast::<i32>() = (e).take_handle() as i32;
25657 }
25658 ValueBound::Excluded(e) => {
25659 *base.add(16).cast::<u8>() = (1i32) as u8;
25660 *base.add(20).cast::<i32>() = (e).take_handle() as i32;
25661 }
25662 ValueBound::Unbounded => {
25663 *base.add(16).cast::<u8>() = (2i32) as u8;
25664 }
25665 }
25666 match end86 {
25667 ValueBound::Included(e) => {
25668 *base.add(24).cast::<u8>() = (0i32) as u8;
25669 *base.add(28).cast::<i32>() = (e).take_handle() as i32;
25670 }
25671 ValueBound::Excluded(e) => {
25672 *base.add(24).cast::<u8>() = (1i32) as u8;
25673 *base.add(28).cast::<i32>() = (e).take_handle() as i32;
25674 }
25675 ValueBound::Unbounded => {
25676 *base.add(24).cast::<u8>() = (2i32) as u8;
25677 }
25678 }
25679 }
25680 DbValue::Null => {
25681 *base.add(0).cast::<u8>() = (41i32) as u8;
25682 }
25683 }
25684 }
25685 }
25686 let ptr88 = ret_area.0.as_mut_ptr().cast::<u8>();
25687 #[cfg(target_arch = "wasm32")]
25688 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
25689 extern "C" {
25690 #[link_name = "[method]db-connection.query-stream"]
25691 fn wit_import(
25692 _: i32,
25693 _: *mut u8,
25694 _: usize,
25695 _: *mut u8,
25696 _: usize,
25697 _: *mut u8,
25698 );
25699 }
25700 #[cfg(not(target_arch = "wasm32"))]
25701 fn wit_import(
25702 _: i32,
25703 _: *mut u8,
25704 _: usize,
25705 _: *mut u8,
25706 _: usize,
25707 _: *mut u8,
25708 ) {
25709 unreachable!()
25710 }
25711 wit_import(
25712 (self).handle() as i32,
25713 ptr0.cast_mut(),
25714 len0,
25715 result87,
25716 len87,
25717 ptr88,
25718 );
25719 let l89 = i32::from(*ptr88.add(0).cast::<u8>());
25720 if layout87.size() != 0 {
25721 _rt::alloc::dealloc(result87.cast(), layout87);
25722 }
25723 for (ptr, layout) in cleanup_list {
25724 if layout.size() != 0 {
25725 _rt::alloc::dealloc(ptr.cast(), layout);
25726 }
25727 }
25728 match l89 {
25729 0 => {
25730 let e = {
25731 let l90 = *ptr88.add(4).cast::<i32>();
25732 DbResultStream::from_handle(l90 as u32)
25733 };
25734 Ok(e)
25735 }
25736 1 => {
25737 let e = {
25738 let l91 = i32::from(*ptr88.add(4).cast::<u8>());
25739 let v107 = match l91 {
25740 0 => {
25741 let e107 = {
25742 let l92 = *ptr88.add(8).cast::<*mut u8>();
25743 let l93 = *ptr88.add(12).cast::<usize>();
25744 let len94 = l93;
25745 let bytes94 = _rt::Vec::from_raw_parts(
25746 l92.cast(),
25747 len94,
25748 len94,
25749 );
25750 _rt::string_lift(bytes94)
25751 };
25752 Error::ConnectionFailure(e107)
25753 }
25754 1 => {
25755 let e107 = {
25756 let l95 = *ptr88.add(8).cast::<*mut u8>();
25757 let l96 = *ptr88.add(12).cast::<usize>();
25758 let len97 = l96;
25759 let bytes97 = _rt::Vec::from_raw_parts(
25760 l95.cast(),
25761 len97,
25762 len97,
25763 );
25764 _rt::string_lift(bytes97)
25765 };
25766 Error::QueryParameterFailure(e107)
25767 }
25768 2 => {
25769 let e107 = {
25770 let l98 = *ptr88.add(8).cast::<*mut u8>();
25771 let l99 = *ptr88.add(12).cast::<usize>();
25772 let len100 = l99;
25773 let bytes100 = _rt::Vec::from_raw_parts(
25774 l98.cast(),
25775 len100,
25776 len100,
25777 );
25778 _rt::string_lift(bytes100)
25779 };
25780 Error::QueryExecutionFailure(e107)
25781 }
25782 3 => {
25783 let e107 = {
25784 let l101 = *ptr88.add(8).cast::<*mut u8>();
25785 let l102 = *ptr88.add(12).cast::<usize>();
25786 let len103 = l102;
25787 let bytes103 = _rt::Vec::from_raw_parts(
25788 l101.cast(),
25789 len103,
25790 len103,
25791 );
25792 _rt::string_lift(bytes103)
25793 };
25794 Error::QueryResponseFailure(e107)
25795 }
25796 n => {
25797 debug_assert_eq!(n, 4, "invalid enum discriminant");
25798 let e107 = {
25799 let l104 = *ptr88.add(8).cast::<*mut u8>();
25800 let l105 = *ptr88.add(12).cast::<usize>();
25801 let len106 = l105;
25802 let bytes106 = _rt::Vec::from_raw_parts(
25803 l104.cast(),
25804 len106,
25805 len106,
25806 );
25807 _rt::string_lift(bytes106)
25808 };
25809 Error::Other(e107)
25810 }
25811 };
25812 v107
25813 };
25814 Err(e)
25815 }
25816 _ => _rt::invalid_enum_discriminant(),
25817 }
25818 }
25819 }
25820 }
25821 impl DbConnection {
25822 #[allow(unused_unsafe, clippy::all)]
25823 pub fn execute(
25824 &self,
25825 statement: &str,
25826 params: _rt::Vec<DbValue>,
25827 ) -> Result<u64, Error> {
25828 unsafe {
25829 let mut cleanup_list = _rt::Vec::new();
25830 #[repr(align(8))]
25831 struct RetArea([::core::mem::MaybeUninit<u8>; 24]);
25832 let mut ret_area = RetArea(
25833 [::core::mem::MaybeUninit::uninit(); 24],
25834 );
25835 let vec0 = statement;
25836 let ptr0 = vec0.as_ptr().cast::<u8>();
25837 let len0 = vec0.len();
25838 let vec87 = ¶ms;
25839 let len87 = vec87.len();
25840 let layout87 = _rt::alloc::Layout::from_size_align_unchecked(
25841 vec87.len() * 56,
25842 8,
25843 );
25844 let result87 = if layout87.size() != 0 {
25845 let ptr = _rt::alloc::alloc(layout87).cast::<u8>();
25846 if ptr.is_null() {
25847 _rt::alloc::handle_alloc_error(layout87);
25848 }
25849 ptr
25850 } else {
25851 ::core::ptr::null_mut()
25852 };
25853 for (i, e) in vec87.into_iter().enumerate() {
25854 let base = result87.add(i * 56);
25855 {
25856 match e {
25857 DbValue::Character(e) => {
25858 *base.add(0).cast::<u8>() = (0i32) as u8;
25859 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
25860 }
25861 DbValue::Int2(e) => {
25862 *base.add(0).cast::<u8>() = (1i32) as u8;
25863 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
25864 }
25865 DbValue::Int4(e) => {
25866 *base.add(0).cast::<u8>() = (2i32) as u8;
25867 *base.add(8).cast::<i32>() = _rt::as_i32(e);
25868 }
25869 DbValue::Int8(e) => {
25870 *base.add(0).cast::<u8>() = (3i32) as u8;
25871 *base.add(8).cast::<i64>() = _rt::as_i64(e);
25872 }
25873 DbValue::Float4(e) => {
25874 *base.add(0).cast::<u8>() = (4i32) as u8;
25875 *base.add(8).cast::<f32>() = _rt::as_f32(e);
25876 }
25877 DbValue::Float8(e) => {
25878 *base.add(0).cast::<u8>() = (5i32) as u8;
25879 *base.add(8).cast::<f64>() = _rt::as_f64(e);
25880 }
25881 DbValue::Numeric(e) => {
25882 *base.add(0).cast::<u8>() = (6i32) as u8;
25883 let vec1 = e;
25884 let ptr1 = vec1.as_ptr().cast::<u8>();
25885 let len1 = vec1.len();
25886 *base.add(12).cast::<usize>() = len1;
25887 *base.add(8).cast::<*mut u8>() = ptr1.cast_mut();
25888 }
25889 DbValue::Boolean(e) => {
25890 *base.add(0).cast::<u8>() = (7i32) as u8;
25891 *base.add(8).cast::<u8>() = (match e {
25892 true => 1,
25893 false => 0,
25894 }) as u8;
25895 }
25896 DbValue::Text(e) => {
25897 *base.add(0).cast::<u8>() = (8i32) as u8;
25898 let vec2 = e;
25899 let ptr2 = vec2.as_ptr().cast::<u8>();
25900 let len2 = vec2.len();
25901 *base.add(12).cast::<usize>() = len2;
25902 *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
25903 }
25904 DbValue::Varchar(e) => {
25905 *base.add(0).cast::<u8>() = (9i32) as u8;
25906 let vec3 = e;
25907 let ptr3 = vec3.as_ptr().cast::<u8>();
25908 let len3 = vec3.len();
25909 *base.add(12).cast::<usize>() = len3;
25910 *base.add(8).cast::<*mut u8>() = ptr3.cast_mut();
25911 }
25912 DbValue::Bpchar(e) => {
25913 *base.add(0).cast::<u8>() = (10i32) as u8;
25914 let vec4 = e;
25915 let ptr4 = vec4.as_ptr().cast::<u8>();
25916 let len4 = vec4.len();
25917 *base.add(12).cast::<usize>() = len4;
25918 *base.add(8).cast::<*mut u8>() = ptr4.cast_mut();
25919 }
25920 DbValue::Timestamp(e) => {
25921 *base.add(0).cast::<u8>() = (11i32) as u8;
25922 let super::super::super::golem::rdbms::types::Timestamp {
25923 date: date5,
25924 time: time5,
25925 } = e;
25926 let super::super::super::golem::rdbms::types::Date {
25927 year: year6,
25928 month: month6,
25929 day: day6,
25930 } = date5;
25931 *base.add(8).cast::<i32>() = _rt::as_i32(year6);
25932 *base.add(12).cast::<u8>() = (_rt::as_i32(month6)) as u8;
25933 *base.add(13).cast::<u8>() = (_rt::as_i32(day6)) as u8;
25934 let super::super::super::golem::rdbms::types::Time {
25935 hour: hour7,
25936 minute: minute7,
25937 second: second7,
25938 nanosecond: nanosecond7,
25939 } = time5;
25940 *base.add(16).cast::<u8>() = (_rt::as_i32(hour7)) as u8;
25941 *base.add(17).cast::<u8>() = (_rt::as_i32(minute7)) as u8;
25942 *base.add(18).cast::<u8>() = (_rt::as_i32(second7)) as u8;
25943 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond7);
25944 }
25945 DbValue::Timestamptz(e) => {
25946 *base.add(0).cast::<u8>() = (12i32) as u8;
25947 let super::super::super::golem::rdbms::types::Timestamptz {
25948 timestamp: timestamp8,
25949 offset: offset8,
25950 } = e;
25951 let super::super::super::golem::rdbms::types::Timestamp {
25952 date: date9,
25953 time: time9,
25954 } = timestamp8;
25955 let super::super::super::golem::rdbms::types::Date {
25956 year: year10,
25957 month: month10,
25958 day: day10,
25959 } = date9;
25960 *base.add(8).cast::<i32>() = _rt::as_i32(year10);
25961 *base.add(12).cast::<u8>() = (_rt::as_i32(month10)) as u8;
25962 *base.add(13).cast::<u8>() = (_rt::as_i32(day10)) as u8;
25963 let super::super::super::golem::rdbms::types::Time {
25964 hour: hour11,
25965 minute: minute11,
25966 second: second11,
25967 nanosecond: nanosecond11,
25968 } = time9;
25969 *base.add(16).cast::<u8>() = (_rt::as_i32(hour11)) as u8;
25970 *base.add(17).cast::<u8>() = (_rt::as_i32(minute11)) as u8;
25971 *base.add(18).cast::<u8>() = (_rt::as_i32(second11)) as u8;
25972 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond11);
25973 *base.add(24).cast::<i32>() = _rt::as_i32(offset8);
25974 }
25975 DbValue::Date(e) => {
25976 *base.add(0).cast::<u8>() = (13i32) as u8;
25977 let super::super::super::golem::rdbms::types::Date {
25978 year: year12,
25979 month: month12,
25980 day: day12,
25981 } = e;
25982 *base.add(8).cast::<i32>() = _rt::as_i32(year12);
25983 *base.add(12).cast::<u8>() = (_rt::as_i32(month12)) as u8;
25984 *base.add(13).cast::<u8>() = (_rt::as_i32(day12)) as u8;
25985 }
25986 DbValue::Time(e) => {
25987 *base.add(0).cast::<u8>() = (14i32) as u8;
25988 let super::super::super::golem::rdbms::types::Time {
25989 hour: hour13,
25990 minute: minute13,
25991 second: second13,
25992 nanosecond: nanosecond13,
25993 } = e;
25994 *base.add(8).cast::<u8>() = (_rt::as_i32(hour13)) as u8;
25995 *base.add(9).cast::<u8>() = (_rt::as_i32(minute13)) as u8;
25996 *base.add(10).cast::<u8>() = (_rt::as_i32(second13)) as u8;
25997 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond13);
25998 }
25999 DbValue::Timetz(e) => {
26000 *base.add(0).cast::<u8>() = (15i32) as u8;
26001 let super::super::super::golem::rdbms::types::Timetz {
26002 time: time14,
26003 offset: offset14,
26004 } = e;
26005 let super::super::super::golem::rdbms::types::Time {
26006 hour: hour15,
26007 minute: minute15,
26008 second: second15,
26009 nanosecond: nanosecond15,
26010 } = time14;
26011 *base.add(8).cast::<u8>() = (_rt::as_i32(hour15)) as u8;
26012 *base.add(9).cast::<u8>() = (_rt::as_i32(minute15)) as u8;
26013 *base.add(10).cast::<u8>() = (_rt::as_i32(second15)) as u8;
26014 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond15);
26015 *base.add(16).cast::<i32>() = _rt::as_i32(offset14);
26016 }
26017 DbValue::Interval(e) => {
26018 *base.add(0).cast::<u8>() = (16i32) as u8;
26019 let Interval {
26020 months: months16,
26021 days: days16,
26022 microseconds: microseconds16,
26023 } = e;
26024 *base.add(8).cast::<i32>() = _rt::as_i32(months16);
26025 *base.add(12).cast::<i32>() = _rt::as_i32(days16);
26026 *base.add(16).cast::<i64>() = _rt::as_i64(microseconds16);
26027 }
26028 DbValue::Bytea(e) => {
26029 *base.add(0).cast::<u8>() = (17i32) as u8;
26030 let vec17 = e;
26031 let ptr17 = vec17.as_ptr().cast::<u8>();
26032 let len17 = vec17.len();
26033 *base.add(12).cast::<usize>() = len17;
26034 *base.add(8).cast::<*mut u8>() = ptr17.cast_mut();
26035 }
26036 DbValue::Json(e) => {
26037 *base.add(0).cast::<u8>() = (18i32) as u8;
26038 let vec18 = e;
26039 let ptr18 = vec18.as_ptr().cast::<u8>();
26040 let len18 = vec18.len();
26041 *base.add(12).cast::<usize>() = len18;
26042 *base.add(8).cast::<*mut u8>() = ptr18.cast_mut();
26043 }
26044 DbValue::Jsonb(e) => {
26045 *base.add(0).cast::<u8>() = (19i32) as u8;
26046 let vec19 = e;
26047 let ptr19 = vec19.as_ptr().cast::<u8>();
26048 let len19 = vec19.len();
26049 *base.add(12).cast::<usize>() = len19;
26050 *base.add(8).cast::<*mut u8>() = ptr19.cast_mut();
26051 }
26052 DbValue::Jsonpath(e) => {
26053 *base.add(0).cast::<u8>() = (20i32) as u8;
26054 let vec20 = e;
26055 let ptr20 = vec20.as_ptr().cast::<u8>();
26056 let len20 = vec20.len();
26057 *base.add(12).cast::<usize>() = len20;
26058 *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
26059 }
26060 DbValue::Xml(e) => {
26061 *base.add(0).cast::<u8>() = (21i32) as u8;
26062 let vec21 = e;
26063 let ptr21 = vec21.as_ptr().cast::<u8>();
26064 let len21 = vec21.len();
26065 *base.add(12).cast::<usize>() = len21;
26066 *base.add(8).cast::<*mut u8>() = ptr21.cast_mut();
26067 }
26068 DbValue::Uuid(e) => {
26069 *base.add(0).cast::<u8>() = (22i32) as u8;
26070 let super::super::super::golem::rdbms::types::Uuid {
26071 high_bits: high_bits22,
26072 low_bits: low_bits22,
26073 } = e;
26074 *base.add(8).cast::<i64>() = _rt::as_i64(high_bits22);
26075 *base.add(16).cast::<i64>() = _rt::as_i64(low_bits22);
26076 }
26077 DbValue::Inet(e) => {
26078 *base.add(0).cast::<u8>() = (23i32) as u8;
26079 use super::super::super::golem::rdbms::types::IpAddress as V25;
26080 match e {
26081 V25::Ipv4(e) => {
26082 *base.add(8).cast::<u8>() = (0i32) as u8;
26083 let (t23_0, t23_1, t23_2, t23_3) = e;
26084 *base.add(10).cast::<u8>() = (_rt::as_i32(t23_0)) as u8;
26085 *base.add(11).cast::<u8>() = (_rt::as_i32(t23_1)) as u8;
26086 *base.add(12).cast::<u8>() = (_rt::as_i32(t23_2)) as u8;
26087 *base.add(13).cast::<u8>() = (_rt::as_i32(t23_3)) as u8;
26088 }
26089 V25::Ipv6(e) => {
26090 *base.add(8).cast::<u8>() = (1i32) as u8;
26091 let (
26092 t24_0,
26093 t24_1,
26094 t24_2,
26095 t24_3,
26096 t24_4,
26097 t24_5,
26098 t24_6,
26099 t24_7,
26100 ) = e;
26101 *base.add(10).cast::<u16>() = (_rt::as_i32(t24_0)) as u16;
26102 *base.add(12).cast::<u16>() = (_rt::as_i32(t24_1)) as u16;
26103 *base.add(14).cast::<u16>() = (_rt::as_i32(t24_2)) as u16;
26104 *base.add(16).cast::<u16>() = (_rt::as_i32(t24_3)) as u16;
26105 *base.add(18).cast::<u16>() = (_rt::as_i32(t24_4)) as u16;
26106 *base.add(20).cast::<u16>() = (_rt::as_i32(t24_5)) as u16;
26107 *base.add(22).cast::<u16>() = (_rt::as_i32(t24_6)) as u16;
26108 *base.add(24).cast::<u16>() = (_rt::as_i32(t24_7)) as u16;
26109 }
26110 }
26111 }
26112 DbValue::Cidr(e) => {
26113 *base.add(0).cast::<u8>() = (24i32) as u8;
26114 use super::super::super::golem::rdbms::types::IpAddress as V28;
26115 match e {
26116 V28::Ipv4(e) => {
26117 *base.add(8).cast::<u8>() = (0i32) as u8;
26118 let (t26_0, t26_1, t26_2, t26_3) = e;
26119 *base.add(10).cast::<u8>() = (_rt::as_i32(t26_0)) as u8;
26120 *base.add(11).cast::<u8>() = (_rt::as_i32(t26_1)) as u8;
26121 *base.add(12).cast::<u8>() = (_rt::as_i32(t26_2)) as u8;
26122 *base.add(13).cast::<u8>() = (_rt::as_i32(t26_3)) as u8;
26123 }
26124 V28::Ipv6(e) => {
26125 *base.add(8).cast::<u8>() = (1i32) as u8;
26126 let (
26127 t27_0,
26128 t27_1,
26129 t27_2,
26130 t27_3,
26131 t27_4,
26132 t27_5,
26133 t27_6,
26134 t27_7,
26135 ) = e;
26136 *base.add(10).cast::<u16>() = (_rt::as_i32(t27_0)) as u16;
26137 *base.add(12).cast::<u16>() = (_rt::as_i32(t27_1)) as u16;
26138 *base.add(14).cast::<u16>() = (_rt::as_i32(t27_2)) as u16;
26139 *base.add(16).cast::<u16>() = (_rt::as_i32(t27_3)) as u16;
26140 *base.add(18).cast::<u16>() = (_rt::as_i32(t27_4)) as u16;
26141 *base.add(20).cast::<u16>() = (_rt::as_i32(t27_5)) as u16;
26142 *base.add(22).cast::<u16>() = (_rt::as_i32(t27_6)) as u16;
26143 *base.add(24).cast::<u16>() = (_rt::as_i32(t27_7)) as u16;
26144 }
26145 }
26146 }
26147 DbValue::Macaddr(e) => {
26148 *base.add(0).cast::<u8>() = (25i32) as u8;
26149 let super::super::super::golem::rdbms::types::MacAddress {
26150 octets: octets29,
26151 } = e;
26152 let (t30_0, t30_1, t30_2, t30_3, t30_4, t30_5) = octets29;
26153 *base.add(8).cast::<u8>() = (_rt::as_i32(t30_0)) as u8;
26154 *base.add(9).cast::<u8>() = (_rt::as_i32(t30_1)) as u8;
26155 *base.add(10).cast::<u8>() = (_rt::as_i32(t30_2)) as u8;
26156 *base.add(11).cast::<u8>() = (_rt::as_i32(t30_3)) as u8;
26157 *base.add(12).cast::<u8>() = (_rt::as_i32(t30_4)) as u8;
26158 *base.add(13).cast::<u8>() = (_rt::as_i32(t30_5)) as u8;
26159 }
26160 DbValue::Bit(e) => {
26161 *base.add(0).cast::<u8>() = (26i32) as u8;
26162 let vec31 = e;
26163 let len31 = vec31.len();
26164 let layout31 = _rt::alloc::Layout::from_size_align_unchecked(
26165 vec31.len() * 1,
26166 1,
26167 );
26168 let result31 = if layout31.size() != 0 {
26169 let ptr = _rt::alloc::alloc(layout31).cast::<u8>();
26170 if ptr.is_null() {
26171 _rt::alloc::handle_alloc_error(layout31);
26172 }
26173 ptr
26174 } else {
26175 ::core::ptr::null_mut()
26176 };
26177 for (i, e) in vec31.into_iter().enumerate() {
26178 let base = result31.add(i * 1);
26179 {
26180 *base.add(0).cast::<u8>() = (match e {
26181 true => 1,
26182 false => 0,
26183 }) as u8;
26184 }
26185 }
26186 *base.add(12).cast::<usize>() = len31;
26187 *base.add(8).cast::<*mut u8>() = result31;
26188 cleanup_list.extend_from_slice(&[(result31, layout31)]);
26189 }
26190 DbValue::Varbit(e) => {
26191 *base.add(0).cast::<u8>() = (27i32) as u8;
26192 let vec32 = e;
26193 let len32 = vec32.len();
26194 let layout32 = _rt::alloc::Layout::from_size_align_unchecked(
26195 vec32.len() * 1,
26196 1,
26197 );
26198 let result32 = if layout32.size() != 0 {
26199 let ptr = _rt::alloc::alloc(layout32).cast::<u8>();
26200 if ptr.is_null() {
26201 _rt::alloc::handle_alloc_error(layout32);
26202 }
26203 ptr
26204 } else {
26205 ::core::ptr::null_mut()
26206 };
26207 for (i, e) in vec32.into_iter().enumerate() {
26208 let base = result32.add(i * 1);
26209 {
26210 *base.add(0).cast::<u8>() = (match e {
26211 true => 1,
26212 false => 0,
26213 }) as u8;
26214 }
26215 }
26216 *base.add(12).cast::<usize>() = len32;
26217 *base.add(8).cast::<*mut u8>() = result32;
26218 cleanup_list.extend_from_slice(&[(result32, layout32)]);
26219 }
26220 DbValue::Int4range(e) => {
26221 *base.add(0).cast::<u8>() = (28i32) as u8;
26222 let Int4range { start: start33, end: end33 } = e;
26223 match start33 {
26224 Int4bound::Included(e) => {
26225 *base.add(8).cast::<u8>() = (0i32) as u8;
26226 *base.add(12).cast::<i32>() = _rt::as_i32(e);
26227 }
26228 Int4bound::Excluded(e) => {
26229 *base.add(8).cast::<u8>() = (1i32) as u8;
26230 *base.add(12).cast::<i32>() = _rt::as_i32(e);
26231 }
26232 Int4bound::Unbounded => {
26233 *base.add(8).cast::<u8>() = (2i32) as u8;
26234 }
26235 }
26236 match end33 {
26237 Int4bound::Included(e) => {
26238 *base.add(16).cast::<u8>() = (0i32) as u8;
26239 *base.add(20).cast::<i32>() = _rt::as_i32(e);
26240 }
26241 Int4bound::Excluded(e) => {
26242 *base.add(16).cast::<u8>() = (1i32) as u8;
26243 *base.add(20).cast::<i32>() = _rt::as_i32(e);
26244 }
26245 Int4bound::Unbounded => {
26246 *base.add(16).cast::<u8>() = (2i32) as u8;
26247 }
26248 }
26249 }
26250 DbValue::Int8range(e) => {
26251 *base.add(0).cast::<u8>() = (29i32) as u8;
26252 let Int8range { start: start34, end: end34 } = e;
26253 match start34 {
26254 Int8bound::Included(e) => {
26255 *base.add(8).cast::<u8>() = (0i32) as u8;
26256 *base.add(16).cast::<i64>() = _rt::as_i64(e);
26257 }
26258 Int8bound::Excluded(e) => {
26259 *base.add(8).cast::<u8>() = (1i32) as u8;
26260 *base.add(16).cast::<i64>() = _rt::as_i64(e);
26261 }
26262 Int8bound::Unbounded => {
26263 *base.add(8).cast::<u8>() = (2i32) as u8;
26264 }
26265 }
26266 match end34 {
26267 Int8bound::Included(e) => {
26268 *base.add(24).cast::<u8>() = (0i32) as u8;
26269 *base.add(32).cast::<i64>() = _rt::as_i64(e);
26270 }
26271 Int8bound::Excluded(e) => {
26272 *base.add(24).cast::<u8>() = (1i32) as u8;
26273 *base.add(32).cast::<i64>() = _rt::as_i64(e);
26274 }
26275 Int8bound::Unbounded => {
26276 *base.add(24).cast::<u8>() = (2i32) as u8;
26277 }
26278 }
26279 }
26280 DbValue::Numrange(e) => {
26281 *base.add(0).cast::<u8>() = (30i32) as u8;
26282 let Numrange { start: start35, end: end35 } = e;
26283 match start35 {
26284 Numbound::Included(e) => {
26285 *base.add(8).cast::<u8>() = (0i32) as u8;
26286 let vec36 = e;
26287 let ptr36 = vec36.as_ptr().cast::<u8>();
26288 let len36 = vec36.len();
26289 *base.add(16).cast::<usize>() = len36;
26290 *base.add(12).cast::<*mut u8>() = ptr36.cast_mut();
26291 }
26292 Numbound::Excluded(e) => {
26293 *base.add(8).cast::<u8>() = (1i32) as u8;
26294 let vec37 = e;
26295 let ptr37 = vec37.as_ptr().cast::<u8>();
26296 let len37 = vec37.len();
26297 *base.add(16).cast::<usize>() = len37;
26298 *base.add(12).cast::<*mut u8>() = ptr37.cast_mut();
26299 }
26300 Numbound::Unbounded => {
26301 *base.add(8).cast::<u8>() = (2i32) as u8;
26302 }
26303 }
26304 match end35 {
26305 Numbound::Included(e) => {
26306 *base.add(20).cast::<u8>() = (0i32) as u8;
26307 let vec38 = e;
26308 let ptr38 = vec38.as_ptr().cast::<u8>();
26309 let len38 = vec38.len();
26310 *base.add(28).cast::<usize>() = len38;
26311 *base.add(24).cast::<*mut u8>() = ptr38.cast_mut();
26312 }
26313 Numbound::Excluded(e) => {
26314 *base.add(20).cast::<u8>() = (1i32) as u8;
26315 let vec39 = e;
26316 let ptr39 = vec39.as_ptr().cast::<u8>();
26317 let len39 = vec39.len();
26318 *base.add(28).cast::<usize>() = len39;
26319 *base.add(24).cast::<*mut u8>() = ptr39.cast_mut();
26320 }
26321 Numbound::Unbounded => {
26322 *base.add(20).cast::<u8>() = (2i32) as u8;
26323 }
26324 }
26325 }
26326 DbValue::Tsrange(e) => {
26327 *base.add(0).cast::<u8>() = (31i32) as u8;
26328 let Tsrange { start: start40, end: end40 } = e;
26329 match start40 {
26330 Tsbound::Included(e) => {
26331 *base.add(8).cast::<u8>() = (0i32) as u8;
26332 let super::super::super::golem::rdbms::types::Timestamp {
26333 date: date41,
26334 time: time41,
26335 } = e;
26336 let super::super::super::golem::rdbms::types::Date {
26337 year: year42,
26338 month: month42,
26339 day: day42,
26340 } = date41;
26341 *base.add(12).cast::<i32>() = _rt::as_i32(year42);
26342 *base.add(16).cast::<u8>() = (_rt::as_i32(month42)) as u8;
26343 *base.add(17).cast::<u8>() = (_rt::as_i32(day42)) as u8;
26344 let super::super::super::golem::rdbms::types::Time {
26345 hour: hour43,
26346 minute: minute43,
26347 second: second43,
26348 nanosecond: nanosecond43,
26349 } = time41;
26350 *base.add(20).cast::<u8>() = (_rt::as_i32(hour43)) as u8;
26351 *base.add(21).cast::<u8>() = (_rt::as_i32(minute43)) as u8;
26352 *base.add(22).cast::<u8>() = (_rt::as_i32(second43)) as u8;
26353 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond43);
26354 }
26355 Tsbound::Excluded(e) => {
26356 *base.add(8).cast::<u8>() = (1i32) as u8;
26357 let super::super::super::golem::rdbms::types::Timestamp {
26358 date: date44,
26359 time: time44,
26360 } = e;
26361 let super::super::super::golem::rdbms::types::Date {
26362 year: year45,
26363 month: month45,
26364 day: day45,
26365 } = date44;
26366 *base.add(12).cast::<i32>() = _rt::as_i32(year45);
26367 *base.add(16).cast::<u8>() = (_rt::as_i32(month45)) as u8;
26368 *base.add(17).cast::<u8>() = (_rt::as_i32(day45)) as u8;
26369 let super::super::super::golem::rdbms::types::Time {
26370 hour: hour46,
26371 minute: minute46,
26372 second: second46,
26373 nanosecond: nanosecond46,
26374 } = time44;
26375 *base.add(20).cast::<u8>() = (_rt::as_i32(hour46)) as u8;
26376 *base.add(21).cast::<u8>() = (_rt::as_i32(minute46)) as u8;
26377 *base.add(22).cast::<u8>() = (_rt::as_i32(second46)) as u8;
26378 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond46);
26379 }
26380 Tsbound::Unbounded => {
26381 *base.add(8).cast::<u8>() = (2i32) as u8;
26382 }
26383 }
26384 match end40 {
26385 Tsbound::Included(e) => {
26386 *base.add(28).cast::<u8>() = (0i32) as u8;
26387 let super::super::super::golem::rdbms::types::Timestamp {
26388 date: date47,
26389 time: time47,
26390 } = e;
26391 let super::super::super::golem::rdbms::types::Date {
26392 year: year48,
26393 month: month48,
26394 day: day48,
26395 } = date47;
26396 *base.add(32).cast::<i32>() = _rt::as_i32(year48);
26397 *base.add(36).cast::<u8>() = (_rt::as_i32(month48)) as u8;
26398 *base.add(37).cast::<u8>() = (_rt::as_i32(day48)) as u8;
26399 let super::super::super::golem::rdbms::types::Time {
26400 hour: hour49,
26401 minute: minute49,
26402 second: second49,
26403 nanosecond: nanosecond49,
26404 } = time47;
26405 *base.add(40).cast::<u8>() = (_rt::as_i32(hour49)) as u8;
26406 *base.add(41).cast::<u8>() = (_rt::as_i32(minute49)) as u8;
26407 *base.add(42).cast::<u8>() = (_rt::as_i32(second49)) as u8;
26408 *base.add(44).cast::<i32>() = _rt::as_i32(nanosecond49);
26409 }
26410 Tsbound::Excluded(e) => {
26411 *base.add(28).cast::<u8>() = (1i32) as u8;
26412 let super::super::super::golem::rdbms::types::Timestamp {
26413 date: date50,
26414 time: time50,
26415 } = e;
26416 let super::super::super::golem::rdbms::types::Date {
26417 year: year51,
26418 month: month51,
26419 day: day51,
26420 } = date50;
26421 *base.add(32).cast::<i32>() = _rt::as_i32(year51);
26422 *base.add(36).cast::<u8>() = (_rt::as_i32(month51)) as u8;
26423 *base.add(37).cast::<u8>() = (_rt::as_i32(day51)) as u8;
26424 let super::super::super::golem::rdbms::types::Time {
26425 hour: hour52,
26426 minute: minute52,
26427 second: second52,
26428 nanosecond: nanosecond52,
26429 } = time50;
26430 *base.add(40).cast::<u8>() = (_rt::as_i32(hour52)) as u8;
26431 *base.add(41).cast::<u8>() = (_rt::as_i32(minute52)) as u8;
26432 *base.add(42).cast::<u8>() = (_rt::as_i32(second52)) as u8;
26433 *base.add(44).cast::<i32>() = _rt::as_i32(nanosecond52);
26434 }
26435 Tsbound::Unbounded => {
26436 *base.add(28).cast::<u8>() = (2i32) as u8;
26437 }
26438 }
26439 }
26440 DbValue::Tstzrange(e) => {
26441 *base.add(0).cast::<u8>() = (32i32) as u8;
26442 let Tstzrange { start: start53, end: end53 } = e;
26443 match start53 {
26444 Tstzbound::Included(e) => {
26445 *base.add(8).cast::<u8>() = (0i32) as u8;
26446 let super::super::super::golem::rdbms::types::Timestamptz {
26447 timestamp: timestamp54,
26448 offset: offset54,
26449 } = e;
26450 let super::super::super::golem::rdbms::types::Timestamp {
26451 date: date55,
26452 time: time55,
26453 } = timestamp54;
26454 let super::super::super::golem::rdbms::types::Date {
26455 year: year56,
26456 month: month56,
26457 day: day56,
26458 } = date55;
26459 *base.add(12).cast::<i32>() = _rt::as_i32(year56);
26460 *base.add(16).cast::<u8>() = (_rt::as_i32(month56)) as u8;
26461 *base.add(17).cast::<u8>() = (_rt::as_i32(day56)) as u8;
26462 let super::super::super::golem::rdbms::types::Time {
26463 hour: hour57,
26464 minute: minute57,
26465 second: second57,
26466 nanosecond: nanosecond57,
26467 } = time55;
26468 *base.add(20).cast::<u8>() = (_rt::as_i32(hour57)) as u8;
26469 *base.add(21).cast::<u8>() = (_rt::as_i32(minute57)) as u8;
26470 *base.add(22).cast::<u8>() = (_rt::as_i32(second57)) as u8;
26471 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond57);
26472 *base.add(28).cast::<i32>() = _rt::as_i32(offset54);
26473 }
26474 Tstzbound::Excluded(e) => {
26475 *base.add(8).cast::<u8>() = (1i32) as u8;
26476 let super::super::super::golem::rdbms::types::Timestamptz {
26477 timestamp: timestamp58,
26478 offset: offset58,
26479 } = e;
26480 let super::super::super::golem::rdbms::types::Timestamp {
26481 date: date59,
26482 time: time59,
26483 } = timestamp58;
26484 let super::super::super::golem::rdbms::types::Date {
26485 year: year60,
26486 month: month60,
26487 day: day60,
26488 } = date59;
26489 *base.add(12).cast::<i32>() = _rt::as_i32(year60);
26490 *base.add(16).cast::<u8>() = (_rt::as_i32(month60)) as u8;
26491 *base.add(17).cast::<u8>() = (_rt::as_i32(day60)) as u8;
26492 let super::super::super::golem::rdbms::types::Time {
26493 hour: hour61,
26494 minute: minute61,
26495 second: second61,
26496 nanosecond: nanosecond61,
26497 } = time59;
26498 *base.add(20).cast::<u8>() = (_rt::as_i32(hour61)) as u8;
26499 *base.add(21).cast::<u8>() = (_rt::as_i32(minute61)) as u8;
26500 *base.add(22).cast::<u8>() = (_rt::as_i32(second61)) as u8;
26501 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond61);
26502 *base.add(28).cast::<i32>() = _rt::as_i32(offset58);
26503 }
26504 Tstzbound::Unbounded => {
26505 *base.add(8).cast::<u8>() = (2i32) as u8;
26506 }
26507 }
26508 match end53 {
26509 Tstzbound::Included(e) => {
26510 *base.add(32).cast::<u8>() = (0i32) as u8;
26511 let super::super::super::golem::rdbms::types::Timestamptz {
26512 timestamp: timestamp62,
26513 offset: offset62,
26514 } = e;
26515 let super::super::super::golem::rdbms::types::Timestamp {
26516 date: date63,
26517 time: time63,
26518 } = timestamp62;
26519 let super::super::super::golem::rdbms::types::Date {
26520 year: year64,
26521 month: month64,
26522 day: day64,
26523 } = date63;
26524 *base.add(36).cast::<i32>() = _rt::as_i32(year64);
26525 *base.add(40).cast::<u8>() = (_rt::as_i32(month64)) as u8;
26526 *base.add(41).cast::<u8>() = (_rt::as_i32(day64)) as u8;
26527 let super::super::super::golem::rdbms::types::Time {
26528 hour: hour65,
26529 minute: minute65,
26530 second: second65,
26531 nanosecond: nanosecond65,
26532 } = time63;
26533 *base.add(44).cast::<u8>() = (_rt::as_i32(hour65)) as u8;
26534 *base.add(45).cast::<u8>() = (_rt::as_i32(minute65)) as u8;
26535 *base.add(46).cast::<u8>() = (_rt::as_i32(second65)) as u8;
26536 *base.add(48).cast::<i32>() = _rt::as_i32(nanosecond65);
26537 *base.add(52).cast::<i32>() = _rt::as_i32(offset62);
26538 }
26539 Tstzbound::Excluded(e) => {
26540 *base.add(32).cast::<u8>() = (1i32) as u8;
26541 let super::super::super::golem::rdbms::types::Timestamptz {
26542 timestamp: timestamp66,
26543 offset: offset66,
26544 } = e;
26545 let super::super::super::golem::rdbms::types::Timestamp {
26546 date: date67,
26547 time: time67,
26548 } = timestamp66;
26549 let super::super::super::golem::rdbms::types::Date {
26550 year: year68,
26551 month: month68,
26552 day: day68,
26553 } = date67;
26554 *base.add(36).cast::<i32>() = _rt::as_i32(year68);
26555 *base.add(40).cast::<u8>() = (_rt::as_i32(month68)) as u8;
26556 *base.add(41).cast::<u8>() = (_rt::as_i32(day68)) as u8;
26557 let super::super::super::golem::rdbms::types::Time {
26558 hour: hour69,
26559 minute: minute69,
26560 second: second69,
26561 nanosecond: nanosecond69,
26562 } = time67;
26563 *base.add(44).cast::<u8>() = (_rt::as_i32(hour69)) as u8;
26564 *base.add(45).cast::<u8>() = (_rt::as_i32(minute69)) as u8;
26565 *base.add(46).cast::<u8>() = (_rt::as_i32(second69)) as u8;
26566 *base.add(48).cast::<i32>() = _rt::as_i32(nanosecond69);
26567 *base.add(52).cast::<i32>() = _rt::as_i32(offset66);
26568 }
26569 Tstzbound::Unbounded => {
26570 *base.add(32).cast::<u8>() = (2i32) as u8;
26571 }
26572 }
26573 }
26574 DbValue::Daterange(e) => {
26575 *base.add(0).cast::<u8>() = (33i32) as u8;
26576 let Daterange { start: start70, end: end70 } = e;
26577 match start70 {
26578 Datebound::Included(e) => {
26579 *base.add(8).cast::<u8>() = (0i32) as u8;
26580 let super::super::super::golem::rdbms::types::Date {
26581 year: year71,
26582 month: month71,
26583 day: day71,
26584 } = e;
26585 *base.add(12).cast::<i32>() = _rt::as_i32(year71);
26586 *base.add(16).cast::<u8>() = (_rt::as_i32(month71)) as u8;
26587 *base.add(17).cast::<u8>() = (_rt::as_i32(day71)) as u8;
26588 }
26589 Datebound::Excluded(e) => {
26590 *base.add(8).cast::<u8>() = (1i32) as u8;
26591 let super::super::super::golem::rdbms::types::Date {
26592 year: year72,
26593 month: month72,
26594 day: day72,
26595 } = e;
26596 *base.add(12).cast::<i32>() = _rt::as_i32(year72);
26597 *base.add(16).cast::<u8>() = (_rt::as_i32(month72)) as u8;
26598 *base.add(17).cast::<u8>() = (_rt::as_i32(day72)) as u8;
26599 }
26600 Datebound::Unbounded => {
26601 *base.add(8).cast::<u8>() = (2i32) as u8;
26602 }
26603 }
26604 match end70 {
26605 Datebound::Included(e) => {
26606 *base.add(20).cast::<u8>() = (0i32) as u8;
26607 let super::super::super::golem::rdbms::types::Date {
26608 year: year73,
26609 month: month73,
26610 day: day73,
26611 } = e;
26612 *base.add(24).cast::<i32>() = _rt::as_i32(year73);
26613 *base.add(28).cast::<u8>() = (_rt::as_i32(month73)) as u8;
26614 *base.add(29).cast::<u8>() = (_rt::as_i32(day73)) as u8;
26615 }
26616 Datebound::Excluded(e) => {
26617 *base.add(20).cast::<u8>() = (1i32) as u8;
26618 let super::super::super::golem::rdbms::types::Date {
26619 year: year74,
26620 month: month74,
26621 day: day74,
26622 } = e;
26623 *base.add(24).cast::<i32>() = _rt::as_i32(year74);
26624 *base.add(28).cast::<u8>() = (_rt::as_i32(month74)) as u8;
26625 *base.add(29).cast::<u8>() = (_rt::as_i32(day74)) as u8;
26626 }
26627 Datebound::Unbounded => {
26628 *base.add(20).cast::<u8>() = (2i32) as u8;
26629 }
26630 }
26631 }
26632 DbValue::Money(e) => {
26633 *base.add(0).cast::<u8>() = (34i32) as u8;
26634 *base.add(8).cast::<i64>() = _rt::as_i64(e);
26635 }
26636 DbValue::Oid(e) => {
26637 *base.add(0).cast::<u8>() = (35i32) as u8;
26638 *base.add(8).cast::<i32>() = _rt::as_i32(e);
26639 }
26640 DbValue::Enumeration(e) => {
26641 *base.add(0).cast::<u8>() = (36i32) as u8;
26642 let Enumeration { name: name75, value: value75 } = e;
26643 let vec76 = name75;
26644 let ptr76 = vec76.as_ptr().cast::<u8>();
26645 let len76 = vec76.len();
26646 *base.add(12).cast::<usize>() = len76;
26647 *base.add(8).cast::<*mut u8>() = ptr76.cast_mut();
26648 let vec77 = value75;
26649 let ptr77 = vec77.as_ptr().cast::<u8>();
26650 let len77 = vec77.len();
26651 *base.add(20).cast::<usize>() = len77;
26652 *base.add(16).cast::<*mut u8>() = ptr77.cast_mut();
26653 }
26654 DbValue::Composite(e) => {
26655 *base.add(0).cast::<u8>() = (37i32) as u8;
26656 let Composite { name: name78, values: values78 } = e;
26657 let vec79 = name78;
26658 let ptr79 = vec79.as_ptr().cast::<u8>();
26659 let len79 = vec79.len();
26660 *base.add(12).cast::<usize>() = len79;
26661 *base.add(8).cast::<*mut u8>() = ptr79.cast_mut();
26662 let vec80 = values78;
26663 let len80 = vec80.len();
26664 let layout80 = _rt::alloc::Layout::from_size_align_unchecked(
26665 vec80.len() * 4,
26666 4,
26667 );
26668 let result80 = if layout80.size() != 0 {
26669 let ptr = _rt::alloc::alloc(layout80).cast::<u8>();
26670 if ptr.is_null() {
26671 _rt::alloc::handle_alloc_error(layout80);
26672 }
26673 ptr
26674 } else {
26675 ::core::ptr::null_mut()
26676 };
26677 for (i, e) in vec80.into_iter().enumerate() {
26678 let base = result80.add(i * 4);
26679 {
26680 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
26681 }
26682 }
26683 *base.add(20).cast::<usize>() = len80;
26684 *base.add(16).cast::<*mut u8>() = result80;
26685 cleanup_list.extend_from_slice(&[(result80, layout80)]);
26686 }
26687 DbValue::Domain(e) => {
26688 *base.add(0).cast::<u8>() = (38i32) as u8;
26689 let Domain { name: name81, value: value81 } = e;
26690 let vec82 = name81;
26691 let ptr82 = vec82.as_ptr().cast::<u8>();
26692 let len82 = vec82.len();
26693 *base.add(12).cast::<usize>() = len82;
26694 *base.add(8).cast::<*mut u8>() = ptr82.cast_mut();
26695 *base.add(16).cast::<i32>() = (value81).take_handle()
26696 as i32;
26697 }
26698 DbValue::Array(e) => {
26699 *base.add(0).cast::<u8>() = (39i32) as u8;
26700 let vec83 = e;
26701 let len83 = vec83.len();
26702 let layout83 = _rt::alloc::Layout::from_size_align_unchecked(
26703 vec83.len() * 4,
26704 4,
26705 );
26706 let result83 = if layout83.size() != 0 {
26707 let ptr = _rt::alloc::alloc(layout83).cast::<u8>();
26708 if ptr.is_null() {
26709 _rt::alloc::handle_alloc_error(layout83);
26710 }
26711 ptr
26712 } else {
26713 ::core::ptr::null_mut()
26714 };
26715 for (i, e) in vec83.into_iter().enumerate() {
26716 let base = result83.add(i * 4);
26717 {
26718 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
26719 }
26720 }
26721 *base.add(12).cast::<usize>() = len83;
26722 *base.add(8).cast::<*mut u8>() = result83;
26723 cleanup_list.extend_from_slice(&[(result83, layout83)]);
26724 }
26725 DbValue::Range(e) => {
26726 *base.add(0).cast::<u8>() = (40i32) as u8;
26727 let Range { name: name84, value: value84 } = e;
26728 let vec85 = name84;
26729 let ptr85 = vec85.as_ptr().cast::<u8>();
26730 let len85 = vec85.len();
26731 *base.add(12).cast::<usize>() = len85;
26732 *base.add(8).cast::<*mut u8>() = ptr85.cast_mut();
26733 let ValuesRange { start: start86, end: end86 } = value84;
26734 match start86 {
26735 ValueBound::Included(e) => {
26736 *base.add(16).cast::<u8>() = (0i32) as u8;
26737 *base.add(20).cast::<i32>() = (e).take_handle() as i32;
26738 }
26739 ValueBound::Excluded(e) => {
26740 *base.add(16).cast::<u8>() = (1i32) as u8;
26741 *base.add(20).cast::<i32>() = (e).take_handle() as i32;
26742 }
26743 ValueBound::Unbounded => {
26744 *base.add(16).cast::<u8>() = (2i32) as u8;
26745 }
26746 }
26747 match end86 {
26748 ValueBound::Included(e) => {
26749 *base.add(24).cast::<u8>() = (0i32) as u8;
26750 *base.add(28).cast::<i32>() = (e).take_handle() as i32;
26751 }
26752 ValueBound::Excluded(e) => {
26753 *base.add(24).cast::<u8>() = (1i32) as u8;
26754 *base.add(28).cast::<i32>() = (e).take_handle() as i32;
26755 }
26756 ValueBound::Unbounded => {
26757 *base.add(24).cast::<u8>() = (2i32) as u8;
26758 }
26759 }
26760 }
26761 DbValue::Null => {
26762 *base.add(0).cast::<u8>() = (41i32) as u8;
26763 }
26764 }
26765 }
26766 }
26767 let ptr88 = ret_area.0.as_mut_ptr().cast::<u8>();
26768 #[cfg(target_arch = "wasm32")]
26769 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
26770 extern "C" {
26771 #[link_name = "[method]db-connection.execute"]
26772 fn wit_import(
26773 _: i32,
26774 _: *mut u8,
26775 _: usize,
26776 _: *mut u8,
26777 _: usize,
26778 _: *mut u8,
26779 );
26780 }
26781 #[cfg(not(target_arch = "wasm32"))]
26782 fn wit_import(
26783 _: i32,
26784 _: *mut u8,
26785 _: usize,
26786 _: *mut u8,
26787 _: usize,
26788 _: *mut u8,
26789 ) {
26790 unreachable!()
26791 }
26792 wit_import(
26793 (self).handle() as i32,
26794 ptr0.cast_mut(),
26795 len0,
26796 result87,
26797 len87,
26798 ptr88,
26799 );
26800 let l89 = i32::from(*ptr88.add(0).cast::<u8>());
26801 if layout87.size() != 0 {
26802 _rt::alloc::dealloc(result87.cast(), layout87);
26803 }
26804 for (ptr, layout) in cleanup_list {
26805 if layout.size() != 0 {
26806 _rt::alloc::dealloc(ptr.cast(), layout);
26807 }
26808 }
26809 match l89 {
26810 0 => {
26811 let e = {
26812 let l90 = *ptr88.add(8).cast::<i64>();
26813 l90 as u64
26814 };
26815 Ok(e)
26816 }
26817 1 => {
26818 let e = {
26819 let l91 = i32::from(*ptr88.add(8).cast::<u8>());
26820 let v107 = match l91 {
26821 0 => {
26822 let e107 = {
26823 let l92 = *ptr88.add(12).cast::<*mut u8>();
26824 let l93 = *ptr88.add(16).cast::<usize>();
26825 let len94 = l93;
26826 let bytes94 = _rt::Vec::from_raw_parts(
26827 l92.cast(),
26828 len94,
26829 len94,
26830 );
26831 _rt::string_lift(bytes94)
26832 };
26833 Error::ConnectionFailure(e107)
26834 }
26835 1 => {
26836 let e107 = {
26837 let l95 = *ptr88.add(12).cast::<*mut u8>();
26838 let l96 = *ptr88.add(16).cast::<usize>();
26839 let len97 = l96;
26840 let bytes97 = _rt::Vec::from_raw_parts(
26841 l95.cast(),
26842 len97,
26843 len97,
26844 );
26845 _rt::string_lift(bytes97)
26846 };
26847 Error::QueryParameterFailure(e107)
26848 }
26849 2 => {
26850 let e107 = {
26851 let l98 = *ptr88.add(12).cast::<*mut u8>();
26852 let l99 = *ptr88.add(16).cast::<usize>();
26853 let len100 = l99;
26854 let bytes100 = _rt::Vec::from_raw_parts(
26855 l98.cast(),
26856 len100,
26857 len100,
26858 );
26859 _rt::string_lift(bytes100)
26860 };
26861 Error::QueryExecutionFailure(e107)
26862 }
26863 3 => {
26864 let e107 = {
26865 let l101 = *ptr88.add(12).cast::<*mut u8>();
26866 let l102 = *ptr88.add(16).cast::<usize>();
26867 let len103 = l102;
26868 let bytes103 = _rt::Vec::from_raw_parts(
26869 l101.cast(),
26870 len103,
26871 len103,
26872 );
26873 _rt::string_lift(bytes103)
26874 };
26875 Error::QueryResponseFailure(e107)
26876 }
26877 n => {
26878 debug_assert_eq!(n, 4, "invalid enum discriminant");
26879 let e107 = {
26880 let l104 = *ptr88.add(12).cast::<*mut u8>();
26881 let l105 = *ptr88.add(16).cast::<usize>();
26882 let len106 = l105;
26883 let bytes106 = _rt::Vec::from_raw_parts(
26884 l104.cast(),
26885 len106,
26886 len106,
26887 );
26888 _rt::string_lift(bytes106)
26889 };
26890 Error::Other(e107)
26891 }
26892 };
26893 v107
26894 };
26895 Err(e)
26896 }
26897 _ => _rt::invalid_enum_discriminant(),
26898 }
26899 }
26900 }
26901 }
26902 impl DbConnection {
26903 #[allow(unused_unsafe, clippy::all)]
26904 pub fn begin_transaction(&self) -> Result<DbTransaction, Error> {
26905 unsafe {
26906 #[repr(align(4))]
26907 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
26908 let mut ret_area = RetArea(
26909 [::core::mem::MaybeUninit::uninit(); 16],
26910 );
26911 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
26912 #[cfg(target_arch = "wasm32")]
26913 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
26914 extern "C" {
26915 #[link_name = "[method]db-connection.begin-transaction"]
26916 fn wit_import(_: i32, _: *mut u8);
26917 }
26918 #[cfg(not(target_arch = "wasm32"))]
26919 fn wit_import(_: i32, _: *mut u8) {
26920 unreachable!()
26921 }
26922 wit_import((self).handle() as i32, ptr0);
26923 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
26924 match l1 {
26925 0 => {
26926 let e = {
26927 let l2 = *ptr0.add(4).cast::<i32>();
26928 DbTransaction::from_handle(l2 as u32)
26929 };
26930 Ok(e)
26931 }
26932 1 => {
26933 let e = {
26934 let l3 = i32::from(*ptr0.add(4).cast::<u8>());
26935 let v19 = match l3 {
26936 0 => {
26937 let e19 = {
26938 let l4 = *ptr0.add(8).cast::<*mut u8>();
26939 let l5 = *ptr0.add(12).cast::<usize>();
26940 let len6 = l5;
26941 let bytes6 = _rt::Vec::from_raw_parts(
26942 l4.cast(),
26943 len6,
26944 len6,
26945 );
26946 _rt::string_lift(bytes6)
26947 };
26948 Error::ConnectionFailure(e19)
26949 }
26950 1 => {
26951 let e19 = {
26952 let l7 = *ptr0.add(8).cast::<*mut u8>();
26953 let l8 = *ptr0.add(12).cast::<usize>();
26954 let len9 = l8;
26955 let bytes9 = _rt::Vec::from_raw_parts(
26956 l7.cast(),
26957 len9,
26958 len9,
26959 );
26960 _rt::string_lift(bytes9)
26961 };
26962 Error::QueryParameterFailure(e19)
26963 }
26964 2 => {
26965 let e19 = {
26966 let l10 = *ptr0.add(8).cast::<*mut u8>();
26967 let l11 = *ptr0.add(12).cast::<usize>();
26968 let len12 = l11;
26969 let bytes12 = _rt::Vec::from_raw_parts(
26970 l10.cast(),
26971 len12,
26972 len12,
26973 );
26974 _rt::string_lift(bytes12)
26975 };
26976 Error::QueryExecutionFailure(e19)
26977 }
26978 3 => {
26979 let e19 = {
26980 let l13 = *ptr0.add(8).cast::<*mut u8>();
26981 let l14 = *ptr0.add(12).cast::<usize>();
26982 let len15 = l14;
26983 let bytes15 = _rt::Vec::from_raw_parts(
26984 l13.cast(),
26985 len15,
26986 len15,
26987 );
26988 _rt::string_lift(bytes15)
26989 };
26990 Error::QueryResponseFailure(e19)
26991 }
26992 n => {
26993 debug_assert_eq!(n, 4, "invalid enum discriminant");
26994 let e19 = {
26995 let l16 = *ptr0.add(8).cast::<*mut u8>();
26996 let l17 = *ptr0.add(12).cast::<usize>();
26997 let len18 = l17;
26998 let bytes18 = _rt::Vec::from_raw_parts(
26999 l16.cast(),
27000 len18,
27001 len18,
27002 );
27003 _rt::string_lift(bytes18)
27004 };
27005 Error::Other(e19)
27006 }
27007 };
27008 v19
27009 };
27010 Err(e)
27011 }
27012 _ => _rt::invalid_enum_discriminant(),
27013 }
27014 }
27015 }
27016 }
27017 impl DbTransaction {
27018 #[allow(unused_unsafe, clippy::all)]
27019 pub fn query(
27020 &self,
27021 statement: &str,
27022 params: _rt::Vec<DbValue>,
27023 ) -> Result<DbResult, Error> {
27024 unsafe {
27025 let mut cleanup_list = _rt::Vec::new();
27026 #[repr(align(4))]
27027 struct RetArea([::core::mem::MaybeUninit<u8>; 20]);
27028 let mut ret_area = RetArea(
27029 [::core::mem::MaybeUninit::uninit(); 20],
27030 );
27031 let vec0 = statement;
27032 let ptr0 = vec0.as_ptr().cast::<u8>();
27033 let len0 = vec0.len();
27034 let vec87 = ¶ms;
27035 let len87 = vec87.len();
27036 let layout87 = _rt::alloc::Layout::from_size_align_unchecked(
27037 vec87.len() * 56,
27038 8,
27039 );
27040 let result87 = if layout87.size() != 0 {
27041 let ptr = _rt::alloc::alloc(layout87).cast::<u8>();
27042 if ptr.is_null() {
27043 _rt::alloc::handle_alloc_error(layout87);
27044 }
27045 ptr
27046 } else {
27047 ::core::ptr::null_mut()
27048 };
27049 for (i, e) in vec87.into_iter().enumerate() {
27050 let base = result87.add(i * 56);
27051 {
27052 match e {
27053 DbValue::Character(e) => {
27054 *base.add(0).cast::<u8>() = (0i32) as u8;
27055 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
27056 }
27057 DbValue::Int2(e) => {
27058 *base.add(0).cast::<u8>() = (1i32) as u8;
27059 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
27060 }
27061 DbValue::Int4(e) => {
27062 *base.add(0).cast::<u8>() = (2i32) as u8;
27063 *base.add(8).cast::<i32>() = _rt::as_i32(e);
27064 }
27065 DbValue::Int8(e) => {
27066 *base.add(0).cast::<u8>() = (3i32) as u8;
27067 *base.add(8).cast::<i64>() = _rt::as_i64(e);
27068 }
27069 DbValue::Float4(e) => {
27070 *base.add(0).cast::<u8>() = (4i32) as u8;
27071 *base.add(8).cast::<f32>() = _rt::as_f32(e);
27072 }
27073 DbValue::Float8(e) => {
27074 *base.add(0).cast::<u8>() = (5i32) as u8;
27075 *base.add(8).cast::<f64>() = _rt::as_f64(e);
27076 }
27077 DbValue::Numeric(e) => {
27078 *base.add(0).cast::<u8>() = (6i32) as u8;
27079 let vec1 = e;
27080 let ptr1 = vec1.as_ptr().cast::<u8>();
27081 let len1 = vec1.len();
27082 *base.add(12).cast::<usize>() = len1;
27083 *base.add(8).cast::<*mut u8>() = ptr1.cast_mut();
27084 }
27085 DbValue::Boolean(e) => {
27086 *base.add(0).cast::<u8>() = (7i32) as u8;
27087 *base.add(8).cast::<u8>() = (match e {
27088 true => 1,
27089 false => 0,
27090 }) as u8;
27091 }
27092 DbValue::Text(e) => {
27093 *base.add(0).cast::<u8>() = (8i32) as u8;
27094 let vec2 = e;
27095 let ptr2 = vec2.as_ptr().cast::<u8>();
27096 let len2 = vec2.len();
27097 *base.add(12).cast::<usize>() = len2;
27098 *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
27099 }
27100 DbValue::Varchar(e) => {
27101 *base.add(0).cast::<u8>() = (9i32) as u8;
27102 let vec3 = e;
27103 let ptr3 = vec3.as_ptr().cast::<u8>();
27104 let len3 = vec3.len();
27105 *base.add(12).cast::<usize>() = len3;
27106 *base.add(8).cast::<*mut u8>() = ptr3.cast_mut();
27107 }
27108 DbValue::Bpchar(e) => {
27109 *base.add(0).cast::<u8>() = (10i32) as u8;
27110 let vec4 = e;
27111 let ptr4 = vec4.as_ptr().cast::<u8>();
27112 let len4 = vec4.len();
27113 *base.add(12).cast::<usize>() = len4;
27114 *base.add(8).cast::<*mut u8>() = ptr4.cast_mut();
27115 }
27116 DbValue::Timestamp(e) => {
27117 *base.add(0).cast::<u8>() = (11i32) as u8;
27118 let super::super::super::golem::rdbms::types::Timestamp {
27119 date: date5,
27120 time: time5,
27121 } = e;
27122 let super::super::super::golem::rdbms::types::Date {
27123 year: year6,
27124 month: month6,
27125 day: day6,
27126 } = date5;
27127 *base.add(8).cast::<i32>() = _rt::as_i32(year6);
27128 *base.add(12).cast::<u8>() = (_rt::as_i32(month6)) as u8;
27129 *base.add(13).cast::<u8>() = (_rt::as_i32(day6)) as u8;
27130 let super::super::super::golem::rdbms::types::Time {
27131 hour: hour7,
27132 minute: minute7,
27133 second: second7,
27134 nanosecond: nanosecond7,
27135 } = time5;
27136 *base.add(16).cast::<u8>() = (_rt::as_i32(hour7)) as u8;
27137 *base.add(17).cast::<u8>() = (_rt::as_i32(minute7)) as u8;
27138 *base.add(18).cast::<u8>() = (_rt::as_i32(second7)) as u8;
27139 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond7);
27140 }
27141 DbValue::Timestamptz(e) => {
27142 *base.add(0).cast::<u8>() = (12i32) as u8;
27143 let super::super::super::golem::rdbms::types::Timestamptz {
27144 timestamp: timestamp8,
27145 offset: offset8,
27146 } = e;
27147 let super::super::super::golem::rdbms::types::Timestamp {
27148 date: date9,
27149 time: time9,
27150 } = timestamp8;
27151 let super::super::super::golem::rdbms::types::Date {
27152 year: year10,
27153 month: month10,
27154 day: day10,
27155 } = date9;
27156 *base.add(8).cast::<i32>() = _rt::as_i32(year10);
27157 *base.add(12).cast::<u8>() = (_rt::as_i32(month10)) as u8;
27158 *base.add(13).cast::<u8>() = (_rt::as_i32(day10)) as u8;
27159 let super::super::super::golem::rdbms::types::Time {
27160 hour: hour11,
27161 minute: minute11,
27162 second: second11,
27163 nanosecond: nanosecond11,
27164 } = time9;
27165 *base.add(16).cast::<u8>() = (_rt::as_i32(hour11)) as u8;
27166 *base.add(17).cast::<u8>() = (_rt::as_i32(minute11)) as u8;
27167 *base.add(18).cast::<u8>() = (_rt::as_i32(second11)) as u8;
27168 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond11);
27169 *base.add(24).cast::<i32>() = _rt::as_i32(offset8);
27170 }
27171 DbValue::Date(e) => {
27172 *base.add(0).cast::<u8>() = (13i32) as u8;
27173 let super::super::super::golem::rdbms::types::Date {
27174 year: year12,
27175 month: month12,
27176 day: day12,
27177 } = e;
27178 *base.add(8).cast::<i32>() = _rt::as_i32(year12);
27179 *base.add(12).cast::<u8>() = (_rt::as_i32(month12)) as u8;
27180 *base.add(13).cast::<u8>() = (_rt::as_i32(day12)) as u8;
27181 }
27182 DbValue::Time(e) => {
27183 *base.add(0).cast::<u8>() = (14i32) as u8;
27184 let super::super::super::golem::rdbms::types::Time {
27185 hour: hour13,
27186 minute: minute13,
27187 second: second13,
27188 nanosecond: nanosecond13,
27189 } = e;
27190 *base.add(8).cast::<u8>() = (_rt::as_i32(hour13)) as u8;
27191 *base.add(9).cast::<u8>() = (_rt::as_i32(minute13)) as u8;
27192 *base.add(10).cast::<u8>() = (_rt::as_i32(second13)) as u8;
27193 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond13);
27194 }
27195 DbValue::Timetz(e) => {
27196 *base.add(0).cast::<u8>() = (15i32) as u8;
27197 let super::super::super::golem::rdbms::types::Timetz {
27198 time: time14,
27199 offset: offset14,
27200 } = e;
27201 let super::super::super::golem::rdbms::types::Time {
27202 hour: hour15,
27203 minute: minute15,
27204 second: second15,
27205 nanosecond: nanosecond15,
27206 } = time14;
27207 *base.add(8).cast::<u8>() = (_rt::as_i32(hour15)) as u8;
27208 *base.add(9).cast::<u8>() = (_rt::as_i32(minute15)) as u8;
27209 *base.add(10).cast::<u8>() = (_rt::as_i32(second15)) as u8;
27210 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond15);
27211 *base.add(16).cast::<i32>() = _rt::as_i32(offset14);
27212 }
27213 DbValue::Interval(e) => {
27214 *base.add(0).cast::<u8>() = (16i32) as u8;
27215 let Interval {
27216 months: months16,
27217 days: days16,
27218 microseconds: microseconds16,
27219 } = e;
27220 *base.add(8).cast::<i32>() = _rt::as_i32(months16);
27221 *base.add(12).cast::<i32>() = _rt::as_i32(days16);
27222 *base.add(16).cast::<i64>() = _rt::as_i64(microseconds16);
27223 }
27224 DbValue::Bytea(e) => {
27225 *base.add(0).cast::<u8>() = (17i32) as u8;
27226 let vec17 = e;
27227 let ptr17 = vec17.as_ptr().cast::<u8>();
27228 let len17 = vec17.len();
27229 *base.add(12).cast::<usize>() = len17;
27230 *base.add(8).cast::<*mut u8>() = ptr17.cast_mut();
27231 }
27232 DbValue::Json(e) => {
27233 *base.add(0).cast::<u8>() = (18i32) as u8;
27234 let vec18 = e;
27235 let ptr18 = vec18.as_ptr().cast::<u8>();
27236 let len18 = vec18.len();
27237 *base.add(12).cast::<usize>() = len18;
27238 *base.add(8).cast::<*mut u8>() = ptr18.cast_mut();
27239 }
27240 DbValue::Jsonb(e) => {
27241 *base.add(0).cast::<u8>() = (19i32) as u8;
27242 let vec19 = e;
27243 let ptr19 = vec19.as_ptr().cast::<u8>();
27244 let len19 = vec19.len();
27245 *base.add(12).cast::<usize>() = len19;
27246 *base.add(8).cast::<*mut u8>() = ptr19.cast_mut();
27247 }
27248 DbValue::Jsonpath(e) => {
27249 *base.add(0).cast::<u8>() = (20i32) as u8;
27250 let vec20 = e;
27251 let ptr20 = vec20.as_ptr().cast::<u8>();
27252 let len20 = vec20.len();
27253 *base.add(12).cast::<usize>() = len20;
27254 *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
27255 }
27256 DbValue::Xml(e) => {
27257 *base.add(0).cast::<u8>() = (21i32) as u8;
27258 let vec21 = e;
27259 let ptr21 = vec21.as_ptr().cast::<u8>();
27260 let len21 = vec21.len();
27261 *base.add(12).cast::<usize>() = len21;
27262 *base.add(8).cast::<*mut u8>() = ptr21.cast_mut();
27263 }
27264 DbValue::Uuid(e) => {
27265 *base.add(0).cast::<u8>() = (22i32) as u8;
27266 let super::super::super::golem::rdbms::types::Uuid {
27267 high_bits: high_bits22,
27268 low_bits: low_bits22,
27269 } = e;
27270 *base.add(8).cast::<i64>() = _rt::as_i64(high_bits22);
27271 *base.add(16).cast::<i64>() = _rt::as_i64(low_bits22);
27272 }
27273 DbValue::Inet(e) => {
27274 *base.add(0).cast::<u8>() = (23i32) as u8;
27275 use super::super::super::golem::rdbms::types::IpAddress as V25;
27276 match e {
27277 V25::Ipv4(e) => {
27278 *base.add(8).cast::<u8>() = (0i32) as u8;
27279 let (t23_0, t23_1, t23_2, t23_3) = e;
27280 *base.add(10).cast::<u8>() = (_rt::as_i32(t23_0)) as u8;
27281 *base.add(11).cast::<u8>() = (_rt::as_i32(t23_1)) as u8;
27282 *base.add(12).cast::<u8>() = (_rt::as_i32(t23_2)) as u8;
27283 *base.add(13).cast::<u8>() = (_rt::as_i32(t23_3)) as u8;
27284 }
27285 V25::Ipv6(e) => {
27286 *base.add(8).cast::<u8>() = (1i32) as u8;
27287 let (
27288 t24_0,
27289 t24_1,
27290 t24_2,
27291 t24_3,
27292 t24_4,
27293 t24_5,
27294 t24_6,
27295 t24_7,
27296 ) = e;
27297 *base.add(10).cast::<u16>() = (_rt::as_i32(t24_0)) as u16;
27298 *base.add(12).cast::<u16>() = (_rt::as_i32(t24_1)) as u16;
27299 *base.add(14).cast::<u16>() = (_rt::as_i32(t24_2)) as u16;
27300 *base.add(16).cast::<u16>() = (_rt::as_i32(t24_3)) as u16;
27301 *base.add(18).cast::<u16>() = (_rt::as_i32(t24_4)) as u16;
27302 *base.add(20).cast::<u16>() = (_rt::as_i32(t24_5)) as u16;
27303 *base.add(22).cast::<u16>() = (_rt::as_i32(t24_6)) as u16;
27304 *base.add(24).cast::<u16>() = (_rt::as_i32(t24_7)) as u16;
27305 }
27306 }
27307 }
27308 DbValue::Cidr(e) => {
27309 *base.add(0).cast::<u8>() = (24i32) as u8;
27310 use super::super::super::golem::rdbms::types::IpAddress as V28;
27311 match e {
27312 V28::Ipv4(e) => {
27313 *base.add(8).cast::<u8>() = (0i32) as u8;
27314 let (t26_0, t26_1, t26_2, t26_3) = e;
27315 *base.add(10).cast::<u8>() = (_rt::as_i32(t26_0)) as u8;
27316 *base.add(11).cast::<u8>() = (_rt::as_i32(t26_1)) as u8;
27317 *base.add(12).cast::<u8>() = (_rt::as_i32(t26_2)) as u8;
27318 *base.add(13).cast::<u8>() = (_rt::as_i32(t26_3)) as u8;
27319 }
27320 V28::Ipv6(e) => {
27321 *base.add(8).cast::<u8>() = (1i32) as u8;
27322 let (
27323 t27_0,
27324 t27_1,
27325 t27_2,
27326 t27_3,
27327 t27_4,
27328 t27_5,
27329 t27_6,
27330 t27_7,
27331 ) = e;
27332 *base.add(10).cast::<u16>() = (_rt::as_i32(t27_0)) as u16;
27333 *base.add(12).cast::<u16>() = (_rt::as_i32(t27_1)) as u16;
27334 *base.add(14).cast::<u16>() = (_rt::as_i32(t27_2)) as u16;
27335 *base.add(16).cast::<u16>() = (_rt::as_i32(t27_3)) as u16;
27336 *base.add(18).cast::<u16>() = (_rt::as_i32(t27_4)) as u16;
27337 *base.add(20).cast::<u16>() = (_rt::as_i32(t27_5)) as u16;
27338 *base.add(22).cast::<u16>() = (_rt::as_i32(t27_6)) as u16;
27339 *base.add(24).cast::<u16>() = (_rt::as_i32(t27_7)) as u16;
27340 }
27341 }
27342 }
27343 DbValue::Macaddr(e) => {
27344 *base.add(0).cast::<u8>() = (25i32) as u8;
27345 let super::super::super::golem::rdbms::types::MacAddress {
27346 octets: octets29,
27347 } = e;
27348 let (t30_0, t30_1, t30_2, t30_3, t30_4, t30_5) = octets29;
27349 *base.add(8).cast::<u8>() = (_rt::as_i32(t30_0)) as u8;
27350 *base.add(9).cast::<u8>() = (_rt::as_i32(t30_1)) as u8;
27351 *base.add(10).cast::<u8>() = (_rt::as_i32(t30_2)) as u8;
27352 *base.add(11).cast::<u8>() = (_rt::as_i32(t30_3)) as u8;
27353 *base.add(12).cast::<u8>() = (_rt::as_i32(t30_4)) as u8;
27354 *base.add(13).cast::<u8>() = (_rt::as_i32(t30_5)) as u8;
27355 }
27356 DbValue::Bit(e) => {
27357 *base.add(0).cast::<u8>() = (26i32) as u8;
27358 let vec31 = e;
27359 let len31 = vec31.len();
27360 let layout31 = _rt::alloc::Layout::from_size_align_unchecked(
27361 vec31.len() * 1,
27362 1,
27363 );
27364 let result31 = if layout31.size() != 0 {
27365 let ptr = _rt::alloc::alloc(layout31).cast::<u8>();
27366 if ptr.is_null() {
27367 _rt::alloc::handle_alloc_error(layout31);
27368 }
27369 ptr
27370 } else {
27371 ::core::ptr::null_mut()
27372 };
27373 for (i, e) in vec31.into_iter().enumerate() {
27374 let base = result31.add(i * 1);
27375 {
27376 *base.add(0).cast::<u8>() = (match e {
27377 true => 1,
27378 false => 0,
27379 }) as u8;
27380 }
27381 }
27382 *base.add(12).cast::<usize>() = len31;
27383 *base.add(8).cast::<*mut u8>() = result31;
27384 cleanup_list.extend_from_slice(&[(result31, layout31)]);
27385 }
27386 DbValue::Varbit(e) => {
27387 *base.add(0).cast::<u8>() = (27i32) as u8;
27388 let vec32 = e;
27389 let len32 = vec32.len();
27390 let layout32 = _rt::alloc::Layout::from_size_align_unchecked(
27391 vec32.len() * 1,
27392 1,
27393 );
27394 let result32 = if layout32.size() != 0 {
27395 let ptr = _rt::alloc::alloc(layout32).cast::<u8>();
27396 if ptr.is_null() {
27397 _rt::alloc::handle_alloc_error(layout32);
27398 }
27399 ptr
27400 } else {
27401 ::core::ptr::null_mut()
27402 };
27403 for (i, e) in vec32.into_iter().enumerate() {
27404 let base = result32.add(i * 1);
27405 {
27406 *base.add(0).cast::<u8>() = (match e {
27407 true => 1,
27408 false => 0,
27409 }) as u8;
27410 }
27411 }
27412 *base.add(12).cast::<usize>() = len32;
27413 *base.add(8).cast::<*mut u8>() = result32;
27414 cleanup_list.extend_from_slice(&[(result32, layout32)]);
27415 }
27416 DbValue::Int4range(e) => {
27417 *base.add(0).cast::<u8>() = (28i32) as u8;
27418 let Int4range { start: start33, end: end33 } = e;
27419 match start33 {
27420 Int4bound::Included(e) => {
27421 *base.add(8).cast::<u8>() = (0i32) as u8;
27422 *base.add(12).cast::<i32>() = _rt::as_i32(e);
27423 }
27424 Int4bound::Excluded(e) => {
27425 *base.add(8).cast::<u8>() = (1i32) as u8;
27426 *base.add(12).cast::<i32>() = _rt::as_i32(e);
27427 }
27428 Int4bound::Unbounded => {
27429 *base.add(8).cast::<u8>() = (2i32) as u8;
27430 }
27431 }
27432 match end33 {
27433 Int4bound::Included(e) => {
27434 *base.add(16).cast::<u8>() = (0i32) as u8;
27435 *base.add(20).cast::<i32>() = _rt::as_i32(e);
27436 }
27437 Int4bound::Excluded(e) => {
27438 *base.add(16).cast::<u8>() = (1i32) as u8;
27439 *base.add(20).cast::<i32>() = _rt::as_i32(e);
27440 }
27441 Int4bound::Unbounded => {
27442 *base.add(16).cast::<u8>() = (2i32) as u8;
27443 }
27444 }
27445 }
27446 DbValue::Int8range(e) => {
27447 *base.add(0).cast::<u8>() = (29i32) as u8;
27448 let Int8range { start: start34, end: end34 } = e;
27449 match start34 {
27450 Int8bound::Included(e) => {
27451 *base.add(8).cast::<u8>() = (0i32) as u8;
27452 *base.add(16).cast::<i64>() = _rt::as_i64(e);
27453 }
27454 Int8bound::Excluded(e) => {
27455 *base.add(8).cast::<u8>() = (1i32) as u8;
27456 *base.add(16).cast::<i64>() = _rt::as_i64(e);
27457 }
27458 Int8bound::Unbounded => {
27459 *base.add(8).cast::<u8>() = (2i32) as u8;
27460 }
27461 }
27462 match end34 {
27463 Int8bound::Included(e) => {
27464 *base.add(24).cast::<u8>() = (0i32) as u8;
27465 *base.add(32).cast::<i64>() = _rt::as_i64(e);
27466 }
27467 Int8bound::Excluded(e) => {
27468 *base.add(24).cast::<u8>() = (1i32) as u8;
27469 *base.add(32).cast::<i64>() = _rt::as_i64(e);
27470 }
27471 Int8bound::Unbounded => {
27472 *base.add(24).cast::<u8>() = (2i32) as u8;
27473 }
27474 }
27475 }
27476 DbValue::Numrange(e) => {
27477 *base.add(0).cast::<u8>() = (30i32) as u8;
27478 let Numrange { start: start35, end: end35 } = e;
27479 match start35 {
27480 Numbound::Included(e) => {
27481 *base.add(8).cast::<u8>() = (0i32) as u8;
27482 let vec36 = e;
27483 let ptr36 = vec36.as_ptr().cast::<u8>();
27484 let len36 = vec36.len();
27485 *base.add(16).cast::<usize>() = len36;
27486 *base.add(12).cast::<*mut u8>() = ptr36.cast_mut();
27487 }
27488 Numbound::Excluded(e) => {
27489 *base.add(8).cast::<u8>() = (1i32) as u8;
27490 let vec37 = e;
27491 let ptr37 = vec37.as_ptr().cast::<u8>();
27492 let len37 = vec37.len();
27493 *base.add(16).cast::<usize>() = len37;
27494 *base.add(12).cast::<*mut u8>() = ptr37.cast_mut();
27495 }
27496 Numbound::Unbounded => {
27497 *base.add(8).cast::<u8>() = (2i32) as u8;
27498 }
27499 }
27500 match end35 {
27501 Numbound::Included(e) => {
27502 *base.add(20).cast::<u8>() = (0i32) as u8;
27503 let vec38 = e;
27504 let ptr38 = vec38.as_ptr().cast::<u8>();
27505 let len38 = vec38.len();
27506 *base.add(28).cast::<usize>() = len38;
27507 *base.add(24).cast::<*mut u8>() = ptr38.cast_mut();
27508 }
27509 Numbound::Excluded(e) => {
27510 *base.add(20).cast::<u8>() = (1i32) as u8;
27511 let vec39 = e;
27512 let ptr39 = vec39.as_ptr().cast::<u8>();
27513 let len39 = vec39.len();
27514 *base.add(28).cast::<usize>() = len39;
27515 *base.add(24).cast::<*mut u8>() = ptr39.cast_mut();
27516 }
27517 Numbound::Unbounded => {
27518 *base.add(20).cast::<u8>() = (2i32) as u8;
27519 }
27520 }
27521 }
27522 DbValue::Tsrange(e) => {
27523 *base.add(0).cast::<u8>() = (31i32) as u8;
27524 let Tsrange { start: start40, end: end40 } = e;
27525 match start40 {
27526 Tsbound::Included(e) => {
27527 *base.add(8).cast::<u8>() = (0i32) as u8;
27528 let super::super::super::golem::rdbms::types::Timestamp {
27529 date: date41,
27530 time: time41,
27531 } = e;
27532 let super::super::super::golem::rdbms::types::Date {
27533 year: year42,
27534 month: month42,
27535 day: day42,
27536 } = date41;
27537 *base.add(12).cast::<i32>() = _rt::as_i32(year42);
27538 *base.add(16).cast::<u8>() = (_rt::as_i32(month42)) as u8;
27539 *base.add(17).cast::<u8>() = (_rt::as_i32(day42)) as u8;
27540 let super::super::super::golem::rdbms::types::Time {
27541 hour: hour43,
27542 minute: minute43,
27543 second: second43,
27544 nanosecond: nanosecond43,
27545 } = time41;
27546 *base.add(20).cast::<u8>() = (_rt::as_i32(hour43)) as u8;
27547 *base.add(21).cast::<u8>() = (_rt::as_i32(minute43)) as u8;
27548 *base.add(22).cast::<u8>() = (_rt::as_i32(second43)) as u8;
27549 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond43);
27550 }
27551 Tsbound::Excluded(e) => {
27552 *base.add(8).cast::<u8>() = (1i32) as u8;
27553 let super::super::super::golem::rdbms::types::Timestamp {
27554 date: date44,
27555 time: time44,
27556 } = e;
27557 let super::super::super::golem::rdbms::types::Date {
27558 year: year45,
27559 month: month45,
27560 day: day45,
27561 } = date44;
27562 *base.add(12).cast::<i32>() = _rt::as_i32(year45);
27563 *base.add(16).cast::<u8>() = (_rt::as_i32(month45)) as u8;
27564 *base.add(17).cast::<u8>() = (_rt::as_i32(day45)) as u8;
27565 let super::super::super::golem::rdbms::types::Time {
27566 hour: hour46,
27567 minute: minute46,
27568 second: second46,
27569 nanosecond: nanosecond46,
27570 } = time44;
27571 *base.add(20).cast::<u8>() = (_rt::as_i32(hour46)) as u8;
27572 *base.add(21).cast::<u8>() = (_rt::as_i32(minute46)) as u8;
27573 *base.add(22).cast::<u8>() = (_rt::as_i32(second46)) as u8;
27574 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond46);
27575 }
27576 Tsbound::Unbounded => {
27577 *base.add(8).cast::<u8>() = (2i32) as u8;
27578 }
27579 }
27580 match end40 {
27581 Tsbound::Included(e) => {
27582 *base.add(28).cast::<u8>() = (0i32) as u8;
27583 let super::super::super::golem::rdbms::types::Timestamp {
27584 date: date47,
27585 time: time47,
27586 } = e;
27587 let super::super::super::golem::rdbms::types::Date {
27588 year: year48,
27589 month: month48,
27590 day: day48,
27591 } = date47;
27592 *base.add(32).cast::<i32>() = _rt::as_i32(year48);
27593 *base.add(36).cast::<u8>() = (_rt::as_i32(month48)) as u8;
27594 *base.add(37).cast::<u8>() = (_rt::as_i32(day48)) as u8;
27595 let super::super::super::golem::rdbms::types::Time {
27596 hour: hour49,
27597 minute: minute49,
27598 second: second49,
27599 nanosecond: nanosecond49,
27600 } = time47;
27601 *base.add(40).cast::<u8>() = (_rt::as_i32(hour49)) as u8;
27602 *base.add(41).cast::<u8>() = (_rt::as_i32(minute49)) as u8;
27603 *base.add(42).cast::<u8>() = (_rt::as_i32(second49)) as u8;
27604 *base.add(44).cast::<i32>() = _rt::as_i32(nanosecond49);
27605 }
27606 Tsbound::Excluded(e) => {
27607 *base.add(28).cast::<u8>() = (1i32) as u8;
27608 let super::super::super::golem::rdbms::types::Timestamp {
27609 date: date50,
27610 time: time50,
27611 } = e;
27612 let super::super::super::golem::rdbms::types::Date {
27613 year: year51,
27614 month: month51,
27615 day: day51,
27616 } = date50;
27617 *base.add(32).cast::<i32>() = _rt::as_i32(year51);
27618 *base.add(36).cast::<u8>() = (_rt::as_i32(month51)) as u8;
27619 *base.add(37).cast::<u8>() = (_rt::as_i32(day51)) as u8;
27620 let super::super::super::golem::rdbms::types::Time {
27621 hour: hour52,
27622 minute: minute52,
27623 second: second52,
27624 nanosecond: nanosecond52,
27625 } = time50;
27626 *base.add(40).cast::<u8>() = (_rt::as_i32(hour52)) as u8;
27627 *base.add(41).cast::<u8>() = (_rt::as_i32(minute52)) as u8;
27628 *base.add(42).cast::<u8>() = (_rt::as_i32(second52)) as u8;
27629 *base.add(44).cast::<i32>() = _rt::as_i32(nanosecond52);
27630 }
27631 Tsbound::Unbounded => {
27632 *base.add(28).cast::<u8>() = (2i32) as u8;
27633 }
27634 }
27635 }
27636 DbValue::Tstzrange(e) => {
27637 *base.add(0).cast::<u8>() = (32i32) as u8;
27638 let Tstzrange { start: start53, end: end53 } = e;
27639 match start53 {
27640 Tstzbound::Included(e) => {
27641 *base.add(8).cast::<u8>() = (0i32) as u8;
27642 let super::super::super::golem::rdbms::types::Timestamptz {
27643 timestamp: timestamp54,
27644 offset: offset54,
27645 } = e;
27646 let super::super::super::golem::rdbms::types::Timestamp {
27647 date: date55,
27648 time: time55,
27649 } = timestamp54;
27650 let super::super::super::golem::rdbms::types::Date {
27651 year: year56,
27652 month: month56,
27653 day: day56,
27654 } = date55;
27655 *base.add(12).cast::<i32>() = _rt::as_i32(year56);
27656 *base.add(16).cast::<u8>() = (_rt::as_i32(month56)) as u8;
27657 *base.add(17).cast::<u8>() = (_rt::as_i32(day56)) as u8;
27658 let super::super::super::golem::rdbms::types::Time {
27659 hour: hour57,
27660 minute: minute57,
27661 second: second57,
27662 nanosecond: nanosecond57,
27663 } = time55;
27664 *base.add(20).cast::<u8>() = (_rt::as_i32(hour57)) as u8;
27665 *base.add(21).cast::<u8>() = (_rt::as_i32(minute57)) as u8;
27666 *base.add(22).cast::<u8>() = (_rt::as_i32(second57)) as u8;
27667 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond57);
27668 *base.add(28).cast::<i32>() = _rt::as_i32(offset54);
27669 }
27670 Tstzbound::Excluded(e) => {
27671 *base.add(8).cast::<u8>() = (1i32) as u8;
27672 let super::super::super::golem::rdbms::types::Timestamptz {
27673 timestamp: timestamp58,
27674 offset: offset58,
27675 } = e;
27676 let super::super::super::golem::rdbms::types::Timestamp {
27677 date: date59,
27678 time: time59,
27679 } = timestamp58;
27680 let super::super::super::golem::rdbms::types::Date {
27681 year: year60,
27682 month: month60,
27683 day: day60,
27684 } = date59;
27685 *base.add(12).cast::<i32>() = _rt::as_i32(year60);
27686 *base.add(16).cast::<u8>() = (_rt::as_i32(month60)) as u8;
27687 *base.add(17).cast::<u8>() = (_rt::as_i32(day60)) as u8;
27688 let super::super::super::golem::rdbms::types::Time {
27689 hour: hour61,
27690 minute: minute61,
27691 second: second61,
27692 nanosecond: nanosecond61,
27693 } = time59;
27694 *base.add(20).cast::<u8>() = (_rt::as_i32(hour61)) as u8;
27695 *base.add(21).cast::<u8>() = (_rt::as_i32(minute61)) as u8;
27696 *base.add(22).cast::<u8>() = (_rt::as_i32(second61)) as u8;
27697 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond61);
27698 *base.add(28).cast::<i32>() = _rt::as_i32(offset58);
27699 }
27700 Tstzbound::Unbounded => {
27701 *base.add(8).cast::<u8>() = (2i32) as u8;
27702 }
27703 }
27704 match end53 {
27705 Tstzbound::Included(e) => {
27706 *base.add(32).cast::<u8>() = (0i32) as u8;
27707 let super::super::super::golem::rdbms::types::Timestamptz {
27708 timestamp: timestamp62,
27709 offset: offset62,
27710 } = e;
27711 let super::super::super::golem::rdbms::types::Timestamp {
27712 date: date63,
27713 time: time63,
27714 } = timestamp62;
27715 let super::super::super::golem::rdbms::types::Date {
27716 year: year64,
27717 month: month64,
27718 day: day64,
27719 } = date63;
27720 *base.add(36).cast::<i32>() = _rt::as_i32(year64);
27721 *base.add(40).cast::<u8>() = (_rt::as_i32(month64)) as u8;
27722 *base.add(41).cast::<u8>() = (_rt::as_i32(day64)) as u8;
27723 let super::super::super::golem::rdbms::types::Time {
27724 hour: hour65,
27725 minute: minute65,
27726 second: second65,
27727 nanosecond: nanosecond65,
27728 } = time63;
27729 *base.add(44).cast::<u8>() = (_rt::as_i32(hour65)) as u8;
27730 *base.add(45).cast::<u8>() = (_rt::as_i32(minute65)) as u8;
27731 *base.add(46).cast::<u8>() = (_rt::as_i32(second65)) as u8;
27732 *base.add(48).cast::<i32>() = _rt::as_i32(nanosecond65);
27733 *base.add(52).cast::<i32>() = _rt::as_i32(offset62);
27734 }
27735 Tstzbound::Excluded(e) => {
27736 *base.add(32).cast::<u8>() = (1i32) as u8;
27737 let super::super::super::golem::rdbms::types::Timestamptz {
27738 timestamp: timestamp66,
27739 offset: offset66,
27740 } = e;
27741 let super::super::super::golem::rdbms::types::Timestamp {
27742 date: date67,
27743 time: time67,
27744 } = timestamp66;
27745 let super::super::super::golem::rdbms::types::Date {
27746 year: year68,
27747 month: month68,
27748 day: day68,
27749 } = date67;
27750 *base.add(36).cast::<i32>() = _rt::as_i32(year68);
27751 *base.add(40).cast::<u8>() = (_rt::as_i32(month68)) as u8;
27752 *base.add(41).cast::<u8>() = (_rt::as_i32(day68)) as u8;
27753 let super::super::super::golem::rdbms::types::Time {
27754 hour: hour69,
27755 minute: minute69,
27756 second: second69,
27757 nanosecond: nanosecond69,
27758 } = time67;
27759 *base.add(44).cast::<u8>() = (_rt::as_i32(hour69)) as u8;
27760 *base.add(45).cast::<u8>() = (_rt::as_i32(minute69)) as u8;
27761 *base.add(46).cast::<u8>() = (_rt::as_i32(second69)) as u8;
27762 *base.add(48).cast::<i32>() = _rt::as_i32(nanosecond69);
27763 *base.add(52).cast::<i32>() = _rt::as_i32(offset66);
27764 }
27765 Tstzbound::Unbounded => {
27766 *base.add(32).cast::<u8>() = (2i32) as u8;
27767 }
27768 }
27769 }
27770 DbValue::Daterange(e) => {
27771 *base.add(0).cast::<u8>() = (33i32) as u8;
27772 let Daterange { start: start70, end: end70 } = e;
27773 match start70 {
27774 Datebound::Included(e) => {
27775 *base.add(8).cast::<u8>() = (0i32) as u8;
27776 let super::super::super::golem::rdbms::types::Date {
27777 year: year71,
27778 month: month71,
27779 day: day71,
27780 } = e;
27781 *base.add(12).cast::<i32>() = _rt::as_i32(year71);
27782 *base.add(16).cast::<u8>() = (_rt::as_i32(month71)) as u8;
27783 *base.add(17).cast::<u8>() = (_rt::as_i32(day71)) as u8;
27784 }
27785 Datebound::Excluded(e) => {
27786 *base.add(8).cast::<u8>() = (1i32) as u8;
27787 let super::super::super::golem::rdbms::types::Date {
27788 year: year72,
27789 month: month72,
27790 day: day72,
27791 } = e;
27792 *base.add(12).cast::<i32>() = _rt::as_i32(year72);
27793 *base.add(16).cast::<u8>() = (_rt::as_i32(month72)) as u8;
27794 *base.add(17).cast::<u8>() = (_rt::as_i32(day72)) as u8;
27795 }
27796 Datebound::Unbounded => {
27797 *base.add(8).cast::<u8>() = (2i32) as u8;
27798 }
27799 }
27800 match end70 {
27801 Datebound::Included(e) => {
27802 *base.add(20).cast::<u8>() = (0i32) as u8;
27803 let super::super::super::golem::rdbms::types::Date {
27804 year: year73,
27805 month: month73,
27806 day: day73,
27807 } = e;
27808 *base.add(24).cast::<i32>() = _rt::as_i32(year73);
27809 *base.add(28).cast::<u8>() = (_rt::as_i32(month73)) as u8;
27810 *base.add(29).cast::<u8>() = (_rt::as_i32(day73)) as u8;
27811 }
27812 Datebound::Excluded(e) => {
27813 *base.add(20).cast::<u8>() = (1i32) as u8;
27814 let super::super::super::golem::rdbms::types::Date {
27815 year: year74,
27816 month: month74,
27817 day: day74,
27818 } = e;
27819 *base.add(24).cast::<i32>() = _rt::as_i32(year74);
27820 *base.add(28).cast::<u8>() = (_rt::as_i32(month74)) as u8;
27821 *base.add(29).cast::<u8>() = (_rt::as_i32(day74)) as u8;
27822 }
27823 Datebound::Unbounded => {
27824 *base.add(20).cast::<u8>() = (2i32) as u8;
27825 }
27826 }
27827 }
27828 DbValue::Money(e) => {
27829 *base.add(0).cast::<u8>() = (34i32) as u8;
27830 *base.add(8).cast::<i64>() = _rt::as_i64(e);
27831 }
27832 DbValue::Oid(e) => {
27833 *base.add(0).cast::<u8>() = (35i32) as u8;
27834 *base.add(8).cast::<i32>() = _rt::as_i32(e);
27835 }
27836 DbValue::Enumeration(e) => {
27837 *base.add(0).cast::<u8>() = (36i32) as u8;
27838 let Enumeration { name: name75, value: value75 } = e;
27839 let vec76 = name75;
27840 let ptr76 = vec76.as_ptr().cast::<u8>();
27841 let len76 = vec76.len();
27842 *base.add(12).cast::<usize>() = len76;
27843 *base.add(8).cast::<*mut u8>() = ptr76.cast_mut();
27844 let vec77 = value75;
27845 let ptr77 = vec77.as_ptr().cast::<u8>();
27846 let len77 = vec77.len();
27847 *base.add(20).cast::<usize>() = len77;
27848 *base.add(16).cast::<*mut u8>() = ptr77.cast_mut();
27849 }
27850 DbValue::Composite(e) => {
27851 *base.add(0).cast::<u8>() = (37i32) as u8;
27852 let Composite { name: name78, values: values78 } = e;
27853 let vec79 = name78;
27854 let ptr79 = vec79.as_ptr().cast::<u8>();
27855 let len79 = vec79.len();
27856 *base.add(12).cast::<usize>() = len79;
27857 *base.add(8).cast::<*mut u8>() = ptr79.cast_mut();
27858 let vec80 = values78;
27859 let len80 = vec80.len();
27860 let layout80 = _rt::alloc::Layout::from_size_align_unchecked(
27861 vec80.len() * 4,
27862 4,
27863 );
27864 let result80 = if layout80.size() != 0 {
27865 let ptr = _rt::alloc::alloc(layout80).cast::<u8>();
27866 if ptr.is_null() {
27867 _rt::alloc::handle_alloc_error(layout80);
27868 }
27869 ptr
27870 } else {
27871 ::core::ptr::null_mut()
27872 };
27873 for (i, e) in vec80.into_iter().enumerate() {
27874 let base = result80.add(i * 4);
27875 {
27876 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
27877 }
27878 }
27879 *base.add(20).cast::<usize>() = len80;
27880 *base.add(16).cast::<*mut u8>() = result80;
27881 cleanup_list.extend_from_slice(&[(result80, layout80)]);
27882 }
27883 DbValue::Domain(e) => {
27884 *base.add(0).cast::<u8>() = (38i32) as u8;
27885 let Domain { name: name81, value: value81 } = e;
27886 let vec82 = name81;
27887 let ptr82 = vec82.as_ptr().cast::<u8>();
27888 let len82 = vec82.len();
27889 *base.add(12).cast::<usize>() = len82;
27890 *base.add(8).cast::<*mut u8>() = ptr82.cast_mut();
27891 *base.add(16).cast::<i32>() = (value81).take_handle()
27892 as i32;
27893 }
27894 DbValue::Array(e) => {
27895 *base.add(0).cast::<u8>() = (39i32) as u8;
27896 let vec83 = e;
27897 let len83 = vec83.len();
27898 let layout83 = _rt::alloc::Layout::from_size_align_unchecked(
27899 vec83.len() * 4,
27900 4,
27901 );
27902 let result83 = if layout83.size() != 0 {
27903 let ptr = _rt::alloc::alloc(layout83).cast::<u8>();
27904 if ptr.is_null() {
27905 _rt::alloc::handle_alloc_error(layout83);
27906 }
27907 ptr
27908 } else {
27909 ::core::ptr::null_mut()
27910 };
27911 for (i, e) in vec83.into_iter().enumerate() {
27912 let base = result83.add(i * 4);
27913 {
27914 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
27915 }
27916 }
27917 *base.add(12).cast::<usize>() = len83;
27918 *base.add(8).cast::<*mut u8>() = result83;
27919 cleanup_list.extend_from_slice(&[(result83, layout83)]);
27920 }
27921 DbValue::Range(e) => {
27922 *base.add(0).cast::<u8>() = (40i32) as u8;
27923 let Range { name: name84, value: value84 } = e;
27924 let vec85 = name84;
27925 let ptr85 = vec85.as_ptr().cast::<u8>();
27926 let len85 = vec85.len();
27927 *base.add(12).cast::<usize>() = len85;
27928 *base.add(8).cast::<*mut u8>() = ptr85.cast_mut();
27929 let ValuesRange { start: start86, end: end86 } = value84;
27930 match start86 {
27931 ValueBound::Included(e) => {
27932 *base.add(16).cast::<u8>() = (0i32) as u8;
27933 *base.add(20).cast::<i32>() = (e).take_handle() as i32;
27934 }
27935 ValueBound::Excluded(e) => {
27936 *base.add(16).cast::<u8>() = (1i32) as u8;
27937 *base.add(20).cast::<i32>() = (e).take_handle() as i32;
27938 }
27939 ValueBound::Unbounded => {
27940 *base.add(16).cast::<u8>() = (2i32) as u8;
27941 }
27942 }
27943 match end86 {
27944 ValueBound::Included(e) => {
27945 *base.add(24).cast::<u8>() = (0i32) as u8;
27946 *base.add(28).cast::<i32>() = (e).take_handle() as i32;
27947 }
27948 ValueBound::Excluded(e) => {
27949 *base.add(24).cast::<u8>() = (1i32) as u8;
27950 *base.add(28).cast::<i32>() = (e).take_handle() as i32;
27951 }
27952 ValueBound::Unbounded => {
27953 *base.add(24).cast::<u8>() = (2i32) as u8;
27954 }
27955 }
27956 }
27957 DbValue::Null => {
27958 *base.add(0).cast::<u8>() = (41i32) as u8;
27959 }
27960 }
27961 }
27962 }
27963 let ptr88 = ret_area.0.as_mut_ptr().cast::<u8>();
27964 #[cfg(target_arch = "wasm32")]
27965 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
27966 extern "C" {
27967 #[link_name = "[method]db-transaction.query"]
27968 fn wit_import(
27969 _: i32,
27970 _: *mut u8,
27971 _: usize,
27972 _: *mut u8,
27973 _: usize,
27974 _: *mut u8,
27975 );
27976 }
27977 #[cfg(not(target_arch = "wasm32"))]
27978 fn wit_import(
27979 _: i32,
27980 _: *mut u8,
27981 _: usize,
27982 _: *mut u8,
27983 _: usize,
27984 _: *mut u8,
27985 ) {
27986 unreachable!()
27987 }
27988 wit_import(
27989 (self).handle() as i32,
27990 ptr0.cast_mut(),
27991 len0,
27992 result87,
27993 len87,
27994 ptr88,
27995 );
27996 let l89 = i32::from(*ptr88.add(0).cast::<u8>());
27997 if layout87.size() != 0 {
27998 _rt::alloc::dealloc(result87.cast(), layout87);
27999 }
28000 for (ptr, layout) in cleanup_list {
28001 if layout.size() != 0 {
28002 _rt::alloc::dealloc(ptr.cast(), layout);
28003 }
28004 }
28005 match l89 {
28006 0 => {
28007 let e = {
28008 let l90 = *ptr88.add(4).cast::<*mut u8>();
28009 let l91 = *ptr88.add(8).cast::<usize>();
28010 let base123 = l90;
28011 let len123 = l91;
28012 let mut result123 = _rt::Vec::with_capacity(len123);
28013 for i in 0..len123 {
28014 let base = base123.add(i * 48);
28015 let e123 = {
28016 let l92 = *base.add(0).cast::<i64>();
28017 let l93 = *base.add(8).cast::<*mut u8>();
28018 let l94 = *base.add(12).cast::<usize>();
28019 let len95 = l94;
28020 let bytes95 = _rt::Vec::from_raw_parts(
28021 l93.cast(),
28022 len95,
28023 len95,
28024 );
28025 let l96 = i32::from(*base.add(16).cast::<u8>());
28026 let v119 = match l96 {
28027 0 => DbColumnType::Character,
28028 1 => DbColumnType::Int2,
28029 2 => DbColumnType::Int4,
28030 3 => DbColumnType::Int8,
28031 4 => DbColumnType::Float4,
28032 5 => DbColumnType::Float8,
28033 6 => DbColumnType::Numeric,
28034 7 => DbColumnType::Boolean,
28035 8 => DbColumnType::Text,
28036 9 => DbColumnType::Varchar,
28037 10 => DbColumnType::Bpchar,
28038 11 => DbColumnType::Timestamp,
28039 12 => DbColumnType::Timestamptz,
28040 13 => DbColumnType::Date,
28041 14 => DbColumnType::Time,
28042 15 => DbColumnType::Timetz,
28043 16 => DbColumnType::Interval,
28044 17 => DbColumnType::Bytea,
28045 18 => DbColumnType::Uuid,
28046 19 => DbColumnType::Xml,
28047 20 => DbColumnType::Json,
28048 21 => DbColumnType::Jsonb,
28049 22 => DbColumnType::Jsonpath,
28050 23 => DbColumnType::Inet,
28051 24 => DbColumnType::Cidr,
28052 25 => DbColumnType::Macaddr,
28053 26 => DbColumnType::Bit,
28054 27 => DbColumnType::Varbit,
28055 28 => DbColumnType::Int4range,
28056 29 => DbColumnType::Int8range,
28057 30 => DbColumnType::Numrange,
28058 31 => DbColumnType::Tsrange,
28059 32 => DbColumnType::Tstzrange,
28060 33 => DbColumnType::Daterange,
28061 34 => DbColumnType::Money,
28062 35 => DbColumnType::Oid,
28063 36 => {
28064 let e119 = {
28065 let l97 = *base.add(20).cast::<*mut u8>();
28066 let l98 = *base.add(24).cast::<usize>();
28067 let len99 = l98;
28068 let bytes99 = _rt::Vec::from_raw_parts(
28069 l97.cast(),
28070 len99,
28071 len99,
28072 );
28073 EnumerationType {
28074 name: _rt::string_lift(bytes99),
28075 }
28076 };
28077 DbColumnType::Enumeration(e119)
28078 }
28079 37 => {
28080 let e119 = {
28081 let l100 = *base.add(20).cast::<*mut u8>();
28082 let l101 = *base.add(24).cast::<usize>();
28083 let len102 = l101;
28084 let bytes102 = _rt::Vec::from_raw_parts(
28085 l100.cast(),
28086 len102,
28087 len102,
28088 );
28089 let l103 = *base.add(28).cast::<*mut u8>();
28090 let l104 = *base.add(32).cast::<usize>();
28091 let base109 = l103;
28092 let len109 = l104;
28093 let mut result109 = _rt::Vec::with_capacity(len109);
28094 for i in 0..len109 {
28095 let base = base109.add(i * 12);
28096 let e109 = {
28097 let l105 = *base.add(0).cast::<*mut u8>();
28098 let l106 = *base.add(4).cast::<usize>();
28099 let len107 = l106;
28100 let bytes107 = _rt::Vec::from_raw_parts(
28101 l105.cast(),
28102 len107,
28103 len107,
28104 );
28105 let l108 = *base.add(8).cast::<i32>();
28106 (
28107 _rt::string_lift(bytes107),
28108 LazyDbColumnType::from_handle(l108 as u32),
28109 )
28110 };
28111 result109.push(e109);
28112 }
28113 _rt::cabi_dealloc(base109, len109 * 12, 4);
28114 CompositeType {
28115 name: _rt::string_lift(bytes102),
28116 attributes: result109,
28117 }
28118 };
28119 DbColumnType::Composite(e119)
28120 }
28121 38 => {
28122 let e119 = {
28123 let l110 = *base.add(20).cast::<*mut u8>();
28124 let l111 = *base.add(24).cast::<usize>();
28125 let len112 = l111;
28126 let bytes112 = _rt::Vec::from_raw_parts(
28127 l110.cast(),
28128 len112,
28129 len112,
28130 );
28131 let l113 = *base.add(28).cast::<i32>();
28132 DomainType {
28133 name: _rt::string_lift(bytes112),
28134 base_type: LazyDbColumnType::from_handle(l113 as u32),
28135 }
28136 };
28137 DbColumnType::Domain(e119)
28138 }
28139 39 => {
28140 let e119 = {
28141 let l114 = *base.add(20).cast::<i32>();
28142 LazyDbColumnType::from_handle(l114 as u32)
28143 };
28144 DbColumnType::Array(e119)
28145 }
28146 n => {
28147 debug_assert_eq!(n, 40, "invalid enum discriminant");
28148 let e119 = {
28149 let l115 = *base.add(20).cast::<*mut u8>();
28150 let l116 = *base.add(24).cast::<usize>();
28151 let len117 = l116;
28152 let bytes117 = _rt::Vec::from_raw_parts(
28153 l115.cast(),
28154 len117,
28155 len117,
28156 );
28157 let l118 = *base.add(28).cast::<i32>();
28158 RangeType {
28159 name: _rt::string_lift(bytes117),
28160 base_type: LazyDbColumnType::from_handle(l118 as u32),
28161 }
28162 };
28163 DbColumnType::Range(e119)
28164 }
28165 };
28166 let l120 = *base.add(36).cast::<*mut u8>();
28167 let l121 = *base.add(40).cast::<usize>();
28168 let len122 = l121;
28169 let bytes122 = _rt::Vec::from_raw_parts(
28170 l120.cast(),
28171 len122,
28172 len122,
28173 );
28174 DbColumn {
28175 ordinal: l92 as u64,
28176 name: _rt::string_lift(bytes95),
28177 db_type: v119,
28178 db_type_name: _rt::string_lift(bytes122),
28179 }
28180 };
28181 result123.push(e123);
28182 }
28183 _rt::cabi_dealloc(base123, len123 * 48, 8);
28184 let l124 = *ptr88.add(12).cast::<*mut u8>();
28185 let l125 = *ptr88.add(16).cast::<usize>();
28186 let base389 = l124;
28187 let len389 = l125;
28188 let mut result389 = _rt::Vec::with_capacity(len389);
28189 for i in 0..len389 {
28190 let base = base389.add(i * 8);
28191 let e389 = {
28192 let l126 = *base.add(0).cast::<*mut u8>();
28193 let l127 = *base.add(4).cast::<usize>();
28194 let base388 = l126;
28195 let len388 = l127;
28196 let mut result388 = _rt::Vec::with_capacity(len388);
28197 for i in 0..len388 {
28198 let base = base388.add(i * 56);
28199 let e388 = {
28200 let l128 = i32::from(*base.add(0).cast::<u8>());
28201 let v387 = match l128 {
28202 0 => {
28203 let e387 = {
28204 let l129 = i32::from(*base.add(8).cast::<i8>());
28205 l129 as i8
28206 };
28207 DbValue::Character(e387)
28208 }
28209 1 => {
28210 let e387 = {
28211 let l130 = i32::from(*base.add(8).cast::<i16>());
28212 l130 as i16
28213 };
28214 DbValue::Int2(e387)
28215 }
28216 2 => {
28217 let e387 = {
28218 let l131 = *base.add(8).cast::<i32>();
28219 l131
28220 };
28221 DbValue::Int4(e387)
28222 }
28223 3 => {
28224 let e387 = {
28225 let l132 = *base.add(8).cast::<i64>();
28226 l132
28227 };
28228 DbValue::Int8(e387)
28229 }
28230 4 => {
28231 let e387 = {
28232 let l133 = *base.add(8).cast::<f32>();
28233 l133
28234 };
28235 DbValue::Float4(e387)
28236 }
28237 5 => {
28238 let e387 = {
28239 let l134 = *base.add(8).cast::<f64>();
28240 l134
28241 };
28242 DbValue::Float8(e387)
28243 }
28244 6 => {
28245 let e387 = {
28246 let l135 = *base.add(8).cast::<*mut u8>();
28247 let l136 = *base.add(12).cast::<usize>();
28248 let len137 = l136;
28249 let bytes137 = _rt::Vec::from_raw_parts(
28250 l135.cast(),
28251 len137,
28252 len137,
28253 );
28254 _rt::string_lift(bytes137)
28255 };
28256 DbValue::Numeric(e387)
28257 }
28258 7 => {
28259 let e387 = {
28260 let l138 = i32::from(*base.add(8).cast::<u8>());
28261 _rt::bool_lift(l138 as u8)
28262 };
28263 DbValue::Boolean(e387)
28264 }
28265 8 => {
28266 let e387 = {
28267 let l139 = *base.add(8).cast::<*mut u8>();
28268 let l140 = *base.add(12).cast::<usize>();
28269 let len141 = l140;
28270 let bytes141 = _rt::Vec::from_raw_parts(
28271 l139.cast(),
28272 len141,
28273 len141,
28274 );
28275 _rt::string_lift(bytes141)
28276 };
28277 DbValue::Text(e387)
28278 }
28279 9 => {
28280 let e387 = {
28281 let l142 = *base.add(8).cast::<*mut u8>();
28282 let l143 = *base.add(12).cast::<usize>();
28283 let len144 = l143;
28284 let bytes144 = _rt::Vec::from_raw_parts(
28285 l142.cast(),
28286 len144,
28287 len144,
28288 );
28289 _rt::string_lift(bytes144)
28290 };
28291 DbValue::Varchar(e387)
28292 }
28293 10 => {
28294 let e387 = {
28295 let l145 = *base.add(8).cast::<*mut u8>();
28296 let l146 = *base.add(12).cast::<usize>();
28297 let len147 = l146;
28298 let bytes147 = _rt::Vec::from_raw_parts(
28299 l145.cast(),
28300 len147,
28301 len147,
28302 );
28303 _rt::string_lift(bytes147)
28304 };
28305 DbValue::Bpchar(e387)
28306 }
28307 11 => {
28308 let e387 = {
28309 let l148 = *base.add(8).cast::<i32>();
28310 let l149 = i32::from(*base.add(12).cast::<u8>());
28311 let l150 = i32::from(*base.add(13).cast::<u8>());
28312 let l151 = i32::from(*base.add(16).cast::<u8>());
28313 let l152 = i32::from(*base.add(17).cast::<u8>());
28314 let l153 = i32::from(*base.add(18).cast::<u8>());
28315 let l154 = *base.add(20).cast::<i32>();
28316 super::super::super::golem::rdbms::types::Timestamp {
28317 date: super::super::super::golem::rdbms::types::Date {
28318 year: l148,
28319 month: l149 as u8,
28320 day: l150 as u8,
28321 },
28322 time: super::super::super::golem::rdbms::types::Time {
28323 hour: l151 as u8,
28324 minute: l152 as u8,
28325 second: l153 as u8,
28326 nanosecond: l154 as u32,
28327 },
28328 }
28329 };
28330 DbValue::Timestamp(e387)
28331 }
28332 12 => {
28333 let e387 = {
28334 let l155 = *base.add(8).cast::<i32>();
28335 let l156 = i32::from(*base.add(12).cast::<u8>());
28336 let l157 = i32::from(*base.add(13).cast::<u8>());
28337 let l158 = i32::from(*base.add(16).cast::<u8>());
28338 let l159 = i32::from(*base.add(17).cast::<u8>());
28339 let l160 = i32::from(*base.add(18).cast::<u8>());
28340 let l161 = *base.add(20).cast::<i32>();
28341 let l162 = *base.add(24).cast::<i32>();
28342 super::super::super::golem::rdbms::types::Timestamptz {
28343 timestamp: super::super::super::golem::rdbms::types::Timestamp {
28344 date: super::super::super::golem::rdbms::types::Date {
28345 year: l155,
28346 month: l156 as u8,
28347 day: l157 as u8,
28348 },
28349 time: super::super::super::golem::rdbms::types::Time {
28350 hour: l158 as u8,
28351 minute: l159 as u8,
28352 second: l160 as u8,
28353 nanosecond: l161 as u32,
28354 },
28355 },
28356 offset: l162,
28357 }
28358 };
28359 DbValue::Timestamptz(e387)
28360 }
28361 13 => {
28362 let e387 = {
28363 let l163 = *base.add(8).cast::<i32>();
28364 let l164 = i32::from(*base.add(12).cast::<u8>());
28365 let l165 = i32::from(*base.add(13).cast::<u8>());
28366 super::super::super::golem::rdbms::types::Date {
28367 year: l163,
28368 month: l164 as u8,
28369 day: l165 as u8,
28370 }
28371 };
28372 DbValue::Date(e387)
28373 }
28374 14 => {
28375 let e387 = {
28376 let l166 = i32::from(*base.add(8).cast::<u8>());
28377 let l167 = i32::from(*base.add(9).cast::<u8>());
28378 let l168 = i32::from(*base.add(10).cast::<u8>());
28379 let l169 = *base.add(12).cast::<i32>();
28380 super::super::super::golem::rdbms::types::Time {
28381 hour: l166 as u8,
28382 minute: l167 as u8,
28383 second: l168 as u8,
28384 nanosecond: l169 as u32,
28385 }
28386 };
28387 DbValue::Time(e387)
28388 }
28389 15 => {
28390 let e387 = {
28391 let l170 = i32::from(*base.add(8).cast::<u8>());
28392 let l171 = i32::from(*base.add(9).cast::<u8>());
28393 let l172 = i32::from(*base.add(10).cast::<u8>());
28394 let l173 = *base.add(12).cast::<i32>();
28395 let l174 = *base.add(16).cast::<i32>();
28396 super::super::super::golem::rdbms::types::Timetz {
28397 time: super::super::super::golem::rdbms::types::Time {
28398 hour: l170 as u8,
28399 minute: l171 as u8,
28400 second: l172 as u8,
28401 nanosecond: l173 as u32,
28402 },
28403 offset: l174,
28404 }
28405 };
28406 DbValue::Timetz(e387)
28407 }
28408 16 => {
28409 let e387 = {
28410 let l175 = *base.add(8).cast::<i32>();
28411 let l176 = *base.add(12).cast::<i32>();
28412 let l177 = *base.add(16).cast::<i64>();
28413 Interval {
28414 months: l175,
28415 days: l176,
28416 microseconds: l177,
28417 }
28418 };
28419 DbValue::Interval(e387)
28420 }
28421 17 => {
28422 let e387 = {
28423 let l178 = *base.add(8).cast::<*mut u8>();
28424 let l179 = *base.add(12).cast::<usize>();
28425 let len180 = l179;
28426 _rt::Vec::from_raw_parts(l178.cast(), len180, len180)
28427 };
28428 DbValue::Bytea(e387)
28429 }
28430 18 => {
28431 let e387 = {
28432 let l181 = *base.add(8).cast::<*mut u8>();
28433 let l182 = *base.add(12).cast::<usize>();
28434 let len183 = l182;
28435 let bytes183 = _rt::Vec::from_raw_parts(
28436 l181.cast(),
28437 len183,
28438 len183,
28439 );
28440 _rt::string_lift(bytes183)
28441 };
28442 DbValue::Json(e387)
28443 }
28444 19 => {
28445 let e387 = {
28446 let l184 = *base.add(8).cast::<*mut u8>();
28447 let l185 = *base.add(12).cast::<usize>();
28448 let len186 = l185;
28449 let bytes186 = _rt::Vec::from_raw_parts(
28450 l184.cast(),
28451 len186,
28452 len186,
28453 );
28454 _rt::string_lift(bytes186)
28455 };
28456 DbValue::Jsonb(e387)
28457 }
28458 20 => {
28459 let e387 = {
28460 let l187 = *base.add(8).cast::<*mut u8>();
28461 let l188 = *base.add(12).cast::<usize>();
28462 let len189 = l188;
28463 let bytes189 = _rt::Vec::from_raw_parts(
28464 l187.cast(),
28465 len189,
28466 len189,
28467 );
28468 _rt::string_lift(bytes189)
28469 };
28470 DbValue::Jsonpath(e387)
28471 }
28472 21 => {
28473 let e387 = {
28474 let l190 = *base.add(8).cast::<*mut u8>();
28475 let l191 = *base.add(12).cast::<usize>();
28476 let len192 = l191;
28477 let bytes192 = _rt::Vec::from_raw_parts(
28478 l190.cast(),
28479 len192,
28480 len192,
28481 );
28482 _rt::string_lift(bytes192)
28483 };
28484 DbValue::Xml(e387)
28485 }
28486 22 => {
28487 let e387 = {
28488 let l193 = *base.add(8).cast::<i64>();
28489 let l194 = *base.add(16).cast::<i64>();
28490 super::super::super::golem::rdbms::types::Uuid {
28491 high_bits: l193 as u64,
28492 low_bits: l194 as u64,
28493 }
28494 };
28495 DbValue::Uuid(e387)
28496 }
28497 23 => {
28498 let e387 = {
28499 let l195 = i32::from(*base.add(8).cast::<u8>());
28500 use super::super::super::golem::rdbms::types::IpAddress as V208;
28501 let v208 = match l195 {
28502 0 => {
28503 let e208 = {
28504 let l196 = i32::from(*base.add(10).cast::<u8>());
28505 let l197 = i32::from(*base.add(11).cast::<u8>());
28506 let l198 = i32::from(*base.add(12).cast::<u8>());
28507 let l199 = i32::from(*base.add(13).cast::<u8>());
28508 (l196 as u8, l197 as u8, l198 as u8, l199 as u8)
28509 };
28510 V208::Ipv4(e208)
28511 }
28512 n => {
28513 debug_assert_eq!(n, 1, "invalid enum discriminant");
28514 let e208 = {
28515 let l200 = i32::from(*base.add(10).cast::<u16>());
28516 let l201 = i32::from(*base.add(12).cast::<u16>());
28517 let l202 = i32::from(*base.add(14).cast::<u16>());
28518 let l203 = i32::from(*base.add(16).cast::<u16>());
28519 let l204 = i32::from(*base.add(18).cast::<u16>());
28520 let l205 = i32::from(*base.add(20).cast::<u16>());
28521 let l206 = i32::from(*base.add(22).cast::<u16>());
28522 let l207 = i32::from(*base.add(24).cast::<u16>());
28523 (
28524 l200 as u16,
28525 l201 as u16,
28526 l202 as u16,
28527 l203 as u16,
28528 l204 as u16,
28529 l205 as u16,
28530 l206 as u16,
28531 l207 as u16,
28532 )
28533 };
28534 V208::Ipv6(e208)
28535 }
28536 };
28537 v208
28538 };
28539 DbValue::Inet(e387)
28540 }
28541 24 => {
28542 let e387 = {
28543 let l209 = i32::from(*base.add(8).cast::<u8>());
28544 use super::super::super::golem::rdbms::types::IpAddress as V222;
28545 let v222 = match l209 {
28546 0 => {
28547 let e222 = {
28548 let l210 = i32::from(*base.add(10).cast::<u8>());
28549 let l211 = i32::from(*base.add(11).cast::<u8>());
28550 let l212 = i32::from(*base.add(12).cast::<u8>());
28551 let l213 = i32::from(*base.add(13).cast::<u8>());
28552 (l210 as u8, l211 as u8, l212 as u8, l213 as u8)
28553 };
28554 V222::Ipv4(e222)
28555 }
28556 n => {
28557 debug_assert_eq!(n, 1, "invalid enum discriminant");
28558 let e222 = {
28559 let l214 = i32::from(*base.add(10).cast::<u16>());
28560 let l215 = i32::from(*base.add(12).cast::<u16>());
28561 let l216 = i32::from(*base.add(14).cast::<u16>());
28562 let l217 = i32::from(*base.add(16).cast::<u16>());
28563 let l218 = i32::from(*base.add(18).cast::<u16>());
28564 let l219 = i32::from(*base.add(20).cast::<u16>());
28565 let l220 = i32::from(*base.add(22).cast::<u16>());
28566 let l221 = i32::from(*base.add(24).cast::<u16>());
28567 (
28568 l214 as u16,
28569 l215 as u16,
28570 l216 as u16,
28571 l217 as u16,
28572 l218 as u16,
28573 l219 as u16,
28574 l220 as u16,
28575 l221 as u16,
28576 )
28577 };
28578 V222::Ipv6(e222)
28579 }
28580 };
28581 v222
28582 };
28583 DbValue::Cidr(e387)
28584 }
28585 25 => {
28586 let e387 = {
28587 let l223 = i32::from(*base.add(8).cast::<u8>());
28588 let l224 = i32::from(*base.add(9).cast::<u8>());
28589 let l225 = i32::from(*base.add(10).cast::<u8>());
28590 let l226 = i32::from(*base.add(11).cast::<u8>());
28591 let l227 = i32::from(*base.add(12).cast::<u8>());
28592 let l228 = i32::from(*base.add(13).cast::<u8>());
28593 super::super::super::golem::rdbms::types::MacAddress {
28594 octets: (
28595 l223 as u8,
28596 l224 as u8,
28597 l225 as u8,
28598 l226 as u8,
28599 l227 as u8,
28600 l228 as u8,
28601 ),
28602 }
28603 };
28604 DbValue::Macaddr(e387)
28605 }
28606 26 => {
28607 let e387 = {
28608 let l229 = *base.add(8).cast::<*mut u8>();
28609 let l230 = *base.add(12).cast::<usize>();
28610 let base232 = l229;
28611 let len232 = l230;
28612 let mut result232 = _rt::Vec::with_capacity(len232);
28613 for i in 0..len232 {
28614 let base = base232.add(i * 1);
28615 let e232 = {
28616 let l231 = i32::from(*base.add(0).cast::<u8>());
28617 _rt::bool_lift(l231 as u8)
28618 };
28619 result232.push(e232);
28620 }
28621 _rt::cabi_dealloc(base232, len232 * 1, 1);
28622 result232
28623 };
28624 DbValue::Bit(e387)
28625 }
28626 27 => {
28627 let e387 = {
28628 let l233 = *base.add(8).cast::<*mut u8>();
28629 let l234 = *base.add(12).cast::<usize>();
28630 let base236 = l233;
28631 let len236 = l234;
28632 let mut result236 = _rt::Vec::with_capacity(len236);
28633 for i in 0..len236 {
28634 let base = base236.add(i * 1);
28635 let e236 = {
28636 let l235 = i32::from(*base.add(0).cast::<u8>());
28637 _rt::bool_lift(l235 as u8)
28638 };
28639 result236.push(e236);
28640 }
28641 _rt::cabi_dealloc(base236, len236 * 1, 1);
28642 result236
28643 };
28644 DbValue::Varbit(e387)
28645 }
28646 28 => {
28647 let e387 = {
28648 let l237 = i32::from(*base.add(8).cast::<u8>());
28649 let v240 = match l237 {
28650 0 => {
28651 let e240 = {
28652 let l238 = *base.add(12).cast::<i32>();
28653 l238
28654 };
28655 Int4bound::Included(e240)
28656 }
28657 1 => {
28658 let e240 = {
28659 let l239 = *base.add(12).cast::<i32>();
28660 l239
28661 };
28662 Int4bound::Excluded(e240)
28663 }
28664 n => {
28665 debug_assert_eq!(n, 2, "invalid enum discriminant");
28666 Int4bound::Unbounded
28667 }
28668 };
28669 let l241 = i32::from(*base.add(16).cast::<u8>());
28670 let v244 = match l241 {
28671 0 => {
28672 let e244 = {
28673 let l242 = *base.add(20).cast::<i32>();
28674 l242
28675 };
28676 Int4bound::Included(e244)
28677 }
28678 1 => {
28679 let e244 = {
28680 let l243 = *base.add(20).cast::<i32>();
28681 l243
28682 };
28683 Int4bound::Excluded(e244)
28684 }
28685 n => {
28686 debug_assert_eq!(n, 2, "invalid enum discriminant");
28687 Int4bound::Unbounded
28688 }
28689 };
28690 Int4range {
28691 start: v240,
28692 end: v244,
28693 }
28694 };
28695 DbValue::Int4range(e387)
28696 }
28697 29 => {
28698 let e387 = {
28699 let l245 = i32::from(*base.add(8).cast::<u8>());
28700 let v248 = match l245 {
28701 0 => {
28702 let e248 = {
28703 let l246 = *base.add(16).cast::<i64>();
28704 l246
28705 };
28706 Int8bound::Included(e248)
28707 }
28708 1 => {
28709 let e248 = {
28710 let l247 = *base.add(16).cast::<i64>();
28711 l247
28712 };
28713 Int8bound::Excluded(e248)
28714 }
28715 n => {
28716 debug_assert_eq!(n, 2, "invalid enum discriminant");
28717 Int8bound::Unbounded
28718 }
28719 };
28720 let l249 = i32::from(*base.add(24).cast::<u8>());
28721 let v252 = match l249 {
28722 0 => {
28723 let e252 = {
28724 let l250 = *base.add(32).cast::<i64>();
28725 l250
28726 };
28727 Int8bound::Included(e252)
28728 }
28729 1 => {
28730 let e252 = {
28731 let l251 = *base.add(32).cast::<i64>();
28732 l251
28733 };
28734 Int8bound::Excluded(e252)
28735 }
28736 n => {
28737 debug_assert_eq!(n, 2, "invalid enum discriminant");
28738 Int8bound::Unbounded
28739 }
28740 };
28741 Int8range {
28742 start: v248,
28743 end: v252,
28744 }
28745 };
28746 DbValue::Int8range(e387)
28747 }
28748 30 => {
28749 let e387 = {
28750 let l253 = i32::from(*base.add(8).cast::<u8>());
28751 let v260 = match l253 {
28752 0 => {
28753 let e260 = {
28754 let l254 = *base.add(12).cast::<*mut u8>();
28755 let l255 = *base.add(16).cast::<usize>();
28756 let len256 = l255;
28757 let bytes256 = _rt::Vec::from_raw_parts(
28758 l254.cast(),
28759 len256,
28760 len256,
28761 );
28762 _rt::string_lift(bytes256)
28763 };
28764 Numbound::Included(e260)
28765 }
28766 1 => {
28767 let e260 = {
28768 let l257 = *base.add(12).cast::<*mut u8>();
28769 let l258 = *base.add(16).cast::<usize>();
28770 let len259 = l258;
28771 let bytes259 = _rt::Vec::from_raw_parts(
28772 l257.cast(),
28773 len259,
28774 len259,
28775 );
28776 _rt::string_lift(bytes259)
28777 };
28778 Numbound::Excluded(e260)
28779 }
28780 n => {
28781 debug_assert_eq!(n, 2, "invalid enum discriminant");
28782 Numbound::Unbounded
28783 }
28784 };
28785 let l261 = i32::from(*base.add(20).cast::<u8>());
28786 let v268 = match l261 {
28787 0 => {
28788 let e268 = {
28789 let l262 = *base.add(24).cast::<*mut u8>();
28790 let l263 = *base.add(28).cast::<usize>();
28791 let len264 = l263;
28792 let bytes264 = _rt::Vec::from_raw_parts(
28793 l262.cast(),
28794 len264,
28795 len264,
28796 );
28797 _rt::string_lift(bytes264)
28798 };
28799 Numbound::Included(e268)
28800 }
28801 1 => {
28802 let e268 = {
28803 let l265 = *base.add(24).cast::<*mut u8>();
28804 let l266 = *base.add(28).cast::<usize>();
28805 let len267 = l266;
28806 let bytes267 = _rt::Vec::from_raw_parts(
28807 l265.cast(),
28808 len267,
28809 len267,
28810 );
28811 _rt::string_lift(bytes267)
28812 };
28813 Numbound::Excluded(e268)
28814 }
28815 n => {
28816 debug_assert_eq!(n, 2, "invalid enum discriminant");
28817 Numbound::Unbounded
28818 }
28819 };
28820 Numrange { start: v260, end: v268 }
28821 };
28822 DbValue::Numrange(e387)
28823 }
28824 31 => {
28825 let e387 = {
28826 let l269 = i32::from(*base.add(8).cast::<u8>());
28827 let v284 = match l269 {
28828 0 => {
28829 let e284 = {
28830 let l270 = *base.add(12).cast::<i32>();
28831 let l271 = i32::from(*base.add(16).cast::<u8>());
28832 let l272 = i32::from(*base.add(17).cast::<u8>());
28833 let l273 = i32::from(*base.add(20).cast::<u8>());
28834 let l274 = i32::from(*base.add(21).cast::<u8>());
28835 let l275 = i32::from(*base.add(22).cast::<u8>());
28836 let l276 = *base.add(24).cast::<i32>();
28837 super::super::super::golem::rdbms::types::Timestamp {
28838 date: super::super::super::golem::rdbms::types::Date {
28839 year: l270,
28840 month: l271 as u8,
28841 day: l272 as u8,
28842 },
28843 time: super::super::super::golem::rdbms::types::Time {
28844 hour: l273 as u8,
28845 minute: l274 as u8,
28846 second: l275 as u8,
28847 nanosecond: l276 as u32,
28848 },
28849 }
28850 };
28851 Tsbound::Included(e284)
28852 }
28853 1 => {
28854 let e284 = {
28855 let l277 = *base.add(12).cast::<i32>();
28856 let l278 = i32::from(*base.add(16).cast::<u8>());
28857 let l279 = i32::from(*base.add(17).cast::<u8>());
28858 let l280 = i32::from(*base.add(20).cast::<u8>());
28859 let l281 = i32::from(*base.add(21).cast::<u8>());
28860 let l282 = i32::from(*base.add(22).cast::<u8>());
28861 let l283 = *base.add(24).cast::<i32>();
28862 super::super::super::golem::rdbms::types::Timestamp {
28863 date: super::super::super::golem::rdbms::types::Date {
28864 year: l277,
28865 month: l278 as u8,
28866 day: l279 as u8,
28867 },
28868 time: super::super::super::golem::rdbms::types::Time {
28869 hour: l280 as u8,
28870 minute: l281 as u8,
28871 second: l282 as u8,
28872 nanosecond: l283 as u32,
28873 },
28874 }
28875 };
28876 Tsbound::Excluded(e284)
28877 }
28878 n => {
28879 debug_assert_eq!(n, 2, "invalid enum discriminant");
28880 Tsbound::Unbounded
28881 }
28882 };
28883 let l285 = i32::from(*base.add(28).cast::<u8>());
28884 let v300 = match l285 {
28885 0 => {
28886 let e300 = {
28887 let l286 = *base.add(32).cast::<i32>();
28888 let l287 = i32::from(*base.add(36).cast::<u8>());
28889 let l288 = i32::from(*base.add(37).cast::<u8>());
28890 let l289 = i32::from(*base.add(40).cast::<u8>());
28891 let l290 = i32::from(*base.add(41).cast::<u8>());
28892 let l291 = i32::from(*base.add(42).cast::<u8>());
28893 let l292 = *base.add(44).cast::<i32>();
28894 super::super::super::golem::rdbms::types::Timestamp {
28895 date: super::super::super::golem::rdbms::types::Date {
28896 year: l286,
28897 month: l287 as u8,
28898 day: l288 as u8,
28899 },
28900 time: super::super::super::golem::rdbms::types::Time {
28901 hour: l289 as u8,
28902 minute: l290 as u8,
28903 second: l291 as u8,
28904 nanosecond: l292 as u32,
28905 },
28906 }
28907 };
28908 Tsbound::Included(e300)
28909 }
28910 1 => {
28911 let e300 = {
28912 let l293 = *base.add(32).cast::<i32>();
28913 let l294 = i32::from(*base.add(36).cast::<u8>());
28914 let l295 = i32::from(*base.add(37).cast::<u8>());
28915 let l296 = i32::from(*base.add(40).cast::<u8>());
28916 let l297 = i32::from(*base.add(41).cast::<u8>());
28917 let l298 = i32::from(*base.add(42).cast::<u8>());
28918 let l299 = *base.add(44).cast::<i32>();
28919 super::super::super::golem::rdbms::types::Timestamp {
28920 date: super::super::super::golem::rdbms::types::Date {
28921 year: l293,
28922 month: l294 as u8,
28923 day: l295 as u8,
28924 },
28925 time: super::super::super::golem::rdbms::types::Time {
28926 hour: l296 as u8,
28927 minute: l297 as u8,
28928 second: l298 as u8,
28929 nanosecond: l299 as u32,
28930 },
28931 }
28932 };
28933 Tsbound::Excluded(e300)
28934 }
28935 n => {
28936 debug_assert_eq!(n, 2, "invalid enum discriminant");
28937 Tsbound::Unbounded
28938 }
28939 };
28940 Tsrange { start: v284, end: v300 }
28941 };
28942 DbValue::Tsrange(e387)
28943 }
28944 32 => {
28945 let e387 = {
28946 let l301 = i32::from(*base.add(8).cast::<u8>());
28947 let v318 = match l301 {
28948 0 => {
28949 let e318 = {
28950 let l302 = *base.add(12).cast::<i32>();
28951 let l303 = i32::from(*base.add(16).cast::<u8>());
28952 let l304 = i32::from(*base.add(17).cast::<u8>());
28953 let l305 = i32::from(*base.add(20).cast::<u8>());
28954 let l306 = i32::from(*base.add(21).cast::<u8>());
28955 let l307 = i32::from(*base.add(22).cast::<u8>());
28956 let l308 = *base.add(24).cast::<i32>();
28957 let l309 = *base.add(28).cast::<i32>();
28958 super::super::super::golem::rdbms::types::Timestamptz {
28959 timestamp: super::super::super::golem::rdbms::types::Timestamp {
28960 date: super::super::super::golem::rdbms::types::Date {
28961 year: l302,
28962 month: l303 as u8,
28963 day: l304 as u8,
28964 },
28965 time: super::super::super::golem::rdbms::types::Time {
28966 hour: l305 as u8,
28967 minute: l306 as u8,
28968 second: l307 as u8,
28969 nanosecond: l308 as u32,
28970 },
28971 },
28972 offset: l309,
28973 }
28974 };
28975 Tstzbound::Included(e318)
28976 }
28977 1 => {
28978 let e318 = {
28979 let l310 = *base.add(12).cast::<i32>();
28980 let l311 = i32::from(*base.add(16).cast::<u8>());
28981 let l312 = i32::from(*base.add(17).cast::<u8>());
28982 let l313 = i32::from(*base.add(20).cast::<u8>());
28983 let l314 = i32::from(*base.add(21).cast::<u8>());
28984 let l315 = i32::from(*base.add(22).cast::<u8>());
28985 let l316 = *base.add(24).cast::<i32>();
28986 let l317 = *base.add(28).cast::<i32>();
28987 super::super::super::golem::rdbms::types::Timestamptz {
28988 timestamp: super::super::super::golem::rdbms::types::Timestamp {
28989 date: super::super::super::golem::rdbms::types::Date {
28990 year: l310,
28991 month: l311 as u8,
28992 day: l312 as u8,
28993 },
28994 time: super::super::super::golem::rdbms::types::Time {
28995 hour: l313 as u8,
28996 minute: l314 as u8,
28997 second: l315 as u8,
28998 nanosecond: l316 as u32,
28999 },
29000 },
29001 offset: l317,
29002 }
29003 };
29004 Tstzbound::Excluded(e318)
29005 }
29006 n => {
29007 debug_assert_eq!(n, 2, "invalid enum discriminant");
29008 Tstzbound::Unbounded
29009 }
29010 };
29011 let l319 = i32::from(*base.add(32).cast::<u8>());
29012 let v336 = match l319 {
29013 0 => {
29014 let e336 = {
29015 let l320 = *base.add(36).cast::<i32>();
29016 let l321 = i32::from(*base.add(40).cast::<u8>());
29017 let l322 = i32::from(*base.add(41).cast::<u8>());
29018 let l323 = i32::from(*base.add(44).cast::<u8>());
29019 let l324 = i32::from(*base.add(45).cast::<u8>());
29020 let l325 = i32::from(*base.add(46).cast::<u8>());
29021 let l326 = *base.add(48).cast::<i32>();
29022 let l327 = *base.add(52).cast::<i32>();
29023 super::super::super::golem::rdbms::types::Timestamptz {
29024 timestamp: super::super::super::golem::rdbms::types::Timestamp {
29025 date: super::super::super::golem::rdbms::types::Date {
29026 year: l320,
29027 month: l321 as u8,
29028 day: l322 as u8,
29029 },
29030 time: super::super::super::golem::rdbms::types::Time {
29031 hour: l323 as u8,
29032 minute: l324 as u8,
29033 second: l325 as u8,
29034 nanosecond: l326 as u32,
29035 },
29036 },
29037 offset: l327,
29038 }
29039 };
29040 Tstzbound::Included(e336)
29041 }
29042 1 => {
29043 let e336 = {
29044 let l328 = *base.add(36).cast::<i32>();
29045 let l329 = i32::from(*base.add(40).cast::<u8>());
29046 let l330 = i32::from(*base.add(41).cast::<u8>());
29047 let l331 = i32::from(*base.add(44).cast::<u8>());
29048 let l332 = i32::from(*base.add(45).cast::<u8>());
29049 let l333 = i32::from(*base.add(46).cast::<u8>());
29050 let l334 = *base.add(48).cast::<i32>();
29051 let l335 = *base.add(52).cast::<i32>();
29052 super::super::super::golem::rdbms::types::Timestamptz {
29053 timestamp: super::super::super::golem::rdbms::types::Timestamp {
29054 date: super::super::super::golem::rdbms::types::Date {
29055 year: l328,
29056 month: l329 as u8,
29057 day: l330 as u8,
29058 },
29059 time: super::super::super::golem::rdbms::types::Time {
29060 hour: l331 as u8,
29061 minute: l332 as u8,
29062 second: l333 as u8,
29063 nanosecond: l334 as u32,
29064 },
29065 },
29066 offset: l335,
29067 }
29068 };
29069 Tstzbound::Excluded(e336)
29070 }
29071 n => {
29072 debug_assert_eq!(n, 2, "invalid enum discriminant");
29073 Tstzbound::Unbounded
29074 }
29075 };
29076 Tstzrange {
29077 start: v318,
29078 end: v336,
29079 }
29080 };
29081 DbValue::Tstzrange(e387)
29082 }
29083 33 => {
29084 let e387 = {
29085 let l337 = i32::from(*base.add(8).cast::<u8>());
29086 let v344 = match l337 {
29087 0 => {
29088 let e344 = {
29089 let l338 = *base.add(12).cast::<i32>();
29090 let l339 = i32::from(*base.add(16).cast::<u8>());
29091 let l340 = i32::from(*base.add(17).cast::<u8>());
29092 super::super::super::golem::rdbms::types::Date {
29093 year: l338,
29094 month: l339 as u8,
29095 day: l340 as u8,
29096 }
29097 };
29098 Datebound::Included(e344)
29099 }
29100 1 => {
29101 let e344 = {
29102 let l341 = *base.add(12).cast::<i32>();
29103 let l342 = i32::from(*base.add(16).cast::<u8>());
29104 let l343 = i32::from(*base.add(17).cast::<u8>());
29105 super::super::super::golem::rdbms::types::Date {
29106 year: l341,
29107 month: l342 as u8,
29108 day: l343 as u8,
29109 }
29110 };
29111 Datebound::Excluded(e344)
29112 }
29113 n => {
29114 debug_assert_eq!(n, 2, "invalid enum discriminant");
29115 Datebound::Unbounded
29116 }
29117 };
29118 let l345 = i32::from(*base.add(20).cast::<u8>());
29119 let v352 = match l345 {
29120 0 => {
29121 let e352 = {
29122 let l346 = *base.add(24).cast::<i32>();
29123 let l347 = i32::from(*base.add(28).cast::<u8>());
29124 let l348 = i32::from(*base.add(29).cast::<u8>());
29125 super::super::super::golem::rdbms::types::Date {
29126 year: l346,
29127 month: l347 as u8,
29128 day: l348 as u8,
29129 }
29130 };
29131 Datebound::Included(e352)
29132 }
29133 1 => {
29134 let e352 = {
29135 let l349 = *base.add(24).cast::<i32>();
29136 let l350 = i32::from(*base.add(28).cast::<u8>());
29137 let l351 = i32::from(*base.add(29).cast::<u8>());
29138 super::super::super::golem::rdbms::types::Date {
29139 year: l349,
29140 month: l350 as u8,
29141 day: l351 as u8,
29142 }
29143 };
29144 Datebound::Excluded(e352)
29145 }
29146 n => {
29147 debug_assert_eq!(n, 2, "invalid enum discriminant");
29148 Datebound::Unbounded
29149 }
29150 };
29151 Daterange {
29152 start: v344,
29153 end: v352,
29154 }
29155 };
29156 DbValue::Daterange(e387)
29157 }
29158 34 => {
29159 let e387 = {
29160 let l353 = *base.add(8).cast::<i64>();
29161 l353
29162 };
29163 DbValue::Money(e387)
29164 }
29165 35 => {
29166 let e387 = {
29167 let l354 = *base.add(8).cast::<i32>();
29168 l354 as u32
29169 };
29170 DbValue::Oid(e387)
29171 }
29172 36 => {
29173 let e387 = {
29174 let l355 = *base.add(8).cast::<*mut u8>();
29175 let l356 = *base.add(12).cast::<usize>();
29176 let len357 = l356;
29177 let bytes357 = _rt::Vec::from_raw_parts(
29178 l355.cast(),
29179 len357,
29180 len357,
29181 );
29182 let l358 = *base.add(16).cast::<*mut u8>();
29183 let l359 = *base.add(20).cast::<usize>();
29184 let len360 = l359;
29185 let bytes360 = _rt::Vec::from_raw_parts(
29186 l358.cast(),
29187 len360,
29188 len360,
29189 );
29190 Enumeration {
29191 name: _rt::string_lift(bytes357),
29192 value: _rt::string_lift(bytes360),
29193 }
29194 };
29195 DbValue::Enumeration(e387)
29196 }
29197 37 => {
29198 let e387 = {
29199 let l361 = *base.add(8).cast::<*mut u8>();
29200 let l362 = *base.add(12).cast::<usize>();
29201 let len363 = l362;
29202 let bytes363 = _rt::Vec::from_raw_parts(
29203 l361.cast(),
29204 len363,
29205 len363,
29206 );
29207 let l364 = *base.add(16).cast::<*mut u8>();
29208 let l365 = *base.add(20).cast::<usize>();
29209 let base367 = l364;
29210 let len367 = l365;
29211 let mut result367 = _rt::Vec::with_capacity(len367);
29212 for i in 0..len367 {
29213 let base = base367.add(i * 4);
29214 let e367 = {
29215 let l366 = *base.add(0).cast::<i32>();
29216 LazyDbValue::from_handle(l366 as u32)
29217 };
29218 result367.push(e367);
29219 }
29220 _rt::cabi_dealloc(base367, len367 * 4, 4);
29221 Composite {
29222 name: _rt::string_lift(bytes363),
29223 values: result367,
29224 }
29225 };
29226 DbValue::Composite(e387)
29227 }
29228 38 => {
29229 let e387 = {
29230 let l368 = *base.add(8).cast::<*mut u8>();
29231 let l369 = *base.add(12).cast::<usize>();
29232 let len370 = l369;
29233 let bytes370 = _rt::Vec::from_raw_parts(
29234 l368.cast(),
29235 len370,
29236 len370,
29237 );
29238 let l371 = *base.add(16).cast::<i32>();
29239 Domain {
29240 name: _rt::string_lift(bytes370),
29241 value: LazyDbValue::from_handle(l371 as u32),
29242 }
29243 };
29244 DbValue::Domain(e387)
29245 }
29246 39 => {
29247 let e387 = {
29248 let l372 = *base.add(8).cast::<*mut u8>();
29249 let l373 = *base.add(12).cast::<usize>();
29250 let base375 = l372;
29251 let len375 = l373;
29252 let mut result375 = _rt::Vec::with_capacity(len375);
29253 for i in 0..len375 {
29254 let base = base375.add(i * 4);
29255 let e375 = {
29256 let l374 = *base.add(0).cast::<i32>();
29257 LazyDbValue::from_handle(l374 as u32)
29258 };
29259 result375.push(e375);
29260 }
29261 _rt::cabi_dealloc(base375, len375 * 4, 4);
29262 result375
29263 };
29264 DbValue::Array(e387)
29265 }
29266 40 => {
29267 let e387 = {
29268 let l376 = *base.add(8).cast::<*mut u8>();
29269 let l377 = *base.add(12).cast::<usize>();
29270 let len378 = l377;
29271 let bytes378 = _rt::Vec::from_raw_parts(
29272 l376.cast(),
29273 len378,
29274 len378,
29275 );
29276 let l379 = i32::from(*base.add(16).cast::<u8>());
29277 let v382 = match l379 {
29278 0 => {
29279 let e382 = {
29280 let l380 = *base.add(20).cast::<i32>();
29281 LazyDbValue::from_handle(l380 as u32)
29282 };
29283 ValueBound::Included(e382)
29284 }
29285 1 => {
29286 let e382 = {
29287 let l381 = *base.add(20).cast::<i32>();
29288 LazyDbValue::from_handle(l381 as u32)
29289 };
29290 ValueBound::Excluded(e382)
29291 }
29292 n => {
29293 debug_assert_eq!(n, 2, "invalid enum discriminant");
29294 ValueBound::Unbounded
29295 }
29296 };
29297 let l383 = i32::from(*base.add(24).cast::<u8>());
29298 let v386 = match l383 {
29299 0 => {
29300 let e386 = {
29301 let l384 = *base.add(28).cast::<i32>();
29302 LazyDbValue::from_handle(l384 as u32)
29303 };
29304 ValueBound::Included(e386)
29305 }
29306 1 => {
29307 let e386 = {
29308 let l385 = *base.add(28).cast::<i32>();
29309 LazyDbValue::from_handle(l385 as u32)
29310 };
29311 ValueBound::Excluded(e386)
29312 }
29313 n => {
29314 debug_assert_eq!(n, 2, "invalid enum discriminant");
29315 ValueBound::Unbounded
29316 }
29317 };
29318 Range {
29319 name: _rt::string_lift(bytes378),
29320 value: ValuesRange {
29321 start: v382,
29322 end: v386,
29323 },
29324 }
29325 };
29326 DbValue::Range(e387)
29327 }
29328 n => {
29329 debug_assert_eq!(n, 41, "invalid enum discriminant");
29330 DbValue::Null
29331 }
29332 };
29333 v387
29334 };
29335 result388.push(e388);
29336 }
29337 _rt::cabi_dealloc(base388, len388 * 56, 8);
29338 DbRow { values: result388 }
29339 };
29340 result389.push(e389);
29341 }
29342 _rt::cabi_dealloc(base389, len389 * 8, 4);
29343 DbResult {
29344 columns: result123,
29345 rows: result389,
29346 }
29347 };
29348 Ok(e)
29349 }
29350 1 => {
29351 let e = {
29352 let l390 = i32::from(*ptr88.add(4).cast::<u8>());
29353 let v406 = match l390 {
29354 0 => {
29355 let e406 = {
29356 let l391 = *ptr88.add(8).cast::<*mut u8>();
29357 let l392 = *ptr88.add(12).cast::<usize>();
29358 let len393 = l392;
29359 let bytes393 = _rt::Vec::from_raw_parts(
29360 l391.cast(),
29361 len393,
29362 len393,
29363 );
29364 _rt::string_lift(bytes393)
29365 };
29366 Error::ConnectionFailure(e406)
29367 }
29368 1 => {
29369 let e406 = {
29370 let l394 = *ptr88.add(8).cast::<*mut u8>();
29371 let l395 = *ptr88.add(12).cast::<usize>();
29372 let len396 = l395;
29373 let bytes396 = _rt::Vec::from_raw_parts(
29374 l394.cast(),
29375 len396,
29376 len396,
29377 );
29378 _rt::string_lift(bytes396)
29379 };
29380 Error::QueryParameterFailure(e406)
29381 }
29382 2 => {
29383 let e406 = {
29384 let l397 = *ptr88.add(8).cast::<*mut u8>();
29385 let l398 = *ptr88.add(12).cast::<usize>();
29386 let len399 = l398;
29387 let bytes399 = _rt::Vec::from_raw_parts(
29388 l397.cast(),
29389 len399,
29390 len399,
29391 );
29392 _rt::string_lift(bytes399)
29393 };
29394 Error::QueryExecutionFailure(e406)
29395 }
29396 3 => {
29397 let e406 = {
29398 let l400 = *ptr88.add(8).cast::<*mut u8>();
29399 let l401 = *ptr88.add(12).cast::<usize>();
29400 let len402 = l401;
29401 let bytes402 = _rt::Vec::from_raw_parts(
29402 l400.cast(),
29403 len402,
29404 len402,
29405 );
29406 _rt::string_lift(bytes402)
29407 };
29408 Error::QueryResponseFailure(e406)
29409 }
29410 n => {
29411 debug_assert_eq!(n, 4, "invalid enum discriminant");
29412 let e406 = {
29413 let l403 = *ptr88.add(8).cast::<*mut u8>();
29414 let l404 = *ptr88.add(12).cast::<usize>();
29415 let len405 = l404;
29416 let bytes405 = _rt::Vec::from_raw_parts(
29417 l403.cast(),
29418 len405,
29419 len405,
29420 );
29421 _rt::string_lift(bytes405)
29422 };
29423 Error::Other(e406)
29424 }
29425 };
29426 v406
29427 };
29428 Err(e)
29429 }
29430 _ => _rt::invalid_enum_discriminant(),
29431 }
29432 }
29433 }
29434 }
29435 impl DbTransaction {
29436 #[allow(unused_unsafe, clippy::all)]
29437 pub fn query_stream(
29438 &self,
29439 statement: &str,
29440 params: _rt::Vec<DbValue>,
29441 ) -> Result<DbResultStream, Error> {
29442 unsafe {
29443 let mut cleanup_list = _rt::Vec::new();
29444 #[repr(align(4))]
29445 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
29446 let mut ret_area = RetArea(
29447 [::core::mem::MaybeUninit::uninit(); 16],
29448 );
29449 let vec0 = statement;
29450 let ptr0 = vec0.as_ptr().cast::<u8>();
29451 let len0 = vec0.len();
29452 let vec87 = ¶ms;
29453 let len87 = vec87.len();
29454 let layout87 = _rt::alloc::Layout::from_size_align_unchecked(
29455 vec87.len() * 56,
29456 8,
29457 );
29458 let result87 = if layout87.size() != 0 {
29459 let ptr = _rt::alloc::alloc(layout87).cast::<u8>();
29460 if ptr.is_null() {
29461 _rt::alloc::handle_alloc_error(layout87);
29462 }
29463 ptr
29464 } else {
29465 ::core::ptr::null_mut()
29466 };
29467 for (i, e) in vec87.into_iter().enumerate() {
29468 let base = result87.add(i * 56);
29469 {
29470 match e {
29471 DbValue::Character(e) => {
29472 *base.add(0).cast::<u8>() = (0i32) as u8;
29473 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
29474 }
29475 DbValue::Int2(e) => {
29476 *base.add(0).cast::<u8>() = (1i32) as u8;
29477 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
29478 }
29479 DbValue::Int4(e) => {
29480 *base.add(0).cast::<u8>() = (2i32) as u8;
29481 *base.add(8).cast::<i32>() = _rt::as_i32(e);
29482 }
29483 DbValue::Int8(e) => {
29484 *base.add(0).cast::<u8>() = (3i32) as u8;
29485 *base.add(8).cast::<i64>() = _rt::as_i64(e);
29486 }
29487 DbValue::Float4(e) => {
29488 *base.add(0).cast::<u8>() = (4i32) as u8;
29489 *base.add(8).cast::<f32>() = _rt::as_f32(e);
29490 }
29491 DbValue::Float8(e) => {
29492 *base.add(0).cast::<u8>() = (5i32) as u8;
29493 *base.add(8).cast::<f64>() = _rt::as_f64(e);
29494 }
29495 DbValue::Numeric(e) => {
29496 *base.add(0).cast::<u8>() = (6i32) as u8;
29497 let vec1 = e;
29498 let ptr1 = vec1.as_ptr().cast::<u8>();
29499 let len1 = vec1.len();
29500 *base.add(12).cast::<usize>() = len1;
29501 *base.add(8).cast::<*mut u8>() = ptr1.cast_mut();
29502 }
29503 DbValue::Boolean(e) => {
29504 *base.add(0).cast::<u8>() = (7i32) as u8;
29505 *base.add(8).cast::<u8>() = (match e {
29506 true => 1,
29507 false => 0,
29508 }) as u8;
29509 }
29510 DbValue::Text(e) => {
29511 *base.add(0).cast::<u8>() = (8i32) as u8;
29512 let vec2 = e;
29513 let ptr2 = vec2.as_ptr().cast::<u8>();
29514 let len2 = vec2.len();
29515 *base.add(12).cast::<usize>() = len2;
29516 *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
29517 }
29518 DbValue::Varchar(e) => {
29519 *base.add(0).cast::<u8>() = (9i32) as u8;
29520 let vec3 = e;
29521 let ptr3 = vec3.as_ptr().cast::<u8>();
29522 let len3 = vec3.len();
29523 *base.add(12).cast::<usize>() = len3;
29524 *base.add(8).cast::<*mut u8>() = ptr3.cast_mut();
29525 }
29526 DbValue::Bpchar(e) => {
29527 *base.add(0).cast::<u8>() = (10i32) as u8;
29528 let vec4 = e;
29529 let ptr4 = vec4.as_ptr().cast::<u8>();
29530 let len4 = vec4.len();
29531 *base.add(12).cast::<usize>() = len4;
29532 *base.add(8).cast::<*mut u8>() = ptr4.cast_mut();
29533 }
29534 DbValue::Timestamp(e) => {
29535 *base.add(0).cast::<u8>() = (11i32) as u8;
29536 let super::super::super::golem::rdbms::types::Timestamp {
29537 date: date5,
29538 time: time5,
29539 } = e;
29540 let super::super::super::golem::rdbms::types::Date {
29541 year: year6,
29542 month: month6,
29543 day: day6,
29544 } = date5;
29545 *base.add(8).cast::<i32>() = _rt::as_i32(year6);
29546 *base.add(12).cast::<u8>() = (_rt::as_i32(month6)) as u8;
29547 *base.add(13).cast::<u8>() = (_rt::as_i32(day6)) as u8;
29548 let super::super::super::golem::rdbms::types::Time {
29549 hour: hour7,
29550 minute: minute7,
29551 second: second7,
29552 nanosecond: nanosecond7,
29553 } = time5;
29554 *base.add(16).cast::<u8>() = (_rt::as_i32(hour7)) as u8;
29555 *base.add(17).cast::<u8>() = (_rt::as_i32(minute7)) as u8;
29556 *base.add(18).cast::<u8>() = (_rt::as_i32(second7)) as u8;
29557 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond7);
29558 }
29559 DbValue::Timestamptz(e) => {
29560 *base.add(0).cast::<u8>() = (12i32) as u8;
29561 let super::super::super::golem::rdbms::types::Timestamptz {
29562 timestamp: timestamp8,
29563 offset: offset8,
29564 } = e;
29565 let super::super::super::golem::rdbms::types::Timestamp {
29566 date: date9,
29567 time: time9,
29568 } = timestamp8;
29569 let super::super::super::golem::rdbms::types::Date {
29570 year: year10,
29571 month: month10,
29572 day: day10,
29573 } = date9;
29574 *base.add(8).cast::<i32>() = _rt::as_i32(year10);
29575 *base.add(12).cast::<u8>() = (_rt::as_i32(month10)) as u8;
29576 *base.add(13).cast::<u8>() = (_rt::as_i32(day10)) as u8;
29577 let super::super::super::golem::rdbms::types::Time {
29578 hour: hour11,
29579 minute: minute11,
29580 second: second11,
29581 nanosecond: nanosecond11,
29582 } = time9;
29583 *base.add(16).cast::<u8>() = (_rt::as_i32(hour11)) as u8;
29584 *base.add(17).cast::<u8>() = (_rt::as_i32(minute11)) as u8;
29585 *base.add(18).cast::<u8>() = (_rt::as_i32(second11)) as u8;
29586 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond11);
29587 *base.add(24).cast::<i32>() = _rt::as_i32(offset8);
29588 }
29589 DbValue::Date(e) => {
29590 *base.add(0).cast::<u8>() = (13i32) as u8;
29591 let super::super::super::golem::rdbms::types::Date {
29592 year: year12,
29593 month: month12,
29594 day: day12,
29595 } = e;
29596 *base.add(8).cast::<i32>() = _rt::as_i32(year12);
29597 *base.add(12).cast::<u8>() = (_rt::as_i32(month12)) as u8;
29598 *base.add(13).cast::<u8>() = (_rt::as_i32(day12)) as u8;
29599 }
29600 DbValue::Time(e) => {
29601 *base.add(0).cast::<u8>() = (14i32) as u8;
29602 let super::super::super::golem::rdbms::types::Time {
29603 hour: hour13,
29604 minute: minute13,
29605 second: second13,
29606 nanosecond: nanosecond13,
29607 } = e;
29608 *base.add(8).cast::<u8>() = (_rt::as_i32(hour13)) as u8;
29609 *base.add(9).cast::<u8>() = (_rt::as_i32(minute13)) as u8;
29610 *base.add(10).cast::<u8>() = (_rt::as_i32(second13)) as u8;
29611 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond13);
29612 }
29613 DbValue::Timetz(e) => {
29614 *base.add(0).cast::<u8>() = (15i32) as u8;
29615 let super::super::super::golem::rdbms::types::Timetz {
29616 time: time14,
29617 offset: offset14,
29618 } = e;
29619 let super::super::super::golem::rdbms::types::Time {
29620 hour: hour15,
29621 minute: minute15,
29622 second: second15,
29623 nanosecond: nanosecond15,
29624 } = time14;
29625 *base.add(8).cast::<u8>() = (_rt::as_i32(hour15)) as u8;
29626 *base.add(9).cast::<u8>() = (_rt::as_i32(minute15)) as u8;
29627 *base.add(10).cast::<u8>() = (_rt::as_i32(second15)) as u8;
29628 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond15);
29629 *base.add(16).cast::<i32>() = _rt::as_i32(offset14);
29630 }
29631 DbValue::Interval(e) => {
29632 *base.add(0).cast::<u8>() = (16i32) as u8;
29633 let Interval {
29634 months: months16,
29635 days: days16,
29636 microseconds: microseconds16,
29637 } = e;
29638 *base.add(8).cast::<i32>() = _rt::as_i32(months16);
29639 *base.add(12).cast::<i32>() = _rt::as_i32(days16);
29640 *base.add(16).cast::<i64>() = _rt::as_i64(microseconds16);
29641 }
29642 DbValue::Bytea(e) => {
29643 *base.add(0).cast::<u8>() = (17i32) as u8;
29644 let vec17 = e;
29645 let ptr17 = vec17.as_ptr().cast::<u8>();
29646 let len17 = vec17.len();
29647 *base.add(12).cast::<usize>() = len17;
29648 *base.add(8).cast::<*mut u8>() = ptr17.cast_mut();
29649 }
29650 DbValue::Json(e) => {
29651 *base.add(0).cast::<u8>() = (18i32) as u8;
29652 let vec18 = e;
29653 let ptr18 = vec18.as_ptr().cast::<u8>();
29654 let len18 = vec18.len();
29655 *base.add(12).cast::<usize>() = len18;
29656 *base.add(8).cast::<*mut u8>() = ptr18.cast_mut();
29657 }
29658 DbValue::Jsonb(e) => {
29659 *base.add(0).cast::<u8>() = (19i32) as u8;
29660 let vec19 = e;
29661 let ptr19 = vec19.as_ptr().cast::<u8>();
29662 let len19 = vec19.len();
29663 *base.add(12).cast::<usize>() = len19;
29664 *base.add(8).cast::<*mut u8>() = ptr19.cast_mut();
29665 }
29666 DbValue::Jsonpath(e) => {
29667 *base.add(0).cast::<u8>() = (20i32) as u8;
29668 let vec20 = e;
29669 let ptr20 = vec20.as_ptr().cast::<u8>();
29670 let len20 = vec20.len();
29671 *base.add(12).cast::<usize>() = len20;
29672 *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
29673 }
29674 DbValue::Xml(e) => {
29675 *base.add(0).cast::<u8>() = (21i32) as u8;
29676 let vec21 = e;
29677 let ptr21 = vec21.as_ptr().cast::<u8>();
29678 let len21 = vec21.len();
29679 *base.add(12).cast::<usize>() = len21;
29680 *base.add(8).cast::<*mut u8>() = ptr21.cast_mut();
29681 }
29682 DbValue::Uuid(e) => {
29683 *base.add(0).cast::<u8>() = (22i32) as u8;
29684 let super::super::super::golem::rdbms::types::Uuid {
29685 high_bits: high_bits22,
29686 low_bits: low_bits22,
29687 } = e;
29688 *base.add(8).cast::<i64>() = _rt::as_i64(high_bits22);
29689 *base.add(16).cast::<i64>() = _rt::as_i64(low_bits22);
29690 }
29691 DbValue::Inet(e) => {
29692 *base.add(0).cast::<u8>() = (23i32) as u8;
29693 use super::super::super::golem::rdbms::types::IpAddress as V25;
29694 match e {
29695 V25::Ipv4(e) => {
29696 *base.add(8).cast::<u8>() = (0i32) as u8;
29697 let (t23_0, t23_1, t23_2, t23_3) = e;
29698 *base.add(10).cast::<u8>() = (_rt::as_i32(t23_0)) as u8;
29699 *base.add(11).cast::<u8>() = (_rt::as_i32(t23_1)) as u8;
29700 *base.add(12).cast::<u8>() = (_rt::as_i32(t23_2)) as u8;
29701 *base.add(13).cast::<u8>() = (_rt::as_i32(t23_3)) as u8;
29702 }
29703 V25::Ipv6(e) => {
29704 *base.add(8).cast::<u8>() = (1i32) as u8;
29705 let (
29706 t24_0,
29707 t24_1,
29708 t24_2,
29709 t24_3,
29710 t24_4,
29711 t24_5,
29712 t24_6,
29713 t24_7,
29714 ) = e;
29715 *base.add(10).cast::<u16>() = (_rt::as_i32(t24_0)) as u16;
29716 *base.add(12).cast::<u16>() = (_rt::as_i32(t24_1)) as u16;
29717 *base.add(14).cast::<u16>() = (_rt::as_i32(t24_2)) as u16;
29718 *base.add(16).cast::<u16>() = (_rt::as_i32(t24_3)) as u16;
29719 *base.add(18).cast::<u16>() = (_rt::as_i32(t24_4)) as u16;
29720 *base.add(20).cast::<u16>() = (_rt::as_i32(t24_5)) as u16;
29721 *base.add(22).cast::<u16>() = (_rt::as_i32(t24_6)) as u16;
29722 *base.add(24).cast::<u16>() = (_rt::as_i32(t24_7)) as u16;
29723 }
29724 }
29725 }
29726 DbValue::Cidr(e) => {
29727 *base.add(0).cast::<u8>() = (24i32) as u8;
29728 use super::super::super::golem::rdbms::types::IpAddress as V28;
29729 match e {
29730 V28::Ipv4(e) => {
29731 *base.add(8).cast::<u8>() = (0i32) as u8;
29732 let (t26_0, t26_1, t26_2, t26_3) = e;
29733 *base.add(10).cast::<u8>() = (_rt::as_i32(t26_0)) as u8;
29734 *base.add(11).cast::<u8>() = (_rt::as_i32(t26_1)) as u8;
29735 *base.add(12).cast::<u8>() = (_rt::as_i32(t26_2)) as u8;
29736 *base.add(13).cast::<u8>() = (_rt::as_i32(t26_3)) as u8;
29737 }
29738 V28::Ipv6(e) => {
29739 *base.add(8).cast::<u8>() = (1i32) as u8;
29740 let (
29741 t27_0,
29742 t27_1,
29743 t27_2,
29744 t27_3,
29745 t27_4,
29746 t27_5,
29747 t27_6,
29748 t27_7,
29749 ) = e;
29750 *base.add(10).cast::<u16>() = (_rt::as_i32(t27_0)) as u16;
29751 *base.add(12).cast::<u16>() = (_rt::as_i32(t27_1)) as u16;
29752 *base.add(14).cast::<u16>() = (_rt::as_i32(t27_2)) as u16;
29753 *base.add(16).cast::<u16>() = (_rt::as_i32(t27_3)) as u16;
29754 *base.add(18).cast::<u16>() = (_rt::as_i32(t27_4)) as u16;
29755 *base.add(20).cast::<u16>() = (_rt::as_i32(t27_5)) as u16;
29756 *base.add(22).cast::<u16>() = (_rt::as_i32(t27_6)) as u16;
29757 *base.add(24).cast::<u16>() = (_rt::as_i32(t27_7)) as u16;
29758 }
29759 }
29760 }
29761 DbValue::Macaddr(e) => {
29762 *base.add(0).cast::<u8>() = (25i32) as u8;
29763 let super::super::super::golem::rdbms::types::MacAddress {
29764 octets: octets29,
29765 } = e;
29766 let (t30_0, t30_1, t30_2, t30_3, t30_4, t30_5) = octets29;
29767 *base.add(8).cast::<u8>() = (_rt::as_i32(t30_0)) as u8;
29768 *base.add(9).cast::<u8>() = (_rt::as_i32(t30_1)) as u8;
29769 *base.add(10).cast::<u8>() = (_rt::as_i32(t30_2)) as u8;
29770 *base.add(11).cast::<u8>() = (_rt::as_i32(t30_3)) as u8;
29771 *base.add(12).cast::<u8>() = (_rt::as_i32(t30_4)) as u8;
29772 *base.add(13).cast::<u8>() = (_rt::as_i32(t30_5)) as u8;
29773 }
29774 DbValue::Bit(e) => {
29775 *base.add(0).cast::<u8>() = (26i32) as u8;
29776 let vec31 = e;
29777 let len31 = vec31.len();
29778 let layout31 = _rt::alloc::Layout::from_size_align_unchecked(
29779 vec31.len() * 1,
29780 1,
29781 );
29782 let result31 = if layout31.size() != 0 {
29783 let ptr = _rt::alloc::alloc(layout31).cast::<u8>();
29784 if ptr.is_null() {
29785 _rt::alloc::handle_alloc_error(layout31);
29786 }
29787 ptr
29788 } else {
29789 ::core::ptr::null_mut()
29790 };
29791 for (i, e) in vec31.into_iter().enumerate() {
29792 let base = result31.add(i * 1);
29793 {
29794 *base.add(0).cast::<u8>() = (match e {
29795 true => 1,
29796 false => 0,
29797 }) as u8;
29798 }
29799 }
29800 *base.add(12).cast::<usize>() = len31;
29801 *base.add(8).cast::<*mut u8>() = result31;
29802 cleanup_list.extend_from_slice(&[(result31, layout31)]);
29803 }
29804 DbValue::Varbit(e) => {
29805 *base.add(0).cast::<u8>() = (27i32) as u8;
29806 let vec32 = e;
29807 let len32 = vec32.len();
29808 let layout32 = _rt::alloc::Layout::from_size_align_unchecked(
29809 vec32.len() * 1,
29810 1,
29811 );
29812 let result32 = if layout32.size() != 0 {
29813 let ptr = _rt::alloc::alloc(layout32).cast::<u8>();
29814 if ptr.is_null() {
29815 _rt::alloc::handle_alloc_error(layout32);
29816 }
29817 ptr
29818 } else {
29819 ::core::ptr::null_mut()
29820 };
29821 for (i, e) in vec32.into_iter().enumerate() {
29822 let base = result32.add(i * 1);
29823 {
29824 *base.add(0).cast::<u8>() = (match e {
29825 true => 1,
29826 false => 0,
29827 }) as u8;
29828 }
29829 }
29830 *base.add(12).cast::<usize>() = len32;
29831 *base.add(8).cast::<*mut u8>() = result32;
29832 cleanup_list.extend_from_slice(&[(result32, layout32)]);
29833 }
29834 DbValue::Int4range(e) => {
29835 *base.add(0).cast::<u8>() = (28i32) as u8;
29836 let Int4range { start: start33, end: end33 } = e;
29837 match start33 {
29838 Int4bound::Included(e) => {
29839 *base.add(8).cast::<u8>() = (0i32) as u8;
29840 *base.add(12).cast::<i32>() = _rt::as_i32(e);
29841 }
29842 Int4bound::Excluded(e) => {
29843 *base.add(8).cast::<u8>() = (1i32) as u8;
29844 *base.add(12).cast::<i32>() = _rt::as_i32(e);
29845 }
29846 Int4bound::Unbounded => {
29847 *base.add(8).cast::<u8>() = (2i32) as u8;
29848 }
29849 }
29850 match end33 {
29851 Int4bound::Included(e) => {
29852 *base.add(16).cast::<u8>() = (0i32) as u8;
29853 *base.add(20).cast::<i32>() = _rt::as_i32(e);
29854 }
29855 Int4bound::Excluded(e) => {
29856 *base.add(16).cast::<u8>() = (1i32) as u8;
29857 *base.add(20).cast::<i32>() = _rt::as_i32(e);
29858 }
29859 Int4bound::Unbounded => {
29860 *base.add(16).cast::<u8>() = (2i32) as u8;
29861 }
29862 }
29863 }
29864 DbValue::Int8range(e) => {
29865 *base.add(0).cast::<u8>() = (29i32) as u8;
29866 let Int8range { start: start34, end: end34 } = e;
29867 match start34 {
29868 Int8bound::Included(e) => {
29869 *base.add(8).cast::<u8>() = (0i32) as u8;
29870 *base.add(16).cast::<i64>() = _rt::as_i64(e);
29871 }
29872 Int8bound::Excluded(e) => {
29873 *base.add(8).cast::<u8>() = (1i32) as u8;
29874 *base.add(16).cast::<i64>() = _rt::as_i64(e);
29875 }
29876 Int8bound::Unbounded => {
29877 *base.add(8).cast::<u8>() = (2i32) as u8;
29878 }
29879 }
29880 match end34 {
29881 Int8bound::Included(e) => {
29882 *base.add(24).cast::<u8>() = (0i32) as u8;
29883 *base.add(32).cast::<i64>() = _rt::as_i64(e);
29884 }
29885 Int8bound::Excluded(e) => {
29886 *base.add(24).cast::<u8>() = (1i32) as u8;
29887 *base.add(32).cast::<i64>() = _rt::as_i64(e);
29888 }
29889 Int8bound::Unbounded => {
29890 *base.add(24).cast::<u8>() = (2i32) as u8;
29891 }
29892 }
29893 }
29894 DbValue::Numrange(e) => {
29895 *base.add(0).cast::<u8>() = (30i32) as u8;
29896 let Numrange { start: start35, end: end35 } = e;
29897 match start35 {
29898 Numbound::Included(e) => {
29899 *base.add(8).cast::<u8>() = (0i32) as u8;
29900 let vec36 = e;
29901 let ptr36 = vec36.as_ptr().cast::<u8>();
29902 let len36 = vec36.len();
29903 *base.add(16).cast::<usize>() = len36;
29904 *base.add(12).cast::<*mut u8>() = ptr36.cast_mut();
29905 }
29906 Numbound::Excluded(e) => {
29907 *base.add(8).cast::<u8>() = (1i32) as u8;
29908 let vec37 = e;
29909 let ptr37 = vec37.as_ptr().cast::<u8>();
29910 let len37 = vec37.len();
29911 *base.add(16).cast::<usize>() = len37;
29912 *base.add(12).cast::<*mut u8>() = ptr37.cast_mut();
29913 }
29914 Numbound::Unbounded => {
29915 *base.add(8).cast::<u8>() = (2i32) as u8;
29916 }
29917 }
29918 match end35 {
29919 Numbound::Included(e) => {
29920 *base.add(20).cast::<u8>() = (0i32) as u8;
29921 let vec38 = e;
29922 let ptr38 = vec38.as_ptr().cast::<u8>();
29923 let len38 = vec38.len();
29924 *base.add(28).cast::<usize>() = len38;
29925 *base.add(24).cast::<*mut u8>() = ptr38.cast_mut();
29926 }
29927 Numbound::Excluded(e) => {
29928 *base.add(20).cast::<u8>() = (1i32) as u8;
29929 let vec39 = e;
29930 let ptr39 = vec39.as_ptr().cast::<u8>();
29931 let len39 = vec39.len();
29932 *base.add(28).cast::<usize>() = len39;
29933 *base.add(24).cast::<*mut u8>() = ptr39.cast_mut();
29934 }
29935 Numbound::Unbounded => {
29936 *base.add(20).cast::<u8>() = (2i32) as u8;
29937 }
29938 }
29939 }
29940 DbValue::Tsrange(e) => {
29941 *base.add(0).cast::<u8>() = (31i32) as u8;
29942 let Tsrange { start: start40, end: end40 } = e;
29943 match start40 {
29944 Tsbound::Included(e) => {
29945 *base.add(8).cast::<u8>() = (0i32) as u8;
29946 let super::super::super::golem::rdbms::types::Timestamp {
29947 date: date41,
29948 time: time41,
29949 } = e;
29950 let super::super::super::golem::rdbms::types::Date {
29951 year: year42,
29952 month: month42,
29953 day: day42,
29954 } = date41;
29955 *base.add(12).cast::<i32>() = _rt::as_i32(year42);
29956 *base.add(16).cast::<u8>() = (_rt::as_i32(month42)) as u8;
29957 *base.add(17).cast::<u8>() = (_rt::as_i32(day42)) as u8;
29958 let super::super::super::golem::rdbms::types::Time {
29959 hour: hour43,
29960 minute: minute43,
29961 second: second43,
29962 nanosecond: nanosecond43,
29963 } = time41;
29964 *base.add(20).cast::<u8>() = (_rt::as_i32(hour43)) as u8;
29965 *base.add(21).cast::<u8>() = (_rt::as_i32(minute43)) as u8;
29966 *base.add(22).cast::<u8>() = (_rt::as_i32(second43)) as u8;
29967 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond43);
29968 }
29969 Tsbound::Excluded(e) => {
29970 *base.add(8).cast::<u8>() = (1i32) as u8;
29971 let super::super::super::golem::rdbms::types::Timestamp {
29972 date: date44,
29973 time: time44,
29974 } = e;
29975 let super::super::super::golem::rdbms::types::Date {
29976 year: year45,
29977 month: month45,
29978 day: day45,
29979 } = date44;
29980 *base.add(12).cast::<i32>() = _rt::as_i32(year45);
29981 *base.add(16).cast::<u8>() = (_rt::as_i32(month45)) as u8;
29982 *base.add(17).cast::<u8>() = (_rt::as_i32(day45)) as u8;
29983 let super::super::super::golem::rdbms::types::Time {
29984 hour: hour46,
29985 minute: minute46,
29986 second: second46,
29987 nanosecond: nanosecond46,
29988 } = time44;
29989 *base.add(20).cast::<u8>() = (_rt::as_i32(hour46)) as u8;
29990 *base.add(21).cast::<u8>() = (_rt::as_i32(minute46)) as u8;
29991 *base.add(22).cast::<u8>() = (_rt::as_i32(second46)) as u8;
29992 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond46);
29993 }
29994 Tsbound::Unbounded => {
29995 *base.add(8).cast::<u8>() = (2i32) as u8;
29996 }
29997 }
29998 match end40 {
29999 Tsbound::Included(e) => {
30000 *base.add(28).cast::<u8>() = (0i32) as u8;
30001 let super::super::super::golem::rdbms::types::Timestamp {
30002 date: date47,
30003 time: time47,
30004 } = e;
30005 let super::super::super::golem::rdbms::types::Date {
30006 year: year48,
30007 month: month48,
30008 day: day48,
30009 } = date47;
30010 *base.add(32).cast::<i32>() = _rt::as_i32(year48);
30011 *base.add(36).cast::<u8>() = (_rt::as_i32(month48)) as u8;
30012 *base.add(37).cast::<u8>() = (_rt::as_i32(day48)) as u8;
30013 let super::super::super::golem::rdbms::types::Time {
30014 hour: hour49,
30015 minute: minute49,
30016 second: second49,
30017 nanosecond: nanosecond49,
30018 } = time47;
30019 *base.add(40).cast::<u8>() = (_rt::as_i32(hour49)) as u8;
30020 *base.add(41).cast::<u8>() = (_rt::as_i32(minute49)) as u8;
30021 *base.add(42).cast::<u8>() = (_rt::as_i32(second49)) as u8;
30022 *base.add(44).cast::<i32>() = _rt::as_i32(nanosecond49);
30023 }
30024 Tsbound::Excluded(e) => {
30025 *base.add(28).cast::<u8>() = (1i32) as u8;
30026 let super::super::super::golem::rdbms::types::Timestamp {
30027 date: date50,
30028 time: time50,
30029 } = e;
30030 let super::super::super::golem::rdbms::types::Date {
30031 year: year51,
30032 month: month51,
30033 day: day51,
30034 } = date50;
30035 *base.add(32).cast::<i32>() = _rt::as_i32(year51);
30036 *base.add(36).cast::<u8>() = (_rt::as_i32(month51)) as u8;
30037 *base.add(37).cast::<u8>() = (_rt::as_i32(day51)) as u8;
30038 let super::super::super::golem::rdbms::types::Time {
30039 hour: hour52,
30040 minute: minute52,
30041 second: second52,
30042 nanosecond: nanosecond52,
30043 } = time50;
30044 *base.add(40).cast::<u8>() = (_rt::as_i32(hour52)) as u8;
30045 *base.add(41).cast::<u8>() = (_rt::as_i32(minute52)) as u8;
30046 *base.add(42).cast::<u8>() = (_rt::as_i32(second52)) as u8;
30047 *base.add(44).cast::<i32>() = _rt::as_i32(nanosecond52);
30048 }
30049 Tsbound::Unbounded => {
30050 *base.add(28).cast::<u8>() = (2i32) as u8;
30051 }
30052 }
30053 }
30054 DbValue::Tstzrange(e) => {
30055 *base.add(0).cast::<u8>() = (32i32) as u8;
30056 let Tstzrange { start: start53, end: end53 } = e;
30057 match start53 {
30058 Tstzbound::Included(e) => {
30059 *base.add(8).cast::<u8>() = (0i32) as u8;
30060 let super::super::super::golem::rdbms::types::Timestamptz {
30061 timestamp: timestamp54,
30062 offset: offset54,
30063 } = e;
30064 let super::super::super::golem::rdbms::types::Timestamp {
30065 date: date55,
30066 time: time55,
30067 } = timestamp54;
30068 let super::super::super::golem::rdbms::types::Date {
30069 year: year56,
30070 month: month56,
30071 day: day56,
30072 } = date55;
30073 *base.add(12).cast::<i32>() = _rt::as_i32(year56);
30074 *base.add(16).cast::<u8>() = (_rt::as_i32(month56)) as u8;
30075 *base.add(17).cast::<u8>() = (_rt::as_i32(day56)) as u8;
30076 let super::super::super::golem::rdbms::types::Time {
30077 hour: hour57,
30078 minute: minute57,
30079 second: second57,
30080 nanosecond: nanosecond57,
30081 } = time55;
30082 *base.add(20).cast::<u8>() = (_rt::as_i32(hour57)) as u8;
30083 *base.add(21).cast::<u8>() = (_rt::as_i32(minute57)) as u8;
30084 *base.add(22).cast::<u8>() = (_rt::as_i32(second57)) as u8;
30085 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond57);
30086 *base.add(28).cast::<i32>() = _rt::as_i32(offset54);
30087 }
30088 Tstzbound::Excluded(e) => {
30089 *base.add(8).cast::<u8>() = (1i32) as u8;
30090 let super::super::super::golem::rdbms::types::Timestamptz {
30091 timestamp: timestamp58,
30092 offset: offset58,
30093 } = e;
30094 let super::super::super::golem::rdbms::types::Timestamp {
30095 date: date59,
30096 time: time59,
30097 } = timestamp58;
30098 let super::super::super::golem::rdbms::types::Date {
30099 year: year60,
30100 month: month60,
30101 day: day60,
30102 } = date59;
30103 *base.add(12).cast::<i32>() = _rt::as_i32(year60);
30104 *base.add(16).cast::<u8>() = (_rt::as_i32(month60)) as u8;
30105 *base.add(17).cast::<u8>() = (_rt::as_i32(day60)) as u8;
30106 let super::super::super::golem::rdbms::types::Time {
30107 hour: hour61,
30108 minute: minute61,
30109 second: second61,
30110 nanosecond: nanosecond61,
30111 } = time59;
30112 *base.add(20).cast::<u8>() = (_rt::as_i32(hour61)) as u8;
30113 *base.add(21).cast::<u8>() = (_rt::as_i32(minute61)) as u8;
30114 *base.add(22).cast::<u8>() = (_rt::as_i32(second61)) as u8;
30115 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond61);
30116 *base.add(28).cast::<i32>() = _rt::as_i32(offset58);
30117 }
30118 Tstzbound::Unbounded => {
30119 *base.add(8).cast::<u8>() = (2i32) as u8;
30120 }
30121 }
30122 match end53 {
30123 Tstzbound::Included(e) => {
30124 *base.add(32).cast::<u8>() = (0i32) as u8;
30125 let super::super::super::golem::rdbms::types::Timestamptz {
30126 timestamp: timestamp62,
30127 offset: offset62,
30128 } = e;
30129 let super::super::super::golem::rdbms::types::Timestamp {
30130 date: date63,
30131 time: time63,
30132 } = timestamp62;
30133 let super::super::super::golem::rdbms::types::Date {
30134 year: year64,
30135 month: month64,
30136 day: day64,
30137 } = date63;
30138 *base.add(36).cast::<i32>() = _rt::as_i32(year64);
30139 *base.add(40).cast::<u8>() = (_rt::as_i32(month64)) as u8;
30140 *base.add(41).cast::<u8>() = (_rt::as_i32(day64)) as u8;
30141 let super::super::super::golem::rdbms::types::Time {
30142 hour: hour65,
30143 minute: minute65,
30144 second: second65,
30145 nanosecond: nanosecond65,
30146 } = time63;
30147 *base.add(44).cast::<u8>() = (_rt::as_i32(hour65)) as u8;
30148 *base.add(45).cast::<u8>() = (_rt::as_i32(minute65)) as u8;
30149 *base.add(46).cast::<u8>() = (_rt::as_i32(second65)) as u8;
30150 *base.add(48).cast::<i32>() = _rt::as_i32(nanosecond65);
30151 *base.add(52).cast::<i32>() = _rt::as_i32(offset62);
30152 }
30153 Tstzbound::Excluded(e) => {
30154 *base.add(32).cast::<u8>() = (1i32) as u8;
30155 let super::super::super::golem::rdbms::types::Timestamptz {
30156 timestamp: timestamp66,
30157 offset: offset66,
30158 } = e;
30159 let super::super::super::golem::rdbms::types::Timestamp {
30160 date: date67,
30161 time: time67,
30162 } = timestamp66;
30163 let super::super::super::golem::rdbms::types::Date {
30164 year: year68,
30165 month: month68,
30166 day: day68,
30167 } = date67;
30168 *base.add(36).cast::<i32>() = _rt::as_i32(year68);
30169 *base.add(40).cast::<u8>() = (_rt::as_i32(month68)) as u8;
30170 *base.add(41).cast::<u8>() = (_rt::as_i32(day68)) as u8;
30171 let super::super::super::golem::rdbms::types::Time {
30172 hour: hour69,
30173 minute: minute69,
30174 second: second69,
30175 nanosecond: nanosecond69,
30176 } = time67;
30177 *base.add(44).cast::<u8>() = (_rt::as_i32(hour69)) as u8;
30178 *base.add(45).cast::<u8>() = (_rt::as_i32(minute69)) as u8;
30179 *base.add(46).cast::<u8>() = (_rt::as_i32(second69)) as u8;
30180 *base.add(48).cast::<i32>() = _rt::as_i32(nanosecond69);
30181 *base.add(52).cast::<i32>() = _rt::as_i32(offset66);
30182 }
30183 Tstzbound::Unbounded => {
30184 *base.add(32).cast::<u8>() = (2i32) as u8;
30185 }
30186 }
30187 }
30188 DbValue::Daterange(e) => {
30189 *base.add(0).cast::<u8>() = (33i32) as u8;
30190 let Daterange { start: start70, end: end70 } = e;
30191 match start70 {
30192 Datebound::Included(e) => {
30193 *base.add(8).cast::<u8>() = (0i32) as u8;
30194 let super::super::super::golem::rdbms::types::Date {
30195 year: year71,
30196 month: month71,
30197 day: day71,
30198 } = e;
30199 *base.add(12).cast::<i32>() = _rt::as_i32(year71);
30200 *base.add(16).cast::<u8>() = (_rt::as_i32(month71)) as u8;
30201 *base.add(17).cast::<u8>() = (_rt::as_i32(day71)) as u8;
30202 }
30203 Datebound::Excluded(e) => {
30204 *base.add(8).cast::<u8>() = (1i32) as u8;
30205 let super::super::super::golem::rdbms::types::Date {
30206 year: year72,
30207 month: month72,
30208 day: day72,
30209 } = e;
30210 *base.add(12).cast::<i32>() = _rt::as_i32(year72);
30211 *base.add(16).cast::<u8>() = (_rt::as_i32(month72)) as u8;
30212 *base.add(17).cast::<u8>() = (_rt::as_i32(day72)) as u8;
30213 }
30214 Datebound::Unbounded => {
30215 *base.add(8).cast::<u8>() = (2i32) as u8;
30216 }
30217 }
30218 match end70 {
30219 Datebound::Included(e) => {
30220 *base.add(20).cast::<u8>() = (0i32) as u8;
30221 let super::super::super::golem::rdbms::types::Date {
30222 year: year73,
30223 month: month73,
30224 day: day73,
30225 } = e;
30226 *base.add(24).cast::<i32>() = _rt::as_i32(year73);
30227 *base.add(28).cast::<u8>() = (_rt::as_i32(month73)) as u8;
30228 *base.add(29).cast::<u8>() = (_rt::as_i32(day73)) as u8;
30229 }
30230 Datebound::Excluded(e) => {
30231 *base.add(20).cast::<u8>() = (1i32) as u8;
30232 let super::super::super::golem::rdbms::types::Date {
30233 year: year74,
30234 month: month74,
30235 day: day74,
30236 } = e;
30237 *base.add(24).cast::<i32>() = _rt::as_i32(year74);
30238 *base.add(28).cast::<u8>() = (_rt::as_i32(month74)) as u8;
30239 *base.add(29).cast::<u8>() = (_rt::as_i32(day74)) as u8;
30240 }
30241 Datebound::Unbounded => {
30242 *base.add(20).cast::<u8>() = (2i32) as u8;
30243 }
30244 }
30245 }
30246 DbValue::Money(e) => {
30247 *base.add(0).cast::<u8>() = (34i32) as u8;
30248 *base.add(8).cast::<i64>() = _rt::as_i64(e);
30249 }
30250 DbValue::Oid(e) => {
30251 *base.add(0).cast::<u8>() = (35i32) as u8;
30252 *base.add(8).cast::<i32>() = _rt::as_i32(e);
30253 }
30254 DbValue::Enumeration(e) => {
30255 *base.add(0).cast::<u8>() = (36i32) as u8;
30256 let Enumeration { name: name75, value: value75 } = e;
30257 let vec76 = name75;
30258 let ptr76 = vec76.as_ptr().cast::<u8>();
30259 let len76 = vec76.len();
30260 *base.add(12).cast::<usize>() = len76;
30261 *base.add(8).cast::<*mut u8>() = ptr76.cast_mut();
30262 let vec77 = value75;
30263 let ptr77 = vec77.as_ptr().cast::<u8>();
30264 let len77 = vec77.len();
30265 *base.add(20).cast::<usize>() = len77;
30266 *base.add(16).cast::<*mut u8>() = ptr77.cast_mut();
30267 }
30268 DbValue::Composite(e) => {
30269 *base.add(0).cast::<u8>() = (37i32) as u8;
30270 let Composite { name: name78, values: values78 } = e;
30271 let vec79 = name78;
30272 let ptr79 = vec79.as_ptr().cast::<u8>();
30273 let len79 = vec79.len();
30274 *base.add(12).cast::<usize>() = len79;
30275 *base.add(8).cast::<*mut u8>() = ptr79.cast_mut();
30276 let vec80 = values78;
30277 let len80 = vec80.len();
30278 let layout80 = _rt::alloc::Layout::from_size_align_unchecked(
30279 vec80.len() * 4,
30280 4,
30281 );
30282 let result80 = if layout80.size() != 0 {
30283 let ptr = _rt::alloc::alloc(layout80).cast::<u8>();
30284 if ptr.is_null() {
30285 _rt::alloc::handle_alloc_error(layout80);
30286 }
30287 ptr
30288 } else {
30289 ::core::ptr::null_mut()
30290 };
30291 for (i, e) in vec80.into_iter().enumerate() {
30292 let base = result80.add(i * 4);
30293 {
30294 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
30295 }
30296 }
30297 *base.add(20).cast::<usize>() = len80;
30298 *base.add(16).cast::<*mut u8>() = result80;
30299 cleanup_list.extend_from_slice(&[(result80, layout80)]);
30300 }
30301 DbValue::Domain(e) => {
30302 *base.add(0).cast::<u8>() = (38i32) as u8;
30303 let Domain { name: name81, value: value81 } = e;
30304 let vec82 = name81;
30305 let ptr82 = vec82.as_ptr().cast::<u8>();
30306 let len82 = vec82.len();
30307 *base.add(12).cast::<usize>() = len82;
30308 *base.add(8).cast::<*mut u8>() = ptr82.cast_mut();
30309 *base.add(16).cast::<i32>() = (value81).take_handle()
30310 as i32;
30311 }
30312 DbValue::Array(e) => {
30313 *base.add(0).cast::<u8>() = (39i32) as u8;
30314 let vec83 = e;
30315 let len83 = vec83.len();
30316 let layout83 = _rt::alloc::Layout::from_size_align_unchecked(
30317 vec83.len() * 4,
30318 4,
30319 );
30320 let result83 = if layout83.size() != 0 {
30321 let ptr = _rt::alloc::alloc(layout83).cast::<u8>();
30322 if ptr.is_null() {
30323 _rt::alloc::handle_alloc_error(layout83);
30324 }
30325 ptr
30326 } else {
30327 ::core::ptr::null_mut()
30328 };
30329 for (i, e) in vec83.into_iter().enumerate() {
30330 let base = result83.add(i * 4);
30331 {
30332 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
30333 }
30334 }
30335 *base.add(12).cast::<usize>() = len83;
30336 *base.add(8).cast::<*mut u8>() = result83;
30337 cleanup_list.extend_from_slice(&[(result83, layout83)]);
30338 }
30339 DbValue::Range(e) => {
30340 *base.add(0).cast::<u8>() = (40i32) as u8;
30341 let Range { name: name84, value: value84 } = e;
30342 let vec85 = name84;
30343 let ptr85 = vec85.as_ptr().cast::<u8>();
30344 let len85 = vec85.len();
30345 *base.add(12).cast::<usize>() = len85;
30346 *base.add(8).cast::<*mut u8>() = ptr85.cast_mut();
30347 let ValuesRange { start: start86, end: end86 } = value84;
30348 match start86 {
30349 ValueBound::Included(e) => {
30350 *base.add(16).cast::<u8>() = (0i32) as u8;
30351 *base.add(20).cast::<i32>() = (e).take_handle() as i32;
30352 }
30353 ValueBound::Excluded(e) => {
30354 *base.add(16).cast::<u8>() = (1i32) as u8;
30355 *base.add(20).cast::<i32>() = (e).take_handle() as i32;
30356 }
30357 ValueBound::Unbounded => {
30358 *base.add(16).cast::<u8>() = (2i32) as u8;
30359 }
30360 }
30361 match end86 {
30362 ValueBound::Included(e) => {
30363 *base.add(24).cast::<u8>() = (0i32) as u8;
30364 *base.add(28).cast::<i32>() = (e).take_handle() as i32;
30365 }
30366 ValueBound::Excluded(e) => {
30367 *base.add(24).cast::<u8>() = (1i32) as u8;
30368 *base.add(28).cast::<i32>() = (e).take_handle() as i32;
30369 }
30370 ValueBound::Unbounded => {
30371 *base.add(24).cast::<u8>() = (2i32) as u8;
30372 }
30373 }
30374 }
30375 DbValue::Null => {
30376 *base.add(0).cast::<u8>() = (41i32) as u8;
30377 }
30378 }
30379 }
30380 }
30381 let ptr88 = ret_area.0.as_mut_ptr().cast::<u8>();
30382 #[cfg(target_arch = "wasm32")]
30383 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
30384 extern "C" {
30385 #[link_name = "[method]db-transaction.query-stream"]
30386 fn wit_import(
30387 _: i32,
30388 _: *mut u8,
30389 _: usize,
30390 _: *mut u8,
30391 _: usize,
30392 _: *mut u8,
30393 );
30394 }
30395 #[cfg(not(target_arch = "wasm32"))]
30396 fn wit_import(
30397 _: i32,
30398 _: *mut u8,
30399 _: usize,
30400 _: *mut u8,
30401 _: usize,
30402 _: *mut u8,
30403 ) {
30404 unreachable!()
30405 }
30406 wit_import(
30407 (self).handle() as i32,
30408 ptr0.cast_mut(),
30409 len0,
30410 result87,
30411 len87,
30412 ptr88,
30413 );
30414 let l89 = i32::from(*ptr88.add(0).cast::<u8>());
30415 if layout87.size() != 0 {
30416 _rt::alloc::dealloc(result87.cast(), layout87);
30417 }
30418 for (ptr, layout) in cleanup_list {
30419 if layout.size() != 0 {
30420 _rt::alloc::dealloc(ptr.cast(), layout);
30421 }
30422 }
30423 match l89 {
30424 0 => {
30425 let e = {
30426 let l90 = *ptr88.add(4).cast::<i32>();
30427 DbResultStream::from_handle(l90 as u32)
30428 };
30429 Ok(e)
30430 }
30431 1 => {
30432 let e = {
30433 let l91 = i32::from(*ptr88.add(4).cast::<u8>());
30434 let v107 = match l91 {
30435 0 => {
30436 let e107 = {
30437 let l92 = *ptr88.add(8).cast::<*mut u8>();
30438 let l93 = *ptr88.add(12).cast::<usize>();
30439 let len94 = l93;
30440 let bytes94 = _rt::Vec::from_raw_parts(
30441 l92.cast(),
30442 len94,
30443 len94,
30444 );
30445 _rt::string_lift(bytes94)
30446 };
30447 Error::ConnectionFailure(e107)
30448 }
30449 1 => {
30450 let e107 = {
30451 let l95 = *ptr88.add(8).cast::<*mut u8>();
30452 let l96 = *ptr88.add(12).cast::<usize>();
30453 let len97 = l96;
30454 let bytes97 = _rt::Vec::from_raw_parts(
30455 l95.cast(),
30456 len97,
30457 len97,
30458 );
30459 _rt::string_lift(bytes97)
30460 };
30461 Error::QueryParameterFailure(e107)
30462 }
30463 2 => {
30464 let e107 = {
30465 let l98 = *ptr88.add(8).cast::<*mut u8>();
30466 let l99 = *ptr88.add(12).cast::<usize>();
30467 let len100 = l99;
30468 let bytes100 = _rt::Vec::from_raw_parts(
30469 l98.cast(),
30470 len100,
30471 len100,
30472 );
30473 _rt::string_lift(bytes100)
30474 };
30475 Error::QueryExecutionFailure(e107)
30476 }
30477 3 => {
30478 let e107 = {
30479 let l101 = *ptr88.add(8).cast::<*mut u8>();
30480 let l102 = *ptr88.add(12).cast::<usize>();
30481 let len103 = l102;
30482 let bytes103 = _rt::Vec::from_raw_parts(
30483 l101.cast(),
30484 len103,
30485 len103,
30486 );
30487 _rt::string_lift(bytes103)
30488 };
30489 Error::QueryResponseFailure(e107)
30490 }
30491 n => {
30492 debug_assert_eq!(n, 4, "invalid enum discriminant");
30493 let e107 = {
30494 let l104 = *ptr88.add(8).cast::<*mut u8>();
30495 let l105 = *ptr88.add(12).cast::<usize>();
30496 let len106 = l105;
30497 let bytes106 = _rt::Vec::from_raw_parts(
30498 l104.cast(),
30499 len106,
30500 len106,
30501 );
30502 _rt::string_lift(bytes106)
30503 };
30504 Error::Other(e107)
30505 }
30506 };
30507 v107
30508 };
30509 Err(e)
30510 }
30511 _ => _rt::invalid_enum_discriminant(),
30512 }
30513 }
30514 }
30515 }
30516 impl DbTransaction {
30517 #[allow(unused_unsafe, clippy::all)]
30518 pub fn execute(
30519 &self,
30520 statement: &str,
30521 params: _rt::Vec<DbValue>,
30522 ) -> Result<u64, Error> {
30523 unsafe {
30524 let mut cleanup_list = _rt::Vec::new();
30525 #[repr(align(8))]
30526 struct RetArea([::core::mem::MaybeUninit<u8>; 24]);
30527 let mut ret_area = RetArea(
30528 [::core::mem::MaybeUninit::uninit(); 24],
30529 );
30530 let vec0 = statement;
30531 let ptr0 = vec0.as_ptr().cast::<u8>();
30532 let len0 = vec0.len();
30533 let vec87 = ¶ms;
30534 let len87 = vec87.len();
30535 let layout87 = _rt::alloc::Layout::from_size_align_unchecked(
30536 vec87.len() * 56,
30537 8,
30538 );
30539 let result87 = if layout87.size() != 0 {
30540 let ptr = _rt::alloc::alloc(layout87).cast::<u8>();
30541 if ptr.is_null() {
30542 _rt::alloc::handle_alloc_error(layout87);
30543 }
30544 ptr
30545 } else {
30546 ::core::ptr::null_mut()
30547 };
30548 for (i, e) in vec87.into_iter().enumerate() {
30549 let base = result87.add(i * 56);
30550 {
30551 match e {
30552 DbValue::Character(e) => {
30553 *base.add(0).cast::<u8>() = (0i32) as u8;
30554 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
30555 }
30556 DbValue::Int2(e) => {
30557 *base.add(0).cast::<u8>() = (1i32) as u8;
30558 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
30559 }
30560 DbValue::Int4(e) => {
30561 *base.add(0).cast::<u8>() = (2i32) as u8;
30562 *base.add(8).cast::<i32>() = _rt::as_i32(e);
30563 }
30564 DbValue::Int8(e) => {
30565 *base.add(0).cast::<u8>() = (3i32) as u8;
30566 *base.add(8).cast::<i64>() = _rt::as_i64(e);
30567 }
30568 DbValue::Float4(e) => {
30569 *base.add(0).cast::<u8>() = (4i32) as u8;
30570 *base.add(8).cast::<f32>() = _rt::as_f32(e);
30571 }
30572 DbValue::Float8(e) => {
30573 *base.add(0).cast::<u8>() = (5i32) as u8;
30574 *base.add(8).cast::<f64>() = _rt::as_f64(e);
30575 }
30576 DbValue::Numeric(e) => {
30577 *base.add(0).cast::<u8>() = (6i32) as u8;
30578 let vec1 = e;
30579 let ptr1 = vec1.as_ptr().cast::<u8>();
30580 let len1 = vec1.len();
30581 *base.add(12).cast::<usize>() = len1;
30582 *base.add(8).cast::<*mut u8>() = ptr1.cast_mut();
30583 }
30584 DbValue::Boolean(e) => {
30585 *base.add(0).cast::<u8>() = (7i32) as u8;
30586 *base.add(8).cast::<u8>() = (match e {
30587 true => 1,
30588 false => 0,
30589 }) as u8;
30590 }
30591 DbValue::Text(e) => {
30592 *base.add(0).cast::<u8>() = (8i32) as u8;
30593 let vec2 = e;
30594 let ptr2 = vec2.as_ptr().cast::<u8>();
30595 let len2 = vec2.len();
30596 *base.add(12).cast::<usize>() = len2;
30597 *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
30598 }
30599 DbValue::Varchar(e) => {
30600 *base.add(0).cast::<u8>() = (9i32) as u8;
30601 let vec3 = e;
30602 let ptr3 = vec3.as_ptr().cast::<u8>();
30603 let len3 = vec3.len();
30604 *base.add(12).cast::<usize>() = len3;
30605 *base.add(8).cast::<*mut u8>() = ptr3.cast_mut();
30606 }
30607 DbValue::Bpchar(e) => {
30608 *base.add(0).cast::<u8>() = (10i32) as u8;
30609 let vec4 = e;
30610 let ptr4 = vec4.as_ptr().cast::<u8>();
30611 let len4 = vec4.len();
30612 *base.add(12).cast::<usize>() = len4;
30613 *base.add(8).cast::<*mut u8>() = ptr4.cast_mut();
30614 }
30615 DbValue::Timestamp(e) => {
30616 *base.add(0).cast::<u8>() = (11i32) as u8;
30617 let super::super::super::golem::rdbms::types::Timestamp {
30618 date: date5,
30619 time: time5,
30620 } = e;
30621 let super::super::super::golem::rdbms::types::Date {
30622 year: year6,
30623 month: month6,
30624 day: day6,
30625 } = date5;
30626 *base.add(8).cast::<i32>() = _rt::as_i32(year6);
30627 *base.add(12).cast::<u8>() = (_rt::as_i32(month6)) as u8;
30628 *base.add(13).cast::<u8>() = (_rt::as_i32(day6)) as u8;
30629 let super::super::super::golem::rdbms::types::Time {
30630 hour: hour7,
30631 minute: minute7,
30632 second: second7,
30633 nanosecond: nanosecond7,
30634 } = time5;
30635 *base.add(16).cast::<u8>() = (_rt::as_i32(hour7)) as u8;
30636 *base.add(17).cast::<u8>() = (_rt::as_i32(minute7)) as u8;
30637 *base.add(18).cast::<u8>() = (_rt::as_i32(second7)) as u8;
30638 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond7);
30639 }
30640 DbValue::Timestamptz(e) => {
30641 *base.add(0).cast::<u8>() = (12i32) as u8;
30642 let super::super::super::golem::rdbms::types::Timestamptz {
30643 timestamp: timestamp8,
30644 offset: offset8,
30645 } = e;
30646 let super::super::super::golem::rdbms::types::Timestamp {
30647 date: date9,
30648 time: time9,
30649 } = timestamp8;
30650 let super::super::super::golem::rdbms::types::Date {
30651 year: year10,
30652 month: month10,
30653 day: day10,
30654 } = date9;
30655 *base.add(8).cast::<i32>() = _rt::as_i32(year10);
30656 *base.add(12).cast::<u8>() = (_rt::as_i32(month10)) as u8;
30657 *base.add(13).cast::<u8>() = (_rt::as_i32(day10)) as u8;
30658 let super::super::super::golem::rdbms::types::Time {
30659 hour: hour11,
30660 minute: minute11,
30661 second: second11,
30662 nanosecond: nanosecond11,
30663 } = time9;
30664 *base.add(16).cast::<u8>() = (_rt::as_i32(hour11)) as u8;
30665 *base.add(17).cast::<u8>() = (_rt::as_i32(minute11)) as u8;
30666 *base.add(18).cast::<u8>() = (_rt::as_i32(second11)) as u8;
30667 *base.add(20).cast::<i32>() = _rt::as_i32(nanosecond11);
30668 *base.add(24).cast::<i32>() = _rt::as_i32(offset8);
30669 }
30670 DbValue::Date(e) => {
30671 *base.add(0).cast::<u8>() = (13i32) as u8;
30672 let super::super::super::golem::rdbms::types::Date {
30673 year: year12,
30674 month: month12,
30675 day: day12,
30676 } = e;
30677 *base.add(8).cast::<i32>() = _rt::as_i32(year12);
30678 *base.add(12).cast::<u8>() = (_rt::as_i32(month12)) as u8;
30679 *base.add(13).cast::<u8>() = (_rt::as_i32(day12)) as u8;
30680 }
30681 DbValue::Time(e) => {
30682 *base.add(0).cast::<u8>() = (14i32) as u8;
30683 let super::super::super::golem::rdbms::types::Time {
30684 hour: hour13,
30685 minute: minute13,
30686 second: second13,
30687 nanosecond: nanosecond13,
30688 } = e;
30689 *base.add(8).cast::<u8>() = (_rt::as_i32(hour13)) as u8;
30690 *base.add(9).cast::<u8>() = (_rt::as_i32(minute13)) as u8;
30691 *base.add(10).cast::<u8>() = (_rt::as_i32(second13)) as u8;
30692 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond13);
30693 }
30694 DbValue::Timetz(e) => {
30695 *base.add(0).cast::<u8>() = (15i32) as u8;
30696 let super::super::super::golem::rdbms::types::Timetz {
30697 time: time14,
30698 offset: offset14,
30699 } = e;
30700 let super::super::super::golem::rdbms::types::Time {
30701 hour: hour15,
30702 minute: minute15,
30703 second: second15,
30704 nanosecond: nanosecond15,
30705 } = time14;
30706 *base.add(8).cast::<u8>() = (_rt::as_i32(hour15)) as u8;
30707 *base.add(9).cast::<u8>() = (_rt::as_i32(minute15)) as u8;
30708 *base.add(10).cast::<u8>() = (_rt::as_i32(second15)) as u8;
30709 *base.add(12).cast::<i32>() = _rt::as_i32(nanosecond15);
30710 *base.add(16).cast::<i32>() = _rt::as_i32(offset14);
30711 }
30712 DbValue::Interval(e) => {
30713 *base.add(0).cast::<u8>() = (16i32) as u8;
30714 let Interval {
30715 months: months16,
30716 days: days16,
30717 microseconds: microseconds16,
30718 } = e;
30719 *base.add(8).cast::<i32>() = _rt::as_i32(months16);
30720 *base.add(12).cast::<i32>() = _rt::as_i32(days16);
30721 *base.add(16).cast::<i64>() = _rt::as_i64(microseconds16);
30722 }
30723 DbValue::Bytea(e) => {
30724 *base.add(0).cast::<u8>() = (17i32) as u8;
30725 let vec17 = e;
30726 let ptr17 = vec17.as_ptr().cast::<u8>();
30727 let len17 = vec17.len();
30728 *base.add(12).cast::<usize>() = len17;
30729 *base.add(8).cast::<*mut u8>() = ptr17.cast_mut();
30730 }
30731 DbValue::Json(e) => {
30732 *base.add(0).cast::<u8>() = (18i32) as u8;
30733 let vec18 = e;
30734 let ptr18 = vec18.as_ptr().cast::<u8>();
30735 let len18 = vec18.len();
30736 *base.add(12).cast::<usize>() = len18;
30737 *base.add(8).cast::<*mut u8>() = ptr18.cast_mut();
30738 }
30739 DbValue::Jsonb(e) => {
30740 *base.add(0).cast::<u8>() = (19i32) as u8;
30741 let vec19 = e;
30742 let ptr19 = vec19.as_ptr().cast::<u8>();
30743 let len19 = vec19.len();
30744 *base.add(12).cast::<usize>() = len19;
30745 *base.add(8).cast::<*mut u8>() = ptr19.cast_mut();
30746 }
30747 DbValue::Jsonpath(e) => {
30748 *base.add(0).cast::<u8>() = (20i32) as u8;
30749 let vec20 = e;
30750 let ptr20 = vec20.as_ptr().cast::<u8>();
30751 let len20 = vec20.len();
30752 *base.add(12).cast::<usize>() = len20;
30753 *base.add(8).cast::<*mut u8>() = ptr20.cast_mut();
30754 }
30755 DbValue::Xml(e) => {
30756 *base.add(0).cast::<u8>() = (21i32) as u8;
30757 let vec21 = e;
30758 let ptr21 = vec21.as_ptr().cast::<u8>();
30759 let len21 = vec21.len();
30760 *base.add(12).cast::<usize>() = len21;
30761 *base.add(8).cast::<*mut u8>() = ptr21.cast_mut();
30762 }
30763 DbValue::Uuid(e) => {
30764 *base.add(0).cast::<u8>() = (22i32) as u8;
30765 let super::super::super::golem::rdbms::types::Uuid {
30766 high_bits: high_bits22,
30767 low_bits: low_bits22,
30768 } = e;
30769 *base.add(8).cast::<i64>() = _rt::as_i64(high_bits22);
30770 *base.add(16).cast::<i64>() = _rt::as_i64(low_bits22);
30771 }
30772 DbValue::Inet(e) => {
30773 *base.add(0).cast::<u8>() = (23i32) as u8;
30774 use super::super::super::golem::rdbms::types::IpAddress as V25;
30775 match e {
30776 V25::Ipv4(e) => {
30777 *base.add(8).cast::<u8>() = (0i32) as u8;
30778 let (t23_0, t23_1, t23_2, t23_3) = e;
30779 *base.add(10).cast::<u8>() = (_rt::as_i32(t23_0)) as u8;
30780 *base.add(11).cast::<u8>() = (_rt::as_i32(t23_1)) as u8;
30781 *base.add(12).cast::<u8>() = (_rt::as_i32(t23_2)) as u8;
30782 *base.add(13).cast::<u8>() = (_rt::as_i32(t23_3)) as u8;
30783 }
30784 V25::Ipv6(e) => {
30785 *base.add(8).cast::<u8>() = (1i32) as u8;
30786 let (
30787 t24_0,
30788 t24_1,
30789 t24_2,
30790 t24_3,
30791 t24_4,
30792 t24_5,
30793 t24_6,
30794 t24_7,
30795 ) = e;
30796 *base.add(10).cast::<u16>() = (_rt::as_i32(t24_0)) as u16;
30797 *base.add(12).cast::<u16>() = (_rt::as_i32(t24_1)) as u16;
30798 *base.add(14).cast::<u16>() = (_rt::as_i32(t24_2)) as u16;
30799 *base.add(16).cast::<u16>() = (_rt::as_i32(t24_3)) as u16;
30800 *base.add(18).cast::<u16>() = (_rt::as_i32(t24_4)) as u16;
30801 *base.add(20).cast::<u16>() = (_rt::as_i32(t24_5)) as u16;
30802 *base.add(22).cast::<u16>() = (_rt::as_i32(t24_6)) as u16;
30803 *base.add(24).cast::<u16>() = (_rt::as_i32(t24_7)) as u16;
30804 }
30805 }
30806 }
30807 DbValue::Cidr(e) => {
30808 *base.add(0).cast::<u8>() = (24i32) as u8;
30809 use super::super::super::golem::rdbms::types::IpAddress as V28;
30810 match e {
30811 V28::Ipv4(e) => {
30812 *base.add(8).cast::<u8>() = (0i32) as u8;
30813 let (t26_0, t26_1, t26_2, t26_3) = e;
30814 *base.add(10).cast::<u8>() = (_rt::as_i32(t26_0)) as u8;
30815 *base.add(11).cast::<u8>() = (_rt::as_i32(t26_1)) as u8;
30816 *base.add(12).cast::<u8>() = (_rt::as_i32(t26_2)) as u8;
30817 *base.add(13).cast::<u8>() = (_rt::as_i32(t26_3)) as u8;
30818 }
30819 V28::Ipv6(e) => {
30820 *base.add(8).cast::<u8>() = (1i32) as u8;
30821 let (
30822 t27_0,
30823 t27_1,
30824 t27_2,
30825 t27_3,
30826 t27_4,
30827 t27_5,
30828 t27_6,
30829 t27_7,
30830 ) = e;
30831 *base.add(10).cast::<u16>() = (_rt::as_i32(t27_0)) as u16;
30832 *base.add(12).cast::<u16>() = (_rt::as_i32(t27_1)) as u16;
30833 *base.add(14).cast::<u16>() = (_rt::as_i32(t27_2)) as u16;
30834 *base.add(16).cast::<u16>() = (_rt::as_i32(t27_3)) as u16;
30835 *base.add(18).cast::<u16>() = (_rt::as_i32(t27_4)) as u16;
30836 *base.add(20).cast::<u16>() = (_rt::as_i32(t27_5)) as u16;
30837 *base.add(22).cast::<u16>() = (_rt::as_i32(t27_6)) as u16;
30838 *base.add(24).cast::<u16>() = (_rt::as_i32(t27_7)) as u16;
30839 }
30840 }
30841 }
30842 DbValue::Macaddr(e) => {
30843 *base.add(0).cast::<u8>() = (25i32) as u8;
30844 let super::super::super::golem::rdbms::types::MacAddress {
30845 octets: octets29,
30846 } = e;
30847 let (t30_0, t30_1, t30_2, t30_3, t30_4, t30_5) = octets29;
30848 *base.add(8).cast::<u8>() = (_rt::as_i32(t30_0)) as u8;
30849 *base.add(9).cast::<u8>() = (_rt::as_i32(t30_1)) as u8;
30850 *base.add(10).cast::<u8>() = (_rt::as_i32(t30_2)) as u8;
30851 *base.add(11).cast::<u8>() = (_rt::as_i32(t30_3)) as u8;
30852 *base.add(12).cast::<u8>() = (_rt::as_i32(t30_4)) as u8;
30853 *base.add(13).cast::<u8>() = (_rt::as_i32(t30_5)) as u8;
30854 }
30855 DbValue::Bit(e) => {
30856 *base.add(0).cast::<u8>() = (26i32) as u8;
30857 let vec31 = e;
30858 let len31 = vec31.len();
30859 let layout31 = _rt::alloc::Layout::from_size_align_unchecked(
30860 vec31.len() * 1,
30861 1,
30862 );
30863 let result31 = if layout31.size() != 0 {
30864 let ptr = _rt::alloc::alloc(layout31).cast::<u8>();
30865 if ptr.is_null() {
30866 _rt::alloc::handle_alloc_error(layout31);
30867 }
30868 ptr
30869 } else {
30870 ::core::ptr::null_mut()
30871 };
30872 for (i, e) in vec31.into_iter().enumerate() {
30873 let base = result31.add(i * 1);
30874 {
30875 *base.add(0).cast::<u8>() = (match e {
30876 true => 1,
30877 false => 0,
30878 }) as u8;
30879 }
30880 }
30881 *base.add(12).cast::<usize>() = len31;
30882 *base.add(8).cast::<*mut u8>() = result31;
30883 cleanup_list.extend_from_slice(&[(result31, layout31)]);
30884 }
30885 DbValue::Varbit(e) => {
30886 *base.add(0).cast::<u8>() = (27i32) as u8;
30887 let vec32 = e;
30888 let len32 = vec32.len();
30889 let layout32 = _rt::alloc::Layout::from_size_align_unchecked(
30890 vec32.len() * 1,
30891 1,
30892 );
30893 let result32 = if layout32.size() != 0 {
30894 let ptr = _rt::alloc::alloc(layout32).cast::<u8>();
30895 if ptr.is_null() {
30896 _rt::alloc::handle_alloc_error(layout32);
30897 }
30898 ptr
30899 } else {
30900 ::core::ptr::null_mut()
30901 };
30902 for (i, e) in vec32.into_iter().enumerate() {
30903 let base = result32.add(i * 1);
30904 {
30905 *base.add(0).cast::<u8>() = (match e {
30906 true => 1,
30907 false => 0,
30908 }) as u8;
30909 }
30910 }
30911 *base.add(12).cast::<usize>() = len32;
30912 *base.add(8).cast::<*mut u8>() = result32;
30913 cleanup_list.extend_from_slice(&[(result32, layout32)]);
30914 }
30915 DbValue::Int4range(e) => {
30916 *base.add(0).cast::<u8>() = (28i32) as u8;
30917 let Int4range { start: start33, end: end33 } = e;
30918 match start33 {
30919 Int4bound::Included(e) => {
30920 *base.add(8).cast::<u8>() = (0i32) as u8;
30921 *base.add(12).cast::<i32>() = _rt::as_i32(e);
30922 }
30923 Int4bound::Excluded(e) => {
30924 *base.add(8).cast::<u8>() = (1i32) as u8;
30925 *base.add(12).cast::<i32>() = _rt::as_i32(e);
30926 }
30927 Int4bound::Unbounded => {
30928 *base.add(8).cast::<u8>() = (2i32) as u8;
30929 }
30930 }
30931 match end33 {
30932 Int4bound::Included(e) => {
30933 *base.add(16).cast::<u8>() = (0i32) as u8;
30934 *base.add(20).cast::<i32>() = _rt::as_i32(e);
30935 }
30936 Int4bound::Excluded(e) => {
30937 *base.add(16).cast::<u8>() = (1i32) as u8;
30938 *base.add(20).cast::<i32>() = _rt::as_i32(e);
30939 }
30940 Int4bound::Unbounded => {
30941 *base.add(16).cast::<u8>() = (2i32) as u8;
30942 }
30943 }
30944 }
30945 DbValue::Int8range(e) => {
30946 *base.add(0).cast::<u8>() = (29i32) as u8;
30947 let Int8range { start: start34, end: end34 } = e;
30948 match start34 {
30949 Int8bound::Included(e) => {
30950 *base.add(8).cast::<u8>() = (0i32) as u8;
30951 *base.add(16).cast::<i64>() = _rt::as_i64(e);
30952 }
30953 Int8bound::Excluded(e) => {
30954 *base.add(8).cast::<u8>() = (1i32) as u8;
30955 *base.add(16).cast::<i64>() = _rt::as_i64(e);
30956 }
30957 Int8bound::Unbounded => {
30958 *base.add(8).cast::<u8>() = (2i32) as u8;
30959 }
30960 }
30961 match end34 {
30962 Int8bound::Included(e) => {
30963 *base.add(24).cast::<u8>() = (0i32) as u8;
30964 *base.add(32).cast::<i64>() = _rt::as_i64(e);
30965 }
30966 Int8bound::Excluded(e) => {
30967 *base.add(24).cast::<u8>() = (1i32) as u8;
30968 *base.add(32).cast::<i64>() = _rt::as_i64(e);
30969 }
30970 Int8bound::Unbounded => {
30971 *base.add(24).cast::<u8>() = (2i32) as u8;
30972 }
30973 }
30974 }
30975 DbValue::Numrange(e) => {
30976 *base.add(0).cast::<u8>() = (30i32) as u8;
30977 let Numrange { start: start35, end: end35 } = e;
30978 match start35 {
30979 Numbound::Included(e) => {
30980 *base.add(8).cast::<u8>() = (0i32) as u8;
30981 let vec36 = e;
30982 let ptr36 = vec36.as_ptr().cast::<u8>();
30983 let len36 = vec36.len();
30984 *base.add(16).cast::<usize>() = len36;
30985 *base.add(12).cast::<*mut u8>() = ptr36.cast_mut();
30986 }
30987 Numbound::Excluded(e) => {
30988 *base.add(8).cast::<u8>() = (1i32) as u8;
30989 let vec37 = e;
30990 let ptr37 = vec37.as_ptr().cast::<u8>();
30991 let len37 = vec37.len();
30992 *base.add(16).cast::<usize>() = len37;
30993 *base.add(12).cast::<*mut u8>() = ptr37.cast_mut();
30994 }
30995 Numbound::Unbounded => {
30996 *base.add(8).cast::<u8>() = (2i32) as u8;
30997 }
30998 }
30999 match end35 {
31000 Numbound::Included(e) => {
31001 *base.add(20).cast::<u8>() = (0i32) as u8;
31002 let vec38 = e;
31003 let ptr38 = vec38.as_ptr().cast::<u8>();
31004 let len38 = vec38.len();
31005 *base.add(28).cast::<usize>() = len38;
31006 *base.add(24).cast::<*mut u8>() = ptr38.cast_mut();
31007 }
31008 Numbound::Excluded(e) => {
31009 *base.add(20).cast::<u8>() = (1i32) as u8;
31010 let vec39 = e;
31011 let ptr39 = vec39.as_ptr().cast::<u8>();
31012 let len39 = vec39.len();
31013 *base.add(28).cast::<usize>() = len39;
31014 *base.add(24).cast::<*mut u8>() = ptr39.cast_mut();
31015 }
31016 Numbound::Unbounded => {
31017 *base.add(20).cast::<u8>() = (2i32) as u8;
31018 }
31019 }
31020 }
31021 DbValue::Tsrange(e) => {
31022 *base.add(0).cast::<u8>() = (31i32) as u8;
31023 let Tsrange { start: start40, end: end40 } = e;
31024 match start40 {
31025 Tsbound::Included(e) => {
31026 *base.add(8).cast::<u8>() = (0i32) as u8;
31027 let super::super::super::golem::rdbms::types::Timestamp {
31028 date: date41,
31029 time: time41,
31030 } = e;
31031 let super::super::super::golem::rdbms::types::Date {
31032 year: year42,
31033 month: month42,
31034 day: day42,
31035 } = date41;
31036 *base.add(12).cast::<i32>() = _rt::as_i32(year42);
31037 *base.add(16).cast::<u8>() = (_rt::as_i32(month42)) as u8;
31038 *base.add(17).cast::<u8>() = (_rt::as_i32(day42)) as u8;
31039 let super::super::super::golem::rdbms::types::Time {
31040 hour: hour43,
31041 minute: minute43,
31042 second: second43,
31043 nanosecond: nanosecond43,
31044 } = time41;
31045 *base.add(20).cast::<u8>() = (_rt::as_i32(hour43)) as u8;
31046 *base.add(21).cast::<u8>() = (_rt::as_i32(minute43)) as u8;
31047 *base.add(22).cast::<u8>() = (_rt::as_i32(second43)) as u8;
31048 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond43);
31049 }
31050 Tsbound::Excluded(e) => {
31051 *base.add(8).cast::<u8>() = (1i32) as u8;
31052 let super::super::super::golem::rdbms::types::Timestamp {
31053 date: date44,
31054 time: time44,
31055 } = e;
31056 let super::super::super::golem::rdbms::types::Date {
31057 year: year45,
31058 month: month45,
31059 day: day45,
31060 } = date44;
31061 *base.add(12).cast::<i32>() = _rt::as_i32(year45);
31062 *base.add(16).cast::<u8>() = (_rt::as_i32(month45)) as u8;
31063 *base.add(17).cast::<u8>() = (_rt::as_i32(day45)) as u8;
31064 let super::super::super::golem::rdbms::types::Time {
31065 hour: hour46,
31066 minute: minute46,
31067 second: second46,
31068 nanosecond: nanosecond46,
31069 } = time44;
31070 *base.add(20).cast::<u8>() = (_rt::as_i32(hour46)) as u8;
31071 *base.add(21).cast::<u8>() = (_rt::as_i32(minute46)) as u8;
31072 *base.add(22).cast::<u8>() = (_rt::as_i32(second46)) as u8;
31073 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond46);
31074 }
31075 Tsbound::Unbounded => {
31076 *base.add(8).cast::<u8>() = (2i32) as u8;
31077 }
31078 }
31079 match end40 {
31080 Tsbound::Included(e) => {
31081 *base.add(28).cast::<u8>() = (0i32) as u8;
31082 let super::super::super::golem::rdbms::types::Timestamp {
31083 date: date47,
31084 time: time47,
31085 } = e;
31086 let super::super::super::golem::rdbms::types::Date {
31087 year: year48,
31088 month: month48,
31089 day: day48,
31090 } = date47;
31091 *base.add(32).cast::<i32>() = _rt::as_i32(year48);
31092 *base.add(36).cast::<u8>() = (_rt::as_i32(month48)) as u8;
31093 *base.add(37).cast::<u8>() = (_rt::as_i32(day48)) as u8;
31094 let super::super::super::golem::rdbms::types::Time {
31095 hour: hour49,
31096 minute: minute49,
31097 second: second49,
31098 nanosecond: nanosecond49,
31099 } = time47;
31100 *base.add(40).cast::<u8>() = (_rt::as_i32(hour49)) as u8;
31101 *base.add(41).cast::<u8>() = (_rt::as_i32(minute49)) as u8;
31102 *base.add(42).cast::<u8>() = (_rt::as_i32(second49)) as u8;
31103 *base.add(44).cast::<i32>() = _rt::as_i32(nanosecond49);
31104 }
31105 Tsbound::Excluded(e) => {
31106 *base.add(28).cast::<u8>() = (1i32) as u8;
31107 let super::super::super::golem::rdbms::types::Timestamp {
31108 date: date50,
31109 time: time50,
31110 } = e;
31111 let super::super::super::golem::rdbms::types::Date {
31112 year: year51,
31113 month: month51,
31114 day: day51,
31115 } = date50;
31116 *base.add(32).cast::<i32>() = _rt::as_i32(year51);
31117 *base.add(36).cast::<u8>() = (_rt::as_i32(month51)) as u8;
31118 *base.add(37).cast::<u8>() = (_rt::as_i32(day51)) as u8;
31119 let super::super::super::golem::rdbms::types::Time {
31120 hour: hour52,
31121 minute: minute52,
31122 second: second52,
31123 nanosecond: nanosecond52,
31124 } = time50;
31125 *base.add(40).cast::<u8>() = (_rt::as_i32(hour52)) as u8;
31126 *base.add(41).cast::<u8>() = (_rt::as_i32(minute52)) as u8;
31127 *base.add(42).cast::<u8>() = (_rt::as_i32(second52)) as u8;
31128 *base.add(44).cast::<i32>() = _rt::as_i32(nanosecond52);
31129 }
31130 Tsbound::Unbounded => {
31131 *base.add(28).cast::<u8>() = (2i32) as u8;
31132 }
31133 }
31134 }
31135 DbValue::Tstzrange(e) => {
31136 *base.add(0).cast::<u8>() = (32i32) as u8;
31137 let Tstzrange { start: start53, end: end53 } = e;
31138 match start53 {
31139 Tstzbound::Included(e) => {
31140 *base.add(8).cast::<u8>() = (0i32) as u8;
31141 let super::super::super::golem::rdbms::types::Timestamptz {
31142 timestamp: timestamp54,
31143 offset: offset54,
31144 } = e;
31145 let super::super::super::golem::rdbms::types::Timestamp {
31146 date: date55,
31147 time: time55,
31148 } = timestamp54;
31149 let super::super::super::golem::rdbms::types::Date {
31150 year: year56,
31151 month: month56,
31152 day: day56,
31153 } = date55;
31154 *base.add(12).cast::<i32>() = _rt::as_i32(year56);
31155 *base.add(16).cast::<u8>() = (_rt::as_i32(month56)) as u8;
31156 *base.add(17).cast::<u8>() = (_rt::as_i32(day56)) as u8;
31157 let super::super::super::golem::rdbms::types::Time {
31158 hour: hour57,
31159 minute: minute57,
31160 second: second57,
31161 nanosecond: nanosecond57,
31162 } = time55;
31163 *base.add(20).cast::<u8>() = (_rt::as_i32(hour57)) as u8;
31164 *base.add(21).cast::<u8>() = (_rt::as_i32(minute57)) as u8;
31165 *base.add(22).cast::<u8>() = (_rt::as_i32(second57)) as u8;
31166 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond57);
31167 *base.add(28).cast::<i32>() = _rt::as_i32(offset54);
31168 }
31169 Tstzbound::Excluded(e) => {
31170 *base.add(8).cast::<u8>() = (1i32) as u8;
31171 let super::super::super::golem::rdbms::types::Timestamptz {
31172 timestamp: timestamp58,
31173 offset: offset58,
31174 } = e;
31175 let super::super::super::golem::rdbms::types::Timestamp {
31176 date: date59,
31177 time: time59,
31178 } = timestamp58;
31179 let super::super::super::golem::rdbms::types::Date {
31180 year: year60,
31181 month: month60,
31182 day: day60,
31183 } = date59;
31184 *base.add(12).cast::<i32>() = _rt::as_i32(year60);
31185 *base.add(16).cast::<u8>() = (_rt::as_i32(month60)) as u8;
31186 *base.add(17).cast::<u8>() = (_rt::as_i32(day60)) as u8;
31187 let super::super::super::golem::rdbms::types::Time {
31188 hour: hour61,
31189 minute: minute61,
31190 second: second61,
31191 nanosecond: nanosecond61,
31192 } = time59;
31193 *base.add(20).cast::<u8>() = (_rt::as_i32(hour61)) as u8;
31194 *base.add(21).cast::<u8>() = (_rt::as_i32(minute61)) as u8;
31195 *base.add(22).cast::<u8>() = (_rt::as_i32(second61)) as u8;
31196 *base.add(24).cast::<i32>() = _rt::as_i32(nanosecond61);
31197 *base.add(28).cast::<i32>() = _rt::as_i32(offset58);
31198 }
31199 Tstzbound::Unbounded => {
31200 *base.add(8).cast::<u8>() = (2i32) as u8;
31201 }
31202 }
31203 match end53 {
31204 Tstzbound::Included(e) => {
31205 *base.add(32).cast::<u8>() = (0i32) as u8;
31206 let super::super::super::golem::rdbms::types::Timestamptz {
31207 timestamp: timestamp62,
31208 offset: offset62,
31209 } = e;
31210 let super::super::super::golem::rdbms::types::Timestamp {
31211 date: date63,
31212 time: time63,
31213 } = timestamp62;
31214 let super::super::super::golem::rdbms::types::Date {
31215 year: year64,
31216 month: month64,
31217 day: day64,
31218 } = date63;
31219 *base.add(36).cast::<i32>() = _rt::as_i32(year64);
31220 *base.add(40).cast::<u8>() = (_rt::as_i32(month64)) as u8;
31221 *base.add(41).cast::<u8>() = (_rt::as_i32(day64)) as u8;
31222 let super::super::super::golem::rdbms::types::Time {
31223 hour: hour65,
31224 minute: minute65,
31225 second: second65,
31226 nanosecond: nanosecond65,
31227 } = time63;
31228 *base.add(44).cast::<u8>() = (_rt::as_i32(hour65)) as u8;
31229 *base.add(45).cast::<u8>() = (_rt::as_i32(minute65)) as u8;
31230 *base.add(46).cast::<u8>() = (_rt::as_i32(second65)) as u8;
31231 *base.add(48).cast::<i32>() = _rt::as_i32(nanosecond65);
31232 *base.add(52).cast::<i32>() = _rt::as_i32(offset62);
31233 }
31234 Tstzbound::Excluded(e) => {
31235 *base.add(32).cast::<u8>() = (1i32) as u8;
31236 let super::super::super::golem::rdbms::types::Timestamptz {
31237 timestamp: timestamp66,
31238 offset: offset66,
31239 } = e;
31240 let super::super::super::golem::rdbms::types::Timestamp {
31241 date: date67,
31242 time: time67,
31243 } = timestamp66;
31244 let super::super::super::golem::rdbms::types::Date {
31245 year: year68,
31246 month: month68,
31247 day: day68,
31248 } = date67;
31249 *base.add(36).cast::<i32>() = _rt::as_i32(year68);
31250 *base.add(40).cast::<u8>() = (_rt::as_i32(month68)) as u8;
31251 *base.add(41).cast::<u8>() = (_rt::as_i32(day68)) as u8;
31252 let super::super::super::golem::rdbms::types::Time {
31253 hour: hour69,
31254 minute: minute69,
31255 second: second69,
31256 nanosecond: nanosecond69,
31257 } = time67;
31258 *base.add(44).cast::<u8>() = (_rt::as_i32(hour69)) as u8;
31259 *base.add(45).cast::<u8>() = (_rt::as_i32(minute69)) as u8;
31260 *base.add(46).cast::<u8>() = (_rt::as_i32(second69)) as u8;
31261 *base.add(48).cast::<i32>() = _rt::as_i32(nanosecond69);
31262 *base.add(52).cast::<i32>() = _rt::as_i32(offset66);
31263 }
31264 Tstzbound::Unbounded => {
31265 *base.add(32).cast::<u8>() = (2i32) as u8;
31266 }
31267 }
31268 }
31269 DbValue::Daterange(e) => {
31270 *base.add(0).cast::<u8>() = (33i32) as u8;
31271 let Daterange { start: start70, end: end70 } = e;
31272 match start70 {
31273 Datebound::Included(e) => {
31274 *base.add(8).cast::<u8>() = (0i32) as u8;
31275 let super::super::super::golem::rdbms::types::Date {
31276 year: year71,
31277 month: month71,
31278 day: day71,
31279 } = e;
31280 *base.add(12).cast::<i32>() = _rt::as_i32(year71);
31281 *base.add(16).cast::<u8>() = (_rt::as_i32(month71)) as u8;
31282 *base.add(17).cast::<u8>() = (_rt::as_i32(day71)) as u8;
31283 }
31284 Datebound::Excluded(e) => {
31285 *base.add(8).cast::<u8>() = (1i32) as u8;
31286 let super::super::super::golem::rdbms::types::Date {
31287 year: year72,
31288 month: month72,
31289 day: day72,
31290 } = e;
31291 *base.add(12).cast::<i32>() = _rt::as_i32(year72);
31292 *base.add(16).cast::<u8>() = (_rt::as_i32(month72)) as u8;
31293 *base.add(17).cast::<u8>() = (_rt::as_i32(day72)) as u8;
31294 }
31295 Datebound::Unbounded => {
31296 *base.add(8).cast::<u8>() = (2i32) as u8;
31297 }
31298 }
31299 match end70 {
31300 Datebound::Included(e) => {
31301 *base.add(20).cast::<u8>() = (0i32) as u8;
31302 let super::super::super::golem::rdbms::types::Date {
31303 year: year73,
31304 month: month73,
31305 day: day73,
31306 } = e;
31307 *base.add(24).cast::<i32>() = _rt::as_i32(year73);
31308 *base.add(28).cast::<u8>() = (_rt::as_i32(month73)) as u8;
31309 *base.add(29).cast::<u8>() = (_rt::as_i32(day73)) as u8;
31310 }
31311 Datebound::Excluded(e) => {
31312 *base.add(20).cast::<u8>() = (1i32) as u8;
31313 let super::super::super::golem::rdbms::types::Date {
31314 year: year74,
31315 month: month74,
31316 day: day74,
31317 } = e;
31318 *base.add(24).cast::<i32>() = _rt::as_i32(year74);
31319 *base.add(28).cast::<u8>() = (_rt::as_i32(month74)) as u8;
31320 *base.add(29).cast::<u8>() = (_rt::as_i32(day74)) as u8;
31321 }
31322 Datebound::Unbounded => {
31323 *base.add(20).cast::<u8>() = (2i32) as u8;
31324 }
31325 }
31326 }
31327 DbValue::Money(e) => {
31328 *base.add(0).cast::<u8>() = (34i32) as u8;
31329 *base.add(8).cast::<i64>() = _rt::as_i64(e);
31330 }
31331 DbValue::Oid(e) => {
31332 *base.add(0).cast::<u8>() = (35i32) as u8;
31333 *base.add(8).cast::<i32>() = _rt::as_i32(e);
31334 }
31335 DbValue::Enumeration(e) => {
31336 *base.add(0).cast::<u8>() = (36i32) as u8;
31337 let Enumeration { name: name75, value: value75 } = e;
31338 let vec76 = name75;
31339 let ptr76 = vec76.as_ptr().cast::<u8>();
31340 let len76 = vec76.len();
31341 *base.add(12).cast::<usize>() = len76;
31342 *base.add(8).cast::<*mut u8>() = ptr76.cast_mut();
31343 let vec77 = value75;
31344 let ptr77 = vec77.as_ptr().cast::<u8>();
31345 let len77 = vec77.len();
31346 *base.add(20).cast::<usize>() = len77;
31347 *base.add(16).cast::<*mut u8>() = ptr77.cast_mut();
31348 }
31349 DbValue::Composite(e) => {
31350 *base.add(0).cast::<u8>() = (37i32) as u8;
31351 let Composite { name: name78, values: values78 } = e;
31352 let vec79 = name78;
31353 let ptr79 = vec79.as_ptr().cast::<u8>();
31354 let len79 = vec79.len();
31355 *base.add(12).cast::<usize>() = len79;
31356 *base.add(8).cast::<*mut u8>() = ptr79.cast_mut();
31357 let vec80 = values78;
31358 let len80 = vec80.len();
31359 let layout80 = _rt::alloc::Layout::from_size_align_unchecked(
31360 vec80.len() * 4,
31361 4,
31362 );
31363 let result80 = if layout80.size() != 0 {
31364 let ptr = _rt::alloc::alloc(layout80).cast::<u8>();
31365 if ptr.is_null() {
31366 _rt::alloc::handle_alloc_error(layout80);
31367 }
31368 ptr
31369 } else {
31370 ::core::ptr::null_mut()
31371 };
31372 for (i, e) in vec80.into_iter().enumerate() {
31373 let base = result80.add(i * 4);
31374 {
31375 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
31376 }
31377 }
31378 *base.add(20).cast::<usize>() = len80;
31379 *base.add(16).cast::<*mut u8>() = result80;
31380 cleanup_list.extend_from_slice(&[(result80, layout80)]);
31381 }
31382 DbValue::Domain(e) => {
31383 *base.add(0).cast::<u8>() = (38i32) as u8;
31384 let Domain { name: name81, value: value81 } = e;
31385 let vec82 = name81;
31386 let ptr82 = vec82.as_ptr().cast::<u8>();
31387 let len82 = vec82.len();
31388 *base.add(12).cast::<usize>() = len82;
31389 *base.add(8).cast::<*mut u8>() = ptr82.cast_mut();
31390 *base.add(16).cast::<i32>() = (value81).take_handle()
31391 as i32;
31392 }
31393 DbValue::Array(e) => {
31394 *base.add(0).cast::<u8>() = (39i32) as u8;
31395 let vec83 = e;
31396 let len83 = vec83.len();
31397 let layout83 = _rt::alloc::Layout::from_size_align_unchecked(
31398 vec83.len() * 4,
31399 4,
31400 );
31401 let result83 = if layout83.size() != 0 {
31402 let ptr = _rt::alloc::alloc(layout83).cast::<u8>();
31403 if ptr.is_null() {
31404 _rt::alloc::handle_alloc_error(layout83);
31405 }
31406 ptr
31407 } else {
31408 ::core::ptr::null_mut()
31409 };
31410 for (i, e) in vec83.into_iter().enumerate() {
31411 let base = result83.add(i * 4);
31412 {
31413 *base.add(0).cast::<i32>() = (e).take_handle() as i32;
31414 }
31415 }
31416 *base.add(12).cast::<usize>() = len83;
31417 *base.add(8).cast::<*mut u8>() = result83;
31418 cleanup_list.extend_from_slice(&[(result83, layout83)]);
31419 }
31420 DbValue::Range(e) => {
31421 *base.add(0).cast::<u8>() = (40i32) as u8;
31422 let Range { name: name84, value: value84 } = e;
31423 let vec85 = name84;
31424 let ptr85 = vec85.as_ptr().cast::<u8>();
31425 let len85 = vec85.len();
31426 *base.add(12).cast::<usize>() = len85;
31427 *base.add(8).cast::<*mut u8>() = ptr85.cast_mut();
31428 let ValuesRange { start: start86, end: end86 } = value84;
31429 match start86 {
31430 ValueBound::Included(e) => {
31431 *base.add(16).cast::<u8>() = (0i32) as u8;
31432 *base.add(20).cast::<i32>() = (e).take_handle() as i32;
31433 }
31434 ValueBound::Excluded(e) => {
31435 *base.add(16).cast::<u8>() = (1i32) as u8;
31436 *base.add(20).cast::<i32>() = (e).take_handle() as i32;
31437 }
31438 ValueBound::Unbounded => {
31439 *base.add(16).cast::<u8>() = (2i32) as u8;
31440 }
31441 }
31442 match end86 {
31443 ValueBound::Included(e) => {
31444 *base.add(24).cast::<u8>() = (0i32) as u8;
31445 *base.add(28).cast::<i32>() = (e).take_handle() as i32;
31446 }
31447 ValueBound::Excluded(e) => {
31448 *base.add(24).cast::<u8>() = (1i32) as u8;
31449 *base.add(28).cast::<i32>() = (e).take_handle() as i32;
31450 }
31451 ValueBound::Unbounded => {
31452 *base.add(24).cast::<u8>() = (2i32) as u8;
31453 }
31454 }
31455 }
31456 DbValue::Null => {
31457 *base.add(0).cast::<u8>() = (41i32) as u8;
31458 }
31459 }
31460 }
31461 }
31462 let ptr88 = ret_area.0.as_mut_ptr().cast::<u8>();
31463 #[cfg(target_arch = "wasm32")]
31464 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
31465 extern "C" {
31466 #[link_name = "[method]db-transaction.execute"]
31467 fn wit_import(
31468 _: i32,
31469 _: *mut u8,
31470 _: usize,
31471 _: *mut u8,
31472 _: usize,
31473 _: *mut u8,
31474 );
31475 }
31476 #[cfg(not(target_arch = "wasm32"))]
31477 fn wit_import(
31478 _: i32,
31479 _: *mut u8,
31480 _: usize,
31481 _: *mut u8,
31482 _: usize,
31483 _: *mut u8,
31484 ) {
31485 unreachable!()
31486 }
31487 wit_import(
31488 (self).handle() as i32,
31489 ptr0.cast_mut(),
31490 len0,
31491 result87,
31492 len87,
31493 ptr88,
31494 );
31495 let l89 = i32::from(*ptr88.add(0).cast::<u8>());
31496 if layout87.size() != 0 {
31497 _rt::alloc::dealloc(result87.cast(), layout87);
31498 }
31499 for (ptr, layout) in cleanup_list {
31500 if layout.size() != 0 {
31501 _rt::alloc::dealloc(ptr.cast(), layout);
31502 }
31503 }
31504 match l89 {
31505 0 => {
31506 let e = {
31507 let l90 = *ptr88.add(8).cast::<i64>();
31508 l90 as u64
31509 };
31510 Ok(e)
31511 }
31512 1 => {
31513 let e = {
31514 let l91 = i32::from(*ptr88.add(8).cast::<u8>());
31515 let v107 = match l91 {
31516 0 => {
31517 let e107 = {
31518 let l92 = *ptr88.add(12).cast::<*mut u8>();
31519 let l93 = *ptr88.add(16).cast::<usize>();
31520 let len94 = l93;
31521 let bytes94 = _rt::Vec::from_raw_parts(
31522 l92.cast(),
31523 len94,
31524 len94,
31525 );
31526 _rt::string_lift(bytes94)
31527 };
31528 Error::ConnectionFailure(e107)
31529 }
31530 1 => {
31531 let e107 = {
31532 let l95 = *ptr88.add(12).cast::<*mut u8>();
31533 let l96 = *ptr88.add(16).cast::<usize>();
31534 let len97 = l96;
31535 let bytes97 = _rt::Vec::from_raw_parts(
31536 l95.cast(),
31537 len97,
31538 len97,
31539 );
31540 _rt::string_lift(bytes97)
31541 };
31542 Error::QueryParameterFailure(e107)
31543 }
31544 2 => {
31545 let e107 = {
31546 let l98 = *ptr88.add(12).cast::<*mut u8>();
31547 let l99 = *ptr88.add(16).cast::<usize>();
31548 let len100 = l99;
31549 let bytes100 = _rt::Vec::from_raw_parts(
31550 l98.cast(),
31551 len100,
31552 len100,
31553 );
31554 _rt::string_lift(bytes100)
31555 };
31556 Error::QueryExecutionFailure(e107)
31557 }
31558 3 => {
31559 let e107 = {
31560 let l101 = *ptr88.add(12).cast::<*mut u8>();
31561 let l102 = *ptr88.add(16).cast::<usize>();
31562 let len103 = l102;
31563 let bytes103 = _rt::Vec::from_raw_parts(
31564 l101.cast(),
31565 len103,
31566 len103,
31567 );
31568 _rt::string_lift(bytes103)
31569 };
31570 Error::QueryResponseFailure(e107)
31571 }
31572 n => {
31573 debug_assert_eq!(n, 4, "invalid enum discriminant");
31574 let e107 = {
31575 let l104 = *ptr88.add(12).cast::<*mut u8>();
31576 let l105 = *ptr88.add(16).cast::<usize>();
31577 let len106 = l105;
31578 let bytes106 = _rt::Vec::from_raw_parts(
31579 l104.cast(),
31580 len106,
31581 len106,
31582 );
31583 _rt::string_lift(bytes106)
31584 };
31585 Error::Other(e107)
31586 }
31587 };
31588 v107
31589 };
31590 Err(e)
31591 }
31592 _ => _rt::invalid_enum_discriminant(),
31593 }
31594 }
31595 }
31596 }
31597 impl DbTransaction {
31598 #[allow(unused_unsafe, clippy::all)]
31599 pub fn commit(&self) -> Result<(), Error> {
31600 unsafe {
31601 #[repr(align(4))]
31602 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
31603 let mut ret_area = RetArea(
31604 [::core::mem::MaybeUninit::uninit(); 16],
31605 );
31606 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
31607 #[cfg(target_arch = "wasm32")]
31608 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
31609 extern "C" {
31610 #[link_name = "[method]db-transaction.commit"]
31611 fn wit_import(_: i32, _: *mut u8);
31612 }
31613 #[cfg(not(target_arch = "wasm32"))]
31614 fn wit_import(_: i32, _: *mut u8) {
31615 unreachable!()
31616 }
31617 wit_import((self).handle() as i32, ptr0);
31618 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
31619 match l1 {
31620 0 => {
31621 let e = ();
31622 Ok(e)
31623 }
31624 1 => {
31625 let e = {
31626 let l2 = i32::from(*ptr0.add(4).cast::<u8>());
31627 let v18 = match l2 {
31628 0 => {
31629 let e18 = {
31630 let l3 = *ptr0.add(8).cast::<*mut u8>();
31631 let l4 = *ptr0.add(12).cast::<usize>();
31632 let len5 = l4;
31633 let bytes5 = _rt::Vec::from_raw_parts(
31634 l3.cast(),
31635 len5,
31636 len5,
31637 );
31638 _rt::string_lift(bytes5)
31639 };
31640 Error::ConnectionFailure(e18)
31641 }
31642 1 => {
31643 let e18 = {
31644 let l6 = *ptr0.add(8).cast::<*mut u8>();
31645 let l7 = *ptr0.add(12).cast::<usize>();
31646 let len8 = l7;
31647 let bytes8 = _rt::Vec::from_raw_parts(
31648 l6.cast(),
31649 len8,
31650 len8,
31651 );
31652 _rt::string_lift(bytes8)
31653 };
31654 Error::QueryParameterFailure(e18)
31655 }
31656 2 => {
31657 let e18 = {
31658 let l9 = *ptr0.add(8).cast::<*mut u8>();
31659 let l10 = *ptr0.add(12).cast::<usize>();
31660 let len11 = l10;
31661 let bytes11 = _rt::Vec::from_raw_parts(
31662 l9.cast(),
31663 len11,
31664 len11,
31665 );
31666 _rt::string_lift(bytes11)
31667 };
31668 Error::QueryExecutionFailure(e18)
31669 }
31670 3 => {
31671 let e18 = {
31672 let l12 = *ptr0.add(8).cast::<*mut u8>();
31673 let l13 = *ptr0.add(12).cast::<usize>();
31674 let len14 = l13;
31675 let bytes14 = _rt::Vec::from_raw_parts(
31676 l12.cast(),
31677 len14,
31678 len14,
31679 );
31680 _rt::string_lift(bytes14)
31681 };
31682 Error::QueryResponseFailure(e18)
31683 }
31684 n => {
31685 debug_assert_eq!(n, 4, "invalid enum discriminant");
31686 let e18 = {
31687 let l15 = *ptr0.add(8).cast::<*mut u8>();
31688 let l16 = *ptr0.add(12).cast::<usize>();
31689 let len17 = l16;
31690 let bytes17 = _rt::Vec::from_raw_parts(
31691 l15.cast(),
31692 len17,
31693 len17,
31694 );
31695 _rt::string_lift(bytes17)
31696 };
31697 Error::Other(e18)
31698 }
31699 };
31700 v18
31701 };
31702 Err(e)
31703 }
31704 _ => _rt::invalid_enum_discriminant(),
31705 }
31706 }
31707 }
31708 }
31709 impl DbTransaction {
31710 #[allow(unused_unsafe, clippy::all)]
31711 pub fn rollback(&self) -> Result<(), Error> {
31712 unsafe {
31713 #[repr(align(4))]
31714 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
31715 let mut ret_area = RetArea(
31716 [::core::mem::MaybeUninit::uninit(); 16],
31717 );
31718 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
31719 #[cfg(target_arch = "wasm32")]
31720 #[link(wasm_import_module = "golem:rdbms/postgres@0.0.1")]
31721 extern "C" {
31722 #[link_name = "[method]db-transaction.rollback"]
31723 fn wit_import(_: i32, _: *mut u8);
31724 }
31725 #[cfg(not(target_arch = "wasm32"))]
31726 fn wit_import(_: i32, _: *mut u8) {
31727 unreachable!()
31728 }
31729 wit_import((self).handle() as i32, ptr0);
31730 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
31731 match l1 {
31732 0 => {
31733 let e = ();
31734 Ok(e)
31735 }
31736 1 => {
31737 let e = {
31738 let l2 = i32::from(*ptr0.add(4).cast::<u8>());
31739 let v18 = match l2 {
31740 0 => {
31741 let e18 = {
31742 let l3 = *ptr0.add(8).cast::<*mut u8>();
31743 let l4 = *ptr0.add(12).cast::<usize>();
31744 let len5 = l4;
31745 let bytes5 = _rt::Vec::from_raw_parts(
31746 l3.cast(),
31747 len5,
31748 len5,
31749 );
31750 _rt::string_lift(bytes5)
31751 };
31752 Error::ConnectionFailure(e18)
31753 }
31754 1 => {
31755 let e18 = {
31756 let l6 = *ptr0.add(8).cast::<*mut u8>();
31757 let l7 = *ptr0.add(12).cast::<usize>();
31758 let len8 = l7;
31759 let bytes8 = _rt::Vec::from_raw_parts(
31760 l6.cast(),
31761 len8,
31762 len8,
31763 );
31764 _rt::string_lift(bytes8)
31765 };
31766 Error::QueryParameterFailure(e18)
31767 }
31768 2 => {
31769 let e18 = {
31770 let l9 = *ptr0.add(8).cast::<*mut u8>();
31771 let l10 = *ptr0.add(12).cast::<usize>();
31772 let len11 = l10;
31773 let bytes11 = _rt::Vec::from_raw_parts(
31774 l9.cast(),
31775 len11,
31776 len11,
31777 );
31778 _rt::string_lift(bytes11)
31779 };
31780 Error::QueryExecutionFailure(e18)
31781 }
31782 3 => {
31783 let e18 = {
31784 let l12 = *ptr0.add(8).cast::<*mut u8>();
31785 let l13 = *ptr0.add(12).cast::<usize>();
31786 let len14 = l13;
31787 let bytes14 = _rt::Vec::from_raw_parts(
31788 l12.cast(),
31789 len14,
31790 len14,
31791 );
31792 _rt::string_lift(bytes14)
31793 };
31794 Error::QueryResponseFailure(e18)
31795 }
31796 n => {
31797 debug_assert_eq!(n, 4, "invalid enum discriminant");
31798 let e18 = {
31799 let l15 = *ptr0.add(8).cast::<*mut u8>();
31800 let l16 = *ptr0.add(12).cast::<usize>();
31801 let len17 = l16;
31802 let bytes17 = _rt::Vec::from_raw_parts(
31803 l15.cast(),
31804 len17,
31805 len17,
31806 );
31807 _rt::string_lift(bytes17)
31808 };
31809 Error::Other(e18)
31810 }
31811 };
31812 v18
31813 };
31814 Err(e)
31815 }
31816 _ => _rt::invalid_enum_discriminant(),
31817 }
31818 }
31819 }
31820 }
31821 }
31822 }
31823 pub mod rpc {
31824 #[allow(dead_code, clippy::all)]
31825 pub mod types {
31826 #[used]
31827 #[doc(hidden)]
31828 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
31829 use super::super::super::_rt;
31830 pub type Datetime = super::super::super::wasi::clocks::wall_clock::Datetime;
31831 pub type Pollable = super::super::super::wasi::io::poll::Pollable;
31832 pub type NodeIndex = i32;
31833 pub type ResourceId = u64;
31834 #[repr(u8)]
31835 #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
31836 pub enum ResourceMode {
31837 Owned,
31838 Borrowed,
31839 }
31840 impl ::core::fmt::Debug for ResourceMode {
31841 fn fmt(
31842 &self,
31843 f: &mut ::core::fmt::Formatter<'_>,
31844 ) -> ::core::fmt::Result {
31845 match self {
31846 ResourceMode::Owned => {
31847 f.debug_tuple("ResourceMode::Owned").finish()
31848 }
31849 ResourceMode::Borrowed => {
31850 f.debug_tuple("ResourceMode::Borrowed").finish()
31851 }
31852 }
31853 }
31854 }
31855 impl ResourceMode {
31856 #[doc(hidden)]
31857 pub unsafe fn _lift(val: u8) -> ResourceMode {
31858 if !cfg!(debug_assertions) {
31859 return ::core::mem::transmute(val);
31860 }
31861 match val {
31862 0 => ResourceMode::Owned,
31863 1 => ResourceMode::Borrowed,
31864 _ => panic!("invalid enum discriminant"),
31865 }
31866 }
31867 }
31868 #[derive(Clone)]
31869 pub enum WitTypeNode {
31870 RecordType(_rt::Vec<(_rt::String, NodeIndex)>),
31871 VariantType(_rt::Vec<(_rt::String, Option<NodeIndex>)>),
31872 EnumType(_rt::Vec<_rt::String>),
31873 FlagsType(_rt::Vec<_rt::String>),
31874 TupleType(_rt::Vec<NodeIndex>),
31875 ListType(NodeIndex),
31876 OptionType(NodeIndex),
31877 ResultType((Option<NodeIndex>, Option<NodeIndex>)),
31878 PrimU8Type,
31879 PrimU16Type,
31880 PrimU32Type,
31881 PrimU64Type,
31882 PrimS8Type,
31883 PrimS16Type,
31884 PrimS32Type,
31885 PrimS64Type,
31886 PrimF32Type,
31887 PrimF64Type,
31888 PrimCharType,
31889 PrimBoolType,
31890 PrimStringType,
31891 HandleType((ResourceId, ResourceMode)),
31892 }
31893 impl ::core::fmt::Debug for WitTypeNode {
31894 fn fmt(
31895 &self,
31896 f: &mut ::core::fmt::Formatter<'_>,
31897 ) -> ::core::fmt::Result {
31898 match self {
31899 WitTypeNode::RecordType(e) => {
31900 f.debug_tuple("WitTypeNode::RecordType").field(e).finish()
31901 }
31902 WitTypeNode::VariantType(e) => {
31903 f.debug_tuple("WitTypeNode::VariantType").field(e).finish()
31904 }
31905 WitTypeNode::EnumType(e) => {
31906 f.debug_tuple("WitTypeNode::EnumType").field(e).finish()
31907 }
31908 WitTypeNode::FlagsType(e) => {
31909 f.debug_tuple("WitTypeNode::FlagsType").field(e).finish()
31910 }
31911 WitTypeNode::TupleType(e) => {
31912 f.debug_tuple("WitTypeNode::TupleType").field(e).finish()
31913 }
31914 WitTypeNode::ListType(e) => {
31915 f.debug_tuple("WitTypeNode::ListType").field(e).finish()
31916 }
31917 WitTypeNode::OptionType(e) => {
31918 f.debug_tuple("WitTypeNode::OptionType").field(e).finish()
31919 }
31920 WitTypeNode::ResultType(e) => {
31921 f.debug_tuple("WitTypeNode::ResultType").field(e).finish()
31922 }
31923 WitTypeNode::PrimU8Type => {
31924 f.debug_tuple("WitTypeNode::PrimU8Type").finish()
31925 }
31926 WitTypeNode::PrimU16Type => {
31927 f.debug_tuple("WitTypeNode::PrimU16Type").finish()
31928 }
31929 WitTypeNode::PrimU32Type => {
31930 f.debug_tuple("WitTypeNode::PrimU32Type").finish()
31931 }
31932 WitTypeNode::PrimU64Type => {
31933 f.debug_tuple("WitTypeNode::PrimU64Type").finish()
31934 }
31935 WitTypeNode::PrimS8Type => {
31936 f.debug_tuple("WitTypeNode::PrimS8Type").finish()
31937 }
31938 WitTypeNode::PrimS16Type => {
31939 f.debug_tuple("WitTypeNode::PrimS16Type").finish()
31940 }
31941 WitTypeNode::PrimS32Type => {
31942 f.debug_tuple("WitTypeNode::PrimS32Type").finish()
31943 }
31944 WitTypeNode::PrimS64Type => {
31945 f.debug_tuple("WitTypeNode::PrimS64Type").finish()
31946 }
31947 WitTypeNode::PrimF32Type => {
31948 f.debug_tuple("WitTypeNode::PrimF32Type").finish()
31949 }
31950 WitTypeNode::PrimF64Type => {
31951 f.debug_tuple("WitTypeNode::PrimF64Type").finish()
31952 }
31953 WitTypeNode::PrimCharType => {
31954 f.debug_tuple("WitTypeNode::PrimCharType").finish()
31955 }
31956 WitTypeNode::PrimBoolType => {
31957 f.debug_tuple("WitTypeNode::PrimBoolType").finish()
31958 }
31959 WitTypeNode::PrimStringType => {
31960 f.debug_tuple("WitTypeNode::PrimStringType").finish()
31961 }
31962 WitTypeNode::HandleType(e) => {
31963 f.debug_tuple("WitTypeNode::HandleType").field(e).finish()
31964 }
31965 }
31966 }
31967 }
31968 #[derive(Clone)]
31969 pub struct WitType {
31970 pub nodes: _rt::Vec<WitTypeNode>,
31971 }
31972 impl ::core::fmt::Debug for WitType {
31973 fn fmt(
31974 &self,
31975 f: &mut ::core::fmt::Formatter<'_>,
31976 ) -> ::core::fmt::Result {
31977 f.debug_struct("WitType").field("nodes", &self.nodes).finish()
31978 }
31979 }
31980 #[derive(Clone)]
31981 pub struct Uri {
31982 pub value: _rt::String,
31983 }
31984 impl ::core::fmt::Debug for Uri {
31985 fn fmt(
31986 &self,
31987 f: &mut ::core::fmt::Formatter<'_>,
31988 ) -> ::core::fmt::Result {
31989 f.debug_struct("Uri").field("value", &self.value).finish()
31990 }
31991 }
31992 #[derive(Clone)]
31993 pub enum WitNode {
31994 RecordValue(_rt::Vec<NodeIndex>),
31995 VariantValue((u32, Option<NodeIndex>)),
31996 EnumValue(u32),
31997 FlagsValue(_rt::Vec<bool>),
31998 TupleValue(_rt::Vec<NodeIndex>),
31999 ListValue(_rt::Vec<NodeIndex>),
32000 OptionValue(Option<NodeIndex>),
32001 ResultValue(Result<Option<NodeIndex>, Option<NodeIndex>>),
32002 PrimU8(u8),
32003 PrimU16(u16),
32004 PrimU32(u32),
32005 PrimU64(u64),
32006 PrimS8(i8),
32007 PrimS16(i16),
32008 PrimS32(i32),
32009 PrimS64(i64),
32010 PrimFloat32(f32),
32011 PrimFloat64(f64),
32012 PrimChar(char),
32013 PrimBool(bool),
32014 PrimString(_rt::String),
32015 Handle((Uri, u64)),
32016 }
32017 impl ::core::fmt::Debug for WitNode {
32018 fn fmt(
32019 &self,
32020 f: &mut ::core::fmt::Formatter<'_>,
32021 ) -> ::core::fmt::Result {
32022 match self {
32023 WitNode::RecordValue(e) => {
32024 f.debug_tuple("WitNode::RecordValue").field(e).finish()
32025 }
32026 WitNode::VariantValue(e) => {
32027 f.debug_tuple("WitNode::VariantValue").field(e).finish()
32028 }
32029 WitNode::EnumValue(e) => {
32030 f.debug_tuple("WitNode::EnumValue").field(e).finish()
32031 }
32032 WitNode::FlagsValue(e) => {
32033 f.debug_tuple("WitNode::FlagsValue").field(e).finish()
32034 }
32035 WitNode::TupleValue(e) => {
32036 f.debug_tuple("WitNode::TupleValue").field(e).finish()
32037 }
32038 WitNode::ListValue(e) => {
32039 f.debug_tuple("WitNode::ListValue").field(e).finish()
32040 }
32041 WitNode::OptionValue(e) => {
32042 f.debug_tuple("WitNode::OptionValue").field(e).finish()
32043 }
32044 WitNode::ResultValue(e) => {
32045 f.debug_tuple("WitNode::ResultValue").field(e).finish()
32046 }
32047 WitNode::PrimU8(e) => {
32048 f.debug_tuple("WitNode::PrimU8").field(e).finish()
32049 }
32050 WitNode::PrimU16(e) => {
32051 f.debug_tuple("WitNode::PrimU16").field(e).finish()
32052 }
32053 WitNode::PrimU32(e) => {
32054 f.debug_tuple("WitNode::PrimU32").field(e).finish()
32055 }
32056 WitNode::PrimU64(e) => {
32057 f.debug_tuple("WitNode::PrimU64").field(e).finish()
32058 }
32059 WitNode::PrimS8(e) => {
32060 f.debug_tuple("WitNode::PrimS8").field(e).finish()
32061 }
32062 WitNode::PrimS16(e) => {
32063 f.debug_tuple("WitNode::PrimS16").field(e).finish()
32064 }
32065 WitNode::PrimS32(e) => {
32066 f.debug_tuple("WitNode::PrimS32").field(e).finish()
32067 }
32068 WitNode::PrimS64(e) => {
32069 f.debug_tuple("WitNode::PrimS64").field(e).finish()
32070 }
32071 WitNode::PrimFloat32(e) => {
32072 f.debug_tuple("WitNode::PrimFloat32").field(e).finish()
32073 }
32074 WitNode::PrimFloat64(e) => {
32075 f.debug_tuple("WitNode::PrimFloat64").field(e).finish()
32076 }
32077 WitNode::PrimChar(e) => {
32078 f.debug_tuple("WitNode::PrimChar").field(e).finish()
32079 }
32080 WitNode::PrimBool(e) => {
32081 f.debug_tuple("WitNode::PrimBool").field(e).finish()
32082 }
32083 WitNode::PrimString(e) => {
32084 f.debug_tuple("WitNode::PrimString").field(e).finish()
32085 }
32086 WitNode::Handle(e) => {
32087 f.debug_tuple("WitNode::Handle").field(e).finish()
32088 }
32089 }
32090 }
32091 }
32092 #[derive(Clone)]
32093 pub struct WitValue {
32094 pub nodes: _rt::Vec<WitNode>,
32095 }
32096 impl ::core::fmt::Debug for WitValue {
32097 fn fmt(
32098 &self,
32099 f: &mut ::core::fmt::Formatter<'_>,
32100 ) -> ::core::fmt::Result {
32101 f.debug_struct("WitValue").field("nodes", &self.nodes).finish()
32102 }
32103 }
32104 #[derive(Clone)]
32105 pub struct ValueAndType {
32106 pub value: WitValue,
32107 pub typ: WitType,
32108 }
32109 impl ::core::fmt::Debug for ValueAndType {
32110 fn fmt(
32111 &self,
32112 f: &mut ::core::fmt::Formatter<'_>,
32113 ) -> ::core::fmt::Result {
32114 f.debug_struct("ValueAndType")
32115 .field("value", &self.value)
32116 .field("typ", &self.typ)
32117 .finish()
32118 }
32119 }
32120 #[derive(Clone)]
32121 pub enum RpcError {
32122 ProtocolError(_rt::String),
32123 Denied(_rt::String),
32124 NotFound(_rt::String),
32125 RemoteInternalError(_rt::String),
32126 }
32127 impl ::core::fmt::Debug for RpcError {
32128 fn fmt(
32129 &self,
32130 f: &mut ::core::fmt::Formatter<'_>,
32131 ) -> ::core::fmt::Result {
32132 match self {
32133 RpcError::ProtocolError(e) => {
32134 f.debug_tuple("RpcError::ProtocolError").field(e).finish()
32135 }
32136 RpcError::Denied(e) => {
32137 f.debug_tuple("RpcError::Denied").field(e).finish()
32138 }
32139 RpcError::NotFound(e) => {
32140 f.debug_tuple("RpcError::NotFound").field(e).finish()
32141 }
32142 RpcError::RemoteInternalError(e) => {
32143 f.debug_tuple("RpcError::RemoteInternalError")
32144 .field(e)
32145 .finish()
32146 }
32147 }
32148 }
32149 }
32150 impl ::core::fmt::Display for RpcError {
32151 fn fmt(
32152 &self,
32153 f: &mut ::core::fmt::Formatter<'_>,
32154 ) -> ::core::fmt::Result {
32155 write!(f, "{:?}", self)
32156 }
32157 }
32158 impl std::error::Error for RpcError {}
32159 #[derive(Debug)]
32160 #[repr(transparent)]
32161 pub struct WasmRpc {
32162 handle: _rt::Resource<WasmRpc>,
32163 }
32164 impl WasmRpc {
32165 #[doc(hidden)]
32166 pub unsafe fn from_handle(handle: u32) -> Self {
32167 Self {
32168 handle: _rt::Resource::from_handle(handle),
32169 }
32170 }
32171 #[doc(hidden)]
32172 pub fn take_handle(&self) -> u32 {
32173 _rt::Resource::take_handle(&self.handle)
32174 }
32175 #[doc(hidden)]
32176 pub fn handle(&self) -> u32 {
32177 _rt::Resource::handle(&self.handle)
32178 }
32179 }
32180 unsafe impl _rt::WasmResource for WasmRpc {
32181 #[inline]
32182 unsafe fn drop(_handle: u32) {
32183 #[cfg(not(target_arch = "wasm32"))]
32184 unreachable!();
32185 #[cfg(target_arch = "wasm32")]
32186 {
32187 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
32188 extern "C" {
32189 #[link_name = "[resource-drop]wasm-rpc"]
32190 fn drop(_: u32);
32191 }
32192 drop(_handle);
32193 }
32194 }
32195 }
32196 #[derive(Debug)]
32197 #[repr(transparent)]
32198 pub struct FutureInvokeResult {
32199 handle: _rt::Resource<FutureInvokeResult>,
32200 }
32201 impl FutureInvokeResult {
32202 #[doc(hidden)]
32203 pub unsafe fn from_handle(handle: u32) -> Self {
32204 Self {
32205 handle: _rt::Resource::from_handle(handle),
32206 }
32207 }
32208 #[doc(hidden)]
32209 pub fn take_handle(&self) -> u32 {
32210 _rt::Resource::take_handle(&self.handle)
32211 }
32212 #[doc(hidden)]
32213 pub fn handle(&self) -> u32 {
32214 _rt::Resource::handle(&self.handle)
32215 }
32216 }
32217 unsafe impl _rt::WasmResource for FutureInvokeResult {
32218 #[inline]
32219 unsafe fn drop(_handle: u32) {
32220 #[cfg(not(target_arch = "wasm32"))]
32221 unreachable!();
32222 #[cfg(target_arch = "wasm32")]
32223 {
32224 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
32225 extern "C" {
32226 #[link_name = "[resource-drop]future-invoke-result"]
32227 fn drop(_: u32);
32228 }
32229 drop(_handle);
32230 }
32231 }
32232 }
32233 #[derive(Debug)]
32234 #[repr(transparent)]
32235 pub struct CancellationToken {
32236 handle: _rt::Resource<CancellationToken>,
32237 }
32238 impl CancellationToken {
32239 #[doc(hidden)]
32240 pub unsafe fn from_handle(handle: u32) -> Self {
32241 Self {
32242 handle: _rt::Resource::from_handle(handle),
32243 }
32244 }
32245 #[doc(hidden)]
32246 pub fn take_handle(&self) -> u32 {
32247 _rt::Resource::take_handle(&self.handle)
32248 }
32249 #[doc(hidden)]
32250 pub fn handle(&self) -> u32 {
32251 _rt::Resource::handle(&self.handle)
32252 }
32253 }
32254 unsafe impl _rt::WasmResource for CancellationToken {
32255 #[inline]
32256 unsafe fn drop(_handle: u32) {
32257 #[cfg(not(target_arch = "wasm32"))]
32258 unreachable!();
32259 #[cfg(target_arch = "wasm32")]
32260 {
32261 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
32262 extern "C" {
32263 #[link_name = "[resource-drop]cancellation-token"]
32264 fn drop(_: u32);
32265 }
32266 drop(_handle);
32267 }
32268 }
32269 }
32270 impl WasmRpc {
32271 #[allow(unused_unsafe, clippy::all)]
32272 pub fn new(location: &Uri) -> Self {
32273 unsafe {
32274 let Uri { value: value0 } = location;
32275 let vec1 = value0;
32276 let ptr1 = vec1.as_ptr().cast::<u8>();
32277 let len1 = vec1.len();
32278 #[cfg(target_arch = "wasm32")]
32279 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
32280 extern "C" {
32281 #[link_name = "[constructor]wasm-rpc"]
32282 fn wit_import(_: *mut u8, _: usize) -> i32;
32283 }
32284 #[cfg(not(target_arch = "wasm32"))]
32285 fn wit_import(_: *mut u8, _: usize) -> i32 {
32286 unreachable!()
32287 }
32288 let ret = wit_import(ptr1.cast_mut(), len1);
32289 WasmRpc::from_handle(ret as u32)
32290 }
32291 }
32292 }
32293 impl WasmRpc {
32294 #[allow(unused_unsafe, clippy::all)]
32295 pub fn invoke_and_await(
32296 &self,
32297 function_name: &str,
32298 function_params: &[WitValue],
32299 ) -> Result<WitValue, RpcError> {
32300 unsafe {
32301 let mut cleanup_list = _rt::Vec::new();
32302 #[repr(align(4))]
32303 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
32304 let mut ret_area = RetArea(
32305 [::core::mem::MaybeUninit::uninit(); 16],
32306 );
32307 let vec0 = function_name;
32308 let ptr0 = vec0.as_ptr().cast::<u8>();
32309 let len0 = vec0.len();
32310 let vec12 = function_params;
32311 let len12 = vec12.len();
32312 let layout12 = _rt::alloc::Layout::from_size_align_unchecked(
32313 vec12.len() * 8,
32314 4,
32315 );
32316 let result12 = if layout12.size() != 0 {
32317 let ptr = _rt::alloc::alloc(layout12).cast::<u8>();
32318 if ptr.is_null() {
32319 _rt::alloc::handle_alloc_error(layout12);
32320 }
32321 ptr
32322 } else {
32323 ::core::ptr::null_mut()
32324 };
32325 for (i, e) in vec12.into_iter().enumerate() {
32326 let base = result12.add(i * 8);
32327 {
32328 let WitValue { nodes: nodes1 } = e;
32329 let vec11 = nodes1;
32330 let len11 = vec11.len();
32331 let layout11 = _rt::alloc::Layout::from_size_align_unchecked(
32332 vec11.len() * 24,
32333 8,
32334 );
32335 let result11 = if layout11.size() != 0 {
32336 let ptr = _rt::alloc::alloc(layout11).cast::<u8>();
32337 if ptr.is_null() {
32338 _rt::alloc::handle_alloc_error(layout11);
32339 }
32340 ptr
32341 } else {
32342 ::core::ptr::null_mut()
32343 };
32344 for (i, e) in vec11.into_iter().enumerate() {
32345 let base = result11.add(i * 24);
32346 {
32347 match e {
32348 WitNode::RecordValue(e) => {
32349 *base.add(0).cast::<u8>() = (0i32) as u8;
32350 let vec2 = e;
32351 let ptr2 = vec2.as_ptr().cast::<u8>();
32352 let len2 = vec2.len();
32353 *base.add(12).cast::<usize>() = len2;
32354 *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
32355 }
32356 WitNode::VariantValue(e) => {
32357 *base.add(0).cast::<u8>() = (1i32) as u8;
32358 let (t3_0, t3_1) = e;
32359 *base.add(8).cast::<i32>() = _rt::as_i32(t3_0);
32360 match t3_1 {
32361 Some(e) => {
32362 *base.add(12).cast::<u8>() = (1i32) as u8;
32363 *base.add(16).cast::<i32>() = _rt::as_i32(e);
32364 }
32365 None => {
32366 *base.add(12).cast::<u8>() = (0i32) as u8;
32367 }
32368 };
32369 }
32370 WitNode::EnumValue(e) => {
32371 *base.add(0).cast::<u8>() = (2i32) as u8;
32372 *base.add(8).cast::<i32>() = _rt::as_i32(e);
32373 }
32374 WitNode::FlagsValue(e) => {
32375 *base.add(0).cast::<u8>() = (3i32) as u8;
32376 let vec4 = e;
32377 let len4 = vec4.len();
32378 let layout4 = _rt::alloc::Layout::from_size_align_unchecked(
32379 vec4.len() * 1,
32380 1,
32381 );
32382 let result4 = if layout4.size() != 0 {
32383 let ptr = _rt::alloc::alloc(layout4).cast::<u8>();
32384 if ptr.is_null() {
32385 _rt::alloc::handle_alloc_error(layout4);
32386 }
32387 ptr
32388 } else {
32389 ::core::ptr::null_mut()
32390 };
32391 for (i, e) in vec4.into_iter().enumerate() {
32392 let base = result4.add(i * 1);
32393 {
32394 *base.add(0).cast::<u8>() = (match e {
32395 true => 1,
32396 false => 0,
32397 }) as u8;
32398 }
32399 }
32400 *base.add(12).cast::<usize>() = len4;
32401 *base.add(8).cast::<*mut u8>() = result4;
32402 cleanup_list.extend_from_slice(&[(result4, layout4)]);
32403 }
32404 WitNode::TupleValue(e) => {
32405 *base.add(0).cast::<u8>() = (4i32) as u8;
32406 let vec5 = e;
32407 let ptr5 = vec5.as_ptr().cast::<u8>();
32408 let len5 = vec5.len();
32409 *base.add(12).cast::<usize>() = len5;
32410 *base.add(8).cast::<*mut u8>() = ptr5.cast_mut();
32411 }
32412 WitNode::ListValue(e) => {
32413 *base.add(0).cast::<u8>() = (5i32) as u8;
32414 let vec6 = e;
32415 let ptr6 = vec6.as_ptr().cast::<u8>();
32416 let len6 = vec6.len();
32417 *base.add(12).cast::<usize>() = len6;
32418 *base.add(8).cast::<*mut u8>() = ptr6.cast_mut();
32419 }
32420 WitNode::OptionValue(e) => {
32421 *base.add(0).cast::<u8>() = (6i32) as u8;
32422 match e {
32423 Some(e) => {
32424 *base.add(8).cast::<u8>() = (1i32) as u8;
32425 *base.add(12).cast::<i32>() = _rt::as_i32(e);
32426 }
32427 None => {
32428 *base.add(8).cast::<u8>() = (0i32) as u8;
32429 }
32430 };
32431 }
32432 WitNode::ResultValue(e) => {
32433 *base.add(0).cast::<u8>() = (7i32) as u8;
32434 match e {
32435 Ok(e) => {
32436 *base.add(8).cast::<u8>() = (0i32) as u8;
32437 match e {
32438 Some(e) => {
32439 *base.add(12).cast::<u8>() = (1i32) as u8;
32440 *base.add(16).cast::<i32>() = _rt::as_i32(e);
32441 }
32442 None => {
32443 *base.add(12).cast::<u8>() = (0i32) as u8;
32444 }
32445 };
32446 }
32447 Err(e) => {
32448 *base.add(8).cast::<u8>() = (1i32) as u8;
32449 match e {
32450 Some(e) => {
32451 *base.add(12).cast::<u8>() = (1i32) as u8;
32452 *base.add(16).cast::<i32>() = _rt::as_i32(e);
32453 }
32454 None => {
32455 *base.add(12).cast::<u8>() = (0i32) as u8;
32456 }
32457 };
32458 }
32459 };
32460 }
32461 WitNode::PrimU8(e) => {
32462 *base.add(0).cast::<u8>() = (8i32) as u8;
32463 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
32464 }
32465 WitNode::PrimU16(e) => {
32466 *base.add(0).cast::<u8>() = (9i32) as u8;
32467 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
32468 }
32469 WitNode::PrimU32(e) => {
32470 *base.add(0).cast::<u8>() = (10i32) as u8;
32471 *base.add(8).cast::<i32>() = _rt::as_i32(e);
32472 }
32473 WitNode::PrimU64(e) => {
32474 *base.add(0).cast::<u8>() = (11i32) as u8;
32475 *base.add(8).cast::<i64>() = _rt::as_i64(e);
32476 }
32477 WitNode::PrimS8(e) => {
32478 *base.add(0).cast::<u8>() = (12i32) as u8;
32479 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
32480 }
32481 WitNode::PrimS16(e) => {
32482 *base.add(0).cast::<u8>() = (13i32) as u8;
32483 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
32484 }
32485 WitNode::PrimS32(e) => {
32486 *base.add(0).cast::<u8>() = (14i32) as u8;
32487 *base.add(8).cast::<i32>() = _rt::as_i32(e);
32488 }
32489 WitNode::PrimS64(e) => {
32490 *base.add(0).cast::<u8>() = (15i32) as u8;
32491 *base.add(8).cast::<i64>() = _rt::as_i64(e);
32492 }
32493 WitNode::PrimFloat32(e) => {
32494 *base.add(0).cast::<u8>() = (16i32) as u8;
32495 *base.add(8).cast::<f32>() = _rt::as_f32(e);
32496 }
32497 WitNode::PrimFloat64(e) => {
32498 *base.add(0).cast::<u8>() = (17i32) as u8;
32499 *base.add(8).cast::<f64>() = _rt::as_f64(e);
32500 }
32501 WitNode::PrimChar(e) => {
32502 *base.add(0).cast::<u8>() = (18i32) as u8;
32503 *base.add(8).cast::<i32>() = _rt::as_i32(e);
32504 }
32505 WitNode::PrimBool(e) => {
32506 *base.add(0).cast::<u8>() = (19i32) as u8;
32507 *base.add(8).cast::<u8>() = (match e {
32508 true => 1,
32509 false => 0,
32510 }) as u8;
32511 }
32512 WitNode::PrimString(e) => {
32513 *base.add(0).cast::<u8>() = (20i32) as u8;
32514 let vec7 = e;
32515 let ptr7 = vec7.as_ptr().cast::<u8>();
32516 let len7 = vec7.len();
32517 *base.add(12).cast::<usize>() = len7;
32518 *base.add(8).cast::<*mut u8>() = ptr7.cast_mut();
32519 }
32520 WitNode::Handle(e) => {
32521 *base.add(0).cast::<u8>() = (21i32) as u8;
32522 let (t8_0, t8_1) = e;
32523 let Uri { value: value9 } = t8_0;
32524 let vec10 = value9;
32525 let ptr10 = vec10.as_ptr().cast::<u8>();
32526 let len10 = vec10.len();
32527 *base.add(12).cast::<usize>() = len10;
32528 *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
32529 *base.add(16).cast::<i64>() = _rt::as_i64(t8_1);
32530 }
32531 }
32532 }
32533 }
32534 *base.add(4).cast::<usize>() = len11;
32535 *base.add(0).cast::<*mut u8>() = result11;
32536 cleanup_list.extend_from_slice(&[(result11, layout11)]);
32537 }
32538 }
32539 let ptr13 = ret_area.0.as_mut_ptr().cast::<u8>();
32540 #[cfg(target_arch = "wasm32")]
32541 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
32542 extern "C" {
32543 #[link_name = "[method]wasm-rpc.invoke-and-await"]
32544 fn wit_import(
32545 _: i32,
32546 _: *mut u8,
32547 _: usize,
32548 _: *mut u8,
32549 _: usize,
32550 _: *mut u8,
32551 );
32552 }
32553 #[cfg(not(target_arch = "wasm32"))]
32554 fn wit_import(
32555 _: i32,
32556 _: *mut u8,
32557 _: usize,
32558 _: *mut u8,
32559 _: usize,
32560 _: *mut u8,
32561 ) {
32562 unreachable!()
32563 }
32564 wit_import(
32565 (self).handle() as i32,
32566 ptr0.cast_mut(),
32567 len0,
32568 result12,
32569 len12,
32570 ptr13,
32571 );
32572 let l14 = i32::from(*ptr13.add(0).cast::<u8>());
32573 if layout12.size() != 0 {
32574 _rt::alloc::dealloc(result12.cast(), layout12);
32575 }
32576 for (ptr, layout) in cleanup_list {
32577 if layout.size() != 0 {
32578 _rt::alloc::dealloc(ptr.cast(), layout);
32579 }
32580 }
32581 match l14 {
32582 0 => {
32583 let e = {
32584 let l15 = *ptr13.add(4).cast::<*mut u8>();
32585 let l16 = *ptr13.add(8).cast::<usize>();
32586 let base62 = l15;
32587 let len62 = l16;
32588 let mut result62 = _rt::Vec::with_capacity(len62);
32589 for i in 0..len62 {
32590 let base = base62.add(i * 24);
32591 let e62 = {
32592 let l17 = i32::from(*base.add(0).cast::<u8>());
32593 let v61 = match l17 {
32594 0 => {
32595 let e61 = {
32596 let l18 = *base.add(8).cast::<*mut u8>();
32597 let l19 = *base.add(12).cast::<usize>();
32598 let len20 = l19;
32599 _rt::Vec::from_raw_parts(l18.cast(), len20, len20)
32600 };
32601 WitNode::RecordValue(e61)
32602 }
32603 1 => {
32604 let e61 = {
32605 let l21 = *base.add(8).cast::<i32>();
32606 let l22 = i32::from(*base.add(12).cast::<u8>());
32607 (
32608 l21 as u32,
32609 match l22 {
32610 0 => None,
32611 1 => {
32612 let e = {
32613 let l23 = *base.add(16).cast::<i32>();
32614 l23
32615 };
32616 Some(e)
32617 }
32618 _ => _rt::invalid_enum_discriminant(),
32619 },
32620 )
32621 };
32622 WitNode::VariantValue(e61)
32623 }
32624 2 => {
32625 let e61 = {
32626 let l24 = *base.add(8).cast::<i32>();
32627 l24 as u32
32628 };
32629 WitNode::EnumValue(e61)
32630 }
32631 3 => {
32632 let e61 = {
32633 let l25 = *base.add(8).cast::<*mut u8>();
32634 let l26 = *base.add(12).cast::<usize>();
32635 let base28 = l25;
32636 let len28 = l26;
32637 let mut result28 = _rt::Vec::with_capacity(len28);
32638 for i in 0..len28 {
32639 let base = base28.add(i * 1);
32640 let e28 = {
32641 let l27 = i32::from(*base.add(0).cast::<u8>());
32642 _rt::bool_lift(l27 as u8)
32643 };
32644 result28.push(e28);
32645 }
32646 _rt::cabi_dealloc(base28, len28 * 1, 1);
32647 result28
32648 };
32649 WitNode::FlagsValue(e61)
32650 }
32651 4 => {
32652 let e61 = {
32653 let l29 = *base.add(8).cast::<*mut u8>();
32654 let l30 = *base.add(12).cast::<usize>();
32655 let len31 = l30;
32656 _rt::Vec::from_raw_parts(l29.cast(), len31, len31)
32657 };
32658 WitNode::TupleValue(e61)
32659 }
32660 5 => {
32661 let e61 = {
32662 let l32 = *base.add(8).cast::<*mut u8>();
32663 let l33 = *base.add(12).cast::<usize>();
32664 let len34 = l33;
32665 _rt::Vec::from_raw_parts(l32.cast(), len34, len34)
32666 };
32667 WitNode::ListValue(e61)
32668 }
32669 6 => {
32670 let e61 = {
32671 let l35 = i32::from(*base.add(8).cast::<u8>());
32672 match l35 {
32673 0 => None,
32674 1 => {
32675 let e = {
32676 let l36 = *base.add(12).cast::<i32>();
32677 l36
32678 };
32679 Some(e)
32680 }
32681 _ => _rt::invalid_enum_discriminant(),
32682 }
32683 };
32684 WitNode::OptionValue(e61)
32685 }
32686 7 => {
32687 let e61 = {
32688 let l37 = i32::from(*base.add(8).cast::<u8>());
32689 match l37 {
32690 0 => {
32691 let e = {
32692 let l38 = i32::from(*base.add(12).cast::<u8>());
32693 match l38 {
32694 0 => None,
32695 1 => {
32696 let e = {
32697 let l39 = *base.add(16).cast::<i32>();
32698 l39
32699 };
32700 Some(e)
32701 }
32702 _ => _rt::invalid_enum_discriminant(),
32703 }
32704 };
32705 Ok(e)
32706 }
32707 1 => {
32708 let e = {
32709 let l40 = i32::from(*base.add(12).cast::<u8>());
32710 match l40 {
32711 0 => None,
32712 1 => {
32713 let e = {
32714 let l41 = *base.add(16).cast::<i32>();
32715 l41
32716 };
32717 Some(e)
32718 }
32719 _ => _rt::invalid_enum_discriminant(),
32720 }
32721 };
32722 Err(e)
32723 }
32724 _ => _rt::invalid_enum_discriminant(),
32725 }
32726 };
32727 WitNode::ResultValue(e61)
32728 }
32729 8 => {
32730 let e61 = {
32731 let l42 = i32::from(*base.add(8).cast::<u8>());
32732 l42 as u8
32733 };
32734 WitNode::PrimU8(e61)
32735 }
32736 9 => {
32737 let e61 = {
32738 let l43 = i32::from(*base.add(8).cast::<u16>());
32739 l43 as u16
32740 };
32741 WitNode::PrimU16(e61)
32742 }
32743 10 => {
32744 let e61 = {
32745 let l44 = *base.add(8).cast::<i32>();
32746 l44 as u32
32747 };
32748 WitNode::PrimU32(e61)
32749 }
32750 11 => {
32751 let e61 = {
32752 let l45 = *base.add(8).cast::<i64>();
32753 l45 as u64
32754 };
32755 WitNode::PrimU64(e61)
32756 }
32757 12 => {
32758 let e61 = {
32759 let l46 = i32::from(*base.add(8).cast::<i8>());
32760 l46 as i8
32761 };
32762 WitNode::PrimS8(e61)
32763 }
32764 13 => {
32765 let e61 = {
32766 let l47 = i32::from(*base.add(8).cast::<i16>());
32767 l47 as i16
32768 };
32769 WitNode::PrimS16(e61)
32770 }
32771 14 => {
32772 let e61 = {
32773 let l48 = *base.add(8).cast::<i32>();
32774 l48
32775 };
32776 WitNode::PrimS32(e61)
32777 }
32778 15 => {
32779 let e61 = {
32780 let l49 = *base.add(8).cast::<i64>();
32781 l49
32782 };
32783 WitNode::PrimS64(e61)
32784 }
32785 16 => {
32786 let e61 = {
32787 let l50 = *base.add(8).cast::<f32>();
32788 l50
32789 };
32790 WitNode::PrimFloat32(e61)
32791 }
32792 17 => {
32793 let e61 = {
32794 let l51 = *base.add(8).cast::<f64>();
32795 l51
32796 };
32797 WitNode::PrimFloat64(e61)
32798 }
32799 18 => {
32800 let e61 = {
32801 let l52 = *base.add(8).cast::<i32>();
32802 _rt::char_lift(l52 as u32)
32803 };
32804 WitNode::PrimChar(e61)
32805 }
32806 19 => {
32807 let e61 = {
32808 let l53 = i32::from(*base.add(8).cast::<u8>());
32809 _rt::bool_lift(l53 as u8)
32810 };
32811 WitNode::PrimBool(e61)
32812 }
32813 20 => {
32814 let e61 = {
32815 let l54 = *base.add(8).cast::<*mut u8>();
32816 let l55 = *base.add(12).cast::<usize>();
32817 let len56 = l55;
32818 let bytes56 = _rt::Vec::from_raw_parts(
32819 l54.cast(),
32820 len56,
32821 len56,
32822 );
32823 _rt::string_lift(bytes56)
32824 };
32825 WitNode::PrimString(e61)
32826 }
32827 n => {
32828 debug_assert_eq!(n, 21, "invalid enum discriminant");
32829 let e61 = {
32830 let l57 = *base.add(8).cast::<*mut u8>();
32831 let l58 = *base.add(12).cast::<usize>();
32832 let len59 = l58;
32833 let bytes59 = _rt::Vec::from_raw_parts(
32834 l57.cast(),
32835 len59,
32836 len59,
32837 );
32838 let l60 = *base.add(16).cast::<i64>();
32839 (
32840 Uri {
32841 value: _rt::string_lift(bytes59),
32842 },
32843 l60 as u64,
32844 )
32845 };
32846 WitNode::Handle(e61)
32847 }
32848 };
32849 v61
32850 };
32851 result62.push(e62);
32852 }
32853 _rt::cabi_dealloc(base62, len62 * 24, 8);
32854 WitValue { nodes: result62 }
32855 };
32856 Ok(e)
32857 }
32858 1 => {
32859 let e = {
32860 let l63 = i32::from(*ptr13.add(4).cast::<u8>());
32861 let v76 = match l63 {
32862 0 => {
32863 let e76 = {
32864 let l64 = *ptr13.add(8).cast::<*mut u8>();
32865 let l65 = *ptr13.add(12).cast::<usize>();
32866 let len66 = l65;
32867 let bytes66 = _rt::Vec::from_raw_parts(
32868 l64.cast(),
32869 len66,
32870 len66,
32871 );
32872 _rt::string_lift(bytes66)
32873 };
32874 RpcError::ProtocolError(e76)
32875 }
32876 1 => {
32877 let e76 = {
32878 let l67 = *ptr13.add(8).cast::<*mut u8>();
32879 let l68 = *ptr13.add(12).cast::<usize>();
32880 let len69 = l68;
32881 let bytes69 = _rt::Vec::from_raw_parts(
32882 l67.cast(),
32883 len69,
32884 len69,
32885 );
32886 _rt::string_lift(bytes69)
32887 };
32888 RpcError::Denied(e76)
32889 }
32890 2 => {
32891 let e76 = {
32892 let l70 = *ptr13.add(8).cast::<*mut u8>();
32893 let l71 = *ptr13.add(12).cast::<usize>();
32894 let len72 = l71;
32895 let bytes72 = _rt::Vec::from_raw_parts(
32896 l70.cast(),
32897 len72,
32898 len72,
32899 );
32900 _rt::string_lift(bytes72)
32901 };
32902 RpcError::NotFound(e76)
32903 }
32904 n => {
32905 debug_assert_eq!(n, 3, "invalid enum discriminant");
32906 let e76 = {
32907 let l73 = *ptr13.add(8).cast::<*mut u8>();
32908 let l74 = *ptr13.add(12).cast::<usize>();
32909 let len75 = l74;
32910 let bytes75 = _rt::Vec::from_raw_parts(
32911 l73.cast(),
32912 len75,
32913 len75,
32914 );
32915 _rt::string_lift(bytes75)
32916 };
32917 RpcError::RemoteInternalError(e76)
32918 }
32919 };
32920 v76
32921 };
32922 Err(e)
32923 }
32924 _ => _rt::invalid_enum_discriminant(),
32925 }
32926 }
32927 }
32928 }
32929 impl WasmRpc {
32930 #[allow(unused_unsafe, clippy::all)]
32931 pub fn invoke(
32932 &self,
32933 function_name: &str,
32934 function_params: &[WitValue],
32935 ) -> Result<(), RpcError> {
32936 unsafe {
32937 let mut cleanup_list = _rt::Vec::new();
32938 #[repr(align(4))]
32939 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
32940 let mut ret_area = RetArea(
32941 [::core::mem::MaybeUninit::uninit(); 16],
32942 );
32943 let vec0 = function_name;
32944 let ptr0 = vec0.as_ptr().cast::<u8>();
32945 let len0 = vec0.len();
32946 let vec12 = function_params;
32947 let len12 = vec12.len();
32948 let layout12 = _rt::alloc::Layout::from_size_align_unchecked(
32949 vec12.len() * 8,
32950 4,
32951 );
32952 let result12 = if layout12.size() != 0 {
32953 let ptr = _rt::alloc::alloc(layout12).cast::<u8>();
32954 if ptr.is_null() {
32955 _rt::alloc::handle_alloc_error(layout12);
32956 }
32957 ptr
32958 } else {
32959 ::core::ptr::null_mut()
32960 };
32961 for (i, e) in vec12.into_iter().enumerate() {
32962 let base = result12.add(i * 8);
32963 {
32964 let WitValue { nodes: nodes1 } = e;
32965 let vec11 = nodes1;
32966 let len11 = vec11.len();
32967 let layout11 = _rt::alloc::Layout::from_size_align_unchecked(
32968 vec11.len() * 24,
32969 8,
32970 );
32971 let result11 = if layout11.size() != 0 {
32972 let ptr = _rt::alloc::alloc(layout11).cast::<u8>();
32973 if ptr.is_null() {
32974 _rt::alloc::handle_alloc_error(layout11);
32975 }
32976 ptr
32977 } else {
32978 ::core::ptr::null_mut()
32979 };
32980 for (i, e) in vec11.into_iter().enumerate() {
32981 let base = result11.add(i * 24);
32982 {
32983 match e {
32984 WitNode::RecordValue(e) => {
32985 *base.add(0).cast::<u8>() = (0i32) as u8;
32986 let vec2 = e;
32987 let ptr2 = vec2.as_ptr().cast::<u8>();
32988 let len2 = vec2.len();
32989 *base.add(12).cast::<usize>() = len2;
32990 *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
32991 }
32992 WitNode::VariantValue(e) => {
32993 *base.add(0).cast::<u8>() = (1i32) as u8;
32994 let (t3_0, t3_1) = e;
32995 *base.add(8).cast::<i32>() = _rt::as_i32(t3_0);
32996 match t3_1 {
32997 Some(e) => {
32998 *base.add(12).cast::<u8>() = (1i32) as u8;
32999 *base.add(16).cast::<i32>() = _rt::as_i32(e);
33000 }
33001 None => {
33002 *base.add(12).cast::<u8>() = (0i32) as u8;
33003 }
33004 };
33005 }
33006 WitNode::EnumValue(e) => {
33007 *base.add(0).cast::<u8>() = (2i32) as u8;
33008 *base.add(8).cast::<i32>() = _rt::as_i32(e);
33009 }
33010 WitNode::FlagsValue(e) => {
33011 *base.add(0).cast::<u8>() = (3i32) as u8;
33012 let vec4 = e;
33013 let len4 = vec4.len();
33014 let layout4 = _rt::alloc::Layout::from_size_align_unchecked(
33015 vec4.len() * 1,
33016 1,
33017 );
33018 let result4 = if layout4.size() != 0 {
33019 let ptr = _rt::alloc::alloc(layout4).cast::<u8>();
33020 if ptr.is_null() {
33021 _rt::alloc::handle_alloc_error(layout4);
33022 }
33023 ptr
33024 } else {
33025 ::core::ptr::null_mut()
33026 };
33027 for (i, e) in vec4.into_iter().enumerate() {
33028 let base = result4.add(i * 1);
33029 {
33030 *base.add(0).cast::<u8>() = (match e {
33031 true => 1,
33032 false => 0,
33033 }) as u8;
33034 }
33035 }
33036 *base.add(12).cast::<usize>() = len4;
33037 *base.add(8).cast::<*mut u8>() = result4;
33038 cleanup_list.extend_from_slice(&[(result4, layout4)]);
33039 }
33040 WitNode::TupleValue(e) => {
33041 *base.add(0).cast::<u8>() = (4i32) as u8;
33042 let vec5 = e;
33043 let ptr5 = vec5.as_ptr().cast::<u8>();
33044 let len5 = vec5.len();
33045 *base.add(12).cast::<usize>() = len5;
33046 *base.add(8).cast::<*mut u8>() = ptr5.cast_mut();
33047 }
33048 WitNode::ListValue(e) => {
33049 *base.add(0).cast::<u8>() = (5i32) as u8;
33050 let vec6 = e;
33051 let ptr6 = vec6.as_ptr().cast::<u8>();
33052 let len6 = vec6.len();
33053 *base.add(12).cast::<usize>() = len6;
33054 *base.add(8).cast::<*mut u8>() = ptr6.cast_mut();
33055 }
33056 WitNode::OptionValue(e) => {
33057 *base.add(0).cast::<u8>() = (6i32) as u8;
33058 match e {
33059 Some(e) => {
33060 *base.add(8).cast::<u8>() = (1i32) as u8;
33061 *base.add(12).cast::<i32>() = _rt::as_i32(e);
33062 }
33063 None => {
33064 *base.add(8).cast::<u8>() = (0i32) as u8;
33065 }
33066 };
33067 }
33068 WitNode::ResultValue(e) => {
33069 *base.add(0).cast::<u8>() = (7i32) as u8;
33070 match e {
33071 Ok(e) => {
33072 *base.add(8).cast::<u8>() = (0i32) as u8;
33073 match e {
33074 Some(e) => {
33075 *base.add(12).cast::<u8>() = (1i32) as u8;
33076 *base.add(16).cast::<i32>() = _rt::as_i32(e);
33077 }
33078 None => {
33079 *base.add(12).cast::<u8>() = (0i32) as u8;
33080 }
33081 };
33082 }
33083 Err(e) => {
33084 *base.add(8).cast::<u8>() = (1i32) as u8;
33085 match e {
33086 Some(e) => {
33087 *base.add(12).cast::<u8>() = (1i32) as u8;
33088 *base.add(16).cast::<i32>() = _rt::as_i32(e);
33089 }
33090 None => {
33091 *base.add(12).cast::<u8>() = (0i32) as u8;
33092 }
33093 };
33094 }
33095 };
33096 }
33097 WitNode::PrimU8(e) => {
33098 *base.add(0).cast::<u8>() = (8i32) as u8;
33099 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
33100 }
33101 WitNode::PrimU16(e) => {
33102 *base.add(0).cast::<u8>() = (9i32) as u8;
33103 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
33104 }
33105 WitNode::PrimU32(e) => {
33106 *base.add(0).cast::<u8>() = (10i32) as u8;
33107 *base.add(8).cast::<i32>() = _rt::as_i32(e);
33108 }
33109 WitNode::PrimU64(e) => {
33110 *base.add(0).cast::<u8>() = (11i32) as u8;
33111 *base.add(8).cast::<i64>() = _rt::as_i64(e);
33112 }
33113 WitNode::PrimS8(e) => {
33114 *base.add(0).cast::<u8>() = (12i32) as u8;
33115 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
33116 }
33117 WitNode::PrimS16(e) => {
33118 *base.add(0).cast::<u8>() = (13i32) as u8;
33119 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
33120 }
33121 WitNode::PrimS32(e) => {
33122 *base.add(0).cast::<u8>() = (14i32) as u8;
33123 *base.add(8).cast::<i32>() = _rt::as_i32(e);
33124 }
33125 WitNode::PrimS64(e) => {
33126 *base.add(0).cast::<u8>() = (15i32) as u8;
33127 *base.add(8).cast::<i64>() = _rt::as_i64(e);
33128 }
33129 WitNode::PrimFloat32(e) => {
33130 *base.add(0).cast::<u8>() = (16i32) as u8;
33131 *base.add(8).cast::<f32>() = _rt::as_f32(e);
33132 }
33133 WitNode::PrimFloat64(e) => {
33134 *base.add(0).cast::<u8>() = (17i32) as u8;
33135 *base.add(8).cast::<f64>() = _rt::as_f64(e);
33136 }
33137 WitNode::PrimChar(e) => {
33138 *base.add(0).cast::<u8>() = (18i32) as u8;
33139 *base.add(8).cast::<i32>() = _rt::as_i32(e);
33140 }
33141 WitNode::PrimBool(e) => {
33142 *base.add(0).cast::<u8>() = (19i32) as u8;
33143 *base.add(8).cast::<u8>() = (match e {
33144 true => 1,
33145 false => 0,
33146 }) as u8;
33147 }
33148 WitNode::PrimString(e) => {
33149 *base.add(0).cast::<u8>() = (20i32) as u8;
33150 let vec7 = e;
33151 let ptr7 = vec7.as_ptr().cast::<u8>();
33152 let len7 = vec7.len();
33153 *base.add(12).cast::<usize>() = len7;
33154 *base.add(8).cast::<*mut u8>() = ptr7.cast_mut();
33155 }
33156 WitNode::Handle(e) => {
33157 *base.add(0).cast::<u8>() = (21i32) as u8;
33158 let (t8_0, t8_1) = e;
33159 let Uri { value: value9 } = t8_0;
33160 let vec10 = value9;
33161 let ptr10 = vec10.as_ptr().cast::<u8>();
33162 let len10 = vec10.len();
33163 *base.add(12).cast::<usize>() = len10;
33164 *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
33165 *base.add(16).cast::<i64>() = _rt::as_i64(t8_1);
33166 }
33167 }
33168 }
33169 }
33170 *base.add(4).cast::<usize>() = len11;
33171 *base.add(0).cast::<*mut u8>() = result11;
33172 cleanup_list.extend_from_slice(&[(result11, layout11)]);
33173 }
33174 }
33175 let ptr13 = ret_area.0.as_mut_ptr().cast::<u8>();
33176 #[cfg(target_arch = "wasm32")]
33177 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
33178 extern "C" {
33179 #[link_name = "[method]wasm-rpc.invoke"]
33180 fn wit_import(
33181 _: i32,
33182 _: *mut u8,
33183 _: usize,
33184 _: *mut u8,
33185 _: usize,
33186 _: *mut u8,
33187 );
33188 }
33189 #[cfg(not(target_arch = "wasm32"))]
33190 fn wit_import(
33191 _: i32,
33192 _: *mut u8,
33193 _: usize,
33194 _: *mut u8,
33195 _: usize,
33196 _: *mut u8,
33197 ) {
33198 unreachable!()
33199 }
33200 wit_import(
33201 (self).handle() as i32,
33202 ptr0.cast_mut(),
33203 len0,
33204 result12,
33205 len12,
33206 ptr13,
33207 );
33208 let l14 = i32::from(*ptr13.add(0).cast::<u8>());
33209 if layout12.size() != 0 {
33210 _rt::alloc::dealloc(result12.cast(), layout12);
33211 }
33212 for (ptr, layout) in cleanup_list {
33213 if layout.size() != 0 {
33214 _rt::alloc::dealloc(ptr.cast(), layout);
33215 }
33216 }
33217 match l14 {
33218 0 => {
33219 let e = ();
33220 Ok(e)
33221 }
33222 1 => {
33223 let e = {
33224 let l15 = i32::from(*ptr13.add(4).cast::<u8>());
33225 let v28 = match l15 {
33226 0 => {
33227 let e28 = {
33228 let l16 = *ptr13.add(8).cast::<*mut u8>();
33229 let l17 = *ptr13.add(12).cast::<usize>();
33230 let len18 = l17;
33231 let bytes18 = _rt::Vec::from_raw_parts(
33232 l16.cast(),
33233 len18,
33234 len18,
33235 );
33236 _rt::string_lift(bytes18)
33237 };
33238 RpcError::ProtocolError(e28)
33239 }
33240 1 => {
33241 let e28 = {
33242 let l19 = *ptr13.add(8).cast::<*mut u8>();
33243 let l20 = *ptr13.add(12).cast::<usize>();
33244 let len21 = l20;
33245 let bytes21 = _rt::Vec::from_raw_parts(
33246 l19.cast(),
33247 len21,
33248 len21,
33249 );
33250 _rt::string_lift(bytes21)
33251 };
33252 RpcError::Denied(e28)
33253 }
33254 2 => {
33255 let e28 = {
33256 let l22 = *ptr13.add(8).cast::<*mut u8>();
33257 let l23 = *ptr13.add(12).cast::<usize>();
33258 let len24 = l23;
33259 let bytes24 = _rt::Vec::from_raw_parts(
33260 l22.cast(),
33261 len24,
33262 len24,
33263 );
33264 _rt::string_lift(bytes24)
33265 };
33266 RpcError::NotFound(e28)
33267 }
33268 n => {
33269 debug_assert_eq!(n, 3, "invalid enum discriminant");
33270 let e28 = {
33271 let l25 = *ptr13.add(8).cast::<*mut u8>();
33272 let l26 = *ptr13.add(12).cast::<usize>();
33273 let len27 = l26;
33274 let bytes27 = _rt::Vec::from_raw_parts(
33275 l25.cast(),
33276 len27,
33277 len27,
33278 );
33279 _rt::string_lift(bytes27)
33280 };
33281 RpcError::RemoteInternalError(e28)
33282 }
33283 };
33284 v28
33285 };
33286 Err(e)
33287 }
33288 _ => _rt::invalid_enum_discriminant(),
33289 }
33290 }
33291 }
33292 }
33293 impl WasmRpc {
33294 #[allow(unused_unsafe, clippy::all)]
33295 pub fn async_invoke_and_await(
33296 &self,
33297 function_name: &str,
33298 function_params: &[WitValue],
33299 ) -> FutureInvokeResult {
33300 unsafe {
33301 let mut cleanup_list = _rt::Vec::new();
33302 let vec0 = function_name;
33303 let ptr0 = vec0.as_ptr().cast::<u8>();
33304 let len0 = vec0.len();
33305 let vec12 = function_params;
33306 let len12 = vec12.len();
33307 let layout12 = _rt::alloc::Layout::from_size_align_unchecked(
33308 vec12.len() * 8,
33309 4,
33310 );
33311 let result12 = if layout12.size() != 0 {
33312 let ptr = _rt::alloc::alloc(layout12).cast::<u8>();
33313 if ptr.is_null() {
33314 _rt::alloc::handle_alloc_error(layout12);
33315 }
33316 ptr
33317 } else {
33318 ::core::ptr::null_mut()
33319 };
33320 for (i, e) in vec12.into_iter().enumerate() {
33321 let base = result12.add(i * 8);
33322 {
33323 let WitValue { nodes: nodes1 } = e;
33324 let vec11 = nodes1;
33325 let len11 = vec11.len();
33326 let layout11 = _rt::alloc::Layout::from_size_align_unchecked(
33327 vec11.len() * 24,
33328 8,
33329 );
33330 let result11 = if layout11.size() != 0 {
33331 let ptr = _rt::alloc::alloc(layout11).cast::<u8>();
33332 if ptr.is_null() {
33333 _rt::alloc::handle_alloc_error(layout11);
33334 }
33335 ptr
33336 } else {
33337 ::core::ptr::null_mut()
33338 };
33339 for (i, e) in vec11.into_iter().enumerate() {
33340 let base = result11.add(i * 24);
33341 {
33342 match e {
33343 WitNode::RecordValue(e) => {
33344 *base.add(0).cast::<u8>() = (0i32) as u8;
33345 let vec2 = e;
33346 let ptr2 = vec2.as_ptr().cast::<u8>();
33347 let len2 = vec2.len();
33348 *base.add(12).cast::<usize>() = len2;
33349 *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
33350 }
33351 WitNode::VariantValue(e) => {
33352 *base.add(0).cast::<u8>() = (1i32) as u8;
33353 let (t3_0, t3_1) = e;
33354 *base.add(8).cast::<i32>() = _rt::as_i32(t3_0);
33355 match t3_1 {
33356 Some(e) => {
33357 *base.add(12).cast::<u8>() = (1i32) as u8;
33358 *base.add(16).cast::<i32>() = _rt::as_i32(e);
33359 }
33360 None => {
33361 *base.add(12).cast::<u8>() = (0i32) as u8;
33362 }
33363 };
33364 }
33365 WitNode::EnumValue(e) => {
33366 *base.add(0).cast::<u8>() = (2i32) as u8;
33367 *base.add(8).cast::<i32>() = _rt::as_i32(e);
33368 }
33369 WitNode::FlagsValue(e) => {
33370 *base.add(0).cast::<u8>() = (3i32) as u8;
33371 let vec4 = e;
33372 let len4 = vec4.len();
33373 let layout4 = _rt::alloc::Layout::from_size_align_unchecked(
33374 vec4.len() * 1,
33375 1,
33376 );
33377 let result4 = if layout4.size() != 0 {
33378 let ptr = _rt::alloc::alloc(layout4).cast::<u8>();
33379 if ptr.is_null() {
33380 _rt::alloc::handle_alloc_error(layout4);
33381 }
33382 ptr
33383 } else {
33384 ::core::ptr::null_mut()
33385 };
33386 for (i, e) in vec4.into_iter().enumerate() {
33387 let base = result4.add(i * 1);
33388 {
33389 *base.add(0).cast::<u8>() = (match e {
33390 true => 1,
33391 false => 0,
33392 }) as u8;
33393 }
33394 }
33395 *base.add(12).cast::<usize>() = len4;
33396 *base.add(8).cast::<*mut u8>() = result4;
33397 cleanup_list.extend_from_slice(&[(result4, layout4)]);
33398 }
33399 WitNode::TupleValue(e) => {
33400 *base.add(0).cast::<u8>() = (4i32) as u8;
33401 let vec5 = e;
33402 let ptr5 = vec5.as_ptr().cast::<u8>();
33403 let len5 = vec5.len();
33404 *base.add(12).cast::<usize>() = len5;
33405 *base.add(8).cast::<*mut u8>() = ptr5.cast_mut();
33406 }
33407 WitNode::ListValue(e) => {
33408 *base.add(0).cast::<u8>() = (5i32) as u8;
33409 let vec6 = e;
33410 let ptr6 = vec6.as_ptr().cast::<u8>();
33411 let len6 = vec6.len();
33412 *base.add(12).cast::<usize>() = len6;
33413 *base.add(8).cast::<*mut u8>() = ptr6.cast_mut();
33414 }
33415 WitNode::OptionValue(e) => {
33416 *base.add(0).cast::<u8>() = (6i32) as u8;
33417 match e {
33418 Some(e) => {
33419 *base.add(8).cast::<u8>() = (1i32) as u8;
33420 *base.add(12).cast::<i32>() = _rt::as_i32(e);
33421 }
33422 None => {
33423 *base.add(8).cast::<u8>() = (0i32) as u8;
33424 }
33425 };
33426 }
33427 WitNode::ResultValue(e) => {
33428 *base.add(0).cast::<u8>() = (7i32) as u8;
33429 match e {
33430 Ok(e) => {
33431 *base.add(8).cast::<u8>() = (0i32) as u8;
33432 match e {
33433 Some(e) => {
33434 *base.add(12).cast::<u8>() = (1i32) as u8;
33435 *base.add(16).cast::<i32>() = _rt::as_i32(e);
33436 }
33437 None => {
33438 *base.add(12).cast::<u8>() = (0i32) as u8;
33439 }
33440 };
33441 }
33442 Err(e) => {
33443 *base.add(8).cast::<u8>() = (1i32) as u8;
33444 match e {
33445 Some(e) => {
33446 *base.add(12).cast::<u8>() = (1i32) as u8;
33447 *base.add(16).cast::<i32>() = _rt::as_i32(e);
33448 }
33449 None => {
33450 *base.add(12).cast::<u8>() = (0i32) as u8;
33451 }
33452 };
33453 }
33454 };
33455 }
33456 WitNode::PrimU8(e) => {
33457 *base.add(0).cast::<u8>() = (8i32) as u8;
33458 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
33459 }
33460 WitNode::PrimU16(e) => {
33461 *base.add(0).cast::<u8>() = (9i32) as u8;
33462 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
33463 }
33464 WitNode::PrimU32(e) => {
33465 *base.add(0).cast::<u8>() = (10i32) as u8;
33466 *base.add(8).cast::<i32>() = _rt::as_i32(e);
33467 }
33468 WitNode::PrimU64(e) => {
33469 *base.add(0).cast::<u8>() = (11i32) as u8;
33470 *base.add(8).cast::<i64>() = _rt::as_i64(e);
33471 }
33472 WitNode::PrimS8(e) => {
33473 *base.add(0).cast::<u8>() = (12i32) as u8;
33474 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
33475 }
33476 WitNode::PrimS16(e) => {
33477 *base.add(0).cast::<u8>() = (13i32) as u8;
33478 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
33479 }
33480 WitNode::PrimS32(e) => {
33481 *base.add(0).cast::<u8>() = (14i32) as u8;
33482 *base.add(8).cast::<i32>() = _rt::as_i32(e);
33483 }
33484 WitNode::PrimS64(e) => {
33485 *base.add(0).cast::<u8>() = (15i32) as u8;
33486 *base.add(8).cast::<i64>() = _rt::as_i64(e);
33487 }
33488 WitNode::PrimFloat32(e) => {
33489 *base.add(0).cast::<u8>() = (16i32) as u8;
33490 *base.add(8).cast::<f32>() = _rt::as_f32(e);
33491 }
33492 WitNode::PrimFloat64(e) => {
33493 *base.add(0).cast::<u8>() = (17i32) as u8;
33494 *base.add(8).cast::<f64>() = _rt::as_f64(e);
33495 }
33496 WitNode::PrimChar(e) => {
33497 *base.add(0).cast::<u8>() = (18i32) as u8;
33498 *base.add(8).cast::<i32>() = _rt::as_i32(e);
33499 }
33500 WitNode::PrimBool(e) => {
33501 *base.add(0).cast::<u8>() = (19i32) as u8;
33502 *base.add(8).cast::<u8>() = (match e {
33503 true => 1,
33504 false => 0,
33505 }) as u8;
33506 }
33507 WitNode::PrimString(e) => {
33508 *base.add(0).cast::<u8>() = (20i32) as u8;
33509 let vec7 = e;
33510 let ptr7 = vec7.as_ptr().cast::<u8>();
33511 let len7 = vec7.len();
33512 *base.add(12).cast::<usize>() = len7;
33513 *base.add(8).cast::<*mut u8>() = ptr7.cast_mut();
33514 }
33515 WitNode::Handle(e) => {
33516 *base.add(0).cast::<u8>() = (21i32) as u8;
33517 let (t8_0, t8_1) = e;
33518 let Uri { value: value9 } = t8_0;
33519 let vec10 = value9;
33520 let ptr10 = vec10.as_ptr().cast::<u8>();
33521 let len10 = vec10.len();
33522 *base.add(12).cast::<usize>() = len10;
33523 *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
33524 *base.add(16).cast::<i64>() = _rt::as_i64(t8_1);
33525 }
33526 }
33527 }
33528 }
33529 *base.add(4).cast::<usize>() = len11;
33530 *base.add(0).cast::<*mut u8>() = result11;
33531 cleanup_list.extend_from_slice(&[(result11, layout11)]);
33532 }
33533 }
33534 #[cfg(target_arch = "wasm32")]
33535 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
33536 extern "C" {
33537 #[link_name = "[method]wasm-rpc.async-invoke-and-await"]
33538 fn wit_import(
33539 _: i32,
33540 _: *mut u8,
33541 _: usize,
33542 _: *mut u8,
33543 _: usize,
33544 ) -> i32;
33545 }
33546 #[cfg(not(target_arch = "wasm32"))]
33547 fn wit_import(
33548 _: i32,
33549 _: *mut u8,
33550 _: usize,
33551 _: *mut u8,
33552 _: usize,
33553 ) -> i32 {
33554 unreachable!()
33555 }
33556 let ret = wit_import(
33557 (self).handle() as i32,
33558 ptr0.cast_mut(),
33559 len0,
33560 result12,
33561 len12,
33562 );
33563 if layout12.size() != 0 {
33564 _rt::alloc::dealloc(result12.cast(), layout12);
33565 }
33566 for (ptr, layout) in cleanup_list {
33567 if layout.size() != 0 {
33568 _rt::alloc::dealloc(ptr.cast(), layout);
33569 }
33570 }
33571 FutureInvokeResult::from_handle(ret as u32)
33572 }
33573 }
33574 }
33575 impl WasmRpc {
33576 #[allow(unused_unsafe, clippy::all)]
33577 /// Schedule invocation for later
33578 pub fn schedule_invocation(
33579 &self,
33580 scheduled_time: Datetime,
33581 function_name: &str,
33582 function_params: &[WitValue],
33583 ) {
33584 unsafe {
33585 let mut cleanup_list = _rt::Vec::new();
33586 let super::super::super::wasi::clocks::wall_clock::Datetime {
33587 seconds: seconds0,
33588 nanoseconds: nanoseconds0,
33589 } = scheduled_time;
33590 let vec1 = function_name;
33591 let ptr1 = vec1.as_ptr().cast::<u8>();
33592 let len1 = vec1.len();
33593 let vec13 = function_params;
33594 let len13 = vec13.len();
33595 let layout13 = _rt::alloc::Layout::from_size_align_unchecked(
33596 vec13.len() * 8,
33597 4,
33598 );
33599 let result13 = if layout13.size() != 0 {
33600 let ptr = _rt::alloc::alloc(layout13).cast::<u8>();
33601 if ptr.is_null() {
33602 _rt::alloc::handle_alloc_error(layout13);
33603 }
33604 ptr
33605 } else {
33606 ::core::ptr::null_mut()
33607 };
33608 for (i, e) in vec13.into_iter().enumerate() {
33609 let base = result13.add(i * 8);
33610 {
33611 let WitValue { nodes: nodes2 } = e;
33612 let vec12 = nodes2;
33613 let len12 = vec12.len();
33614 let layout12 = _rt::alloc::Layout::from_size_align_unchecked(
33615 vec12.len() * 24,
33616 8,
33617 );
33618 let result12 = if layout12.size() != 0 {
33619 let ptr = _rt::alloc::alloc(layout12).cast::<u8>();
33620 if ptr.is_null() {
33621 _rt::alloc::handle_alloc_error(layout12);
33622 }
33623 ptr
33624 } else {
33625 ::core::ptr::null_mut()
33626 };
33627 for (i, e) in vec12.into_iter().enumerate() {
33628 let base = result12.add(i * 24);
33629 {
33630 match e {
33631 WitNode::RecordValue(e) => {
33632 *base.add(0).cast::<u8>() = (0i32) as u8;
33633 let vec3 = e;
33634 let ptr3 = vec3.as_ptr().cast::<u8>();
33635 let len3 = vec3.len();
33636 *base.add(12).cast::<usize>() = len3;
33637 *base.add(8).cast::<*mut u8>() = ptr3.cast_mut();
33638 }
33639 WitNode::VariantValue(e) => {
33640 *base.add(0).cast::<u8>() = (1i32) as u8;
33641 let (t4_0, t4_1) = e;
33642 *base.add(8).cast::<i32>() = _rt::as_i32(t4_0);
33643 match t4_1 {
33644 Some(e) => {
33645 *base.add(12).cast::<u8>() = (1i32) as u8;
33646 *base.add(16).cast::<i32>() = _rt::as_i32(e);
33647 }
33648 None => {
33649 *base.add(12).cast::<u8>() = (0i32) as u8;
33650 }
33651 };
33652 }
33653 WitNode::EnumValue(e) => {
33654 *base.add(0).cast::<u8>() = (2i32) as u8;
33655 *base.add(8).cast::<i32>() = _rt::as_i32(e);
33656 }
33657 WitNode::FlagsValue(e) => {
33658 *base.add(0).cast::<u8>() = (3i32) as u8;
33659 let vec5 = e;
33660 let len5 = vec5.len();
33661 let layout5 = _rt::alloc::Layout::from_size_align_unchecked(
33662 vec5.len() * 1,
33663 1,
33664 );
33665 let result5 = if layout5.size() != 0 {
33666 let ptr = _rt::alloc::alloc(layout5).cast::<u8>();
33667 if ptr.is_null() {
33668 _rt::alloc::handle_alloc_error(layout5);
33669 }
33670 ptr
33671 } else {
33672 ::core::ptr::null_mut()
33673 };
33674 for (i, e) in vec5.into_iter().enumerate() {
33675 let base = result5.add(i * 1);
33676 {
33677 *base.add(0).cast::<u8>() = (match e {
33678 true => 1,
33679 false => 0,
33680 }) as u8;
33681 }
33682 }
33683 *base.add(12).cast::<usize>() = len5;
33684 *base.add(8).cast::<*mut u8>() = result5;
33685 cleanup_list.extend_from_slice(&[(result5, layout5)]);
33686 }
33687 WitNode::TupleValue(e) => {
33688 *base.add(0).cast::<u8>() = (4i32) as u8;
33689 let vec6 = e;
33690 let ptr6 = vec6.as_ptr().cast::<u8>();
33691 let len6 = vec6.len();
33692 *base.add(12).cast::<usize>() = len6;
33693 *base.add(8).cast::<*mut u8>() = ptr6.cast_mut();
33694 }
33695 WitNode::ListValue(e) => {
33696 *base.add(0).cast::<u8>() = (5i32) as u8;
33697 let vec7 = e;
33698 let ptr7 = vec7.as_ptr().cast::<u8>();
33699 let len7 = vec7.len();
33700 *base.add(12).cast::<usize>() = len7;
33701 *base.add(8).cast::<*mut u8>() = ptr7.cast_mut();
33702 }
33703 WitNode::OptionValue(e) => {
33704 *base.add(0).cast::<u8>() = (6i32) as u8;
33705 match e {
33706 Some(e) => {
33707 *base.add(8).cast::<u8>() = (1i32) as u8;
33708 *base.add(12).cast::<i32>() = _rt::as_i32(e);
33709 }
33710 None => {
33711 *base.add(8).cast::<u8>() = (0i32) as u8;
33712 }
33713 };
33714 }
33715 WitNode::ResultValue(e) => {
33716 *base.add(0).cast::<u8>() = (7i32) as u8;
33717 match e {
33718 Ok(e) => {
33719 *base.add(8).cast::<u8>() = (0i32) as u8;
33720 match e {
33721 Some(e) => {
33722 *base.add(12).cast::<u8>() = (1i32) as u8;
33723 *base.add(16).cast::<i32>() = _rt::as_i32(e);
33724 }
33725 None => {
33726 *base.add(12).cast::<u8>() = (0i32) as u8;
33727 }
33728 };
33729 }
33730 Err(e) => {
33731 *base.add(8).cast::<u8>() = (1i32) as u8;
33732 match e {
33733 Some(e) => {
33734 *base.add(12).cast::<u8>() = (1i32) as u8;
33735 *base.add(16).cast::<i32>() = _rt::as_i32(e);
33736 }
33737 None => {
33738 *base.add(12).cast::<u8>() = (0i32) as u8;
33739 }
33740 };
33741 }
33742 };
33743 }
33744 WitNode::PrimU8(e) => {
33745 *base.add(0).cast::<u8>() = (8i32) as u8;
33746 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
33747 }
33748 WitNode::PrimU16(e) => {
33749 *base.add(0).cast::<u8>() = (9i32) as u8;
33750 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
33751 }
33752 WitNode::PrimU32(e) => {
33753 *base.add(0).cast::<u8>() = (10i32) as u8;
33754 *base.add(8).cast::<i32>() = _rt::as_i32(e);
33755 }
33756 WitNode::PrimU64(e) => {
33757 *base.add(0).cast::<u8>() = (11i32) as u8;
33758 *base.add(8).cast::<i64>() = _rt::as_i64(e);
33759 }
33760 WitNode::PrimS8(e) => {
33761 *base.add(0).cast::<u8>() = (12i32) as u8;
33762 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
33763 }
33764 WitNode::PrimS16(e) => {
33765 *base.add(0).cast::<u8>() = (13i32) as u8;
33766 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
33767 }
33768 WitNode::PrimS32(e) => {
33769 *base.add(0).cast::<u8>() = (14i32) as u8;
33770 *base.add(8).cast::<i32>() = _rt::as_i32(e);
33771 }
33772 WitNode::PrimS64(e) => {
33773 *base.add(0).cast::<u8>() = (15i32) as u8;
33774 *base.add(8).cast::<i64>() = _rt::as_i64(e);
33775 }
33776 WitNode::PrimFloat32(e) => {
33777 *base.add(0).cast::<u8>() = (16i32) as u8;
33778 *base.add(8).cast::<f32>() = _rt::as_f32(e);
33779 }
33780 WitNode::PrimFloat64(e) => {
33781 *base.add(0).cast::<u8>() = (17i32) as u8;
33782 *base.add(8).cast::<f64>() = _rt::as_f64(e);
33783 }
33784 WitNode::PrimChar(e) => {
33785 *base.add(0).cast::<u8>() = (18i32) as u8;
33786 *base.add(8).cast::<i32>() = _rt::as_i32(e);
33787 }
33788 WitNode::PrimBool(e) => {
33789 *base.add(0).cast::<u8>() = (19i32) as u8;
33790 *base.add(8).cast::<u8>() = (match e {
33791 true => 1,
33792 false => 0,
33793 }) as u8;
33794 }
33795 WitNode::PrimString(e) => {
33796 *base.add(0).cast::<u8>() = (20i32) as u8;
33797 let vec8 = e;
33798 let ptr8 = vec8.as_ptr().cast::<u8>();
33799 let len8 = vec8.len();
33800 *base.add(12).cast::<usize>() = len8;
33801 *base.add(8).cast::<*mut u8>() = ptr8.cast_mut();
33802 }
33803 WitNode::Handle(e) => {
33804 *base.add(0).cast::<u8>() = (21i32) as u8;
33805 let (t9_0, t9_1) = e;
33806 let Uri { value: value10 } = t9_0;
33807 let vec11 = value10;
33808 let ptr11 = vec11.as_ptr().cast::<u8>();
33809 let len11 = vec11.len();
33810 *base.add(12).cast::<usize>() = len11;
33811 *base.add(8).cast::<*mut u8>() = ptr11.cast_mut();
33812 *base.add(16).cast::<i64>() = _rt::as_i64(t9_1);
33813 }
33814 }
33815 }
33816 }
33817 *base.add(4).cast::<usize>() = len12;
33818 *base.add(0).cast::<*mut u8>() = result12;
33819 cleanup_list.extend_from_slice(&[(result12, layout12)]);
33820 }
33821 }
33822 #[cfg(target_arch = "wasm32")]
33823 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
33824 extern "C" {
33825 #[link_name = "[method]wasm-rpc.schedule-invocation"]
33826 fn wit_import(
33827 _: i32,
33828 _: i64,
33829 _: i32,
33830 _: *mut u8,
33831 _: usize,
33832 _: *mut u8,
33833 _: usize,
33834 );
33835 }
33836 #[cfg(not(target_arch = "wasm32"))]
33837 fn wit_import(
33838 _: i32,
33839 _: i64,
33840 _: i32,
33841 _: *mut u8,
33842 _: usize,
33843 _: *mut u8,
33844 _: usize,
33845 ) {
33846 unreachable!()
33847 }
33848 wit_import(
33849 (self).handle() as i32,
33850 _rt::as_i64(seconds0),
33851 _rt::as_i32(nanoseconds0),
33852 ptr1.cast_mut(),
33853 len1,
33854 result13,
33855 len13,
33856 );
33857 if layout13.size() != 0 {
33858 _rt::alloc::dealloc(result13.cast(), layout13);
33859 }
33860 for (ptr, layout) in cleanup_list {
33861 if layout.size() != 0 {
33862 _rt::alloc::dealloc(ptr.cast(), layout);
33863 }
33864 }
33865 }
33866 }
33867 }
33868 impl WasmRpc {
33869 #[allow(unused_unsafe, clippy::all)]
33870 /// Schedule invocation for later. Call cancel on the returned resource to cancel the invocation before the scheduled time.
33871 pub fn schedule_cancelable_invocation(
33872 &self,
33873 scheduled_time: Datetime,
33874 function_name: &str,
33875 function_params: &[WitValue],
33876 ) -> CancellationToken {
33877 unsafe {
33878 let mut cleanup_list = _rt::Vec::new();
33879 let super::super::super::wasi::clocks::wall_clock::Datetime {
33880 seconds: seconds0,
33881 nanoseconds: nanoseconds0,
33882 } = scheduled_time;
33883 let vec1 = function_name;
33884 let ptr1 = vec1.as_ptr().cast::<u8>();
33885 let len1 = vec1.len();
33886 let vec13 = function_params;
33887 let len13 = vec13.len();
33888 let layout13 = _rt::alloc::Layout::from_size_align_unchecked(
33889 vec13.len() * 8,
33890 4,
33891 );
33892 let result13 = if layout13.size() != 0 {
33893 let ptr = _rt::alloc::alloc(layout13).cast::<u8>();
33894 if ptr.is_null() {
33895 _rt::alloc::handle_alloc_error(layout13);
33896 }
33897 ptr
33898 } else {
33899 ::core::ptr::null_mut()
33900 };
33901 for (i, e) in vec13.into_iter().enumerate() {
33902 let base = result13.add(i * 8);
33903 {
33904 let WitValue { nodes: nodes2 } = e;
33905 let vec12 = nodes2;
33906 let len12 = vec12.len();
33907 let layout12 = _rt::alloc::Layout::from_size_align_unchecked(
33908 vec12.len() * 24,
33909 8,
33910 );
33911 let result12 = if layout12.size() != 0 {
33912 let ptr = _rt::alloc::alloc(layout12).cast::<u8>();
33913 if ptr.is_null() {
33914 _rt::alloc::handle_alloc_error(layout12);
33915 }
33916 ptr
33917 } else {
33918 ::core::ptr::null_mut()
33919 };
33920 for (i, e) in vec12.into_iter().enumerate() {
33921 let base = result12.add(i * 24);
33922 {
33923 match e {
33924 WitNode::RecordValue(e) => {
33925 *base.add(0).cast::<u8>() = (0i32) as u8;
33926 let vec3 = e;
33927 let ptr3 = vec3.as_ptr().cast::<u8>();
33928 let len3 = vec3.len();
33929 *base.add(12).cast::<usize>() = len3;
33930 *base.add(8).cast::<*mut u8>() = ptr3.cast_mut();
33931 }
33932 WitNode::VariantValue(e) => {
33933 *base.add(0).cast::<u8>() = (1i32) as u8;
33934 let (t4_0, t4_1) = e;
33935 *base.add(8).cast::<i32>() = _rt::as_i32(t4_0);
33936 match t4_1 {
33937 Some(e) => {
33938 *base.add(12).cast::<u8>() = (1i32) as u8;
33939 *base.add(16).cast::<i32>() = _rt::as_i32(e);
33940 }
33941 None => {
33942 *base.add(12).cast::<u8>() = (0i32) as u8;
33943 }
33944 };
33945 }
33946 WitNode::EnumValue(e) => {
33947 *base.add(0).cast::<u8>() = (2i32) as u8;
33948 *base.add(8).cast::<i32>() = _rt::as_i32(e);
33949 }
33950 WitNode::FlagsValue(e) => {
33951 *base.add(0).cast::<u8>() = (3i32) as u8;
33952 let vec5 = e;
33953 let len5 = vec5.len();
33954 let layout5 = _rt::alloc::Layout::from_size_align_unchecked(
33955 vec5.len() * 1,
33956 1,
33957 );
33958 let result5 = if layout5.size() != 0 {
33959 let ptr = _rt::alloc::alloc(layout5).cast::<u8>();
33960 if ptr.is_null() {
33961 _rt::alloc::handle_alloc_error(layout5);
33962 }
33963 ptr
33964 } else {
33965 ::core::ptr::null_mut()
33966 };
33967 for (i, e) in vec5.into_iter().enumerate() {
33968 let base = result5.add(i * 1);
33969 {
33970 *base.add(0).cast::<u8>() = (match e {
33971 true => 1,
33972 false => 0,
33973 }) as u8;
33974 }
33975 }
33976 *base.add(12).cast::<usize>() = len5;
33977 *base.add(8).cast::<*mut u8>() = result5;
33978 cleanup_list.extend_from_slice(&[(result5, layout5)]);
33979 }
33980 WitNode::TupleValue(e) => {
33981 *base.add(0).cast::<u8>() = (4i32) as u8;
33982 let vec6 = e;
33983 let ptr6 = vec6.as_ptr().cast::<u8>();
33984 let len6 = vec6.len();
33985 *base.add(12).cast::<usize>() = len6;
33986 *base.add(8).cast::<*mut u8>() = ptr6.cast_mut();
33987 }
33988 WitNode::ListValue(e) => {
33989 *base.add(0).cast::<u8>() = (5i32) as u8;
33990 let vec7 = e;
33991 let ptr7 = vec7.as_ptr().cast::<u8>();
33992 let len7 = vec7.len();
33993 *base.add(12).cast::<usize>() = len7;
33994 *base.add(8).cast::<*mut u8>() = ptr7.cast_mut();
33995 }
33996 WitNode::OptionValue(e) => {
33997 *base.add(0).cast::<u8>() = (6i32) as u8;
33998 match e {
33999 Some(e) => {
34000 *base.add(8).cast::<u8>() = (1i32) as u8;
34001 *base.add(12).cast::<i32>() = _rt::as_i32(e);
34002 }
34003 None => {
34004 *base.add(8).cast::<u8>() = (0i32) as u8;
34005 }
34006 };
34007 }
34008 WitNode::ResultValue(e) => {
34009 *base.add(0).cast::<u8>() = (7i32) as u8;
34010 match e {
34011 Ok(e) => {
34012 *base.add(8).cast::<u8>() = (0i32) as u8;
34013 match e {
34014 Some(e) => {
34015 *base.add(12).cast::<u8>() = (1i32) as u8;
34016 *base.add(16).cast::<i32>() = _rt::as_i32(e);
34017 }
34018 None => {
34019 *base.add(12).cast::<u8>() = (0i32) as u8;
34020 }
34021 };
34022 }
34023 Err(e) => {
34024 *base.add(8).cast::<u8>() = (1i32) as u8;
34025 match e {
34026 Some(e) => {
34027 *base.add(12).cast::<u8>() = (1i32) as u8;
34028 *base.add(16).cast::<i32>() = _rt::as_i32(e);
34029 }
34030 None => {
34031 *base.add(12).cast::<u8>() = (0i32) as u8;
34032 }
34033 };
34034 }
34035 };
34036 }
34037 WitNode::PrimU8(e) => {
34038 *base.add(0).cast::<u8>() = (8i32) as u8;
34039 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
34040 }
34041 WitNode::PrimU16(e) => {
34042 *base.add(0).cast::<u8>() = (9i32) as u8;
34043 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
34044 }
34045 WitNode::PrimU32(e) => {
34046 *base.add(0).cast::<u8>() = (10i32) as u8;
34047 *base.add(8).cast::<i32>() = _rt::as_i32(e);
34048 }
34049 WitNode::PrimU64(e) => {
34050 *base.add(0).cast::<u8>() = (11i32) as u8;
34051 *base.add(8).cast::<i64>() = _rt::as_i64(e);
34052 }
34053 WitNode::PrimS8(e) => {
34054 *base.add(0).cast::<u8>() = (12i32) as u8;
34055 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
34056 }
34057 WitNode::PrimS16(e) => {
34058 *base.add(0).cast::<u8>() = (13i32) as u8;
34059 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
34060 }
34061 WitNode::PrimS32(e) => {
34062 *base.add(0).cast::<u8>() = (14i32) as u8;
34063 *base.add(8).cast::<i32>() = _rt::as_i32(e);
34064 }
34065 WitNode::PrimS64(e) => {
34066 *base.add(0).cast::<u8>() = (15i32) as u8;
34067 *base.add(8).cast::<i64>() = _rt::as_i64(e);
34068 }
34069 WitNode::PrimFloat32(e) => {
34070 *base.add(0).cast::<u8>() = (16i32) as u8;
34071 *base.add(8).cast::<f32>() = _rt::as_f32(e);
34072 }
34073 WitNode::PrimFloat64(e) => {
34074 *base.add(0).cast::<u8>() = (17i32) as u8;
34075 *base.add(8).cast::<f64>() = _rt::as_f64(e);
34076 }
34077 WitNode::PrimChar(e) => {
34078 *base.add(0).cast::<u8>() = (18i32) as u8;
34079 *base.add(8).cast::<i32>() = _rt::as_i32(e);
34080 }
34081 WitNode::PrimBool(e) => {
34082 *base.add(0).cast::<u8>() = (19i32) as u8;
34083 *base.add(8).cast::<u8>() = (match e {
34084 true => 1,
34085 false => 0,
34086 }) as u8;
34087 }
34088 WitNode::PrimString(e) => {
34089 *base.add(0).cast::<u8>() = (20i32) as u8;
34090 let vec8 = e;
34091 let ptr8 = vec8.as_ptr().cast::<u8>();
34092 let len8 = vec8.len();
34093 *base.add(12).cast::<usize>() = len8;
34094 *base.add(8).cast::<*mut u8>() = ptr8.cast_mut();
34095 }
34096 WitNode::Handle(e) => {
34097 *base.add(0).cast::<u8>() = (21i32) as u8;
34098 let (t9_0, t9_1) = e;
34099 let Uri { value: value10 } = t9_0;
34100 let vec11 = value10;
34101 let ptr11 = vec11.as_ptr().cast::<u8>();
34102 let len11 = vec11.len();
34103 *base.add(12).cast::<usize>() = len11;
34104 *base.add(8).cast::<*mut u8>() = ptr11.cast_mut();
34105 *base.add(16).cast::<i64>() = _rt::as_i64(t9_1);
34106 }
34107 }
34108 }
34109 }
34110 *base.add(4).cast::<usize>() = len12;
34111 *base.add(0).cast::<*mut u8>() = result12;
34112 cleanup_list.extend_from_slice(&[(result12, layout12)]);
34113 }
34114 }
34115 #[cfg(target_arch = "wasm32")]
34116 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
34117 extern "C" {
34118 #[link_name = "[method]wasm-rpc.schedule-cancelable-invocation"]
34119 fn wit_import(
34120 _: i32,
34121 _: i64,
34122 _: i32,
34123 _: *mut u8,
34124 _: usize,
34125 _: *mut u8,
34126 _: usize,
34127 ) -> i32;
34128 }
34129 #[cfg(not(target_arch = "wasm32"))]
34130 fn wit_import(
34131 _: i32,
34132 _: i64,
34133 _: i32,
34134 _: *mut u8,
34135 _: usize,
34136 _: *mut u8,
34137 _: usize,
34138 ) -> i32 {
34139 unreachable!()
34140 }
34141 let ret = wit_import(
34142 (self).handle() as i32,
34143 _rt::as_i64(seconds0),
34144 _rt::as_i32(nanoseconds0),
34145 ptr1.cast_mut(),
34146 len1,
34147 result13,
34148 len13,
34149 );
34150 if layout13.size() != 0 {
34151 _rt::alloc::dealloc(result13.cast(), layout13);
34152 }
34153 for (ptr, layout) in cleanup_list {
34154 if layout.size() != 0 {
34155 _rt::alloc::dealloc(ptr.cast(), layout);
34156 }
34157 }
34158 CancellationToken::from_handle(ret as u32)
34159 }
34160 }
34161 }
34162 impl FutureInvokeResult {
34163 #[allow(unused_unsafe, clippy::all)]
34164 pub fn subscribe(&self) -> Pollable {
34165 unsafe {
34166 #[cfg(target_arch = "wasm32")]
34167 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
34168 extern "C" {
34169 #[link_name = "[method]future-invoke-result.subscribe"]
34170 fn wit_import(_: i32) -> i32;
34171 }
34172 #[cfg(not(target_arch = "wasm32"))]
34173 fn wit_import(_: i32) -> i32 {
34174 unreachable!()
34175 }
34176 let ret = wit_import((self).handle() as i32);
34177 super::super::super::wasi::io::poll::Pollable::from_handle(
34178 ret as u32,
34179 )
34180 }
34181 }
34182 }
34183 impl FutureInvokeResult {
34184 #[allow(unused_unsafe, clippy::all)]
34185 pub fn get(&self) -> Option<Result<WitValue, RpcError>> {
34186 unsafe {
34187 #[repr(align(4))]
34188 struct RetArea([::core::mem::MaybeUninit<u8>; 20]);
34189 let mut ret_area = RetArea(
34190 [::core::mem::MaybeUninit::uninit(); 20],
34191 );
34192 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
34193 #[cfg(target_arch = "wasm32")]
34194 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
34195 extern "C" {
34196 #[link_name = "[method]future-invoke-result.get"]
34197 fn wit_import(_: i32, _: *mut u8);
34198 }
34199 #[cfg(not(target_arch = "wasm32"))]
34200 fn wit_import(_: i32, _: *mut u8) {
34201 unreachable!()
34202 }
34203 wit_import((self).handle() as i32, ptr0);
34204 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
34205 match l1 {
34206 0 => None,
34207 1 => {
34208 let e = {
34209 let l2 = i32::from(*ptr0.add(4).cast::<u8>());
34210 match l2 {
34211 0 => {
34212 let e = {
34213 let l3 = *ptr0.add(8).cast::<*mut u8>();
34214 let l4 = *ptr0.add(12).cast::<usize>();
34215 let base50 = l3;
34216 let len50 = l4;
34217 let mut result50 = _rt::Vec::with_capacity(len50);
34218 for i in 0..len50 {
34219 let base = base50.add(i * 24);
34220 let e50 = {
34221 let l5 = i32::from(*base.add(0).cast::<u8>());
34222 let v49 = match l5 {
34223 0 => {
34224 let e49 = {
34225 let l6 = *base.add(8).cast::<*mut u8>();
34226 let l7 = *base.add(12).cast::<usize>();
34227 let len8 = l7;
34228 _rt::Vec::from_raw_parts(l6.cast(), len8, len8)
34229 };
34230 WitNode::RecordValue(e49)
34231 }
34232 1 => {
34233 let e49 = {
34234 let l9 = *base.add(8).cast::<i32>();
34235 let l10 = i32::from(*base.add(12).cast::<u8>());
34236 (
34237 l9 as u32,
34238 match l10 {
34239 0 => None,
34240 1 => {
34241 let e = {
34242 let l11 = *base.add(16).cast::<i32>();
34243 l11
34244 };
34245 Some(e)
34246 }
34247 _ => _rt::invalid_enum_discriminant(),
34248 },
34249 )
34250 };
34251 WitNode::VariantValue(e49)
34252 }
34253 2 => {
34254 let e49 = {
34255 let l12 = *base.add(8).cast::<i32>();
34256 l12 as u32
34257 };
34258 WitNode::EnumValue(e49)
34259 }
34260 3 => {
34261 let e49 = {
34262 let l13 = *base.add(8).cast::<*mut u8>();
34263 let l14 = *base.add(12).cast::<usize>();
34264 let base16 = l13;
34265 let len16 = l14;
34266 let mut result16 = _rt::Vec::with_capacity(len16);
34267 for i in 0..len16 {
34268 let base = base16.add(i * 1);
34269 let e16 = {
34270 let l15 = i32::from(*base.add(0).cast::<u8>());
34271 _rt::bool_lift(l15 as u8)
34272 };
34273 result16.push(e16);
34274 }
34275 _rt::cabi_dealloc(base16, len16 * 1, 1);
34276 result16
34277 };
34278 WitNode::FlagsValue(e49)
34279 }
34280 4 => {
34281 let e49 = {
34282 let l17 = *base.add(8).cast::<*mut u8>();
34283 let l18 = *base.add(12).cast::<usize>();
34284 let len19 = l18;
34285 _rt::Vec::from_raw_parts(l17.cast(), len19, len19)
34286 };
34287 WitNode::TupleValue(e49)
34288 }
34289 5 => {
34290 let e49 = {
34291 let l20 = *base.add(8).cast::<*mut u8>();
34292 let l21 = *base.add(12).cast::<usize>();
34293 let len22 = l21;
34294 _rt::Vec::from_raw_parts(l20.cast(), len22, len22)
34295 };
34296 WitNode::ListValue(e49)
34297 }
34298 6 => {
34299 let e49 = {
34300 let l23 = i32::from(*base.add(8).cast::<u8>());
34301 match l23 {
34302 0 => None,
34303 1 => {
34304 let e = {
34305 let l24 = *base.add(12).cast::<i32>();
34306 l24
34307 };
34308 Some(e)
34309 }
34310 _ => _rt::invalid_enum_discriminant(),
34311 }
34312 };
34313 WitNode::OptionValue(e49)
34314 }
34315 7 => {
34316 let e49 = {
34317 let l25 = i32::from(*base.add(8).cast::<u8>());
34318 match l25 {
34319 0 => {
34320 let e = {
34321 let l26 = i32::from(*base.add(12).cast::<u8>());
34322 match l26 {
34323 0 => None,
34324 1 => {
34325 let e = {
34326 let l27 = *base.add(16).cast::<i32>();
34327 l27
34328 };
34329 Some(e)
34330 }
34331 _ => _rt::invalid_enum_discriminant(),
34332 }
34333 };
34334 Ok(e)
34335 }
34336 1 => {
34337 let e = {
34338 let l28 = i32::from(*base.add(12).cast::<u8>());
34339 match l28 {
34340 0 => None,
34341 1 => {
34342 let e = {
34343 let l29 = *base.add(16).cast::<i32>();
34344 l29
34345 };
34346 Some(e)
34347 }
34348 _ => _rt::invalid_enum_discriminant(),
34349 }
34350 };
34351 Err(e)
34352 }
34353 _ => _rt::invalid_enum_discriminant(),
34354 }
34355 };
34356 WitNode::ResultValue(e49)
34357 }
34358 8 => {
34359 let e49 = {
34360 let l30 = i32::from(*base.add(8).cast::<u8>());
34361 l30 as u8
34362 };
34363 WitNode::PrimU8(e49)
34364 }
34365 9 => {
34366 let e49 = {
34367 let l31 = i32::from(*base.add(8).cast::<u16>());
34368 l31 as u16
34369 };
34370 WitNode::PrimU16(e49)
34371 }
34372 10 => {
34373 let e49 = {
34374 let l32 = *base.add(8).cast::<i32>();
34375 l32 as u32
34376 };
34377 WitNode::PrimU32(e49)
34378 }
34379 11 => {
34380 let e49 = {
34381 let l33 = *base.add(8).cast::<i64>();
34382 l33 as u64
34383 };
34384 WitNode::PrimU64(e49)
34385 }
34386 12 => {
34387 let e49 = {
34388 let l34 = i32::from(*base.add(8).cast::<i8>());
34389 l34 as i8
34390 };
34391 WitNode::PrimS8(e49)
34392 }
34393 13 => {
34394 let e49 = {
34395 let l35 = i32::from(*base.add(8).cast::<i16>());
34396 l35 as i16
34397 };
34398 WitNode::PrimS16(e49)
34399 }
34400 14 => {
34401 let e49 = {
34402 let l36 = *base.add(8).cast::<i32>();
34403 l36
34404 };
34405 WitNode::PrimS32(e49)
34406 }
34407 15 => {
34408 let e49 = {
34409 let l37 = *base.add(8).cast::<i64>();
34410 l37
34411 };
34412 WitNode::PrimS64(e49)
34413 }
34414 16 => {
34415 let e49 = {
34416 let l38 = *base.add(8).cast::<f32>();
34417 l38
34418 };
34419 WitNode::PrimFloat32(e49)
34420 }
34421 17 => {
34422 let e49 = {
34423 let l39 = *base.add(8).cast::<f64>();
34424 l39
34425 };
34426 WitNode::PrimFloat64(e49)
34427 }
34428 18 => {
34429 let e49 = {
34430 let l40 = *base.add(8).cast::<i32>();
34431 _rt::char_lift(l40 as u32)
34432 };
34433 WitNode::PrimChar(e49)
34434 }
34435 19 => {
34436 let e49 = {
34437 let l41 = i32::from(*base.add(8).cast::<u8>());
34438 _rt::bool_lift(l41 as u8)
34439 };
34440 WitNode::PrimBool(e49)
34441 }
34442 20 => {
34443 let e49 = {
34444 let l42 = *base.add(8).cast::<*mut u8>();
34445 let l43 = *base.add(12).cast::<usize>();
34446 let len44 = l43;
34447 let bytes44 = _rt::Vec::from_raw_parts(
34448 l42.cast(),
34449 len44,
34450 len44,
34451 );
34452 _rt::string_lift(bytes44)
34453 };
34454 WitNode::PrimString(e49)
34455 }
34456 n => {
34457 debug_assert_eq!(n, 21, "invalid enum discriminant");
34458 let e49 = {
34459 let l45 = *base.add(8).cast::<*mut u8>();
34460 let l46 = *base.add(12).cast::<usize>();
34461 let len47 = l46;
34462 let bytes47 = _rt::Vec::from_raw_parts(
34463 l45.cast(),
34464 len47,
34465 len47,
34466 );
34467 let l48 = *base.add(16).cast::<i64>();
34468 (
34469 Uri {
34470 value: _rt::string_lift(bytes47),
34471 },
34472 l48 as u64,
34473 )
34474 };
34475 WitNode::Handle(e49)
34476 }
34477 };
34478 v49
34479 };
34480 result50.push(e50);
34481 }
34482 _rt::cabi_dealloc(base50, len50 * 24, 8);
34483 WitValue { nodes: result50 }
34484 };
34485 Ok(e)
34486 }
34487 1 => {
34488 let e = {
34489 let l51 = i32::from(*ptr0.add(8).cast::<u8>());
34490 let v64 = match l51 {
34491 0 => {
34492 let e64 = {
34493 let l52 = *ptr0.add(12).cast::<*mut u8>();
34494 let l53 = *ptr0.add(16).cast::<usize>();
34495 let len54 = l53;
34496 let bytes54 = _rt::Vec::from_raw_parts(
34497 l52.cast(),
34498 len54,
34499 len54,
34500 );
34501 _rt::string_lift(bytes54)
34502 };
34503 RpcError::ProtocolError(e64)
34504 }
34505 1 => {
34506 let e64 = {
34507 let l55 = *ptr0.add(12).cast::<*mut u8>();
34508 let l56 = *ptr0.add(16).cast::<usize>();
34509 let len57 = l56;
34510 let bytes57 = _rt::Vec::from_raw_parts(
34511 l55.cast(),
34512 len57,
34513 len57,
34514 );
34515 _rt::string_lift(bytes57)
34516 };
34517 RpcError::Denied(e64)
34518 }
34519 2 => {
34520 let e64 = {
34521 let l58 = *ptr0.add(12).cast::<*mut u8>();
34522 let l59 = *ptr0.add(16).cast::<usize>();
34523 let len60 = l59;
34524 let bytes60 = _rt::Vec::from_raw_parts(
34525 l58.cast(),
34526 len60,
34527 len60,
34528 );
34529 _rt::string_lift(bytes60)
34530 };
34531 RpcError::NotFound(e64)
34532 }
34533 n => {
34534 debug_assert_eq!(n, 3, "invalid enum discriminant");
34535 let e64 = {
34536 let l61 = *ptr0.add(12).cast::<*mut u8>();
34537 let l62 = *ptr0.add(16).cast::<usize>();
34538 let len63 = l62;
34539 let bytes63 = _rt::Vec::from_raw_parts(
34540 l61.cast(),
34541 len63,
34542 len63,
34543 );
34544 _rt::string_lift(bytes63)
34545 };
34546 RpcError::RemoteInternalError(e64)
34547 }
34548 };
34549 v64
34550 };
34551 Err(e)
34552 }
34553 _ => _rt::invalid_enum_discriminant(),
34554 }
34555 };
34556 Some(e)
34557 }
34558 _ => _rt::invalid_enum_discriminant(),
34559 }
34560 }
34561 }
34562 }
34563 impl CancellationToken {
34564 #[allow(unused_unsafe, clippy::all)]
34565 pub fn cancel(&self) {
34566 unsafe {
34567 #[cfg(target_arch = "wasm32")]
34568 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
34569 extern "C" {
34570 #[link_name = "[method]cancellation-token.cancel"]
34571 fn wit_import(_: i32);
34572 }
34573 #[cfg(not(target_arch = "wasm32"))]
34574 fn wit_import(_: i32) {
34575 unreachable!()
34576 }
34577 wit_import((self).handle() as i32);
34578 }
34579 }
34580 }
34581 #[allow(unused_unsafe, clippy::all)]
34582 pub fn extract_value(vnt: &ValueAndType) -> WitValue {
34583 unsafe {
34584 let mut cleanup_list = _rt::Vec::new();
34585 #[repr(align(4))]
34586 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
34587 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
34588 let ValueAndType { value: value0, typ: typ0 } = vnt;
34589 let WitValue { nodes: nodes1 } = value0;
34590 let vec11 = nodes1;
34591 let len11 = vec11.len();
34592 let layout11 = _rt::alloc::Layout::from_size_align_unchecked(
34593 vec11.len() * 24,
34594 8,
34595 );
34596 let result11 = if layout11.size() != 0 {
34597 let ptr = _rt::alloc::alloc(layout11).cast::<u8>();
34598 if ptr.is_null() {
34599 _rt::alloc::handle_alloc_error(layout11);
34600 }
34601 ptr
34602 } else {
34603 ::core::ptr::null_mut()
34604 };
34605 for (i, e) in vec11.into_iter().enumerate() {
34606 let base = result11.add(i * 24);
34607 {
34608 match e {
34609 WitNode::RecordValue(e) => {
34610 *base.add(0).cast::<u8>() = (0i32) as u8;
34611 let vec2 = e;
34612 let ptr2 = vec2.as_ptr().cast::<u8>();
34613 let len2 = vec2.len();
34614 *base.add(12).cast::<usize>() = len2;
34615 *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
34616 }
34617 WitNode::VariantValue(e) => {
34618 *base.add(0).cast::<u8>() = (1i32) as u8;
34619 let (t3_0, t3_1) = e;
34620 *base.add(8).cast::<i32>() = _rt::as_i32(t3_0);
34621 match t3_1 {
34622 Some(e) => {
34623 *base.add(12).cast::<u8>() = (1i32) as u8;
34624 *base.add(16).cast::<i32>() = _rt::as_i32(e);
34625 }
34626 None => {
34627 *base.add(12).cast::<u8>() = (0i32) as u8;
34628 }
34629 };
34630 }
34631 WitNode::EnumValue(e) => {
34632 *base.add(0).cast::<u8>() = (2i32) as u8;
34633 *base.add(8).cast::<i32>() = _rt::as_i32(e);
34634 }
34635 WitNode::FlagsValue(e) => {
34636 *base.add(0).cast::<u8>() = (3i32) as u8;
34637 let vec4 = e;
34638 let len4 = vec4.len();
34639 let layout4 = _rt::alloc::Layout::from_size_align_unchecked(
34640 vec4.len() * 1,
34641 1,
34642 );
34643 let result4 = if layout4.size() != 0 {
34644 let ptr = _rt::alloc::alloc(layout4).cast::<u8>();
34645 if ptr.is_null() {
34646 _rt::alloc::handle_alloc_error(layout4);
34647 }
34648 ptr
34649 } else {
34650 ::core::ptr::null_mut()
34651 };
34652 for (i, e) in vec4.into_iter().enumerate() {
34653 let base = result4.add(i * 1);
34654 {
34655 *base.add(0).cast::<u8>() = (match e {
34656 true => 1,
34657 false => 0,
34658 }) as u8;
34659 }
34660 }
34661 *base.add(12).cast::<usize>() = len4;
34662 *base.add(8).cast::<*mut u8>() = result4;
34663 cleanup_list.extend_from_slice(&[(result4, layout4)]);
34664 }
34665 WitNode::TupleValue(e) => {
34666 *base.add(0).cast::<u8>() = (4i32) as u8;
34667 let vec5 = e;
34668 let ptr5 = vec5.as_ptr().cast::<u8>();
34669 let len5 = vec5.len();
34670 *base.add(12).cast::<usize>() = len5;
34671 *base.add(8).cast::<*mut u8>() = ptr5.cast_mut();
34672 }
34673 WitNode::ListValue(e) => {
34674 *base.add(0).cast::<u8>() = (5i32) as u8;
34675 let vec6 = e;
34676 let ptr6 = vec6.as_ptr().cast::<u8>();
34677 let len6 = vec6.len();
34678 *base.add(12).cast::<usize>() = len6;
34679 *base.add(8).cast::<*mut u8>() = ptr6.cast_mut();
34680 }
34681 WitNode::OptionValue(e) => {
34682 *base.add(0).cast::<u8>() = (6i32) as u8;
34683 match e {
34684 Some(e) => {
34685 *base.add(8).cast::<u8>() = (1i32) as u8;
34686 *base.add(12).cast::<i32>() = _rt::as_i32(e);
34687 }
34688 None => {
34689 *base.add(8).cast::<u8>() = (0i32) as u8;
34690 }
34691 };
34692 }
34693 WitNode::ResultValue(e) => {
34694 *base.add(0).cast::<u8>() = (7i32) as u8;
34695 match e {
34696 Ok(e) => {
34697 *base.add(8).cast::<u8>() = (0i32) as u8;
34698 match e {
34699 Some(e) => {
34700 *base.add(12).cast::<u8>() = (1i32) as u8;
34701 *base.add(16).cast::<i32>() = _rt::as_i32(e);
34702 }
34703 None => {
34704 *base.add(12).cast::<u8>() = (0i32) as u8;
34705 }
34706 };
34707 }
34708 Err(e) => {
34709 *base.add(8).cast::<u8>() = (1i32) as u8;
34710 match e {
34711 Some(e) => {
34712 *base.add(12).cast::<u8>() = (1i32) as u8;
34713 *base.add(16).cast::<i32>() = _rt::as_i32(e);
34714 }
34715 None => {
34716 *base.add(12).cast::<u8>() = (0i32) as u8;
34717 }
34718 };
34719 }
34720 };
34721 }
34722 WitNode::PrimU8(e) => {
34723 *base.add(0).cast::<u8>() = (8i32) as u8;
34724 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
34725 }
34726 WitNode::PrimU16(e) => {
34727 *base.add(0).cast::<u8>() = (9i32) as u8;
34728 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
34729 }
34730 WitNode::PrimU32(e) => {
34731 *base.add(0).cast::<u8>() = (10i32) as u8;
34732 *base.add(8).cast::<i32>() = _rt::as_i32(e);
34733 }
34734 WitNode::PrimU64(e) => {
34735 *base.add(0).cast::<u8>() = (11i32) as u8;
34736 *base.add(8).cast::<i64>() = _rt::as_i64(e);
34737 }
34738 WitNode::PrimS8(e) => {
34739 *base.add(0).cast::<u8>() = (12i32) as u8;
34740 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
34741 }
34742 WitNode::PrimS16(e) => {
34743 *base.add(0).cast::<u8>() = (13i32) as u8;
34744 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
34745 }
34746 WitNode::PrimS32(e) => {
34747 *base.add(0).cast::<u8>() = (14i32) as u8;
34748 *base.add(8).cast::<i32>() = _rt::as_i32(e);
34749 }
34750 WitNode::PrimS64(e) => {
34751 *base.add(0).cast::<u8>() = (15i32) as u8;
34752 *base.add(8).cast::<i64>() = _rt::as_i64(e);
34753 }
34754 WitNode::PrimFloat32(e) => {
34755 *base.add(0).cast::<u8>() = (16i32) as u8;
34756 *base.add(8).cast::<f32>() = _rt::as_f32(e);
34757 }
34758 WitNode::PrimFloat64(e) => {
34759 *base.add(0).cast::<u8>() = (17i32) as u8;
34760 *base.add(8).cast::<f64>() = _rt::as_f64(e);
34761 }
34762 WitNode::PrimChar(e) => {
34763 *base.add(0).cast::<u8>() = (18i32) as u8;
34764 *base.add(8).cast::<i32>() = _rt::as_i32(e);
34765 }
34766 WitNode::PrimBool(e) => {
34767 *base.add(0).cast::<u8>() = (19i32) as u8;
34768 *base.add(8).cast::<u8>() = (match e {
34769 true => 1,
34770 false => 0,
34771 }) as u8;
34772 }
34773 WitNode::PrimString(e) => {
34774 *base.add(0).cast::<u8>() = (20i32) as u8;
34775 let vec7 = e;
34776 let ptr7 = vec7.as_ptr().cast::<u8>();
34777 let len7 = vec7.len();
34778 *base.add(12).cast::<usize>() = len7;
34779 *base.add(8).cast::<*mut u8>() = ptr7.cast_mut();
34780 }
34781 WitNode::Handle(e) => {
34782 *base.add(0).cast::<u8>() = (21i32) as u8;
34783 let (t8_0, t8_1) = e;
34784 let Uri { value: value9 } = t8_0;
34785 let vec10 = value9;
34786 let ptr10 = vec10.as_ptr().cast::<u8>();
34787 let len10 = vec10.len();
34788 *base.add(12).cast::<usize>() = len10;
34789 *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
34790 *base.add(16).cast::<i64>() = _rt::as_i64(t8_1);
34791 }
34792 }
34793 }
34794 }
34795 let WitType { nodes: nodes12 } = typ0;
34796 let vec26 = nodes12;
34797 let len26 = vec26.len();
34798 let layout26 = _rt::alloc::Layout::from_size_align_unchecked(
34799 vec26.len() * 24,
34800 8,
34801 );
34802 let result26 = if layout26.size() != 0 {
34803 let ptr = _rt::alloc::alloc(layout26).cast::<u8>();
34804 if ptr.is_null() {
34805 _rt::alloc::handle_alloc_error(layout26);
34806 }
34807 ptr
34808 } else {
34809 ::core::ptr::null_mut()
34810 };
34811 for (i, e) in vec26.into_iter().enumerate() {
34812 let base = result26.add(i * 24);
34813 {
34814 match e {
34815 WitTypeNode::RecordType(e) => {
34816 *base.add(0).cast::<u8>() = (0i32) as u8;
34817 let vec15 = e;
34818 let len15 = vec15.len();
34819 let layout15 = _rt::alloc::Layout::from_size_align_unchecked(
34820 vec15.len() * 12,
34821 4,
34822 );
34823 let result15 = if layout15.size() != 0 {
34824 let ptr = _rt::alloc::alloc(layout15).cast::<u8>();
34825 if ptr.is_null() {
34826 _rt::alloc::handle_alloc_error(layout15);
34827 }
34828 ptr
34829 } else {
34830 ::core::ptr::null_mut()
34831 };
34832 for (i, e) in vec15.into_iter().enumerate() {
34833 let base = result15.add(i * 12);
34834 {
34835 let (t13_0, t13_1) = e;
34836 let vec14 = t13_0;
34837 let ptr14 = vec14.as_ptr().cast::<u8>();
34838 let len14 = vec14.len();
34839 *base.add(4).cast::<usize>() = len14;
34840 *base.add(0).cast::<*mut u8>() = ptr14.cast_mut();
34841 *base.add(8).cast::<i32>() = _rt::as_i32(t13_1);
34842 }
34843 }
34844 *base.add(12).cast::<usize>() = len15;
34845 *base.add(8).cast::<*mut u8>() = result15;
34846 cleanup_list.extend_from_slice(&[(result15, layout15)]);
34847 }
34848 WitTypeNode::VariantType(e) => {
34849 *base.add(0).cast::<u8>() = (1i32) as u8;
34850 let vec18 = e;
34851 let len18 = vec18.len();
34852 let layout18 = _rt::alloc::Layout::from_size_align_unchecked(
34853 vec18.len() * 16,
34854 4,
34855 );
34856 let result18 = if layout18.size() != 0 {
34857 let ptr = _rt::alloc::alloc(layout18).cast::<u8>();
34858 if ptr.is_null() {
34859 _rt::alloc::handle_alloc_error(layout18);
34860 }
34861 ptr
34862 } else {
34863 ::core::ptr::null_mut()
34864 };
34865 for (i, e) in vec18.into_iter().enumerate() {
34866 let base = result18.add(i * 16);
34867 {
34868 let (t16_0, t16_1) = e;
34869 let vec17 = t16_0;
34870 let ptr17 = vec17.as_ptr().cast::<u8>();
34871 let len17 = vec17.len();
34872 *base.add(4).cast::<usize>() = len17;
34873 *base.add(0).cast::<*mut u8>() = ptr17.cast_mut();
34874 match t16_1 {
34875 Some(e) => {
34876 *base.add(8).cast::<u8>() = (1i32) as u8;
34877 *base.add(12).cast::<i32>() = _rt::as_i32(e);
34878 }
34879 None => {
34880 *base.add(8).cast::<u8>() = (0i32) as u8;
34881 }
34882 };
34883 }
34884 }
34885 *base.add(12).cast::<usize>() = len18;
34886 *base.add(8).cast::<*mut u8>() = result18;
34887 cleanup_list.extend_from_slice(&[(result18, layout18)]);
34888 }
34889 WitTypeNode::EnumType(e) => {
34890 *base.add(0).cast::<u8>() = (2i32) as u8;
34891 let vec20 = e;
34892 let len20 = vec20.len();
34893 let layout20 = _rt::alloc::Layout::from_size_align_unchecked(
34894 vec20.len() * 8,
34895 4,
34896 );
34897 let result20 = if layout20.size() != 0 {
34898 let ptr = _rt::alloc::alloc(layout20).cast::<u8>();
34899 if ptr.is_null() {
34900 _rt::alloc::handle_alloc_error(layout20);
34901 }
34902 ptr
34903 } else {
34904 ::core::ptr::null_mut()
34905 };
34906 for (i, e) in vec20.into_iter().enumerate() {
34907 let base = result20.add(i * 8);
34908 {
34909 let vec19 = e;
34910 let ptr19 = vec19.as_ptr().cast::<u8>();
34911 let len19 = vec19.len();
34912 *base.add(4).cast::<usize>() = len19;
34913 *base.add(0).cast::<*mut u8>() = ptr19.cast_mut();
34914 }
34915 }
34916 *base.add(12).cast::<usize>() = len20;
34917 *base.add(8).cast::<*mut u8>() = result20;
34918 cleanup_list.extend_from_slice(&[(result20, layout20)]);
34919 }
34920 WitTypeNode::FlagsType(e) => {
34921 *base.add(0).cast::<u8>() = (3i32) as u8;
34922 let vec22 = e;
34923 let len22 = vec22.len();
34924 let layout22 = _rt::alloc::Layout::from_size_align_unchecked(
34925 vec22.len() * 8,
34926 4,
34927 );
34928 let result22 = if layout22.size() != 0 {
34929 let ptr = _rt::alloc::alloc(layout22).cast::<u8>();
34930 if ptr.is_null() {
34931 _rt::alloc::handle_alloc_error(layout22);
34932 }
34933 ptr
34934 } else {
34935 ::core::ptr::null_mut()
34936 };
34937 for (i, e) in vec22.into_iter().enumerate() {
34938 let base = result22.add(i * 8);
34939 {
34940 let vec21 = e;
34941 let ptr21 = vec21.as_ptr().cast::<u8>();
34942 let len21 = vec21.len();
34943 *base.add(4).cast::<usize>() = len21;
34944 *base.add(0).cast::<*mut u8>() = ptr21.cast_mut();
34945 }
34946 }
34947 *base.add(12).cast::<usize>() = len22;
34948 *base.add(8).cast::<*mut u8>() = result22;
34949 cleanup_list.extend_from_slice(&[(result22, layout22)]);
34950 }
34951 WitTypeNode::TupleType(e) => {
34952 *base.add(0).cast::<u8>() = (4i32) as u8;
34953 let vec23 = e;
34954 let ptr23 = vec23.as_ptr().cast::<u8>();
34955 let len23 = vec23.len();
34956 *base.add(12).cast::<usize>() = len23;
34957 *base.add(8).cast::<*mut u8>() = ptr23.cast_mut();
34958 }
34959 WitTypeNode::ListType(e) => {
34960 *base.add(0).cast::<u8>() = (5i32) as u8;
34961 *base.add(8).cast::<i32>() = _rt::as_i32(e);
34962 }
34963 WitTypeNode::OptionType(e) => {
34964 *base.add(0).cast::<u8>() = (6i32) as u8;
34965 *base.add(8).cast::<i32>() = _rt::as_i32(e);
34966 }
34967 WitTypeNode::ResultType(e) => {
34968 *base.add(0).cast::<u8>() = (7i32) as u8;
34969 let (t24_0, t24_1) = e;
34970 match t24_0 {
34971 Some(e) => {
34972 *base.add(8).cast::<u8>() = (1i32) as u8;
34973 *base.add(12).cast::<i32>() = _rt::as_i32(e);
34974 }
34975 None => {
34976 *base.add(8).cast::<u8>() = (0i32) as u8;
34977 }
34978 };
34979 match t24_1 {
34980 Some(e) => {
34981 *base.add(16).cast::<u8>() = (1i32) as u8;
34982 *base.add(20).cast::<i32>() = _rt::as_i32(e);
34983 }
34984 None => {
34985 *base.add(16).cast::<u8>() = (0i32) as u8;
34986 }
34987 };
34988 }
34989 WitTypeNode::PrimU8Type => {
34990 *base.add(0).cast::<u8>() = (8i32) as u8;
34991 }
34992 WitTypeNode::PrimU16Type => {
34993 *base.add(0).cast::<u8>() = (9i32) as u8;
34994 }
34995 WitTypeNode::PrimU32Type => {
34996 *base.add(0).cast::<u8>() = (10i32) as u8;
34997 }
34998 WitTypeNode::PrimU64Type => {
34999 *base.add(0).cast::<u8>() = (11i32) as u8;
35000 }
35001 WitTypeNode::PrimS8Type => {
35002 *base.add(0).cast::<u8>() = (12i32) as u8;
35003 }
35004 WitTypeNode::PrimS16Type => {
35005 *base.add(0).cast::<u8>() = (13i32) as u8;
35006 }
35007 WitTypeNode::PrimS32Type => {
35008 *base.add(0).cast::<u8>() = (14i32) as u8;
35009 }
35010 WitTypeNode::PrimS64Type => {
35011 *base.add(0).cast::<u8>() = (15i32) as u8;
35012 }
35013 WitTypeNode::PrimF32Type => {
35014 *base.add(0).cast::<u8>() = (16i32) as u8;
35015 }
35016 WitTypeNode::PrimF64Type => {
35017 *base.add(0).cast::<u8>() = (17i32) as u8;
35018 }
35019 WitTypeNode::PrimCharType => {
35020 *base.add(0).cast::<u8>() = (18i32) as u8;
35021 }
35022 WitTypeNode::PrimBoolType => {
35023 *base.add(0).cast::<u8>() = (19i32) as u8;
35024 }
35025 WitTypeNode::PrimStringType => {
35026 *base.add(0).cast::<u8>() = (20i32) as u8;
35027 }
35028 WitTypeNode::HandleType(e) => {
35029 *base.add(0).cast::<u8>() = (21i32) as u8;
35030 let (t25_0, t25_1) = e;
35031 *base.add(8).cast::<i64>() = _rt::as_i64(t25_0);
35032 *base.add(16).cast::<u8>() = (t25_1.clone() as i32) as u8;
35033 }
35034 }
35035 }
35036 }
35037 let ptr27 = ret_area.0.as_mut_ptr().cast::<u8>();
35038 #[cfg(target_arch = "wasm32")]
35039 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
35040 extern "C" {
35041 #[link_name = "extract-value"]
35042 fn wit_import(
35043 _: *mut u8,
35044 _: usize,
35045 _: *mut u8,
35046 _: usize,
35047 _: *mut u8,
35048 );
35049 }
35050 #[cfg(not(target_arch = "wasm32"))]
35051 fn wit_import(
35052 _: *mut u8,
35053 _: usize,
35054 _: *mut u8,
35055 _: usize,
35056 _: *mut u8,
35057 ) {
35058 unreachable!()
35059 }
35060 wit_import(result11, len11, result26, len26, ptr27);
35061 let l28 = *ptr27.add(0).cast::<*mut u8>();
35062 let l29 = *ptr27.add(4).cast::<usize>();
35063 let base75 = l28;
35064 let len75 = l29;
35065 let mut result75 = _rt::Vec::with_capacity(len75);
35066 for i in 0..len75 {
35067 let base = base75.add(i * 24);
35068 let e75 = {
35069 let l30 = i32::from(*base.add(0).cast::<u8>());
35070 let v74 = match l30 {
35071 0 => {
35072 let e74 = {
35073 let l31 = *base.add(8).cast::<*mut u8>();
35074 let l32 = *base.add(12).cast::<usize>();
35075 let len33 = l32;
35076 _rt::Vec::from_raw_parts(l31.cast(), len33, len33)
35077 };
35078 WitNode::RecordValue(e74)
35079 }
35080 1 => {
35081 let e74 = {
35082 let l34 = *base.add(8).cast::<i32>();
35083 let l35 = i32::from(*base.add(12).cast::<u8>());
35084 (
35085 l34 as u32,
35086 match l35 {
35087 0 => None,
35088 1 => {
35089 let e = {
35090 let l36 = *base.add(16).cast::<i32>();
35091 l36
35092 };
35093 Some(e)
35094 }
35095 _ => _rt::invalid_enum_discriminant(),
35096 },
35097 )
35098 };
35099 WitNode::VariantValue(e74)
35100 }
35101 2 => {
35102 let e74 = {
35103 let l37 = *base.add(8).cast::<i32>();
35104 l37 as u32
35105 };
35106 WitNode::EnumValue(e74)
35107 }
35108 3 => {
35109 let e74 = {
35110 let l38 = *base.add(8).cast::<*mut u8>();
35111 let l39 = *base.add(12).cast::<usize>();
35112 let base41 = l38;
35113 let len41 = l39;
35114 let mut result41 = _rt::Vec::with_capacity(len41);
35115 for i in 0..len41 {
35116 let base = base41.add(i * 1);
35117 let e41 = {
35118 let l40 = i32::from(*base.add(0).cast::<u8>());
35119 _rt::bool_lift(l40 as u8)
35120 };
35121 result41.push(e41);
35122 }
35123 _rt::cabi_dealloc(base41, len41 * 1, 1);
35124 result41
35125 };
35126 WitNode::FlagsValue(e74)
35127 }
35128 4 => {
35129 let e74 = {
35130 let l42 = *base.add(8).cast::<*mut u8>();
35131 let l43 = *base.add(12).cast::<usize>();
35132 let len44 = l43;
35133 _rt::Vec::from_raw_parts(l42.cast(), len44, len44)
35134 };
35135 WitNode::TupleValue(e74)
35136 }
35137 5 => {
35138 let e74 = {
35139 let l45 = *base.add(8).cast::<*mut u8>();
35140 let l46 = *base.add(12).cast::<usize>();
35141 let len47 = l46;
35142 _rt::Vec::from_raw_parts(l45.cast(), len47, len47)
35143 };
35144 WitNode::ListValue(e74)
35145 }
35146 6 => {
35147 let e74 = {
35148 let l48 = i32::from(*base.add(8).cast::<u8>());
35149 match l48 {
35150 0 => None,
35151 1 => {
35152 let e = {
35153 let l49 = *base.add(12).cast::<i32>();
35154 l49
35155 };
35156 Some(e)
35157 }
35158 _ => _rt::invalid_enum_discriminant(),
35159 }
35160 };
35161 WitNode::OptionValue(e74)
35162 }
35163 7 => {
35164 let e74 = {
35165 let l50 = i32::from(*base.add(8).cast::<u8>());
35166 match l50 {
35167 0 => {
35168 let e = {
35169 let l51 = i32::from(*base.add(12).cast::<u8>());
35170 match l51 {
35171 0 => None,
35172 1 => {
35173 let e = {
35174 let l52 = *base.add(16).cast::<i32>();
35175 l52
35176 };
35177 Some(e)
35178 }
35179 _ => _rt::invalid_enum_discriminant(),
35180 }
35181 };
35182 Ok(e)
35183 }
35184 1 => {
35185 let e = {
35186 let l53 = i32::from(*base.add(12).cast::<u8>());
35187 match l53 {
35188 0 => None,
35189 1 => {
35190 let e = {
35191 let l54 = *base.add(16).cast::<i32>();
35192 l54
35193 };
35194 Some(e)
35195 }
35196 _ => _rt::invalid_enum_discriminant(),
35197 }
35198 };
35199 Err(e)
35200 }
35201 _ => _rt::invalid_enum_discriminant(),
35202 }
35203 };
35204 WitNode::ResultValue(e74)
35205 }
35206 8 => {
35207 let e74 = {
35208 let l55 = i32::from(*base.add(8).cast::<u8>());
35209 l55 as u8
35210 };
35211 WitNode::PrimU8(e74)
35212 }
35213 9 => {
35214 let e74 = {
35215 let l56 = i32::from(*base.add(8).cast::<u16>());
35216 l56 as u16
35217 };
35218 WitNode::PrimU16(e74)
35219 }
35220 10 => {
35221 let e74 = {
35222 let l57 = *base.add(8).cast::<i32>();
35223 l57 as u32
35224 };
35225 WitNode::PrimU32(e74)
35226 }
35227 11 => {
35228 let e74 = {
35229 let l58 = *base.add(8).cast::<i64>();
35230 l58 as u64
35231 };
35232 WitNode::PrimU64(e74)
35233 }
35234 12 => {
35235 let e74 = {
35236 let l59 = i32::from(*base.add(8).cast::<i8>());
35237 l59 as i8
35238 };
35239 WitNode::PrimS8(e74)
35240 }
35241 13 => {
35242 let e74 = {
35243 let l60 = i32::from(*base.add(8).cast::<i16>());
35244 l60 as i16
35245 };
35246 WitNode::PrimS16(e74)
35247 }
35248 14 => {
35249 let e74 = {
35250 let l61 = *base.add(8).cast::<i32>();
35251 l61
35252 };
35253 WitNode::PrimS32(e74)
35254 }
35255 15 => {
35256 let e74 = {
35257 let l62 = *base.add(8).cast::<i64>();
35258 l62
35259 };
35260 WitNode::PrimS64(e74)
35261 }
35262 16 => {
35263 let e74 = {
35264 let l63 = *base.add(8).cast::<f32>();
35265 l63
35266 };
35267 WitNode::PrimFloat32(e74)
35268 }
35269 17 => {
35270 let e74 = {
35271 let l64 = *base.add(8).cast::<f64>();
35272 l64
35273 };
35274 WitNode::PrimFloat64(e74)
35275 }
35276 18 => {
35277 let e74 = {
35278 let l65 = *base.add(8).cast::<i32>();
35279 _rt::char_lift(l65 as u32)
35280 };
35281 WitNode::PrimChar(e74)
35282 }
35283 19 => {
35284 let e74 = {
35285 let l66 = i32::from(*base.add(8).cast::<u8>());
35286 _rt::bool_lift(l66 as u8)
35287 };
35288 WitNode::PrimBool(e74)
35289 }
35290 20 => {
35291 let e74 = {
35292 let l67 = *base.add(8).cast::<*mut u8>();
35293 let l68 = *base.add(12).cast::<usize>();
35294 let len69 = l68;
35295 let bytes69 = _rt::Vec::from_raw_parts(
35296 l67.cast(),
35297 len69,
35298 len69,
35299 );
35300 _rt::string_lift(bytes69)
35301 };
35302 WitNode::PrimString(e74)
35303 }
35304 n => {
35305 debug_assert_eq!(n, 21, "invalid enum discriminant");
35306 let e74 = {
35307 let l70 = *base.add(8).cast::<*mut u8>();
35308 let l71 = *base.add(12).cast::<usize>();
35309 let len72 = l71;
35310 let bytes72 = _rt::Vec::from_raw_parts(
35311 l70.cast(),
35312 len72,
35313 len72,
35314 );
35315 let l73 = *base.add(16).cast::<i64>();
35316 (
35317 Uri {
35318 value: _rt::string_lift(bytes72),
35319 },
35320 l73 as u64,
35321 )
35322 };
35323 WitNode::Handle(e74)
35324 }
35325 };
35326 v74
35327 };
35328 result75.push(e75);
35329 }
35330 _rt::cabi_dealloc(base75, len75 * 24, 8);
35331 if layout11.size() != 0 {
35332 _rt::alloc::dealloc(result11.cast(), layout11);
35333 }
35334 if layout26.size() != 0 {
35335 _rt::alloc::dealloc(result26.cast(), layout26);
35336 }
35337 for (ptr, layout) in cleanup_list {
35338 if layout.size() != 0 {
35339 _rt::alloc::dealloc(ptr.cast(), layout);
35340 }
35341 }
35342 WitValue { nodes: result75 }
35343 }
35344 }
35345 #[allow(unused_unsafe, clippy::all)]
35346 pub fn extract_type(vnt: &ValueAndType) -> WitType {
35347 unsafe {
35348 let mut cleanup_list = _rt::Vec::new();
35349 #[repr(align(4))]
35350 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
35351 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
35352 let ValueAndType { value: value0, typ: typ0 } = vnt;
35353 let WitValue { nodes: nodes1 } = value0;
35354 let vec11 = nodes1;
35355 let len11 = vec11.len();
35356 let layout11 = _rt::alloc::Layout::from_size_align_unchecked(
35357 vec11.len() * 24,
35358 8,
35359 );
35360 let result11 = if layout11.size() != 0 {
35361 let ptr = _rt::alloc::alloc(layout11).cast::<u8>();
35362 if ptr.is_null() {
35363 _rt::alloc::handle_alloc_error(layout11);
35364 }
35365 ptr
35366 } else {
35367 ::core::ptr::null_mut()
35368 };
35369 for (i, e) in vec11.into_iter().enumerate() {
35370 let base = result11.add(i * 24);
35371 {
35372 match e {
35373 WitNode::RecordValue(e) => {
35374 *base.add(0).cast::<u8>() = (0i32) as u8;
35375 let vec2 = e;
35376 let ptr2 = vec2.as_ptr().cast::<u8>();
35377 let len2 = vec2.len();
35378 *base.add(12).cast::<usize>() = len2;
35379 *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
35380 }
35381 WitNode::VariantValue(e) => {
35382 *base.add(0).cast::<u8>() = (1i32) as u8;
35383 let (t3_0, t3_1) = e;
35384 *base.add(8).cast::<i32>() = _rt::as_i32(t3_0);
35385 match t3_1 {
35386 Some(e) => {
35387 *base.add(12).cast::<u8>() = (1i32) as u8;
35388 *base.add(16).cast::<i32>() = _rt::as_i32(e);
35389 }
35390 None => {
35391 *base.add(12).cast::<u8>() = (0i32) as u8;
35392 }
35393 };
35394 }
35395 WitNode::EnumValue(e) => {
35396 *base.add(0).cast::<u8>() = (2i32) as u8;
35397 *base.add(8).cast::<i32>() = _rt::as_i32(e);
35398 }
35399 WitNode::FlagsValue(e) => {
35400 *base.add(0).cast::<u8>() = (3i32) as u8;
35401 let vec4 = e;
35402 let len4 = vec4.len();
35403 let layout4 = _rt::alloc::Layout::from_size_align_unchecked(
35404 vec4.len() * 1,
35405 1,
35406 );
35407 let result4 = if layout4.size() != 0 {
35408 let ptr = _rt::alloc::alloc(layout4).cast::<u8>();
35409 if ptr.is_null() {
35410 _rt::alloc::handle_alloc_error(layout4);
35411 }
35412 ptr
35413 } else {
35414 ::core::ptr::null_mut()
35415 };
35416 for (i, e) in vec4.into_iter().enumerate() {
35417 let base = result4.add(i * 1);
35418 {
35419 *base.add(0).cast::<u8>() = (match e {
35420 true => 1,
35421 false => 0,
35422 }) as u8;
35423 }
35424 }
35425 *base.add(12).cast::<usize>() = len4;
35426 *base.add(8).cast::<*mut u8>() = result4;
35427 cleanup_list.extend_from_slice(&[(result4, layout4)]);
35428 }
35429 WitNode::TupleValue(e) => {
35430 *base.add(0).cast::<u8>() = (4i32) as u8;
35431 let vec5 = e;
35432 let ptr5 = vec5.as_ptr().cast::<u8>();
35433 let len5 = vec5.len();
35434 *base.add(12).cast::<usize>() = len5;
35435 *base.add(8).cast::<*mut u8>() = ptr5.cast_mut();
35436 }
35437 WitNode::ListValue(e) => {
35438 *base.add(0).cast::<u8>() = (5i32) as u8;
35439 let vec6 = e;
35440 let ptr6 = vec6.as_ptr().cast::<u8>();
35441 let len6 = vec6.len();
35442 *base.add(12).cast::<usize>() = len6;
35443 *base.add(8).cast::<*mut u8>() = ptr6.cast_mut();
35444 }
35445 WitNode::OptionValue(e) => {
35446 *base.add(0).cast::<u8>() = (6i32) as u8;
35447 match e {
35448 Some(e) => {
35449 *base.add(8).cast::<u8>() = (1i32) as u8;
35450 *base.add(12).cast::<i32>() = _rt::as_i32(e);
35451 }
35452 None => {
35453 *base.add(8).cast::<u8>() = (0i32) as u8;
35454 }
35455 };
35456 }
35457 WitNode::ResultValue(e) => {
35458 *base.add(0).cast::<u8>() = (7i32) as u8;
35459 match e {
35460 Ok(e) => {
35461 *base.add(8).cast::<u8>() = (0i32) as u8;
35462 match e {
35463 Some(e) => {
35464 *base.add(12).cast::<u8>() = (1i32) as u8;
35465 *base.add(16).cast::<i32>() = _rt::as_i32(e);
35466 }
35467 None => {
35468 *base.add(12).cast::<u8>() = (0i32) as u8;
35469 }
35470 };
35471 }
35472 Err(e) => {
35473 *base.add(8).cast::<u8>() = (1i32) as u8;
35474 match e {
35475 Some(e) => {
35476 *base.add(12).cast::<u8>() = (1i32) as u8;
35477 *base.add(16).cast::<i32>() = _rt::as_i32(e);
35478 }
35479 None => {
35480 *base.add(12).cast::<u8>() = (0i32) as u8;
35481 }
35482 };
35483 }
35484 };
35485 }
35486 WitNode::PrimU8(e) => {
35487 *base.add(0).cast::<u8>() = (8i32) as u8;
35488 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
35489 }
35490 WitNode::PrimU16(e) => {
35491 *base.add(0).cast::<u8>() = (9i32) as u8;
35492 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
35493 }
35494 WitNode::PrimU32(e) => {
35495 *base.add(0).cast::<u8>() = (10i32) as u8;
35496 *base.add(8).cast::<i32>() = _rt::as_i32(e);
35497 }
35498 WitNode::PrimU64(e) => {
35499 *base.add(0).cast::<u8>() = (11i32) as u8;
35500 *base.add(8).cast::<i64>() = _rt::as_i64(e);
35501 }
35502 WitNode::PrimS8(e) => {
35503 *base.add(0).cast::<u8>() = (12i32) as u8;
35504 *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
35505 }
35506 WitNode::PrimS16(e) => {
35507 *base.add(0).cast::<u8>() = (13i32) as u8;
35508 *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
35509 }
35510 WitNode::PrimS32(e) => {
35511 *base.add(0).cast::<u8>() = (14i32) as u8;
35512 *base.add(8).cast::<i32>() = _rt::as_i32(e);
35513 }
35514 WitNode::PrimS64(e) => {
35515 *base.add(0).cast::<u8>() = (15i32) as u8;
35516 *base.add(8).cast::<i64>() = _rt::as_i64(e);
35517 }
35518 WitNode::PrimFloat32(e) => {
35519 *base.add(0).cast::<u8>() = (16i32) as u8;
35520 *base.add(8).cast::<f32>() = _rt::as_f32(e);
35521 }
35522 WitNode::PrimFloat64(e) => {
35523 *base.add(0).cast::<u8>() = (17i32) as u8;
35524 *base.add(8).cast::<f64>() = _rt::as_f64(e);
35525 }
35526 WitNode::PrimChar(e) => {
35527 *base.add(0).cast::<u8>() = (18i32) as u8;
35528 *base.add(8).cast::<i32>() = _rt::as_i32(e);
35529 }
35530 WitNode::PrimBool(e) => {
35531 *base.add(0).cast::<u8>() = (19i32) as u8;
35532 *base.add(8).cast::<u8>() = (match e {
35533 true => 1,
35534 false => 0,
35535 }) as u8;
35536 }
35537 WitNode::PrimString(e) => {
35538 *base.add(0).cast::<u8>() = (20i32) as u8;
35539 let vec7 = e;
35540 let ptr7 = vec7.as_ptr().cast::<u8>();
35541 let len7 = vec7.len();
35542 *base.add(12).cast::<usize>() = len7;
35543 *base.add(8).cast::<*mut u8>() = ptr7.cast_mut();
35544 }
35545 WitNode::Handle(e) => {
35546 *base.add(0).cast::<u8>() = (21i32) as u8;
35547 let (t8_0, t8_1) = e;
35548 let Uri { value: value9 } = t8_0;
35549 let vec10 = value9;
35550 let ptr10 = vec10.as_ptr().cast::<u8>();
35551 let len10 = vec10.len();
35552 *base.add(12).cast::<usize>() = len10;
35553 *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
35554 *base.add(16).cast::<i64>() = _rt::as_i64(t8_1);
35555 }
35556 }
35557 }
35558 }
35559 let WitType { nodes: nodes12 } = typ0;
35560 let vec26 = nodes12;
35561 let len26 = vec26.len();
35562 let layout26 = _rt::alloc::Layout::from_size_align_unchecked(
35563 vec26.len() * 24,
35564 8,
35565 );
35566 let result26 = if layout26.size() != 0 {
35567 let ptr = _rt::alloc::alloc(layout26).cast::<u8>();
35568 if ptr.is_null() {
35569 _rt::alloc::handle_alloc_error(layout26);
35570 }
35571 ptr
35572 } else {
35573 ::core::ptr::null_mut()
35574 };
35575 for (i, e) in vec26.into_iter().enumerate() {
35576 let base = result26.add(i * 24);
35577 {
35578 match e {
35579 WitTypeNode::RecordType(e) => {
35580 *base.add(0).cast::<u8>() = (0i32) as u8;
35581 let vec15 = e;
35582 let len15 = vec15.len();
35583 let layout15 = _rt::alloc::Layout::from_size_align_unchecked(
35584 vec15.len() * 12,
35585 4,
35586 );
35587 let result15 = if layout15.size() != 0 {
35588 let ptr = _rt::alloc::alloc(layout15).cast::<u8>();
35589 if ptr.is_null() {
35590 _rt::alloc::handle_alloc_error(layout15);
35591 }
35592 ptr
35593 } else {
35594 ::core::ptr::null_mut()
35595 };
35596 for (i, e) in vec15.into_iter().enumerate() {
35597 let base = result15.add(i * 12);
35598 {
35599 let (t13_0, t13_1) = e;
35600 let vec14 = t13_0;
35601 let ptr14 = vec14.as_ptr().cast::<u8>();
35602 let len14 = vec14.len();
35603 *base.add(4).cast::<usize>() = len14;
35604 *base.add(0).cast::<*mut u8>() = ptr14.cast_mut();
35605 *base.add(8).cast::<i32>() = _rt::as_i32(t13_1);
35606 }
35607 }
35608 *base.add(12).cast::<usize>() = len15;
35609 *base.add(8).cast::<*mut u8>() = result15;
35610 cleanup_list.extend_from_slice(&[(result15, layout15)]);
35611 }
35612 WitTypeNode::VariantType(e) => {
35613 *base.add(0).cast::<u8>() = (1i32) as u8;
35614 let vec18 = e;
35615 let len18 = vec18.len();
35616 let layout18 = _rt::alloc::Layout::from_size_align_unchecked(
35617 vec18.len() * 16,
35618 4,
35619 );
35620 let result18 = if layout18.size() != 0 {
35621 let ptr = _rt::alloc::alloc(layout18).cast::<u8>();
35622 if ptr.is_null() {
35623 _rt::alloc::handle_alloc_error(layout18);
35624 }
35625 ptr
35626 } else {
35627 ::core::ptr::null_mut()
35628 };
35629 for (i, e) in vec18.into_iter().enumerate() {
35630 let base = result18.add(i * 16);
35631 {
35632 let (t16_0, t16_1) = e;
35633 let vec17 = t16_0;
35634 let ptr17 = vec17.as_ptr().cast::<u8>();
35635 let len17 = vec17.len();
35636 *base.add(4).cast::<usize>() = len17;
35637 *base.add(0).cast::<*mut u8>() = ptr17.cast_mut();
35638 match t16_1 {
35639 Some(e) => {
35640 *base.add(8).cast::<u8>() = (1i32) as u8;
35641 *base.add(12).cast::<i32>() = _rt::as_i32(e);
35642 }
35643 None => {
35644 *base.add(8).cast::<u8>() = (0i32) as u8;
35645 }
35646 };
35647 }
35648 }
35649 *base.add(12).cast::<usize>() = len18;
35650 *base.add(8).cast::<*mut u8>() = result18;
35651 cleanup_list.extend_from_slice(&[(result18, layout18)]);
35652 }
35653 WitTypeNode::EnumType(e) => {
35654 *base.add(0).cast::<u8>() = (2i32) as u8;
35655 let vec20 = e;
35656 let len20 = vec20.len();
35657 let layout20 = _rt::alloc::Layout::from_size_align_unchecked(
35658 vec20.len() * 8,
35659 4,
35660 );
35661 let result20 = if layout20.size() != 0 {
35662 let ptr = _rt::alloc::alloc(layout20).cast::<u8>();
35663 if ptr.is_null() {
35664 _rt::alloc::handle_alloc_error(layout20);
35665 }
35666 ptr
35667 } else {
35668 ::core::ptr::null_mut()
35669 };
35670 for (i, e) in vec20.into_iter().enumerate() {
35671 let base = result20.add(i * 8);
35672 {
35673 let vec19 = e;
35674 let ptr19 = vec19.as_ptr().cast::<u8>();
35675 let len19 = vec19.len();
35676 *base.add(4).cast::<usize>() = len19;
35677 *base.add(0).cast::<*mut u8>() = ptr19.cast_mut();
35678 }
35679 }
35680 *base.add(12).cast::<usize>() = len20;
35681 *base.add(8).cast::<*mut u8>() = result20;
35682 cleanup_list.extend_from_slice(&[(result20, layout20)]);
35683 }
35684 WitTypeNode::FlagsType(e) => {
35685 *base.add(0).cast::<u8>() = (3i32) as u8;
35686 let vec22 = e;
35687 let len22 = vec22.len();
35688 let layout22 = _rt::alloc::Layout::from_size_align_unchecked(
35689 vec22.len() * 8,
35690 4,
35691 );
35692 let result22 = if layout22.size() != 0 {
35693 let ptr = _rt::alloc::alloc(layout22).cast::<u8>();
35694 if ptr.is_null() {
35695 _rt::alloc::handle_alloc_error(layout22);
35696 }
35697 ptr
35698 } else {
35699 ::core::ptr::null_mut()
35700 };
35701 for (i, e) in vec22.into_iter().enumerate() {
35702 let base = result22.add(i * 8);
35703 {
35704 let vec21 = e;
35705 let ptr21 = vec21.as_ptr().cast::<u8>();
35706 let len21 = vec21.len();
35707 *base.add(4).cast::<usize>() = len21;
35708 *base.add(0).cast::<*mut u8>() = ptr21.cast_mut();
35709 }
35710 }
35711 *base.add(12).cast::<usize>() = len22;
35712 *base.add(8).cast::<*mut u8>() = result22;
35713 cleanup_list.extend_from_slice(&[(result22, layout22)]);
35714 }
35715 WitTypeNode::TupleType(e) => {
35716 *base.add(0).cast::<u8>() = (4i32) as u8;
35717 let vec23 = e;
35718 let ptr23 = vec23.as_ptr().cast::<u8>();
35719 let len23 = vec23.len();
35720 *base.add(12).cast::<usize>() = len23;
35721 *base.add(8).cast::<*mut u8>() = ptr23.cast_mut();
35722 }
35723 WitTypeNode::ListType(e) => {
35724 *base.add(0).cast::<u8>() = (5i32) as u8;
35725 *base.add(8).cast::<i32>() = _rt::as_i32(e);
35726 }
35727 WitTypeNode::OptionType(e) => {
35728 *base.add(0).cast::<u8>() = (6i32) as u8;
35729 *base.add(8).cast::<i32>() = _rt::as_i32(e);
35730 }
35731 WitTypeNode::ResultType(e) => {
35732 *base.add(0).cast::<u8>() = (7i32) as u8;
35733 let (t24_0, t24_1) = e;
35734 match t24_0 {
35735 Some(e) => {
35736 *base.add(8).cast::<u8>() = (1i32) as u8;
35737 *base.add(12).cast::<i32>() = _rt::as_i32(e);
35738 }
35739 None => {
35740 *base.add(8).cast::<u8>() = (0i32) as u8;
35741 }
35742 };
35743 match t24_1 {
35744 Some(e) => {
35745 *base.add(16).cast::<u8>() = (1i32) as u8;
35746 *base.add(20).cast::<i32>() = _rt::as_i32(e);
35747 }
35748 None => {
35749 *base.add(16).cast::<u8>() = (0i32) as u8;
35750 }
35751 };
35752 }
35753 WitTypeNode::PrimU8Type => {
35754 *base.add(0).cast::<u8>() = (8i32) as u8;
35755 }
35756 WitTypeNode::PrimU16Type => {
35757 *base.add(0).cast::<u8>() = (9i32) as u8;
35758 }
35759 WitTypeNode::PrimU32Type => {
35760 *base.add(0).cast::<u8>() = (10i32) as u8;
35761 }
35762 WitTypeNode::PrimU64Type => {
35763 *base.add(0).cast::<u8>() = (11i32) as u8;
35764 }
35765 WitTypeNode::PrimS8Type => {
35766 *base.add(0).cast::<u8>() = (12i32) as u8;
35767 }
35768 WitTypeNode::PrimS16Type => {
35769 *base.add(0).cast::<u8>() = (13i32) as u8;
35770 }
35771 WitTypeNode::PrimS32Type => {
35772 *base.add(0).cast::<u8>() = (14i32) as u8;
35773 }
35774 WitTypeNode::PrimS64Type => {
35775 *base.add(0).cast::<u8>() = (15i32) as u8;
35776 }
35777 WitTypeNode::PrimF32Type => {
35778 *base.add(0).cast::<u8>() = (16i32) as u8;
35779 }
35780 WitTypeNode::PrimF64Type => {
35781 *base.add(0).cast::<u8>() = (17i32) as u8;
35782 }
35783 WitTypeNode::PrimCharType => {
35784 *base.add(0).cast::<u8>() = (18i32) as u8;
35785 }
35786 WitTypeNode::PrimBoolType => {
35787 *base.add(0).cast::<u8>() = (19i32) as u8;
35788 }
35789 WitTypeNode::PrimStringType => {
35790 *base.add(0).cast::<u8>() = (20i32) as u8;
35791 }
35792 WitTypeNode::HandleType(e) => {
35793 *base.add(0).cast::<u8>() = (21i32) as u8;
35794 let (t25_0, t25_1) = e;
35795 *base.add(8).cast::<i64>() = _rt::as_i64(t25_0);
35796 *base.add(16).cast::<u8>() = (t25_1.clone() as i32) as u8;
35797 }
35798 }
35799 }
35800 }
35801 let ptr27 = ret_area.0.as_mut_ptr().cast::<u8>();
35802 #[cfg(target_arch = "wasm32")]
35803 #[link(wasm_import_module = "golem:rpc/types@0.1.3")]
35804 extern "C" {
35805 #[link_name = "extract-type"]
35806 fn wit_import(
35807 _: *mut u8,
35808 _: usize,
35809 _: *mut u8,
35810 _: usize,
35811 _: *mut u8,
35812 );
35813 }
35814 #[cfg(not(target_arch = "wasm32"))]
35815 fn wit_import(
35816 _: *mut u8,
35817 _: usize,
35818 _: *mut u8,
35819 _: usize,
35820 _: *mut u8,
35821 ) {
35822 unreachable!()
35823 }
35824 wit_import(result11, len11, result26, len26, ptr27);
35825 let l28 = *ptr27.add(0).cast::<*mut u8>();
35826 let l29 = *ptr27.add(4).cast::<usize>();
35827 let base70 = l28;
35828 let len70 = l29;
35829 let mut result70 = _rt::Vec::with_capacity(len70);
35830 for i in 0..len70 {
35831 let base = base70.add(i * 24);
35832 let e70 = {
35833 let l30 = i32::from(*base.add(0).cast::<u8>());
35834 let v69 = match l30 {
35835 0 => {
35836 let e69 = {
35837 let l31 = *base.add(8).cast::<*mut u8>();
35838 let l32 = *base.add(12).cast::<usize>();
35839 let base37 = l31;
35840 let len37 = l32;
35841 let mut result37 = _rt::Vec::with_capacity(len37);
35842 for i in 0..len37 {
35843 let base = base37.add(i * 12);
35844 let e37 = {
35845 let l33 = *base.add(0).cast::<*mut u8>();
35846 let l34 = *base.add(4).cast::<usize>();
35847 let len35 = l34;
35848 let bytes35 = _rt::Vec::from_raw_parts(
35849 l33.cast(),
35850 len35,
35851 len35,
35852 );
35853 let l36 = *base.add(8).cast::<i32>();
35854 (_rt::string_lift(bytes35), l36)
35855 };
35856 result37.push(e37);
35857 }
35858 _rt::cabi_dealloc(base37, len37 * 12, 4);
35859 result37
35860 };
35861 WitTypeNode::RecordType(e69)
35862 }
35863 1 => {
35864 let e69 = {
35865 let l38 = *base.add(8).cast::<*mut u8>();
35866 let l39 = *base.add(12).cast::<usize>();
35867 let base45 = l38;
35868 let len45 = l39;
35869 let mut result45 = _rt::Vec::with_capacity(len45);
35870 for i in 0..len45 {
35871 let base = base45.add(i * 16);
35872 let e45 = {
35873 let l40 = *base.add(0).cast::<*mut u8>();
35874 let l41 = *base.add(4).cast::<usize>();
35875 let len42 = l41;
35876 let bytes42 = _rt::Vec::from_raw_parts(
35877 l40.cast(),
35878 len42,
35879 len42,
35880 );
35881 let l43 = i32::from(*base.add(8).cast::<u8>());
35882 (
35883 _rt::string_lift(bytes42),
35884 match l43 {
35885 0 => None,
35886 1 => {
35887 let e = {
35888 let l44 = *base.add(12).cast::<i32>();
35889 l44
35890 };
35891 Some(e)
35892 }
35893 _ => _rt::invalid_enum_discriminant(),
35894 },
35895 )
35896 };
35897 result45.push(e45);
35898 }
35899 _rt::cabi_dealloc(base45, len45 * 16, 4);
35900 result45
35901 };
35902 WitTypeNode::VariantType(e69)
35903 }
35904 2 => {
35905 let e69 = {
35906 let l46 = *base.add(8).cast::<*mut u8>();
35907 let l47 = *base.add(12).cast::<usize>();
35908 let base51 = l46;
35909 let len51 = l47;
35910 let mut result51 = _rt::Vec::with_capacity(len51);
35911 for i in 0..len51 {
35912 let base = base51.add(i * 8);
35913 let e51 = {
35914 let l48 = *base.add(0).cast::<*mut u8>();
35915 let l49 = *base.add(4).cast::<usize>();
35916 let len50 = l49;
35917 let bytes50 = _rt::Vec::from_raw_parts(
35918 l48.cast(),
35919 len50,
35920 len50,
35921 );
35922 _rt::string_lift(bytes50)
35923 };
35924 result51.push(e51);
35925 }
35926 _rt::cabi_dealloc(base51, len51 * 8, 4);
35927 result51
35928 };
35929 WitTypeNode::EnumType(e69)
35930 }
35931 3 => {
35932 let e69 = {
35933 let l52 = *base.add(8).cast::<*mut u8>();
35934 let l53 = *base.add(12).cast::<usize>();
35935 let base57 = l52;
35936 let len57 = l53;
35937 let mut result57 = _rt::Vec::with_capacity(len57);
35938 for i in 0..len57 {
35939 let base = base57.add(i * 8);
35940 let e57 = {
35941 let l54 = *base.add(0).cast::<*mut u8>();
35942 let l55 = *base.add(4).cast::<usize>();
35943 let len56 = l55;
35944 let bytes56 = _rt::Vec::from_raw_parts(
35945 l54.cast(),
35946 len56,
35947 len56,
35948 );
35949 _rt::string_lift(bytes56)
35950 };
35951 result57.push(e57);
35952 }
35953 _rt::cabi_dealloc(base57, len57 * 8, 4);
35954 result57
35955 };
35956 WitTypeNode::FlagsType(e69)
35957 }
35958 4 => {
35959 let e69 = {
35960 let l58 = *base.add(8).cast::<*mut u8>();
35961 let l59 = *base.add(12).cast::<usize>();
35962 let len60 = l59;
35963 _rt::Vec::from_raw_parts(l58.cast(), len60, len60)
35964 };
35965 WitTypeNode::TupleType(e69)
35966 }
35967 5 => {
35968 let e69 = {
35969 let l61 = *base.add(8).cast::<i32>();
35970 l61
35971 };
35972 WitTypeNode::ListType(e69)
35973 }
35974 6 => {
35975 let e69 = {
35976 let l62 = *base.add(8).cast::<i32>();
35977 l62
35978 };
35979 WitTypeNode::OptionType(e69)
35980 }
35981 7 => {
35982 let e69 = {
35983 let l63 = i32::from(*base.add(8).cast::<u8>());
35984 let l65 = i32::from(*base.add(16).cast::<u8>());
35985 (
35986 match l63 {
35987 0 => None,
35988 1 => {
35989 let e = {
35990 let l64 = *base.add(12).cast::<i32>();
35991 l64
35992 };
35993 Some(e)
35994 }
35995 _ => _rt::invalid_enum_discriminant(),
35996 },
35997 match l65 {
35998 0 => None,
35999 1 => {
36000 let e = {
36001 let l66 = *base.add(20).cast::<i32>();
36002 l66
36003 };
36004 Some(e)
36005 }
36006 _ => _rt::invalid_enum_discriminant(),
36007 },
36008 )
36009 };
36010 WitTypeNode::ResultType(e69)
36011 }
36012 8 => WitTypeNode::PrimU8Type,
36013 9 => WitTypeNode::PrimU16Type,
36014 10 => WitTypeNode::PrimU32Type,
36015 11 => WitTypeNode::PrimU64Type,
36016 12 => WitTypeNode::PrimS8Type,
36017 13 => WitTypeNode::PrimS16Type,
36018 14 => WitTypeNode::PrimS32Type,
36019 15 => WitTypeNode::PrimS64Type,
36020 16 => WitTypeNode::PrimF32Type,
36021 17 => WitTypeNode::PrimF64Type,
36022 18 => WitTypeNode::PrimCharType,
36023 19 => WitTypeNode::PrimBoolType,
36024 20 => WitTypeNode::PrimStringType,
36025 n => {
36026 debug_assert_eq!(n, 21, "invalid enum discriminant");
36027 let e69 = {
36028 let l67 = *base.add(8).cast::<i64>();
36029 let l68 = i32::from(*base.add(16).cast::<u8>());
36030 (l67 as u64, ResourceMode::_lift(l68 as u8))
36031 };
36032 WitTypeNode::HandleType(e69)
36033 }
36034 };
36035 v69
36036 };
36037 result70.push(e70);
36038 }
36039 _rt::cabi_dealloc(base70, len70 * 24, 8);
36040 if layout11.size() != 0 {
36041 _rt::alloc::dealloc(result11.cast(), layout11);
36042 }
36043 if layout26.size() != 0 {
36044 _rt::alloc::dealloc(result26.cast(), layout26);
36045 }
36046 for (ptr, layout) in cleanup_list {
36047 if layout.size() != 0 {
36048 _rt::alloc::dealloc(ptr.cast(), layout);
36049 }
36050 }
36051 WitType { nodes: result70 }
36052 }
36053 }
36054 }
36055 }
36056}
36057#[rustfmt::skip]
36058#[allow(dead_code, clippy::all)]
36059pub mod wasi {
36060 pub mod blobstore {
36061 /// Types used by blobstore
36062 #[allow(dead_code, clippy::all)]
36063 pub mod types {
36064 #[used]
36065 #[doc(hidden)]
36066 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
36067 use super::super::super::_rt;
36068 pub type InputStream = super::super::super::wasi::io::streams::InputStream;
36069 pub type OutputStream = super::super::super::wasi::io::streams::OutputStream;
36070 /// name of a container, a collection of objects.
36071 /// The container name may be any valid UTF-8 string.
36072 pub type ContainerName = _rt::String;
36073 /// name of an object within a container
36074 /// The object name may be any valid UTF-8 string.
36075 pub type ObjectName = _rt::String;
36076 /// TODO: define timestamp to include seconds since
36077 /// Unix epoch and nanoseconds
36078 /// https://github.com/WebAssembly/wasi-blob-store/issues/7
36079 pub type Timestamp = u64;
36080 /// size of an object, in bytes
36081 pub type ObjectSize = u64;
36082 pub type Error = _rt::String;
36083 /// information about a container
36084 #[derive(Clone)]
36085 pub struct ContainerMetadata {
36086 /// the container's name
36087 pub name: ContainerName,
36088 /// date and time container was created
36089 pub created_at: Timestamp,
36090 }
36091 impl ::core::fmt::Debug for ContainerMetadata {
36092 fn fmt(
36093 &self,
36094 f: &mut ::core::fmt::Formatter<'_>,
36095 ) -> ::core::fmt::Result {
36096 f.debug_struct("ContainerMetadata")
36097 .field("name", &self.name)
36098 .field("created-at", &self.created_at)
36099 .finish()
36100 }
36101 }
36102 /// information about an object
36103 #[derive(Clone)]
36104 pub struct ObjectMetadata {
36105 /// the object's name
36106 pub name: ObjectName,
36107 /// the object's parent container
36108 pub container: ContainerName,
36109 /// date and time the object was created
36110 pub created_at: Timestamp,
36111 /// size of the object, in bytes
36112 pub size: ObjectSize,
36113 }
36114 impl ::core::fmt::Debug for ObjectMetadata {
36115 fn fmt(
36116 &self,
36117 f: &mut ::core::fmt::Formatter<'_>,
36118 ) -> ::core::fmt::Result {
36119 f.debug_struct("ObjectMetadata")
36120 .field("name", &self.name)
36121 .field("container", &self.container)
36122 .field("created-at", &self.created_at)
36123 .field("size", &self.size)
36124 .finish()
36125 }
36126 }
36127 /// identifier for an object that includes its container name
36128 #[derive(Clone)]
36129 pub struct ObjectId {
36130 pub container: ContainerName,
36131 pub object: ObjectName,
36132 }
36133 impl ::core::fmt::Debug for ObjectId {
36134 fn fmt(
36135 &self,
36136 f: &mut ::core::fmt::Formatter<'_>,
36137 ) -> ::core::fmt::Result {
36138 f.debug_struct("ObjectId")
36139 .field("container", &self.container)
36140 .field("object", &self.object)
36141 .finish()
36142 }
36143 }
36144 /// A data is the data stored in a data blob. The value can be of any type
36145 /// that can be represented in a byte array. It provides a way to write the value
36146 /// to the output-stream defined in the `wasi-io` interface.
36147 /// Soon: switch to `resource value { ... }`
36148 #[derive(Debug)]
36149 #[repr(transparent)]
36150 pub struct OutgoingValue {
36151 handle: _rt::Resource<OutgoingValue>,
36152 }
36153 impl OutgoingValue {
36154 #[doc(hidden)]
36155 pub unsafe fn from_handle(handle: u32) -> Self {
36156 Self {
36157 handle: _rt::Resource::from_handle(handle),
36158 }
36159 }
36160 #[doc(hidden)]
36161 pub fn take_handle(&self) -> u32 {
36162 _rt::Resource::take_handle(&self.handle)
36163 }
36164 #[doc(hidden)]
36165 pub fn handle(&self) -> u32 {
36166 _rt::Resource::handle(&self.handle)
36167 }
36168 }
36169 unsafe impl _rt::WasmResource for OutgoingValue {
36170 #[inline]
36171 unsafe fn drop(_handle: u32) {
36172 #[cfg(not(target_arch = "wasm32"))]
36173 unreachable!();
36174 #[cfg(target_arch = "wasm32")]
36175 {
36176 #[link(wasm_import_module = "wasi:blobstore/types")]
36177 extern "C" {
36178 #[link_name = "[resource-drop]outgoing-value"]
36179 fn drop(_: u32);
36180 }
36181 drop(_handle);
36182 }
36183 }
36184 }
36185 /// A incoming-value is a wrapper around a value. It provides a way to read the value
36186 /// from the input-stream defined in the `wasi-io` interface.
36187 ///
36188 /// The incoming-value provides two ways to consume the value:
36189 /// 1. `incoming-value-consume-sync` consumes the value synchronously and returns the
36190 /// value as a list of bytes.
36191 /// 2. `incoming-value-consume-async` consumes the value asynchronously and returns the
36192 /// value as an input-stream.
36193 /// Soon: switch to `resource incoming-value { ... }`
36194 #[derive(Debug)]
36195 #[repr(transparent)]
36196 pub struct IncomingValue {
36197 handle: _rt::Resource<IncomingValue>,
36198 }
36199 impl IncomingValue {
36200 #[doc(hidden)]
36201 pub unsafe fn from_handle(handle: u32) -> Self {
36202 Self {
36203 handle: _rt::Resource::from_handle(handle),
36204 }
36205 }
36206 #[doc(hidden)]
36207 pub fn take_handle(&self) -> u32 {
36208 _rt::Resource::take_handle(&self.handle)
36209 }
36210 #[doc(hidden)]
36211 pub fn handle(&self) -> u32 {
36212 _rt::Resource::handle(&self.handle)
36213 }
36214 }
36215 unsafe impl _rt::WasmResource for IncomingValue {
36216 #[inline]
36217 unsafe fn drop(_handle: u32) {
36218 #[cfg(not(target_arch = "wasm32"))]
36219 unreachable!();
36220 #[cfg(target_arch = "wasm32")]
36221 {
36222 #[link(wasm_import_module = "wasi:blobstore/types")]
36223 extern "C" {
36224 #[link_name = "[resource-drop]incoming-value"]
36225 fn drop(_: u32);
36226 }
36227 drop(_handle);
36228 }
36229 }
36230 }
36231 pub type IncomingValueAsyncBody = InputStream;
36232 pub type IncomingValueSyncBody = _rt::Vec<u8>;
36233 impl OutgoingValue {
36234 #[allow(unused_unsafe, clippy::all)]
36235 pub fn new_outgoing_value() -> OutgoingValue {
36236 unsafe {
36237 #[cfg(target_arch = "wasm32")]
36238 #[link(wasm_import_module = "wasi:blobstore/types")]
36239 extern "C" {
36240 #[link_name = "[static]outgoing-value.new-outgoing-value"]
36241 fn wit_import() -> i32;
36242 }
36243 #[cfg(not(target_arch = "wasm32"))]
36244 fn wit_import() -> i32 {
36245 unreachable!()
36246 }
36247 let ret = wit_import();
36248 OutgoingValue::from_handle(ret as u32)
36249 }
36250 }
36251 }
36252 impl OutgoingValue {
36253 #[allow(unused_unsafe, clippy::all)]
36254 pub fn outgoing_value_write_body(&self) -> Result<OutputStream, ()> {
36255 unsafe {
36256 #[repr(align(4))]
36257 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
36258 let mut ret_area = RetArea(
36259 [::core::mem::MaybeUninit::uninit(); 8],
36260 );
36261 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
36262 #[cfg(target_arch = "wasm32")]
36263 #[link(wasm_import_module = "wasi:blobstore/types")]
36264 extern "C" {
36265 #[link_name = "[method]outgoing-value.outgoing-value-write-body"]
36266 fn wit_import(_: i32, _: *mut u8);
36267 }
36268 #[cfg(not(target_arch = "wasm32"))]
36269 fn wit_import(_: i32, _: *mut u8) {
36270 unreachable!()
36271 }
36272 wit_import((self).handle() as i32, ptr0);
36273 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
36274 match l1 {
36275 0 => {
36276 let e = {
36277 let l2 = *ptr0.add(4).cast::<i32>();
36278 super::super::super::wasi::io::streams::OutputStream::from_handle(
36279 l2 as u32,
36280 )
36281 };
36282 Ok(e)
36283 }
36284 1 => {
36285 let e = ();
36286 Err(e)
36287 }
36288 _ => _rt::invalid_enum_discriminant(),
36289 }
36290 }
36291 }
36292 }
36293 impl IncomingValue {
36294 #[allow(unused_unsafe, clippy::all)]
36295 pub fn incoming_value_consume_sync(
36296 &self,
36297 ) -> Result<IncomingValueSyncBody, Error> {
36298 unsafe {
36299 #[repr(align(4))]
36300 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
36301 let mut ret_area = RetArea(
36302 [::core::mem::MaybeUninit::uninit(); 12],
36303 );
36304 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
36305 #[cfg(target_arch = "wasm32")]
36306 #[link(wasm_import_module = "wasi:blobstore/types")]
36307 extern "C" {
36308 #[link_name = "[method]incoming-value.incoming-value-consume-sync"]
36309 fn wit_import(_: i32, _: *mut u8);
36310 }
36311 #[cfg(not(target_arch = "wasm32"))]
36312 fn wit_import(_: i32, _: *mut u8) {
36313 unreachable!()
36314 }
36315 wit_import((self).handle() as i32, ptr0);
36316 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
36317 match l1 {
36318 0 => {
36319 let e = {
36320 let l2 = *ptr0.add(4).cast::<*mut u8>();
36321 let l3 = *ptr0.add(8).cast::<usize>();
36322 let len4 = l3;
36323 _rt::Vec::from_raw_parts(l2.cast(), len4, len4)
36324 };
36325 Ok(e)
36326 }
36327 1 => {
36328 let e = {
36329 let l5 = *ptr0.add(4).cast::<*mut u8>();
36330 let l6 = *ptr0.add(8).cast::<usize>();
36331 let len7 = l6;
36332 let bytes7 = _rt::Vec::from_raw_parts(
36333 l5.cast(),
36334 len7,
36335 len7,
36336 );
36337 _rt::string_lift(bytes7)
36338 };
36339 Err(e)
36340 }
36341 _ => _rt::invalid_enum_discriminant(),
36342 }
36343 }
36344 }
36345 }
36346 impl IncomingValue {
36347 #[allow(unused_unsafe, clippy::all)]
36348 pub fn incoming_value_consume_async(
36349 &self,
36350 ) -> Result<IncomingValueAsyncBody, Error> {
36351 unsafe {
36352 #[repr(align(4))]
36353 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
36354 let mut ret_area = RetArea(
36355 [::core::mem::MaybeUninit::uninit(); 12],
36356 );
36357 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
36358 #[cfg(target_arch = "wasm32")]
36359 #[link(wasm_import_module = "wasi:blobstore/types")]
36360 extern "C" {
36361 #[link_name = "[method]incoming-value.incoming-value-consume-async"]
36362 fn wit_import(_: i32, _: *mut u8);
36363 }
36364 #[cfg(not(target_arch = "wasm32"))]
36365 fn wit_import(_: i32, _: *mut u8) {
36366 unreachable!()
36367 }
36368 wit_import((self).handle() as i32, ptr0);
36369 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
36370 match l1 {
36371 0 => {
36372 let e = {
36373 let l2 = *ptr0.add(4).cast::<i32>();
36374 super::super::super::wasi::io::streams::InputStream::from_handle(
36375 l2 as u32,
36376 )
36377 };
36378 Ok(e)
36379 }
36380 1 => {
36381 let e = {
36382 let l3 = *ptr0.add(4).cast::<*mut u8>();
36383 let l4 = *ptr0.add(8).cast::<usize>();
36384 let len5 = l4;
36385 let bytes5 = _rt::Vec::from_raw_parts(
36386 l3.cast(),
36387 len5,
36388 len5,
36389 );
36390 _rt::string_lift(bytes5)
36391 };
36392 Err(e)
36393 }
36394 _ => _rt::invalid_enum_discriminant(),
36395 }
36396 }
36397 }
36398 }
36399 impl IncomingValue {
36400 #[allow(unused_unsafe, clippy::all)]
36401 pub fn size(&self) -> u64 {
36402 unsafe {
36403 #[cfg(target_arch = "wasm32")]
36404 #[link(wasm_import_module = "wasi:blobstore/types")]
36405 extern "C" {
36406 #[link_name = "[method]incoming-value.size"]
36407 fn wit_import(_: i32) -> i64;
36408 }
36409 #[cfg(not(target_arch = "wasm32"))]
36410 fn wit_import(_: i32) -> i64 {
36411 unreachable!()
36412 }
36413 let ret = wit_import((self).handle() as i32);
36414 ret as u64
36415 }
36416 }
36417 }
36418 }
36419 /// a Container is a collection of objects
36420 #[allow(dead_code, clippy::all)]
36421 pub mod container {
36422 #[used]
36423 #[doc(hidden)]
36424 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
36425 use super::super::super::_rt;
36426 pub type ContainerMetadata = super::super::super::wasi::blobstore::types::ContainerMetadata;
36427 pub type Error = super::super::super::wasi::blobstore::types::Error;
36428 pub type IncomingValue = super::super::super::wasi::blobstore::types::IncomingValue;
36429 pub type ObjectMetadata = super::super::super::wasi::blobstore::types::ObjectMetadata;
36430 pub type ObjectName = super::super::super::wasi::blobstore::types::ObjectName;
36431 pub type OutgoingValue = super::super::super::wasi::blobstore::types::OutgoingValue;
36432 /// this defines the `container` resource
36433 #[derive(Debug)]
36434 #[repr(transparent)]
36435 pub struct Container {
36436 handle: _rt::Resource<Container>,
36437 }
36438 impl Container {
36439 #[doc(hidden)]
36440 pub unsafe fn from_handle(handle: u32) -> Self {
36441 Self {
36442 handle: _rt::Resource::from_handle(handle),
36443 }
36444 }
36445 #[doc(hidden)]
36446 pub fn take_handle(&self) -> u32 {
36447 _rt::Resource::take_handle(&self.handle)
36448 }
36449 #[doc(hidden)]
36450 pub fn handle(&self) -> u32 {
36451 _rt::Resource::handle(&self.handle)
36452 }
36453 }
36454 unsafe impl _rt::WasmResource for Container {
36455 #[inline]
36456 unsafe fn drop(_handle: u32) {
36457 #[cfg(not(target_arch = "wasm32"))]
36458 unreachable!();
36459 #[cfg(target_arch = "wasm32")]
36460 {
36461 #[link(wasm_import_module = "wasi:blobstore/container")]
36462 extern "C" {
36463 #[link_name = "[resource-drop]container"]
36464 fn drop(_: u32);
36465 }
36466 drop(_handle);
36467 }
36468 }
36469 }
36470 /// this defines the `stream-object-names` resource which is a representation of stream<object-name>
36471 #[derive(Debug)]
36472 #[repr(transparent)]
36473 pub struct StreamObjectNames {
36474 handle: _rt::Resource<StreamObjectNames>,
36475 }
36476 impl StreamObjectNames {
36477 #[doc(hidden)]
36478 pub unsafe fn from_handle(handle: u32) -> Self {
36479 Self {
36480 handle: _rt::Resource::from_handle(handle),
36481 }
36482 }
36483 #[doc(hidden)]
36484 pub fn take_handle(&self) -> u32 {
36485 _rt::Resource::take_handle(&self.handle)
36486 }
36487 #[doc(hidden)]
36488 pub fn handle(&self) -> u32 {
36489 _rt::Resource::handle(&self.handle)
36490 }
36491 }
36492 unsafe impl _rt::WasmResource for StreamObjectNames {
36493 #[inline]
36494 unsafe fn drop(_handle: u32) {
36495 #[cfg(not(target_arch = "wasm32"))]
36496 unreachable!();
36497 #[cfg(target_arch = "wasm32")]
36498 {
36499 #[link(wasm_import_module = "wasi:blobstore/container")]
36500 extern "C" {
36501 #[link_name = "[resource-drop]stream-object-names"]
36502 fn drop(_: u32);
36503 }
36504 drop(_handle);
36505 }
36506 }
36507 }
36508 impl Container {
36509 #[allow(unused_unsafe, clippy::all)]
36510 /// returns container name
36511 pub fn name(&self) -> Result<_rt::String, Error> {
36512 unsafe {
36513 #[repr(align(4))]
36514 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
36515 let mut ret_area = RetArea(
36516 [::core::mem::MaybeUninit::uninit(); 12],
36517 );
36518 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
36519 #[cfg(target_arch = "wasm32")]
36520 #[link(wasm_import_module = "wasi:blobstore/container")]
36521 extern "C" {
36522 #[link_name = "[method]container.name"]
36523 fn wit_import(_: i32, _: *mut u8);
36524 }
36525 #[cfg(not(target_arch = "wasm32"))]
36526 fn wit_import(_: i32, _: *mut u8) {
36527 unreachable!()
36528 }
36529 wit_import((self).handle() as i32, ptr0);
36530 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
36531 match l1 {
36532 0 => {
36533 let e = {
36534 let l2 = *ptr0.add(4).cast::<*mut u8>();
36535 let l3 = *ptr0.add(8).cast::<usize>();
36536 let len4 = l3;
36537 let bytes4 = _rt::Vec::from_raw_parts(
36538 l2.cast(),
36539 len4,
36540 len4,
36541 );
36542 _rt::string_lift(bytes4)
36543 };
36544 Ok(e)
36545 }
36546 1 => {
36547 let e = {
36548 let l5 = *ptr0.add(4).cast::<*mut u8>();
36549 let l6 = *ptr0.add(8).cast::<usize>();
36550 let len7 = l6;
36551 let bytes7 = _rt::Vec::from_raw_parts(
36552 l5.cast(),
36553 len7,
36554 len7,
36555 );
36556 _rt::string_lift(bytes7)
36557 };
36558 Err(e)
36559 }
36560 _ => _rt::invalid_enum_discriminant(),
36561 }
36562 }
36563 }
36564 }
36565 impl Container {
36566 #[allow(unused_unsafe, clippy::all)]
36567 /// returns container metadata
36568 pub fn info(&self) -> Result<ContainerMetadata, Error> {
36569 unsafe {
36570 #[repr(align(8))]
36571 struct RetArea([::core::mem::MaybeUninit<u8>; 24]);
36572 let mut ret_area = RetArea(
36573 [::core::mem::MaybeUninit::uninit(); 24],
36574 );
36575 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
36576 #[cfg(target_arch = "wasm32")]
36577 #[link(wasm_import_module = "wasi:blobstore/container")]
36578 extern "C" {
36579 #[link_name = "[method]container.info"]
36580 fn wit_import(_: i32, _: *mut u8);
36581 }
36582 #[cfg(not(target_arch = "wasm32"))]
36583 fn wit_import(_: i32, _: *mut u8) {
36584 unreachable!()
36585 }
36586 wit_import((self).handle() as i32, ptr0);
36587 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
36588 match l1 {
36589 0 => {
36590 let e = {
36591 let l2 = *ptr0.add(8).cast::<*mut u8>();
36592 let l3 = *ptr0.add(12).cast::<usize>();
36593 let len4 = l3;
36594 let bytes4 = _rt::Vec::from_raw_parts(
36595 l2.cast(),
36596 len4,
36597 len4,
36598 );
36599 let l5 = *ptr0.add(16).cast::<i64>();
36600 super::super::super::wasi::blobstore::types::ContainerMetadata {
36601 name: _rt::string_lift(bytes4),
36602 created_at: l5 as u64,
36603 }
36604 };
36605 Ok(e)
36606 }
36607 1 => {
36608 let e = {
36609 let l6 = *ptr0.add(8).cast::<*mut u8>();
36610 let l7 = *ptr0.add(12).cast::<usize>();
36611 let len8 = l7;
36612 let bytes8 = _rt::Vec::from_raw_parts(
36613 l6.cast(),
36614 len8,
36615 len8,
36616 );
36617 _rt::string_lift(bytes8)
36618 };
36619 Err(e)
36620 }
36621 _ => _rt::invalid_enum_discriminant(),
36622 }
36623 }
36624 }
36625 }
36626 impl Container {
36627 #[allow(unused_unsafe, clippy::all)]
36628 /// retrieves an object or portion of an object, as a resource.
36629 /// Start and end offsets are inclusive.
36630 /// Once a data-blob resource has been created, the underlying bytes are held by the blobstore service for the lifetime
36631 /// of the data-blob resource, even if the object they came from is later deleted.
36632 pub fn get_data(
36633 &self,
36634 name: &ObjectName,
36635 start: u64,
36636 end: u64,
36637 ) -> Result<IncomingValue, Error> {
36638 unsafe {
36639 #[repr(align(4))]
36640 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
36641 let mut ret_area = RetArea(
36642 [::core::mem::MaybeUninit::uninit(); 12],
36643 );
36644 let vec0 = name;
36645 let ptr0 = vec0.as_ptr().cast::<u8>();
36646 let len0 = vec0.len();
36647 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
36648 #[cfg(target_arch = "wasm32")]
36649 #[link(wasm_import_module = "wasi:blobstore/container")]
36650 extern "C" {
36651 #[link_name = "[method]container.get-data"]
36652 fn wit_import(
36653 _: i32,
36654 _: *mut u8,
36655 _: usize,
36656 _: i64,
36657 _: i64,
36658 _: *mut u8,
36659 );
36660 }
36661 #[cfg(not(target_arch = "wasm32"))]
36662 fn wit_import(
36663 _: i32,
36664 _: *mut u8,
36665 _: usize,
36666 _: i64,
36667 _: i64,
36668 _: *mut u8,
36669 ) {
36670 unreachable!()
36671 }
36672 wit_import(
36673 (self).handle() as i32,
36674 ptr0.cast_mut(),
36675 len0,
36676 _rt::as_i64(&start),
36677 _rt::as_i64(&end),
36678 ptr1,
36679 );
36680 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
36681 match l2 {
36682 0 => {
36683 let e = {
36684 let l3 = *ptr1.add(4).cast::<i32>();
36685 super::super::super::wasi::blobstore::types::IncomingValue::from_handle(
36686 l3 as u32,
36687 )
36688 };
36689 Ok(e)
36690 }
36691 1 => {
36692 let e = {
36693 let l4 = *ptr1.add(4).cast::<*mut u8>();
36694 let l5 = *ptr1.add(8).cast::<usize>();
36695 let len6 = l5;
36696 let bytes6 = _rt::Vec::from_raw_parts(
36697 l4.cast(),
36698 len6,
36699 len6,
36700 );
36701 _rt::string_lift(bytes6)
36702 };
36703 Err(e)
36704 }
36705 _ => _rt::invalid_enum_discriminant(),
36706 }
36707 }
36708 }
36709 }
36710 impl Container {
36711 #[allow(unused_unsafe, clippy::all)]
36712 /// creates or replaces an object with the data blob.
36713 pub fn write_data(
36714 &self,
36715 name: &ObjectName,
36716 data: &OutgoingValue,
36717 ) -> Result<(), Error> {
36718 unsafe {
36719 #[repr(align(4))]
36720 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
36721 let mut ret_area = RetArea(
36722 [::core::mem::MaybeUninit::uninit(); 12],
36723 );
36724 let vec0 = name;
36725 let ptr0 = vec0.as_ptr().cast::<u8>();
36726 let len0 = vec0.len();
36727 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
36728 #[cfg(target_arch = "wasm32")]
36729 #[link(wasm_import_module = "wasi:blobstore/container")]
36730 extern "C" {
36731 #[link_name = "[method]container.write-data"]
36732 fn wit_import(
36733 _: i32,
36734 _: *mut u8,
36735 _: usize,
36736 _: i32,
36737 _: *mut u8,
36738 );
36739 }
36740 #[cfg(not(target_arch = "wasm32"))]
36741 fn wit_import(_: i32, _: *mut u8, _: usize, _: i32, _: *mut u8) {
36742 unreachable!()
36743 }
36744 wit_import(
36745 (self).handle() as i32,
36746 ptr0.cast_mut(),
36747 len0,
36748 (data).handle() as i32,
36749 ptr1,
36750 );
36751 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
36752 match l2 {
36753 0 => {
36754 let e = ();
36755 Ok(e)
36756 }
36757 1 => {
36758 let e = {
36759 let l3 = *ptr1.add(4).cast::<*mut u8>();
36760 let l4 = *ptr1.add(8).cast::<usize>();
36761 let len5 = l4;
36762 let bytes5 = _rt::Vec::from_raw_parts(
36763 l3.cast(),
36764 len5,
36765 len5,
36766 );
36767 _rt::string_lift(bytes5)
36768 };
36769 Err(e)
36770 }
36771 _ => _rt::invalid_enum_discriminant(),
36772 }
36773 }
36774 }
36775 }
36776 impl Container {
36777 #[allow(unused_unsafe, clippy::all)]
36778 /// returns list of objects in the container. Order is undefined.
36779 pub fn list_objects(&self) -> Result<StreamObjectNames, Error> {
36780 unsafe {
36781 #[repr(align(4))]
36782 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
36783 let mut ret_area = RetArea(
36784 [::core::mem::MaybeUninit::uninit(); 12],
36785 );
36786 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
36787 #[cfg(target_arch = "wasm32")]
36788 #[link(wasm_import_module = "wasi:blobstore/container")]
36789 extern "C" {
36790 #[link_name = "[method]container.list-objects"]
36791 fn wit_import(_: i32, _: *mut u8);
36792 }
36793 #[cfg(not(target_arch = "wasm32"))]
36794 fn wit_import(_: i32, _: *mut u8) {
36795 unreachable!()
36796 }
36797 wit_import((self).handle() as i32, ptr0);
36798 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
36799 match l1 {
36800 0 => {
36801 let e = {
36802 let l2 = *ptr0.add(4).cast::<i32>();
36803 StreamObjectNames::from_handle(l2 as u32)
36804 };
36805 Ok(e)
36806 }
36807 1 => {
36808 let e = {
36809 let l3 = *ptr0.add(4).cast::<*mut u8>();
36810 let l4 = *ptr0.add(8).cast::<usize>();
36811 let len5 = l4;
36812 let bytes5 = _rt::Vec::from_raw_parts(
36813 l3.cast(),
36814 len5,
36815 len5,
36816 );
36817 _rt::string_lift(bytes5)
36818 };
36819 Err(e)
36820 }
36821 _ => _rt::invalid_enum_discriminant(),
36822 }
36823 }
36824 }
36825 }
36826 impl Container {
36827 #[allow(unused_unsafe, clippy::all)]
36828 /// deletes object.
36829 /// does not return error if object did not exist.
36830 pub fn delete_object(&self, name: &ObjectName) -> Result<(), Error> {
36831 unsafe {
36832 #[repr(align(4))]
36833 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
36834 let mut ret_area = RetArea(
36835 [::core::mem::MaybeUninit::uninit(); 12],
36836 );
36837 let vec0 = name;
36838 let ptr0 = vec0.as_ptr().cast::<u8>();
36839 let len0 = vec0.len();
36840 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
36841 #[cfg(target_arch = "wasm32")]
36842 #[link(wasm_import_module = "wasi:blobstore/container")]
36843 extern "C" {
36844 #[link_name = "[method]container.delete-object"]
36845 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
36846 }
36847 #[cfg(not(target_arch = "wasm32"))]
36848 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
36849 unreachable!()
36850 }
36851 wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
36852 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
36853 match l2 {
36854 0 => {
36855 let e = ();
36856 Ok(e)
36857 }
36858 1 => {
36859 let e = {
36860 let l3 = *ptr1.add(4).cast::<*mut u8>();
36861 let l4 = *ptr1.add(8).cast::<usize>();
36862 let len5 = l4;
36863 let bytes5 = _rt::Vec::from_raw_parts(
36864 l3.cast(),
36865 len5,
36866 len5,
36867 );
36868 _rt::string_lift(bytes5)
36869 };
36870 Err(e)
36871 }
36872 _ => _rt::invalid_enum_discriminant(),
36873 }
36874 }
36875 }
36876 }
36877 impl Container {
36878 #[allow(unused_unsafe, clippy::all)]
36879 /// deletes multiple objects in the container
36880 pub fn delete_objects(&self, names: &[ObjectName]) -> Result<(), Error> {
36881 unsafe {
36882 #[repr(align(4))]
36883 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
36884 let mut ret_area = RetArea(
36885 [::core::mem::MaybeUninit::uninit(); 12],
36886 );
36887 let vec1 = names;
36888 let len1 = vec1.len();
36889 let layout1 = _rt::alloc::Layout::from_size_align_unchecked(
36890 vec1.len() * 8,
36891 4,
36892 );
36893 let result1 = if layout1.size() != 0 {
36894 let ptr = _rt::alloc::alloc(layout1).cast::<u8>();
36895 if ptr.is_null() {
36896 _rt::alloc::handle_alloc_error(layout1);
36897 }
36898 ptr
36899 } else {
36900 ::core::ptr::null_mut()
36901 };
36902 for (i, e) in vec1.into_iter().enumerate() {
36903 let base = result1.add(i * 8);
36904 {
36905 let vec0 = e;
36906 let ptr0 = vec0.as_ptr().cast::<u8>();
36907 let len0 = vec0.len();
36908 *base.add(4).cast::<usize>() = len0;
36909 *base.add(0).cast::<*mut u8>() = ptr0.cast_mut();
36910 }
36911 }
36912 let ptr2 = ret_area.0.as_mut_ptr().cast::<u8>();
36913 #[cfg(target_arch = "wasm32")]
36914 #[link(wasm_import_module = "wasi:blobstore/container")]
36915 extern "C" {
36916 #[link_name = "[method]container.delete-objects"]
36917 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
36918 }
36919 #[cfg(not(target_arch = "wasm32"))]
36920 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
36921 unreachable!()
36922 }
36923 wit_import((self).handle() as i32, result1, len1, ptr2);
36924 let l3 = i32::from(*ptr2.add(0).cast::<u8>());
36925 if layout1.size() != 0 {
36926 _rt::alloc::dealloc(result1.cast(), layout1);
36927 }
36928 match l3 {
36929 0 => {
36930 let e = ();
36931 Ok(e)
36932 }
36933 1 => {
36934 let e = {
36935 let l4 = *ptr2.add(4).cast::<*mut u8>();
36936 let l5 = *ptr2.add(8).cast::<usize>();
36937 let len6 = l5;
36938 let bytes6 = _rt::Vec::from_raw_parts(
36939 l4.cast(),
36940 len6,
36941 len6,
36942 );
36943 _rt::string_lift(bytes6)
36944 };
36945 Err(e)
36946 }
36947 _ => _rt::invalid_enum_discriminant(),
36948 }
36949 }
36950 }
36951 }
36952 impl Container {
36953 #[allow(unused_unsafe, clippy::all)]
36954 /// returns true if the object exists in this container
36955 pub fn has_object(&self, name: &ObjectName) -> Result<bool, Error> {
36956 unsafe {
36957 #[repr(align(4))]
36958 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
36959 let mut ret_area = RetArea(
36960 [::core::mem::MaybeUninit::uninit(); 12],
36961 );
36962 let vec0 = name;
36963 let ptr0 = vec0.as_ptr().cast::<u8>();
36964 let len0 = vec0.len();
36965 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
36966 #[cfg(target_arch = "wasm32")]
36967 #[link(wasm_import_module = "wasi:blobstore/container")]
36968 extern "C" {
36969 #[link_name = "[method]container.has-object"]
36970 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
36971 }
36972 #[cfg(not(target_arch = "wasm32"))]
36973 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
36974 unreachable!()
36975 }
36976 wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
36977 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
36978 match l2 {
36979 0 => {
36980 let e = {
36981 let l3 = i32::from(*ptr1.add(4).cast::<u8>());
36982 _rt::bool_lift(l3 as u8)
36983 };
36984 Ok(e)
36985 }
36986 1 => {
36987 let e = {
36988 let l4 = *ptr1.add(4).cast::<*mut u8>();
36989 let l5 = *ptr1.add(8).cast::<usize>();
36990 let len6 = l5;
36991 let bytes6 = _rt::Vec::from_raw_parts(
36992 l4.cast(),
36993 len6,
36994 len6,
36995 );
36996 _rt::string_lift(bytes6)
36997 };
36998 Err(e)
36999 }
37000 _ => _rt::invalid_enum_discriminant(),
37001 }
37002 }
37003 }
37004 }
37005 impl Container {
37006 #[allow(unused_unsafe, clippy::all)]
37007 /// returns metadata for the object
37008 pub fn object_info(
37009 &self,
37010 name: &ObjectName,
37011 ) -> Result<ObjectMetadata, Error> {
37012 unsafe {
37013 #[repr(align(8))]
37014 struct RetArea([::core::mem::MaybeUninit<u8>; 40]);
37015 let mut ret_area = RetArea(
37016 [::core::mem::MaybeUninit::uninit(); 40],
37017 );
37018 let vec0 = name;
37019 let ptr0 = vec0.as_ptr().cast::<u8>();
37020 let len0 = vec0.len();
37021 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
37022 #[cfg(target_arch = "wasm32")]
37023 #[link(wasm_import_module = "wasi:blobstore/container")]
37024 extern "C" {
37025 #[link_name = "[method]container.object-info"]
37026 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
37027 }
37028 #[cfg(not(target_arch = "wasm32"))]
37029 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
37030 unreachable!()
37031 }
37032 wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
37033 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
37034 match l2 {
37035 0 => {
37036 let e = {
37037 let l3 = *ptr1.add(8).cast::<*mut u8>();
37038 let l4 = *ptr1.add(12).cast::<usize>();
37039 let len5 = l4;
37040 let bytes5 = _rt::Vec::from_raw_parts(
37041 l3.cast(),
37042 len5,
37043 len5,
37044 );
37045 let l6 = *ptr1.add(16).cast::<*mut u8>();
37046 let l7 = *ptr1.add(20).cast::<usize>();
37047 let len8 = l7;
37048 let bytes8 = _rt::Vec::from_raw_parts(
37049 l6.cast(),
37050 len8,
37051 len8,
37052 );
37053 let l9 = *ptr1.add(24).cast::<i64>();
37054 let l10 = *ptr1.add(32).cast::<i64>();
37055 super::super::super::wasi::blobstore::types::ObjectMetadata {
37056 name: _rt::string_lift(bytes5),
37057 container: _rt::string_lift(bytes8),
37058 created_at: l9 as u64,
37059 size: l10 as u64,
37060 }
37061 };
37062 Ok(e)
37063 }
37064 1 => {
37065 let e = {
37066 let l11 = *ptr1.add(8).cast::<*mut u8>();
37067 let l12 = *ptr1.add(12).cast::<usize>();
37068 let len13 = l12;
37069 let bytes13 = _rt::Vec::from_raw_parts(
37070 l11.cast(),
37071 len13,
37072 len13,
37073 );
37074 _rt::string_lift(bytes13)
37075 };
37076 Err(e)
37077 }
37078 _ => _rt::invalid_enum_discriminant(),
37079 }
37080 }
37081 }
37082 }
37083 impl Container {
37084 #[allow(unused_unsafe, clippy::all)]
37085 /// removes all objects within the container, leaving the container empty.
37086 pub fn clear(&self) -> Result<(), Error> {
37087 unsafe {
37088 #[repr(align(4))]
37089 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
37090 let mut ret_area = RetArea(
37091 [::core::mem::MaybeUninit::uninit(); 12],
37092 );
37093 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
37094 #[cfg(target_arch = "wasm32")]
37095 #[link(wasm_import_module = "wasi:blobstore/container")]
37096 extern "C" {
37097 #[link_name = "[method]container.clear"]
37098 fn wit_import(_: i32, _: *mut u8);
37099 }
37100 #[cfg(not(target_arch = "wasm32"))]
37101 fn wit_import(_: i32, _: *mut u8) {
37102 unreachable!()
37103 }
37104 wit_import((self).handle() as i32, ptr0);
37105 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
37106 match l1 {
37107 0 => {
37108 let e = ();
37109 Ok(e)
37110 }
37111 1 => {
37112 let e = {
37113 let l2 = *ptr0.add(4).cast::<*mut u8>();
37114 let l3 = *ptr0.add(8).cast::<usize>();
37115 let len4 = l3;
37116 let bytes4 = _rt::Vec::from_raw_parts(
37117 l2.cast(),
37118 len4,
37119 len4,
37120 );
37121 _rt::string_lift(bytes4)
37122 };
37123 Err(e)
37124 }
37125 _ => _rt::invalid_enum_discriminant(),
37126 }
37127 }
37128 }
37129 }
37130 impl StreamObjectNames {
37131 #[allow(unused_unsafe, clippy::all)]
37132 /// reads the next number of objects from the stream
37133 ///
37134 /// This function returns the list of objects read, and a boolean indicating if the end of the stream was reached.
37135 pub fn read_stream_object_names(
37136 &self,
37137 len: u64,
37138 ) -> Result<(_rt::Vec<ObjectName>, bool), Error> {
37139 unsafe {
37140 #[repr(align(4))]
37141 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
37142 let mut ret_area = RetArea(
37143 [::core::mem::MaybeUninit::uninit(); 16],
37144 );
37145 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
37146 #[cfg(target_arch = "wasm32")]
37147 #[link(wasm_import_module = "wasi:blobstore/container")]
37148 extern "C" {
37149 #[link_name = "[method]stream-object-names.read-stream-object-names"]
37150 fn wit_import(_: i32, _: i64, _: *mut u8);
37151 }
37152 #[cfg(not(target_arch = "wasm32"))]
37153 fn wit_import(_: i32, _: i64, _: *mut u8) {
37154 unreachable!()
37155 }
37156 wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0);
37157 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
37158 match l1 {
37159 0 => {
37160 let e = {
37161 let l2 = *ptr0.add(4).cast::<*mut u8>();
37162 let l3 = *ptr0.add(8).cast::<usize>();
37163 let base7 = l2;
37164 let len7 = l3;
37165 let mut result7 = _rt::Vec::with_capacity(len7);
37166 for i in 0..len7 {
37167 let base = base7.add(i * 8);
37168 let e7 = {
37169 let l4 = *base.add(0).cast::<*mut u8>();
37170 let l5 = *base.add(4).cast::<usize>();
37171 let len6 = l5;
37172 let bytes6 = _rt::Vec::from_raw_parts(
37173 l4.cast(),
37174 len6,
37175 len6,
37176 );
37177 _rt::string_lift(bytes6)
37178 };
37179 result7.push(e7);
37180 }
37181 _rt::cabi_dealloc(base7, len7 * 8, 4);
37182 let l8 = i32::from(*ptr0.add(12).cast::<u8>());
37183 (result7, _rt::bool_lift(l8 as u8))
37184 };
37185 Ok(e)
37186 }
37187 1 => {
37188 let e = {
37189 let l9 = *ptr0.add(4).cast::<*mut u8>();
37190 let l10 = *ptr0.add(8).cast::<usize>();
37191 let len11 = l10;
37192 let bytes11 = _rt::Vec::from_raw_parts(
37193 l9.cast(),
37194 len11,
37195 len11,
37196 );
37197 _rt::string_lift(bytes11)
37198 };
37199 Err(e)
37200 }
37201 _ => _rt::invalid_enum_discriminant(),
37202 }
37203 }
37204 }
37205 }
37206 impl StreamObjectNames {
37207 #[allow(unused_unsafe, clippy::all)]
37208 /// skip the next number of objects in the stream
37209 ///
37210 /// This function returns the number of objects skipped, and a boolean indicating if the end of the stream was reached.
37211 pub fn skip_stream_object_names(
37212 &self,
37213 num: u64,
37214 ) -> Result<(u64, bool), Error> {
37215 unsafe {
37216 #[repr(align(8))]
37217 struct RetArea([::core::mem::MaybeUninit<u8>; 24]);
37218 let mut ret_area = RetArea(
37219 [::core::mem::MaybeUninit::uninit(); 24],
37220 );
37221 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
37222 #[cfg(target_arch = "wasm32")]
37223 #[link(wasm_import_module = "wasi:blobstore/container")]
37224 extern "C" {
37225 #[link_name = "[method]stream-object-names.skip-stream-object-names"]
37226 fn wit_import(_: i32, _: i64, _: *mut u8);
37227 }
37228 #[cfg(not(target_arch = "wasm32"))]
37229 fn wit_import(_: i32, _: i64, _: *mut u8) {
37230 unreachable!()
37231 }
37232 wit_import((self).handle() as i32, _rt::as_i64(&num), ptr0);
37233 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
37234 match l1 {
37235 0 => {
37236 let e = {
37237 let l2 = *ptr0.add(8).cast::<i64>();
37238 let l3 = i32::from(*ptr0.add(16).cast::<u8>());
37239 (l2 as u64, _rt::bool_lift(l3 as u8))
37240 };
37241 Ok(e)
37242 }
37243 1 => {
37244 let e = {
37245 let l4 = *ptr0.add(8).cast::<*mut u8>();
37246 let l5 = *ptr0.add(12).cast::<usize>();
37247 let len6 = l5;
37248 let bytes6 = _rt::Vec::from_raw_parts(
37249 l4.cast(),
37250 len6,
37251 len6,
37252 );
37253 _rt::string_lift(bytes6)
37254 };
37255 Err(e)
37256 }
37257 _ => _rt::invalid_enum_discriminant(),
37258 }
37259 }
37260 }
37261 }
37262 }
37263 /// wasi-cloud Blobstore service definition
37264 #[allow(dead_code, clippy::all)]
37265 pub mod blobstore {
37266 #[used]
37267 #[doc(hidden)]
37268 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
37269 use super::super::super::_rt;
37270 pub type Container = super::super::super::wasi::blobstore::container::Container;
37271 pub type Error = super::super::super::wasi::blobstore::types::Error;
37272 pub type ContainerName = super::super::super::wasi::blobstore::types::ContainerName;
37273 pub type ObjectId = super::super::super::wasi::blobstore::types::ObjectId;
37274 #[allow(unused_unsafe, clippy::all)]
37275 /// creates a new empty container
37276 pub fn create_container(name: &ContainerName) -> Result<Container, Error> {
37277 unsafe {
37278 #[repr(align(4))]
37279 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
37280 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]);
37281 let vec0 = name;
37282 let ptr0 = vec0.as_ptr().cast::<u8>();
37283 let len0 = vec0.len();
37284 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
37285 #[cfg(target_arch = "wasm32")]
37286 #[link(wasm_import_module = "wasi:blobstore/blobstore")]
37287 extern "C" {
37288 #[link_name = "create-container"]
37289 fn wit_import(_: *mut u8, _: usize, _: *mut u8);
37290 }
37291 #[cfg(not(target_arch = "wasm32"))]
37292 fn wit_import(_: *mut u8, _: usize, _: *mut u8) {
37293 unreachable!()
37294 }
37295 wit_import(ptr0.cast_mut(), len0, ptr1);
37296 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
37297 match l2 {
37298 0 => {
37299 let e = {
37300 let l3 = *ptr1.add(4).cast::<i32>();
37301 super::super::super::wasi::blobstore::container::Container::from_handle(
37302 l3 as u32,
37303 )
37304 };
37305 Ok(e)
37306 }
37307 1 => {
37308 let e = {
37309 let l4 = *ptr1.add(4).cast::<*mut u8>();
37310 let l5 = *ptr1.add(8).cast::<usize>();
37311 let len6 = l5;
37312 let bytes6 = _rt::Vec::from_raw_parts(
37313 l4.cast(),
37314 len6,
37315 len6,
37316 );
37317 _rt::string_lift(bytes6)
37318 };
37319 Err(e)
37320 }
37321 _ => _rt::invalid_enum_discriminant(),
37322 }
37323 }
37324 }
37325 #[allow(unused_unsafe, clippy::all)]
37326 /// retrieves a container by name
37327 pub fn get_container(name: &ContainerName) -> Result<Container, Error> {
37328 unsafe {
37329 #[repr(align(4))]
37330 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
37331 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]);
37332 let vec0 = name;
37333 let ptr0 = vec0.as_ptr().cast::<u8>();
37334 let len0 = vec0.len();
37335 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
37336 #[cfg(target_arch = "wasm32")]
37337 #[link(wasm_import_module = "wasi:blobstore/blobstore")]
37338 extern "C" {
37339 #[link_name = "get-container"]
37340 fn wit_import(_: *mut u8, _: usize, _: *mut u8);
37341 }
37342 #[cfg(not(target_arch = "wasm32"))]
37343 fn wit_import(_: *mut u8, _: usize, _: *mut u8) {
37344 unreachable!()
37345 }
37346 wit_import(ptr0.cast_mut(), len0, ptr1);
37347 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
37348 match l2 {
37349 0 => {
37350 let e = {
37351 let l3 = *ptr1.add(4).cast::<i32>();
37352 super::super::super::wasi::blobstore::container::Container::from_handle(
37353 l3 as u32,
37354 )
37355 };
37356 Ok(e)
37357 }
37358 1 => {
37359 let e = {
37360 let l4 = *ptr1.add(4).cast::<*mut u8>();
37361 let l5 = *ptr1.add(8).cast::<usize>();
37362 let len6 = l5;
37363 let bytes6 = _rt::Vec::from_raw_parts(
37364 l4.cast(),
37365 len6,
37366 len6,
37367 );
37368 _rt::string_lift(bytes6)
37369 };
37370 Err(e)
37371 }
37372 _ => _rt::invalid_enum_discriminant(),
37373 }
37374 }
37375 }
37376 #[allow(unused_unsafe, clippy::all)]
37377 /// deletes a container and all objects within it
37378 pub fn delete_container(name: &ContainerName) -> Result<(), Error> {
37379 unsafe {
37380 #[repr(align(4))]
37381 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
37382 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]);
37383 let vec0 = name;
37384 let ptr0 = vec0.as_ptr().cast::<u8>();
37385 let len0 = vec0.len();
37386 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
37387 #[cfg(target_arch = "wasm32")]
37388 #[link(wasm_import_module = "wasi:blobstore/blobstore")]
37389 extern "C" {
37390 #[link_name = "delete-container"]
37391 fn wit_import(_: *mut u8, _: usize, _: *mut u8);
37392 }
37393 #[cfg(not(target_arch = "wasm32"))]
37394 fn wit_import(_: *mut u8, _: usize, _: *mut u8) {
37395 unreachable!()
37396 }
37397 wit_import(ptr0.cast_mut(), len0, ptr1);
37398 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
37399 match l2 {
37400 0 => {
37401 let e = ();
37402 Ok(e)
37403 }
37404 1 => {
37405 let e = {
37406 let l3 = *ptr1.add(4).cast::<*mut u8>();
37407 let l4 = *ptr1.add(8).cast::<usize>();
37408 let len5 = l4;
37409 let bytes5 = _rt::Vec::from_raw_parts(
37410 l3.cast(),
37411 len5,
37412 len5,
37413 );
37414 _rt::string_lift(bytes5)
37415 };
37416 Err(e)
37417 }
37418 _ => _rt::invalid_enum_discriminant(),
37419 }
37420 }
37421 }
37422 #[allow(unused_unsafe, clippy::all)]
37423 /// returns true if the container exists
37424 pub fn container_exists(name: &ContainerName) -> Result<bool, Error> {
37425 unsafe {
37426 #[repr(align(4))]
37427 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
37428 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]);
37429 let vec0 = name;
37430 let ptr0 = vec0.as_ptr().cast::<u8>();
37431 let len0 = vec0.len();
37432 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
37433 #[cfg(target_arch = "wasm32")]
37434 #[link(wasm_import_module = "wasi:blobstore/blobstore")]
37435 extern "C" {
37436 #[link_name = "container-exists"]
37437 fn wit_import(_: *mut u8, _: usize, _: *mut u8);
37438 }
37439 #[cfg(not(target_arch = "wasm32"))]
37440 fn wit_import(_: *mut u8, _: usize, _: *mut u8) {
37441 unreachable!()
37442 }
37443 wit_import(ptr0.cast_mut(), len0, ptr1);
37444 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
37445 match l2 {
37446 0 => {
37447 let e = {
37448 let l3 = i32::from(*ptr1.add(4).cast::<u8>());
37449 _rt::bool_lift(l3 as u8)
37450 };
37451 Ok(e)
37452 }
37453 1 => {
37454 let e = {
37455 let l4 = *ptr1.add(4).cast::<*mut u8>();
37456 let l5 = *ptr1.add(8).cast::<usize>();
37457 let len6 = l5;
37458 let bytes6 = _rt::Vec::from_raw_parts(
37459 l4.cast(),
37460 len6,
37461 len6,
37462 );
37463 _rt::string_lift(bytes6)
37464 };
37465 Err(e)
37466 }
37467 _ => _rt::invalid_enum_discriminant(),
37468 }
37469 }
37470 }
37471 #[allow(unused_unsafe, clippy::all)]
37472 /// copies (duplicates) an object, to the same or a different container.
37473 /// returns an error if the target container does not exist.
37474 /// overwrites destination object if it already existed.
37475 pub fn copy_object(src: &ObjectId, dest: &ObjectId) -> Result<(), Error> {
37476 unsafe {
37477 #[repr(align(4))]
37478 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
37479 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]);
37480 let super::super::super::wasi::blobstore::types::ObjectId {
37481 container: container0,
37482 object: object0,
37483 } = src;
37484 let vec1 = container0;
37485 let ptr1 = vec1.as_ptr().cast::<u8>();
37486 let len1 = vec1.len();
37487 let vec2 = object0;
37488 let ptr2 = vec2.as_ptr().cast::<u8>();
37489 let len2 = vec2.len();
37490 let super::super::super::wasi::blobstore::types::ObjectId {
37491 container: container3,
37492 object: object3,
37493 } = dest;
37494 let vec4 = container3;
37495 let ptr4 = vec4.as_ptr().cast::<u8>();
37496 let len4 = vec4.len();
37497 let vec5 = object3;
37498 let ptr5 = vec5.as_ptr().cast::<u8>();
37499 let len5 = vec5.len();
37500 let ptr6 = ret_area.0.as_mut_ptr().cast::<u8>();
37501 #[cfg(target_arch = "wasm32")]
37502 #[link(wasm_import_module = "wasi:blobstore/blobstore")]
37503 extern "C" {
37504 #[link_name = "copy-object"]
37505 fn wit_import(
37506 _: *mut u8,
37507 _: usize,
37508 _: *mut u8,
37509 _: usize,
37510 _: *mut u8,
37511 _: usize,
37512 _: *mut u8,
37513 _: usize,
37514 _: *mut u8,
37515 );
37516 }
37517 #[cfg(not(target_arch = "wasm32"))]
37518 fn wit_import(
37519 _: *mut u8,
37520 _: usize,
37521 _: *mut u8,
37522 _: usize,
37523 _: *mut u8,
37524 _: usize,
37525 _: *mut u8,
37526 _: usize,
37527 _: *mut u8,
37528 ) {
37529 unreachable!()
37530 }
37531 wit_import(
37532 ptr1.cast_mut(),
37533 len1,
37534 ptr2.cast_mut(),
37535 len2,
37536 ptr4.cast_mut(),
37537 len4,
37538 ptr5.cast_mut(),
37539 len5,
37540 ptr6,
37541 );
37542 let l7 = i32::from(*ptr6.add(0).cast::<u8>());
37543 match l7 {
37544 0 => {
37545 let e = ();
37546 Ok(e)
37547 }
37548 1 => {
37549 let e = {
37550 let l8 = *ptr6.add(4).cast::<*mut u8>();
37551 let l9 = *ptr6.add(8).cast::<usize>();
37552 let len10 = l9;
37553 let bytes10 = _rt::Vec::from_raw_parts(
37554 l8.cast(),
37555 len10,
37556 len10,
37557 );
37558 _rt::string_lift(bytes10)
37559 };
37560 Err(e)
37561 }
37562 _ => _rt::invalid_enum_discriminant(),
37563 }
37564 }
37565 }
37566 #[allow(unused_unsafe, clippy::all)]
37567 /// moves or renames an object, to the same or a different container
37568 /// returns an error if the destination container does not exist.
37569 /// overwrites destination object if it already existed.
37570 pub fn move_object(src: &ObjectId, dest: &ObjectId) -> Result<(), Error> {
37571 unsafe {
37572 #[repr(align(4))]
37573 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
37574 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]);
37575 let super::super::super::wasi::blobstore::types::ObjectId {
37576 container: container0,
37577 object: object0,
37578 } = src;
37579 let vec1 = container0;
37580 let ptr1 = vec1.as_ptr().cast::<u8>();
37581 let len1 = vec1.len();
37582 let vec2 = object0;
37583 let ptr2 = vec2.as_ptr().cast::<u8>();
37584 let len2 = vec2.len();
37585 let super::super::super::wasi::blobstore::types::ObjectId {
37586 container: container3,
37587 object: object3,
37588 } = dest;
37589 let vec4 = container3;
37590 let ptr4 = vec4.as_ptr().cast::<u8>();
37591 let len4 = vec4.len();
37592 let vec5 = object3;
37593 let ptr5 = vec5.as_ptr().cast::<u8>();
37594 let len5 = vec5.len();
37595 let ptr6 = ret_area.0.as_mut_ptr().cast::<u8>();
37596 #[cfg(target_arch = "wasm32")]
37597 #[link(wasm_import_module = "wasi:blobstore/blobstore")]
37598 extern "C" {
37599 #[link_name = "move-object"]
37600 fn wit_import(
37601 _: *mut u8,
37602 _: usize,
37603 _: *mut u8,
37604 _: usize,
37605 _: *mut u8,
37606 _: usize,
37607 _: *mut u8,
37608 _: usize,
37609 _: *mut u8,
37610 );
37611 }
37612 #[cfg(not(target_arch = "wasm32"))]
37613 fn wit_import(
37614 _: *mut u8,
37615 _: usize,
37616 _: *mut u8,
37617 _: usize,
37618 _: *mut u8,
37619 _: usize,
37620 _: *mut u8,
37621 _: usize,
37622 _: *mut u8,
37623 ) {
37624 unreachable!()
37625 }
37626 wit_import(
37627 ptr1.cast_mut(),
37628 len1,
37629 ptr2.cast_mut(),
37630 len2,
37631 ptr4.cast_mut(),
37632 len4,
37633 ptr5.cast_mut(),
37634 len5,
37635 ptr6,
37636 );
37637 let l7 = i32::from(*ptr6.add(0).cast::<u8>());
37638 match l7 {
37639 0 => {
37640 let e = ();
37641 Ok(e)
37642 }
37643 1 => {
37644 let e = {
37645 let l8 = *ptr6.add(4).cast::<*mut u8>();
37646 let l9 = *ptr6.add(8).cast::<usize>();
37647 let len10 = l9;
37648 let bytes10 = _rt::Vec::from_raw_parts(
37649 l8.cast(),
37650 len10,
37651 len10,
37652 );
37653 _rt::string_lift(bytes10)
37654 };
37655 Err(e)
37656 }
37657 _ => _rt::invalid_enum_discriminant(),
37658 }
37659 }
37660 }
37661 }
37662 }
37663 pub mod clocks {
37664 /// WASI Wall Clock is a clock API intended to let users query the current
37665 /// time. The name "wall" makes an analogy to a "clock on the wall", which
37666 /// is not necessarily monotonic as it may be reset.
37667 ///
37668 /// It is intended to be portable at least between Unix-family platforms and
37669 /// Windows.
37670 ///
37671 /// A wall clock is a clock which measures the date and time according to
37672 /// some external reference.
37673 ///
37674 /// External references may be reset, so this clock is not necessarily
37675 /// monotonic, making it unsuitable for measuring elapsed time.
37676 ///
37677 /// It is intended for reporting the current date and time for humans.
37678 #[allow(dead_code, clippy::all)]
37679 pub mod wall_clock {
37680 #[used]
37681 #[doc(hidden)]
37682 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
37683 /// A time and date in seconds plus nanoseconds.
37684 #[repr(C)]
37685 #[derive(Clone, Copy)]
37686 pub struct Datetime {
37687 pub seconds: u64,
37688 pub nanoseconds: u32,
37689 }
37690 impl ::core::fmt::Debug for Datetime {
37691 fn fmt(
37692 &self,
37693 f: &mut ::core::fmt::Formatter<'_>,
37694 ) -> ::core::fmt::Result {
37695 f.debug_struct("Datetime")
37696 .field("seconds", &self.seconds)
37697 .field("nanoseconds", &self.nanoseconds)
37698 .finish()
37699 }
37700 }
37701 #[allow(unused_unsafe, clippy::all)]
37702 /// Read the current value of the clock.
37703 ///
37704 /// This clock is not monotonic, therefore calling this function repeatedly
37705 /// will not necessarily produce a sequence of non-decreasing values.
37706 ///
37707 /// The returned timestamps represent the number of seconds since
37708 /// 1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch],
37709 /// also known as [Unix Time].
37710 ///
37711 /// The nanoseconds field of the output is always less than 1000000000.
37712 ///
37713 /// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
37714 /// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
37715 pub fn now() -> Datetime {
37716 unsafe {
37717 #[repr(align(8))]
37718 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
37719 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]);
37720 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
37721 #[cfg(target_arch = "wasm32")]
37722 #[link(wasm_import_module = "wasi:clocks/wall-clock@0.2.0")]
37723 extern "C" {
37724 #[link_name = "now"]
37725 fn wit_import(_: *mut u8);
37726 }
37727 #[cfg(not(target_arch = "wasm32"))]
37728 fn wit_import(_: *mut u8) {
37729 unreachable!()
37730 }
37731 wit_import(ptr0);
37732 let l1 = *ptr0.add(0).cast::<i64>();
37733 let l2 = *ptr0.add(8).cast::<i32>();
37734 Datetime {
37735 seconds: l1 as u64,
37736 nanoseconds: l2 as u32,
37737 }
37738 }
37739 }
37740 #[allow(unused_unsafe, clippy::all)]
37741 /// Query the resolution of the clock.
37742 ///
37743 /// The nanoseconds field of the output is always less than 1000000000.
37744 pub fn resolution() -> Datetime {
37745 unsafe {
37746 #[repr(align(8))]
37747 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
37748 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]);
37749 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
37750 #[cfg(target_arch = "wasm32")]
37751 #[link(wasm_import_module = "wasi:clocks/wall-clock@0.2.0")]
37752 extern "C" {
37753 #[link_name = "resolution"]
37754 fn wit_import(_: *mut u8);
37755 }
37756 #[cfg(not(target_arch = "wasm32"))]
37757 fn wit_import(_: *mut u8) {
37758 unreachable!()
37759 }
37760 wit_import(ptr0);
37761 let l1 = *ptr0.add(0).cast::<i64>();
37762 let l2 = *ptr0.add(8).cast::<i32>();
37763 Datetime {
37764 seconds: l1 as u64,
37765 nanoseconds: l2 as u32,
37766 }
37767 }
37768 }
37769 }
37770 /// WASI Monotonic Clock is a clock API intended to let users measure elapsed
37771 /// time.
37772 ///
37773 /// It is intended to be portable at least between Unix-family platforms and
37774 /// Windows.
37775 ///
37776 /// A monotonic clock is a clock which has an unspecified initial value, and
37777 /// successive reads of the clock will produce non-decreasing values.
37778 ///
37779 /// It is intended for measuring elapsed time.
37780 #[allow(dead_code, clippy::all)]
37781 pub mod monotonic_clock {
37782 #[used]
37783 #[doc(hidden)]
37784 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
37785 use super::super::super::_rt;
37786 pub type Pollable = super::super::super::wasi::io::poll::Pollable;
37787 /// An instant in time, in nanoseconds. An instant is relative to an
37788 /// unspecified initial value, and can only be compared to instances from
37789 /// the same monotonic-clock.
37790 pub type Instant = u64;
37791 /// A duration of time, in nanoseconds.
37792 pub type Duration = u64;
37793 #[allow(unused_unsafe, clippy::all)]
37794 /// Read the current value of the clock.
37795 ///
37796 /// The clock is monotonic, therefore calling this function repeatedly will
37797 /// produce a sequence of non-decreasing values.
37798 pub fn now() -> Instant {
37799 unsafe {
37800 #[cfg(target_arch = "wasm32")]
37801 #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")]
37802 extern "C" {
37803 #[link_name = "now"]
37804 fn wit_import() -> i64;
37805 }
37806 #[cfg(not(target_arch = "wasm32"))]
37807 fn wit_import() -> i64 {
37808 unreachable!()
37809 }
37810 let ret = wit_import();
37811 ret as u64
37812 }
37813 }
37814 #[allow(unused_unsafe, clippy::all)]
37815 /// Query the resolution of the clock. Returns the duration of time
37816 /// corresponding to a clock tick.
37817 pub fn resolution() -> Duration {
37818 unsafe {
37819 #[cfg(target_arch = "wasm32")]
37820 #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")]
37821 extern "C" {
37822 #[link_name = "resolution"]
37823 fn wit_import() -> i64;
37824 }
37825 #[cfg(not(target_arch = "wasm32"))]
37826 fn wit_import() -> i64 {
37827 unreachable!()
37828 }
37829 let ret = wit_import();
37830 ret as u64
37831 }
37832 }
37833 #[allow(unused_unsafe, clippy::all)]
37834 /// Create a `pollable` which will resolve once the specified instant
37835 /// occured.
37836 pub fn subscribe_instant(when: Instant) -> Pollable {
37837 unsafe {
37838 #[cfg(target_arch = "wasm32")]
37839 #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")]
37840 extern "C" {
37841 #[link_name = "subscribe-instant"]
37842 fn wit_import(_: i64) -> i32;
37843 }
37844 #[cfg(not(target_arch = "wasm32"))]
37845 fn wit_import(_: i64) -> i32 {
37846 unreachable!()
37847 }
37848 let ret = wit_import(_rt::as_i64(when));
37849 super::super::super::wasi::io::poll::Pollable::from_handle(
37850 ret as u32,
37851 )
37852 }
37853 }
37854 #[allow(unused_unsafe, clippy::all)]
37855 /// Create a `pollable` which will resolve once the given duration has
37856 /// elapsed, starting at the time at which this function was called.
37857 /// occured.
37858 pub fn subscribe_duration(when: Duration) -> Pollable {
37859 unsafe {
37860 #[cfg(target_arch = "wasm32")]
37861 #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")]
37862 extern "C" {
37863 #[link_name = "subscribe-duration"]
37864 fn wit_import(_: i64) -> i32;
37865 }
37866 #[cfg(not(target_arch = "wasm32"))]
37867 fn wit_import(_: i64) -> i32 {
37868 unreachable!()
37869 }
37870 let ret = wit_import(_rt::as_i64(when));
37871 super::super::super::wasi::io::poll::Pollable::from_handle(
37872 ret as u32,
37873 )
37874 }
37875 }
37876 }
37877 }
37878 pub mod filesystem {
37879 /// WASI filesystem is a filesystem API primarily intended to let users run WASI
37880 /// programs that access their files on their existing filesystems, without
37881 /// significant overhead.
37882 ///
37883 /// It is intended to be roughly portable between Unix-family platforms and
37884 /// Windows, though it does not hide many of the major differences.
37885 ///
37886 /// Paths are passed as interface-type `string`s, meaning they must consist of
37887 /// a sequence of Unicode Scalar Values (USVs). Some filesystems may contain
37888 /// paths which are not accessible by this API.
37889 ///
37890 /// The directory separator in WASI is always the forward-slash (`/`).
37891 ///
37892 /// All paths in WASI are relative paths, and are interpreted relative to a
37893 /// `descriptor` referring to a base directory. If a `path` argument to any WASI
37894 /// function starts with `/`, or if any step of resolving a `path`, including
37895 /// `..` and symbolic link steps, reaches a directory outside of the base
37896 /// directory, or reaches a symlink to an absolute or rooted path in the
37897 /// underlying filesystem, the function fails with `error-code::not-permitted`.
37898 ///
37899 /// For more information about WASI path resolution and sandboxing, see
37900 /// [WASI filesystem path resolution].
37901 ///
37902 /// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md
37903 #[allow(dead_code, clippy::all)]
37904 pub mod types {
37905 #[used]
37906 #[doc(hidden)]
37907 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
37908 use super::super::super::_rt;
37909 pub type InputStream = super::super::super::wasi::io::streams::InputStream;
37910 pub type OutputStream = super::super::super::wasi::io::streams::OutputStream;
37911 pub type Error = super::super::super::wasi::io::streams::Error;
37912 pub type Datetime = super::super::super::wasi::clocks::wall_clock::Datetime;
37913 /// File size or length of a region within a file.
37914 pub type Filesize = u64;
37915 /// The type of a filesystem object referenced by a descriptor.
37916 ///
37917 /// Note: This was called `filetype` in earlier versions of WASI.
37918 #[repr(u8)]
37919 #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
37920 pub enum DescriptorType {
37921 /// The type of the descriptor or file is unknown or is different from
37922 /// any of the other types specified.
37923 Unknown,
37924 /// The descriptor refers to a block device inode.
37925 BlockDevice,
37926 /// The descriptor refers to a character device inode.
37927 CharacterDevice,
37928 /// The descriptor refers to a directory inode.
37929 Directory,
37930 /// The descriptor refers to a named pipe.
37931 Fifo,
37932 /// The file refers to a symbolic link inode.
37933 SymbolicLink,
37934 /// The descriptor refers to a regular file inode.
37935 RegularFile,
37936 /// The descriptor refers to a socket.
37937 Socket,
37938 }
37939 impl ::core::fmt::Debug for DescriptorType {
37940 fn fmt(
37941 &self,
37942 f: &mut ::core::fmt::Formatter<'_>,
37943 ) -> ::core::fmt::Result {
37944 match self {
37945 DescriptorType::Unknown => {
37946 f.debug_tuple("DescriptorType::Unknown").finish()
37947 }
37948 DescriptorType::BlockDevice => {
37949 f.debug_tuple("DescriptorType::BlockDevice").finish()
37950 }
37951 DescriptorType::CharacterDevice => {
37952 f.debug_tuple("DescriptorType::CharacterDevice").finish()
37953 }
37954 DescriptorType::Directory => {
37955 f.debug_tuple("DescriptorType::Directory").finish()
37956 }
37957 DescriptorType::Fifo => {
37958 f.debug_tuple("DescriptorType::Fifo").finish()
37959 }
37960 DescriptorType::SymbolicLink => {
37961 f.debug_tuple("DescriptorType::SymbolicLink").finish()
37962 }
37963 DescriptorType::RegularFile => {
37964 f.debug_tuple("DescriptorType::RegularFile").finish()
37965 }
37966 DescriptorType::Socket => {
37967 f.debug_tuple("DescriptorType::Socket").finish()
37968 }
37969 }
37970 }
37971 }
37972 impl DescriptorType {
37973 #[doc(hidden)]
37974 pub unsafe fn _lift(val: u8) -> DescriptorType {
37975 if !cfg!(debug_assertions) {
37976 return ::core::mem::transmute(val);
37977 }
37978 match val {
37979 0 => DescriptorType::Unknown,
37980 1 => DescriptorType::BlockDevice,
37981 2 => DescriptorType::CharacterDevice,
37982 3 => DescriptorType::Directory,
37983 4 => DescriptorType::Fifo,
37984 5 => DescriptorType::SymbolicLink,
37985 6 => DescriptorType::RegularFile,
37986 7 => DescriptorType::Socket,
37987 _ => panic!("invalid enum discriminant"),
37988 }
37989 }
37990 }
37991 wit_bindgen_rt::bitflags::bitflags! {
37992 #[doc = " Descriptor flags."] #[doc = ""] #[doc =
37993 " Note: This was called `fdflags` in earlier versions of WASI."]
37994 #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] pub
37995 struct DescriptorFlags : u8 { #[doc = " Read mode: Data can be read."]
37996 const READ = 1 << 0; #[doc = " Write mode: Data can be written to."]
37997 const WRITE = 1 << 1; #[doc =
37998 " Request that writes be performed according to synchronized I/O file"]
37999 #[doc =
38000 " integrity completion. The data stored in the file and the file's"]
38001 #[doc =
38002 " metadata are synchronized. This is similar to `O_SYNC` in POSIX."]
38003 #[doc = ""] #[doc =
38004 " The precise semantics of this operation have not yet been defined for"]
38005 #[doc =
38006 " WASI. At this time, it should be interpreted as a request, and not a"]
38007 #[doc = " requirement."] const FILE_INTEGRITY_SYNC = 1 << 2; #[doc =
38008 " Request that writes be performed according to synchronized I/O data"]
38009 #[doc = " integrity completion. Only the data stored in the file is"]
38010 #[doc = " synchronized. This is similar to `O_DSYNC` in POSIX."] #[doc =
38011 ""] #[doc =
38012 " The precise semantics of this operation have not yet been defined for"]
38013 #[doc =
38014 " WASI. At this time, it should be interpreted as a request, and not a"]
38015 #[doc = " requirement."] const DATA_INTEGRITY_SYNC = 1 << 3; #[doc =
38016 " Requests that reads be performed at the same level of integrety"] #[doc
38017 = " requested for writes. This is similar to `O_RSYNC` in POSIX."] #[doc
38018 = ""] #[doc =
38019 " The precise semantics of this operation have not yet been defined for"]
38020 #[doc =
38021 " WASI. At this time, it should be interpreted as a request, and not a"]
38022 #[doc = " requirement."] const REQUESTED_WRITE_SYNC = 1 << 4; #[doc =
38023 " Mutating directories mode: Directory contents may be mutated."] #[doc =
38024 ""] #[doc =
38025 " When this flag is unset on a descriptor, operations using the"] #[doc =
38026 " descriptor which would create, rename, delete, modify the data or"]
38027 #[doc =
38028 " metadata of filesystem objects, or obtain another handle which"] #[doc
38029 =
38030 " would permit any of those, shall fail with `error-code::read-only` if"]
38031 #[doc = " they would otherwise succeed."] #[doc = ""] #[doc =
38032 " This may only be set on directories."] const MUTATE_DIRECTORY = 1 << 5;
38033 }
38034 }
38035 wit_bindgen_rt::bitflags::bitflags! {
38036 #[doc = " Flags determining the method of how paths are resolved."]
38037 #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] pub
38038 struct PathFlags : u8 { #[doc =
38039 " As long as the resolved path corresponds to a symbolic link, it is"]
38040 #[doc = " expanded."] const SYMLINK_FOLLOW = 1 << 0; }
38041 }
38042 wit_bindgen_rt::bitflags::bitflags! {
38043 #[doc = " Open flags used by `open-at`."] #[derive(PartialEq, Eq,
38044 PartialOrd, Ord, Hash, Debug, Clone, Copy)] pub struct OpenFlags : u8 {
38045 #[doc =
38046 " Create file if it does not exist, similar to `O_CREAT` in POSIX."]
38047 const CREATE = 1 << 0; #[doc =
38048 " Fail if not a directory, similar to `O_DIRECTORY` in POSIX."] const
38049 DIRECTORY = 1 << 1; #[doc =
38050 " Fail if file already exists, similar to `O_EXCL` in POSIX."] const
38051 EXCLUSIVE = 1 << 2; #[doc =
38052 " Truncate file to size 0, similar to `O_TRUNC` in POSIX."] const
38053 TRUNCATE = 1 << 3; }
38054 }
38055 /// Number of hard links to an inode.
38056 pub type LinkCount = u64;
38057 /// File attributes.
38058 ///
38059 /// Note: This was called `filestat` in earlier versions of WASI.
38060 #[repr(C)]
38061 #[derive(Clone, Copy)]
38062 pub struct DescriptorStat {
38063 /// File type.
38064 pub type_: DescriptorType,
38065 /// Number of hard links to the file.
38066 pub link_count: LinkCount,
38067 /// For regular files, the file size in bytes. For symbolic links, the
38068 /// length in bytes of the pathname contained in the symbolic link.
38069 pub size: Filesize,
38070 /// Last data access timestamp.
38071 ///
38072 /// If the `option` is none, the platform doesn't maintain an access
38073 /// timestamp for this file.
38074 pub data_access_timestamp: Option<Datetime>,
38075 /// Last data modification timestamp.
38076 ///
38077 /// If the `option` is none, the platform doesn't maintain a
38078 /// modification timestamp for this file.
38079 pub data_modification_timestamp: Option<Datetime>,
38080 /// Last file status-change timestamp.
38081 ///
38082 /// If the `option` is none, the platform doesn't maintain a
38083 /// status-change timestamp for this file.
38084 pub status_change_timestamp: Option<Datetime>,
38085 }
38086 impl ::core::fmt::Debug for DescriptorStat {
38087 fn fmt(
38088 &self,
38089 f: &mut ::core::fmt::Formatter<'_>,
38090 ) -> ::core::fmt::Result {
38091 f.debug_struct("DescriptorStat")
38092 .field("type", &self.type_)
38093 .field("link-count", &self.link_count)
38094 .field("size", &self.size)
38095 .field("data-access-timestamp", &self.data_access_timestamp)
38096 .field(
38097 "data-modification-timestamp",
38098 &self.data_modification_timestamp,
38099 )
38100 .field("status-change-timestamp", &self.status_change_timestamp)
38101 .finish()
38102 }
38103 }
38104 /// When setting a timestamp, this gives the value to set it to.
38105 #[derive(Clone, Copy)]
38106 pub enum NewTimestamp {
38107 /// Leave the timestamp set to its previous value.
38108 NoChange,
38109 /// Set the timestamp to the current time of the system clock associated
38110 /// with the filesystem.
38111 Now,
38112 /// Set the timestamp to the given value.
38113 Timestamp(Datetime),
38114 }
38115 impl ::core::fmt::Debug for NewTimestamp {
38116 fn fmt(
38117 &self,
38118 f: &mut ::core::fmt::Formatter<'_>,
38119 ) -> ::core::fmt::Result {
38120 match self {
38121 NewTimestamp::NoChange => {
38122 f.debug_tuple("NewTimestamp::NoChange").finish()
38123 }
38124 NewTimestamp::Now => f.debug_tuple("NewTimestamp::Now").finish(),
38125 NewTimestamp::Timestamp(e) => {
38126 f.debug_tuple("NewTimestamp::Timestamp").field(e).finish()
38127 }
38128 }
38129 }
38130 }
38131 /// A directory entry.
38132 #[derive(Clone)]
38133 pub struct DirectoryEntry {
38134 /// The type of the file referred to by this directory entry.
38135 pub type_: DescriptorType,
38136 /// The name of the object.
38137 pub name: _rt::String,
38138 }
38139 impl ::core::fmt::Debug for DirectoryEntry {
38140 fn fmt(
38141 &self,
38142 f: &mut ::core::fmt::Formatter<'_>,
38143 ) -> ::core::fmt::Result {
38144 f.debug_struct("DirectoryEntry")
38145 .field("type", &self.type_)
38146 .field("name", &self.name)
38147 .finish()
38148 }
38149 }
38150 /// Error codes returned by functions, similar to `errno` in POSIX.
38151 /// Not all of these error codes are returned by the functions provided by this
38152 /// API; some are used in higher-level library layers, and others are provided
38153 /// merely for alignment with POSIX.
38154 #[repr(u8)]
38155 #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
38156 pub enum ErrorCode {
38157 /// Permission denied, similar to `EACCES` in POSIX.
38158 Access,
38159 /// Resource unavailable, or operation would block, similar to `EAGAIN` and `EWOULDBLOCK` in POSIX.
38160 WouldBlock,
38161 /// Connection already in progress, similar to `EALREADY` in POSIX.
38162 Already,
38163 /// Bad descriptor, similar to `EBADF` in POSIX.
38164 BadDescriptor,
38165 /// Device or resource busy, similar to `EBUSY` in POSIX.
38166 Busy,
38167 /// Resource deadlock would occur, similar to `EDEADLK` in POSIX.
38168 Deadlock,
38169 /// Storage quota exceeded, similar to `EDQUOT` in POSIX.
38170 Quota,
38171 /// File exists, similar to `EEXIST` in POSIX.
38172 Exist,
38173 /// File too large, similar to `EFBIG` in POSIX.
38174 FileTooLarge,
38175 /// Illegal byte sequence, similar to `EILSEQ` in POSIX.
38176 IllegalByteSequence,
38177 /// Operation in progress, similar to `EINPROGRESS` in POSIX.
38178 InProgress,
38179 /// Interrupted function, similar to `EINTR` in POSIX.
38180 Interrupted,
38181 /// Invalid argument, similar to `EINVAL` in POSIX.
38182 Invalid,
38183 /// I/O error, similar to `EIO` in POSIX.
38184 Io,
38185 /// Is a directory, similar to `EISDIR` in POSIX.
38186 IsDirectory,
38187 /// Too many levels of symbolic links, similar to `ELOOP` in POSIX.
38188 Loop,
38189 /// Too many links, similar to `EMLINK` in POSIX.
38190 TooManyLinks,
38191 /// Message too large, similar to `EMSGSIZE` in POSIX.
38192 MessageSize,
38193 /// Filename too long, similar to `ENAMETOOLONG` in POSIX.
38194 NameTooLong,
38195 /// No such device, similar to `ENODEV` in POSIX.
38196 NoDevice,
38197 /// No such file or directory, similar to `ENOENT` in POSIX.
38198 NoEntry,
38199 /// No locks available, similar to `ENOLCK` in POSIX.
38200 NoLock,
38201 /// Not enough space, similar to `ENOMEM` in POSIX.
38202 InsufficientMemory,
38203 /// No space left on device, similar to `ENOSPC` in POSIX.
38204 InsufficientSpace,
38205 /// Not a directory or a symbolic link to a directory, similar to `ENOTDIR` in POSIX.
38206 NotDirectory,
38207 /// Directory not empty, similar to `ENOTEMPTY` in POSIX.
38208 NotEmpty,
38209 /// State not recoverable, similar to `ENOTRECOVERABLE` in POSIX.
38210 NotRecoverable,
38211 /// Not supported, similar to `ENOTSUP` and `ENOSYS` in POSIX.
38212 Unsupported,
38213 /// Inappropriate I/O control operation, similar to `ENOTTY` in POSIX.
38214 NoTty,
38215 /// No such device or address, similar to `ENXIO` in POSIX.
38216 NoSuchDevice,
38217 /// Value too large to be stored in data type, similar to `EOVERFLOW` in POSIX.
38218 Overflow,
38219 /// Operation not permitted, similar to `EPERM` in POSIX.
38220 NotPermitted,
38221 /// Broken pipe, similar to `EPIPE` in POSIX.
38222 Pipe,
38223 /// Read-only file system, similar to `EROFS` in POSIX.
38224 ReadOnly,
38225 /// Invalid seek, similar to `ESPIPE` in POSIX.
38226 InvalidSeek,
38227 /// Text file busy, similar to `ETXTBSY` in POSIX.
38228 TextFileBusy,
38229 /// Cross-device link, similar to `EXDEV` in POSIX.
38230 CrossDevice,
38231 }
38232 impl ErrorCode {
38233 pub fn name(&self) -> &'static str {
38234 match self {
38235 ErrorCode::Access => "access",
38236 ErrorCode::WouldBlock => "would-block",
38237 ErrorCode::Already => "already",
38238 ErrorCode::BadDescriptor => "bad-descriptor",
38239 ErrorCode::Busy => "busy",
38240 ErrorCode::Deadlock => "deadlock",
38241 ErrorCode::Quota => "quota",
38242 ErrorCode::Exist => "exist",
38243 ErrorCode::FileTooLarge => "file-too-large",
38244 ErrorCode::IllegalByteSequence => "illegal-byte-sequence",
38245 ErrorCode::InProgress => "in-progress",
38246 ErrorCode::Interrupted => "interrupted",
38247 ErrorCode::Invalid => "invalid",
38248 ErrorCode::Io => "io",
38249 ErrorCode::IsDirectory => "is-directory",
38250 ErrorCode::Loop => "loop",
38251 ErrorCode::TooManyLinks => "too-many-links",
38252 ErrorCode::MessageSize => "message-size",
38253 ErrorCode::NameTooLong => "name-too-long",
38254 ErrorCode::NoDevice => "no-device",
38255 ErrorCode::NoEntry => "no-entry",
38256 ErrorCode::NoLock => "no-lock",
38257 ErrorCode::InsufficientMemory => "insufficient-memory",
38258 ErrorCode::InsufficientSpace => "insufficient-space",
38259 ErrorCode::NotDirectory => "not-directory",
38260 ErrorCode::NotEmpty => "not-empty",
38261 ErrorCode::NotRecoverable => "not-recoverable",
38262 ErrorCode::Unsupported => "unsupported",
38263 ErrorCode::NoTty => "no-tty",
38264 ErrorCode::NoSuchDevice => "no-such-device",
38265 ErrorCode::Overflow => "overflow",
38266 ErrorCode::NotPermitted => "not-permitted",
38267 ErrorCode::Pipe => "pipe",
38268 ErrorCode::ReadOnly => "read-only",
38269 ErrorCode::InvalidSeek => "invalid-seek",
38270 ErrorCode::TextFileBusy => "text-file-busy",
38271 ErrorCode::CrossDevice => "cross-device",
38272 }
38273 }
38274 pub fn message(&self) -> &'static str {
38275 match self {
38276 ErrorCode::Access => {
38277 "Permission denied, similar to `EACCES` in POSIX."
38278 }
38279 ErrorCode::WouldBlock => {
38280 "Resource unavailable, or operation would block, similar to `EAGAIN` and `EWOULDBLOCK` in POSIX."
38281 }
38282 ErrorCode::Already => {
38283 "Connection already in progress, similar to `EALREADY` in POSIX."
38284 }
38285 ErrorCode::BadDescriptor => {
38286 "Bad descriptor, similar to `EBADF` in POSIX."
38287 }
38288 ErrorCode::Busy => {
38289 "Device or resource busy, similar to `EBUSY` in POSIX."
38290 }
38291 ErrorCode::Deadlock => {
38292 "Resource deadlock would occur, similar to `EDEADLK` in POSIX."
38293 }
38294 ErrorCode::Quota => {
38295 "Storage quota exceeded, similar to `EDQUOT` in POSIX."
38296 }
38297 ErrorCode::Exist => "File exists, similar to `EEXIST` in POSIX.",
38298 ErrorCode::FileTooLarge => {
38299 "File too large, similar to `EFBIG` in POSIX."
38300 }
38301 ErrorCode::IllegalByteSequence => {
38302 "Illegal byte sequence, similar to `EILSEQ` in POSIX."
38303 }
38304 ErrorCode::InProgress => {
38305 "Operation in progress, similar to `EINPROGRESS` in POSIX."
38306 }
38307 ErrorCode::Interrupted => {
38308 "Interrupted function, similar to `EINTR` in POSIX."
38309 }
38310 ErrorCode::Invalid => {
38311 "Invalid argument, similar to `EINVAL` in POSIX."
38312 }
38313 ErrorCode::Io => "I/O error, similar to `EIO` in POSIX.",
38314 ErrorCode::IsDirectory => {
38315 "Is a directory, similar to `EISDIR` in POSIX."
38316 }
38317 ErrorCode::Loop => {
38318 "Too many levels of symbolic links, similar to `ELOOP` in POSIX."
38319 }
38320 ErrorCode::TooManyLinks => {
38321 "Too many links, similar to `EMLINK` in POSIX."
38322 }
38323 ErrorCode::MessageSize => {
38324 "Message too large, similar to `EMSGSIZE` in POSIX."
38325 }
38326 ErrorCode::NameTooLong => {
38327 "Filename too long, similar to `ENAMETOOLONG` in POSIX."
38328 }
38329 ErrorCode::NoDevice => {
38330 "No such device, similar to `ENODEV` in POSIX."
38331 }
38332 ErrorCode::NoEntry => {
38333 "No such file or directory, similar to `ENOENT` in POSIX."
38334 }
38335 ErrorCode::NoLock => {
38336 "No locks available, similar to `ENOLCK` in POSIX."
38337 }
38338 ErrorCode::InsufficientMemory => {
38339 "Not enough space, similar to `ENOMEM` in POSIX."
38340 }
38341 ErrorCode::InsufficientSpace => {
38342 "No space left on device, similar to `ENOSPC` in POSIX."
38343 }
38344 ErrorCode::NotDirectory => {
38345 "Not a directory or a symbolic link to a directory, similar to `ENOTDIR` in POSIX."
38346 }
38347 ErrorCode::NotEmpty => {
38348 "Directory not empty, similar to `ENOTEMPTY` in POSIX."
38349 }
38350 ErrorCode::NotRecoverable => {
38351 "State not recoverable, similar to `ENOTRECOVERABLE` in POSIX."
38352 }
38353 ErrorCode::Unsupported => {
38354 "Not supported, similar to `ENOTSUP` and `ENOSYS` in POSIX."
38355 }
38356 ErrorCode::NoTty => {
38357 "Inappropriate I/O control operation, similar to `ENOTTY` in POSIX."
38358 }
38359 ErrorCode::NoSuchDevice => {
38360 "No such device or address, similar to `ENXIO` in POSIX."
38361 }
38362 ErrorCode::Overflow => {
38363 "Value too large to be stored in data type, similar to `EOVERFLOW` in POSIX."
38364 }
38365 ErrorCode::NotPermitted => {
38366 "Operation not permitted, similar to `EPERM` in POSIX."
38367 }
38368 ErrorCode::Pipe => "Broken pipe, similar to `EPIPE` in POSIX.",
38369 ErrorCode::ReadOnly => {
38370 "Read-only file system, similar to `EROFS` in POSIX."
38371 }
38372 ErrorCode::InvalidSeek => {
38373 "Invalid seek, similar to `ESPIPE` in POSIX."
38374 }
38375 ErrorCode::TextFileBusy => {
38376 "Text file busy, similar to `ETXTBSY` in POSIX."
38377 }
38378 ErrorCode::CrossDevice => {
38379 "Cross-device link, similar to `EXDEV` in POSIX."
38380 }
38381 }
38382 }
38383 }
38384 impl ::core::fmt::Debug for ErrorCode {
38385 fn fmt(
38386 &self,
38387 f: &mut ::core::fmt::Formatter<'_>,
38388 ) -> ::core::fmt::Result {
38389 f.debug_struct("ErrorCode")
38390 .field("code", &(*self as i32))
38391 .field("name", &self.name())
38392 .field("message", &self.message())
38393 .finish()
38394 }
38395 }
38396 impl ::core::fmt::Display for ErrorCode {
38397 fn fmt(
38398 &self,
38399 f: &mut ::core::fmt::Formatter<'_>,
38400 ) -> ::core::fmt::Result {
38401 write!(f, "{} (error {})", self.name(), * self as i32)
38402 }
38403 }
38404 impl std::error::Error for ErrorCode {}
38405 impl ErrorCode {
38406 #[doc(hidden)]
38407 pub unsafe fn _lift(val: u8) -> ErrorCode {
38408 if !cfg!(debug_assertions) {
38409 return ::core::mem::transmute(val);
38410 }
38411 match val {
38412 0 => ErrorCode::Access,
38413 1 => ErrorCode::WouldBlock,
38414 2 => ErrorCode::Already,
38415 3 => ErrorCode::BadDescriptor,
38416 4 => ErrorCode::Busy,
38417 5 => ErrorCode::Deadlock,
38418 6 => ErrorCode::Quota,
38419 7 => ErrorCode::Exist,
38420 8 => ErrorCode::FileTooLarge,
38421 9 => ErrorCode::IllegalByteSequence,
38422 10 => ErrorCode::InProgress,
38423 11 => ErrorCode::Interrupted,
38424 12 => ErrorCode::Invalid,
38425 13 => ErrorCode::Io,
38426 14 => ErrorCode::IsDirectory,
38427 15 => ErrorCode::Loop,
38428 16 => ErrorCode::TooManyLinks,
38429 17 => ErrorCode::MessageSize,
38430 18 => ErrorCode::NameTooLong,
38431 19 => ErrorCode::NoDevice,
38432 20 => ErrorCode::NoEntry,
38433 21 => ErrorCode::NoLock,
38434 22 => ErrorCode::InsufficientMemory,
38435 23 => ErrorCode::InsufficientSpace,
38436 24 => ErrorCode::NotDirectory,
38437 25 => ErrorCode::NotEmpty,
38438 26 => ErrorCode::NotRecoverable,
38439 27 => ErrorCode::Unsupported,
38440 28 => ErrorCode::NoTty,
38441 29 => ErrorCode::NoSuchDevice,
38442 30 => ErrorCode::Overflow,
38443 31 => ErrorCode::NotPermitted,
38444 32 => ErrorCode::Pipe,
38445 33 => ErrorCode::ReadOnly,
38446 34 => ErrorCode::InvalidSeek,
38447 35 => ErrorCode::TextFileBusy,
38448 36 => ErrorCode::CrossDevice,
38449 _ => panic!("invalid enum discriminant"),
38450 }
38451 }
38452 }
38453 /// File or memory access pattern advisory information.
38454 #[repr(u8)]
38455 #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
38456 pub enum Advice {
38457 /// The application has no advice to give on its behavior with respect
38458 /// to the specified data.
38459 Normal,
38460 /// The application expects to access the specified data sequentially
38461 /// from lower offsets to higher offsets.
38462 Sequential,
38463 /// The application expects to access the specified data in a random
38464 /// order.
38465 Random,
38466 /// The application expects to access the specified data in the near
38467 /// future.
38468 WillNeed,
38469 /// The application expects that it will not access the specified data
38470 /// in the near future.
38471 DontNeed,
38472 /// The application expects to access the specified data once and then
38473 /// not reuse it thereafter.
38474 NoReuse,
38475 }
38476 impl ::core::fmt::Debug for Advice {
38477 fn fmt(
38478 &self,
38479 f: &mut ::core::fmt::Formatter<'_>,
38480 ) -> ::core::fmt::Result {
38481 match self {
38482 Advice::Normal => f.debug_tuple("Advice::Normal").finish(),
38483 Advice::Sequential => {
38484 f.debug_tuple("Advice::Sequential").finish()
38485 }
38486 Advice::Random => f.debug_tuple("Advice::Random").finish(),
38487 Advice::WillNeed => f.debug_tuple("Advice::WillNeed").finish(),
38488 Advice::DontNeed => f.debug_tuple("Advice::DontNeed").finish(),
38489 Advice::NoReuse => f.debug_tuple("Advice::NoReuse").finish(),
38490 }
38491 }
38492 }
38493 impl Advice {
38494 #[doc(hidden)]
38495 pub unsafe fn _lift(val: u8) -> Advice {
38496 if !cfg!(debug_assertions) {
38497 return ::core::mem::transmute(val);
38498 }
38499 match val {
38500 0 => Advice::Normal,
38501 1 => Advice::Sequential,
38502 2 => Advice::Random,
38503 3 => Advice::WillNeed,
38504 4 => Advice::DontNeed,
38505 5 => Advice::NoReuse,
38506 _ => panic!("invalid enum discriminant"),
38507 }
38508 }
38509 }
38510 /// A 128-bit hash value, split into parts because wasm doesn't have a
38511 /// 128-bit integer type.
38512 #[repr(C)]
38513 #[derive(Clone, Copy)]
38514 pub struct MetadataHashValue {
38515 /// 64 bits of a 128-bit hash value.
38516 pub lower: u64,
38517 /// Another 64 bits of a 128-bit hash value.
38518 pub upper: u64,
38519 }
38520 impl ::core::fmt::Debug for MetadataHashValue {
38521 fn fmt(
38522 &self,
38523 f: &mut ::core::fmt::Formatter<'_>,
38524 ) -> ::core::fmt::Result {
38525 f.debug_struct("MetadataHashValue")
38526 .field("lower", &self.lower)
38527 .field("upper", &self.upper)
38528 .finish()
38529 }
38530 }
38531 /// A descriptor is a reference to a filesystem object, which may be a file,
38532 /// directory, named pipe, special file, or other object on which filesystem
38533 /// calls may be made.
38534 #[derive(Debug)]
38535 #[repr(transparent)]
38536 pub struct Descriptor {
38537 handle: _rt::Resource<Descriptor>,
38538 }
38539 impl Descriptor {
38540 #[doc(hidden)]
38541 pub unsafe fn from_handle(handle: u32) -> Self {
38542 Self {
38543 handle: _rt::Resource::from_handle(handle),
38544 }
38545 }
38546 #[doc(hidden)]
38547 pub fn take_handle(&self) -> u32 {
38548 _rt::Resource::take_handle(&self.handle)
38549 }
38550 #[doc(hidden)]
38551 pub fn handle(&self) -> u32 {
38552 _rt::Resource::handle(&self.handle)
38553 }
38554 }
38555 unsafe impl _rt::WasmResource for Descriptor {
38556 #[inline]
38557 unsafe fn drop(_handle: u32) {
38558 #[cfg(not(target_arch = "wasm32"))]
38559 unreachable!();
38560 #[cfg(target_arch = "wasm32")]
38561 {
38562 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
38563 extern "C" {
38564 #[link_name = "[resource-drop]descriptor"]
38565 fn drop(_: u32);
38566 }
38567 drop(_handle);
38568 }
38569 }
38570 }
38571 /// A stream of directory entries.
38572 #[derive(Debug)]
38573 #[repr(transparent)]
38574 pub struct DirectoryEntryStream {
38575 handle: _rt::Resource<DirectoryEntryStream>,
38576 }
38577 impl DirectoryEntryStream {
38578 #[doc(hidden)]
38579 pub unsafe fn from_handle(handle: u32) -> Self {
38580 Self {
38581 handle: _rt::Resource::from_handle(handle),
38582 }
38583 }
38584 #[doc(hidden)]
38585 pub fn take_handle(&self) -> u32 {
38586 _rt::Resource::take_handle(&self.handle)
38587 }
38588 #[doc(hidden)]
38589 pub fn handle(&self) -> u32 {
38590 _rt::Resource::handle(&self.handle)
38591 }
38592 }
38593 unsafe impl _rt::WasmResource for DirectoryEntryStream {
38594 #[inline]
38595 unsafe fn drop(_handle: u32) {
38596 #[cfg(not(target_arch = "wasm32"))]
38597 unreachable!();
38598 #[cfg(target_arch = "wasm32")]
38599 {
38600 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
38601 extern "C" {
38602 #[link_name = "[resource-drop]directory-entry-stream"]
38603 fn drop(_: u32);
38604 }
38605 drop(_handle);
38606 }
38607 }
38608 }
38609 impl Descriptor {
38610 #[allow(unused_unsafe, clippy::all)]
38611 /// Return a stream for reading from a file, if available.
38612 ///
38613 /// May fail with an error-code describing why the file cannot be read.
38614 ///
38615 /// Multiple read, write, and append streams may be active on the same open
38616 /// file and they do not interfere with each other.
38617 ///
38618 /// Note: This allows using `read-stream`, which is similar to `read` in POSIX.
38619 pub fn read_via_stream(
38620 &self,
38621 offset: Filesize,
38622 ) -> Result<InputStream, ErrorCode> {
38623 unsafe {
38624 #[repr(align(4))]
38625 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
38626 let mut ret_area = RetArea(
38627 [::core::mem::MaybeUninit::uninit(); 8],
38628 );
38629 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
38630 #[cfg(target_arch = "wasm32")]
38631 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
38632 extern "C" {
38633 #[link_name = "[method]descriptor.read-via-stream"]
38634 fn wit_import(_: i32, _: i64, _: *mut u8);
38635 }
38636 #[cfg(not(target_arch = "wasm32"))]
38637 fn wit_import(_: i32, _: i64, _: *mut u8) {
38638 unreachable!()
38639 }
38640 wit_import((self).handle() as i32, _rt::as_i64(offset), ptr0);
38641 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
38642 match l1 {
38643 0 => {
38644 let e = {
38645 let l2 = *ptr0.add(4).cast::<i32>();
38646 super::super::super::wasi::io::streams::InputStream::from_handle(
38647 l2 as u32,
38648 )
38649 };
38650 Ok(e)
38651 }
38652 1 => {
38653 let e = {
38654 let l3 = i32::from(*ptr0.add(4).cast::<u8>());
38655 ErrorCode::_lift(l3 as u8)
38656 };
38657 Err(e)
38658 }
38659 _ => _rt::invalid_enum_discriminant(),
38660 }
38661 }
38662 }
38663 }
38664 impl Descriptor {
38665 #[allow(unused_unsafe, clippy::all)]
38666 /// Return a stream for writing to a file, if available.
38667 ///
38668 /// May fail with an error-code describing why the file cannot be written.
38669 ///
38670 /// Note: This allows using `write-stream`, which is similar to `write` in
38671 /// POSIX.
38672 pub fn write_via_stream(
38673 &self,
38674 offset: Filesize,
38675 ) -> Result<OutputStream, ErrorCode> {
38676 unsafe {
38677 #[repr(align(4))]
38678 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
38679 let mut ret_area = RetArea(
38680 [::core::mem::MaybeUninit::uninit(); 8],
38681 );
38682 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
38683 #[cfg(target_arch = "wasm32")]
38684 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
38685 extern "C" {
38686 #[link_name = "[method]descriptor.write-via-stream"]
38687 fn wit_import(_: i32, _: i64, _: *mut u8);
38688 }
38689 #[cfg(not(target_arch = "wasm32"))]
38690 fn wit_import(_: i32, _: i64, _: *mut u8) {
38691 unreachable!()
38692 }
38693 wit_import((self).handle() as i32, _rt::as_i64(offset), ptr0);
38694 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
38695 match l1 {
38696 0 => {
38697 let e = {
38698 let l2 = *ptr0.add(4).cast::<i32>();
38699 super::super::super::wasi::io::streams::OutputStream::from_handle(
38700 l2 as u32,
38701 )
38702 };
38703 Ok(e)
38704 }
38705 1 => {
38706 let e = {
38707 let l3 = i32::from(*ptr0.add(4).cast::<u8>());
38708 ErrorCode::_lift(l3 as u8)
38709 };
38710 Err(e)
38711 }
38712 _ => _rt::invalid_enum_discriminant(),
38713 }
38714 }
38715 }
38716 }
38717 impl Descriptor {
38718 #[allow(unused_unsafe, clippy::all)]
38719 /// Return a stream for appending to a file, if available.
38720 ///
38721 /// May fail with an error-code describing why the file cannot be appended.
38722 ///
38723 /// Note: This allows using `write-stream`, which is similar to `write` with
38724 /// `O_APPEND` in in POSIX.
38725 pub fn append_via_stream(&self) -> Result<OutputStream, ErrorCode> {
38726 unsafe {
38727 #[repr(align(4))]
38728 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
38729 let mut ret_area = RetArea(
38730 [::core::mem::MaybeUninit::uninit(); 8],
38731 );
38732 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
38733 #[cfg(target_arch = "wasm32")]
38734 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
38735 extern "C" {
38736 #[link_name = "[method]descriptor.append-via-stream"]
38737 fn wit_import(_: i32, _: *mut u8);
38738 }
38739 #[cfg(not(target_arch = "wasm32"))]
38740 fn wit_import(_: i32, _: *mut u8) {
38741 unreachable!()
38742 }
38743 wit_import((self).handle() as i32, ptr0);
38744 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
38745 match l1 {
38746 0 => {
38747 let e = {
38748 let l2 = *ptr0.add(4).cast::<i32>();
38749 super::super::super::wasi::io::streams::OutputStream::from_handle(
38750 l2 as u32,
38751 )
38752 };
38753 Ok(e)
38754 }
38755 1 => {
38756 let e = {
38757 let l3 = i32::from(*ptr0.add(4).cast::<u8>());
38758 ErrorCode::_lift(l3 as u8)
38759 };
38760 Err(e)
38761 }
38762 _ => _rt::invalid_enum_discriminant(),
38763 }
38764 }
38765 }
38766 }
38767 impl Descriptor {
38768 #[allow(unused_unsafe, clippy::all)]
38769 /// Provide file advisory information on a descriptor.
38770 ///
38771 /// This is similar to `posix_fadvise` in POSIX.
38772 pub fn advise(
38773 &self,
38774 offset: Filesize,
38775 length: Filesize,
38776 advice: Advice,
38777 ) -> Result<(), ErrorCode> {
38778 unsafe {
38779 #[repr(align(1))]
38780 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
38781 let mut ret_area = RetArea(
38782 [::core::mem::MaybeUninit::uninit(); 2],
38783 );
38784 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
38785 #[cfg(target_arch = "wasm32")]
38786 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
38787 extern "C" {
38788 #[link_name = "[method]descriptor.advise"]
38789 fn wit_import(_: i32, _: i64, _: i64, _: i32, _: *mut u8);
38790 }
38791 #[cfg(not(target_arch = "wasm32"))]
38792 fn wit_import(_: i32, _: i64, _: i64, _: i32, _: *mut u8) {
38793 unreachable!()
38794 }
38795 wit_import(
38796 (self).handle() as i32,
38797 _rt::as_i64(offset),
38798 _rt::as_i64(length),
38799 advice.clone() as i32,
38800 ptr0,
38801 );
38802 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
38803 match l1 {
38804 0 => {
38805 let e = ();
38806 Ok(e)
38807 }
38808 1 => {
38809 let e = {
38810 let l2 = i32::from(*ptr0.add(1).cast::<u8>());
38811 ErrorCode::_lift(l2 as u8)
38812 };
38813 Err(e)
38814 }
38815 _ => _rt::invalid_enum_discriminant(),
38816 }
38817 }
38818 }
38819 }
38820 impl Descriptor {
38821 #[allow(unused_unsafe, clippy::all)]
38822 /// Synchronize the data of a file to disk.
38823 ///
38824 /// This function succeeds with no effect if the file descriptor is not
38825 /// opened for writing.
38826 ///
38827 /// Note: This is similar to `fdatasync` in POSIX.
38828 pub fn sync_data(&self) -> Result<(), ErrorCode> {
38829 unsafe {
38830 #[repr(align(1))]
38831 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
38832 let mut ret_area = RetArea(
38833 [::core::mem::MaybeUninit::uninit(); 2],
38834 );
38835 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
38836 #[cfg(target_arch = "wasm32")]
38837 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
38838 extern "C" {
38839 #[link_name = "[method]descriptor.sync-data"]
38840 fn wit_import(_: i32, _: *mut u8);
38841 }
38842 #[cfg(not(target_arch = "wasm32"))]
38843 fn wit_import(_: i32, _: *mut u8) {
38844 unreachable!()
38845 }
38846 wit_import((self).handle() as i32, ptr0);
38847 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
38848 match l1 {
38849 0 => {
38850 let e = ();
38851 Ok(e)
38852 }
38853 1 => {
38854 let e = {
38855 let l2 = i32::from(*ptr0.add(1).cast::<u8>());
38856 ErrorCode::_lift(l2 as u8)
38857 };
38858 Err(e)
38859 }
38860 _ => _rt::invalid_enum_discriminant(),
38861 }
38862 }
38863 }
38864 }
38865 impl Descriptor {
38866 #[allow(unused_unsafe, clippy::all)]
38867 /// Get flags associated with a descriptor.
38868 ///
38869 /// Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX.
38870 ///
38871 /// Note: This returns the value that was the `fs_flags` value returned
38872 /// from `fdstat_get` in earlier versions of WASI.
38873 pub fn get_flags(&self) -> Result<DescriptorFlags, ErrorCode> {
38874 unsafe {
38875 #[repr(align(1))]
38876 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
38877 let mut ret_area = RetArea(
38878 [::core::mem::MaybeUninit::uninit(); 2],
38879 );
38880 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
38881 #[cfg(target_arch = "wasm32")]
38882 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
38883 extern "C" {
38884 #[link_name = "[method]descriptor.get-flags"]
38885 fn wit_import(_: i32, _: *mut u8);
38886 }
38887 #[cfg(not(target_arch = "wasm32"))]
38888 fn wit_import(_: i32, _: *mut u8) {
38889 unreachable!()
38890 }
38891 wit_import((self).handle() as i32, ptr0);
38892 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
38893 match l1 {
38894 0 => {
38895 let e = {
38896 let l2 = i32::from(*ptr0.add(1).cast::<u8>());
38897 DescriptorFlags::empty()
38898 | DescriptorFlags::from_bits_retain(((l2 as u8) << 0) as _)
38899 };
38900 Ok(e)
38901 }
38902 1 => {
38903 let e = {
38904 let l3 = i32::from(*ptr0.add(1).cast::<u8>());
38905 ErrorCode::_lift(l3 as u8)
38906 };
38907 Err(e)
38908 }
38909 _ => _rt::invalid_enum_discriminant(),
38910 }
38911 }
38912 }
38913 }
38914 impl Descriptor {
38915 #[allow(unused_unsafe, clippy::all)]
38916 /// Get the dynamic type of a descriptor.
38917 ///
38918 /// Note: This returns the same value as the `type` field of the `fd-stat`
38919 /// returned by `stat`, `stat-at` and similar.
38920 ///
38921 /// Note: This returns similar flags to the `st_mode & S_IFMT` value provided
38922 /// by `fstat` in POSIX.
38923 ///
38924 /// Note: This returns the value that was the `fs_filetype` value returned
38925 /// from `fdstat_get` in earlier versions of WASI.
38926 pub fn get_type(&self) -> Result<DescriptorType, ErrorCode> {
38927 unsafe {
38928 #[repr(align(1))]
38929 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
38930 let mut ret_area = RetArea(
38931 [::core::mem::MaybeUninit::uninit(); 2],
38932 );
38933 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
38934 #[cfg(target_arch = "wasm32")]
38935 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
38936 extern "C" {
38937 #[link_name = "[method]descriptor.get-type"]
38938 fn wit_import(_: i32, _: *mut u8);
38939 }
38940 #[cfg(not(target_arch = "wasm32"))]
38941 fn wit_import(_: i32, _: *mut u8) {
38942 unreachable!()
38943 }
38944 wit_import((self).handle() as i32, ptr0);
38945 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
38946 match l1 {
38947 0 => {
38948 let e = {
38949 let l2 = i32::from(*ptr0.add(1).cast::<u8>());
38950 DescriptorType::_lift(l2 as u8)
38951 };
38952 Ok(e)
38953 }
38954 1 => {
38955 let e = {
38956 let l3 = i32::from(*ptr0.add(1).cast::<u8>());
38957 ErrorCode::_lift(l3 as u8)
38958 };
38959 Err(e)
38960 }
38961 _ => _rt::invalid_enum_discriminant(),
38962 }
38963 }
38964 }
38965 }
38966 impl Descriptor {
38967 #[allow(unused_unsafe, clippy::all)]
38968 /// Adjust the size of an open file. If this increases the file's size, the
38969 /// extra bytes are filled with zeros.
38970 ///
38971 /// Note: This was called `fd_filestat_set_size` in earlier versions of WASI.
38972 pub fn set_size(&self, size: Filesize) -> Result<(), ErrorCode> {
38973 unsafe {
38974 #[repr(align(1))]
38975 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
38976 let mut ret_area = RetArea(
38977 [::core::mem::MaybeUninit::uninit(); 2],
38978 );
38979 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
38980 #[cfg(target_arch = "wasm32")]
38981 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
38982 extern "C" {
38983 #[link_name = "[method]descriptor.set-size"]
38984 fn wit_import(_: i32, _: i64, _: *mut u8);
38985 }
38986 #[cfg(not(target_arch = "wasm32"))]
38987 fn wit_import(_: i32, _: i64, _: *mut u8) {
38988 unreachable!()
38989 }
38990 wit_import((self).handle() as i32, _rt::as_i64(size), ptr0);
38991 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
38992 match l1 {
38993 0 => {
38994 let e = ();
38995 Ok(e)
38996 }
38997 1 => {
38998 let e = {
38999 let l2 = i32::from(*ptr0.add(1).cast::<u8>());
39000 ErrorCode::_lift(l2 as u8)
39001 };
39002 Err(e)
39003 }
39004 _ => _rt::invalid_enum_discriminant(),
39005 }
39006 }
39007 }
39008 }
39009 impl Descriptor {
39010 #[allow(unused_unsafe, clippy::all)]
39011 /// Adjust the timestamps of an open file or directory.
39012 ///
39013 /// Note: This is similar to `futimens` in POSIX.
39014 ///
39015 /// Note: This was called `fd_filestat_set_times` in earlier versions of WASI.
39016 pub fn set_times(
39017 &self,
39018 data_access_timestamp: NewTimestamp,
39019 data_modification_timestamp: NewTimestamp,
39020 ) -> Result<(), ErrorCode> {
39021 unsafe {
39022 #[repr(align(1))]
39023 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
39024 let mut ret_area = RetArea(
39025 [::core::mem::MaybeUninit::uninit(); 2],
39026 );
39027 let (result1_0, result1_1, result1_2) = match data_access_timestamp {
39028 NewTimestamp::NoChange => (0i32, 0i64, 0i32),
39029 NewTimestamp::Now => (1i32, 0i64, 0i32),
39030 NewTimestamp::Timestamp(e) => {
39031 let super::super::super::wasi::clocks::wall_clock::Datetime {
39032 seconds: seconds0,
39033 nanoseconds: nanoseconds0,
39034 } = e;
39035 (2i32, _rt::as_i64(seconds0), _rt::as_i32(nanoseconds0))
39036 }
39037 };
39038 let (result3_0, result3_1, result3_2) = match data_modification_timestamp {
39039 NewTimestamp::NoChange => (0i32, 0i64, 0i32),
39040 NewTimestamp::Now => (1i32, 0i64, 0i32),
39041 NewTimestamp::Timestamp(e) => {
39042 let super::super::super::wasi::clocks::wall_clock::Datetime {
39043 seconds: seconds2,
39044 nanoseconds: nanoseconds2,
39045 } = e;
39046 (2i32, _rt::as_i64(seconds2), _rt::as_i32(nanoseconds2))
39047 }
39048 };
39049 let ptr4 = ret_area.0.as_mut_ptr().cast::<u8>();
39050 #[cfg(target_arch = "wasm32")]
39051 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
39052 extern "C" {
39053 #[link_name = "[method]descriptor.set-times"]
39054 fn wit_import(
39055 _: i32,
39056 _: i32,
39057 _: i64,
39058 _: i32,
39059 _: i32,
39060 _: i64,
39061 _: i32,
39062 _: *mut u8,
39063 );
39064 }
39065 #[cfg(not(target_arch = "wasm32"))]
39066 fn wit_import(
39067 _: i32,
39068 _: i32,
39069 _: i64,
39070 _: i32,
39071 _: i32,
39072 _: i64,
39073 _: i32,
39074 _: *mut u8,
39075 ) {
39076 unreachable!()
39077 }
39078 wit_import(
39079 (self).handle() as i32,
39080 result1_0,
39081 result1_1,
39082 result1_2,
39083 result3_0,
39084 result3_1,
39085 result3_2,
39086 ptr4,
39087 );
39088 let l5 = i32::from(*ptr4.add(0).cast::<u8>());
39089 match l5 {
39090 0 => {
39091 let e = ();
39092 Ok(e)
39093 }
39094 1 => {
39095 let e = {
39096 let l6 = i32::from(*ptr4.add(1).cast::<u8>());
39097 ErrorCode::_lift(l6 as u8)
39098 };
39099 Err(e)
39100 }
39101 _ => _rt::invalid_enum_discriminant(),
39102 }
39103 }
39104 }
39105 }
39106 impl Descriptor {
39107 #[allow(unused_unsafe, clippy::all)]
39108 /// Read from a descriptor, without using and updating the descriptor's offset.
39109 ///
39110 /// This function returns a list of bytes containing the data that was
39111 /// read, along with a bool which, when true, indicates that the end of the
39112 /// file was reached. The returned list will contain up to `length` bytes; it
39113 /// may return fewer than requested, if the end of the file is reached or
39114 /// if the I/O operation is interrupted.
39115 ///
39116 /// In the future, this may change to return a `stream<u8, error-code>`.
39117 ///
39118 /// Note: This is similar to `pread` in POSIX.
39119 pub fn read(
39120 &self,
39121 length: Filesize,
39122 offset: Filesize,
39123 ) -> Result<(_rt::Vec<u8>, bool), ErrorCode> {
39124 unsafe {
39125 #[repr(align(4))]
39126 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
39127 let mut ret_area = RetArea(
39128 [::core::mem::MaybeUninit::uninit(); 16],
39129 );
39130 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
39131 #[cfg(target_arch = "wasm32")]
39132 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
39133 extern "C" {
39134 #[link_name = "[method]descriptor.read"]
39135 fn wit_import(_: i32, _: i64, _: i64, _: *mut u8);
39136 }
39137 #[cfg(not(target_arch = "wasm32"))]
39138 fn wit_import(_: i32, _: i64, _: i64, _: *mut u8) {
39139 unreachable!()
39140 }
39141 wit_import(
39142 (self).handle() as i32,
39143 _rt::as_i64(length),
39144 _rt::as_i64(offset),
39145 ptr0,
39146 );
39147 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
39148 match l1 {
39149 0 => {
39150 let e = {
39151 let l2 = *ptr0.add(4).cast::<*mut u8>();
39152 let l3 = *ptr0.add(8).cast::<usize>();
39153 let len4 = l3;
39154 let l5 = i32::from(*ptr0.add(12).cast::<u8>());
39155 (
39156 _rt::Vec::from_raw_parts(l2.cast(), len4, len4),
39157 _rt::bool_lift(l5 as u8),
39158 )
39159 };
39160 Ok(e)
39161 }
39162 1 => {
39163 let e = {
39164 let l6 = i32::from(*ptr0.add(4).cast::<u8>());
39165 ErrorCode::_lift(l6 as u8)
39166 };
39167 Err(e)
39168 }
39169 _ => _rt::invalid_enum_discriminant(),
39170 }
39171 }
39172 }
39173 }
39174 impl Descriptor {
39175 #[allow(unused_unsafe, clippy::all)]
39176 /// Write to a descriptor, without using and updating the descriptor's offset.
39177 ///
39178 /// It is valid to write past the end of a file; the file is extended to the
39179 /// extent of the write, with bytes between the previous end and the start of
39180 /// the write set to zero.
39181 ///
39182 /// In the future, this may change to take a `stream<u8, error-code>`.
39183 ///
39184 /// Note: This is similar to `pwrite` in POSIX.
39185 pub fn write(
39186 &self,
39187 buffer: &[u8],
39188 offset: Filesize,
39189 ) -> Result<Filesize, ErrorCode> {
39190 unsafe {
39191 #[repr(align(8))]
39192 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
39193 let mut ret_area = RetArea(
39194 [::core::mem::MaybeUninit::uninit(); 16],
39195 );
39196 let vec0 = buffer;
39197 let ptr0 = vec0.as_ptr().cast::<u8>();
39198 let len0 = vec0.len();
39199 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
39200 #[cfg(target_arch = "wasm32")]
39201 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
39202 extern "C" {
39203 #[link_name = "[method]descriptor.write"]
39204 fn wit_import(
39205 _: i32,
39206 _: *mut u8,
39207 _: usize,
39208 _: i64,
39209 _: *mut u8,
39210 );
39211 }
39212 #[cfg(not(target_arch = "wasm32"))]
39213 fn wit_import(_: i32, _: *mut u8, _: usize, _: i64, _: *mut u8) {
39214 unreachable!()
39215 }
39216 wit_import(
39217 (self).handle() as i32,
39218 ptr0.cast_mut(),
39219 len0,
39220 _rt::as_i64(offset),
39221 ptr1,
39222 );
39223 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
39224 match l2 {
39225 0 => {
39226 let e = {
39227 let l3 = *ptr1.add(8).cast::<i64>();
39228 l3 as u64
39229 };
39230 Ok(e)
39231 }
39232 1 => {
39233 let e = {
39234 let l4 = i32::from(*ptr1.add(8).cast::<u8>());
39235 ErrorCode::_lift(l4 as u8)
39236 };
39237 Err(e)
39238 }
39239 _ => _rt::invalid_enum_discriminant(),
39240 }
39241 }
39242 }
39243 }
39244 impl Descriptor {
39245 #[allow(unused_unsafe, clippy::all)]
39246 /// Read directory entries from a directory.
39247 ///
39248 /// On filesystems where directories contain entries referring to themselves
39249 /// and their parents, often named `.` and `..` respectively, these entries
39250 /// are omitted.
39251 ///
39252 /// This always returns a new stream which starts at the beginning of the
39253 /// directory. Multiple streams may be active on the same directory, and they
39254 /// do not interfere with each other.
39255 pub fn read_directory(&self) -> Result<DirectoryEntryStream, ErrorCode> {
39256 unsafe {
39257 #[repr(align(4))]
39258 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
39259 let mut ret_area = RetArea(
39260 [::core::mem::MaybeUninit::uninit(); 8],
39261 );
39262 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
39263 #[cfg(target_arch = "wasm32")]
39264 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
39265 extern "C" {
39266 #[link_name = "[method]descriptor.read-directory"]
39267 fn wit_import(_: i32, _: *mut u8);
39268 }
39269 #[cfg(not(target_arch = "wasm32"))]
39270 fn wit_import(_: i32, _: *mut u8) {
39271 unreachable!()
39272 }
39273 wit_import((self).handle() as i32, ptr0);
39274 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
39275 match l1 {
39276 0 => {
39277 let e = {
39278 let l2 = *ptr0.add(4).cast::<i32>();
39279 DirectoryEntryStream::from_handle(l2 as u32)
39280 };
39281 Ok(e)
39282 }
39283 1 => {
39284 let e = {
39285 let l3 = i32::from(*ptr0.add(4).cast::<u8>());
39286 ErrorCode::_lift(l3 as u8)
39287 };
39288 Err(e)
39289 }
39290 _ => _rt::invalid_enum_discriminant(),
39291 }
39292 }
39293 }
39294 }
39295 impl Descriptor {
39296 #[allow(unused_unsafe, clippy::all)]
39297 /// Synchronize the data and metadata of a file to disk.
39298 ///
39299 /// This function succeeds with no effect if the file descriptor is not
39300 /// opened for writing.
39301 ///
39302 /// Note: This is similar to `fsync` in POSIX.
39303 pub fn sync(&self) -> Result<(), ErrorCode> {
39304 unsafe {
39305 #[repr(align(1))]
39306 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
39307 let mut ret_area = RetArea(
39308 [::core::mem::MaybeUninit::uninit(); 2],
39309 );
39310 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
39311 #[cfg(target_arch = "wasm32")]
39312 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
39313 extern "C" {
39314 #[link_name = "[method]descriptor.sync"]
39315 fn wit_import(_: i32, _: *mut u8);
39316 }
39317 #[cfg(not(target_arch = "wasm32"))]
39318 fn wit_import(_: i32, _: *mut u8) {
39319 unreachable!()
39320 }
39321 wit_import((self).handle() as i32, ptr0);
39322 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
39323 match l1 {
39324 0 => {
39325 let e = ();
39326 Ok(e)
39327 }
39328 1 => {
39329 let e = {
39330 let l2 = i32::from(*ptr0.add(1).cast::<u8>());
39331 ErrorCode::_lift(l2 as u8)
39332 };
39333 Err(e)
39334 }
39335 _ => _rt::invalid_enum_discriminant(),
39336 }
39337 }
39338 }
39339 }
39340 impl Descriptor {
39341 #[allow(unused_unsafe, clippy::all)]
39342 /// Create a directory.
39343 ///
39344 /// Note: This is similar to `mkdirat` in POSIX.
39345 pub fn create_directory_at(&self, path: &str) -> Result<(), ErrorCode> {
39346 unsafe {
39347 #[repr(align(1))]
39348 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
39349 let mut ret_area = RetArea(
39350 [::core::mem::MaybeUninit::uninit(); 2],
39351 );
39352 let vec0 = path;
39353 let ptr0 = vec0.as_ptr().cast::<u8>();
39354 let len0 = vec0.len();
39355 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
39356 #[cfg(target_arch = "wasm32")]
39357 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
39358 extern "C" {
39359 #[link_name = "[method]descriptor.create-directory-at"]
39360 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
39361 }
39362 #[cfg(not(target_arch = "wasm32"))]
39363 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
39364 unreachable!()
39365 }
39366 wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
39367 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
39368 match l2 {
39369 0 => {
39370 let e = ();
39371 Ok(e)
39372 }
39373 1 => {
39374 let e = {
39375 let l3 = i32::from(*ptr1.add(1).cast::<u8>());
39376 ErrorCode::_lift(l3 as u8)
39377 };
39378 Err(e)
39379 }
39380 _ => _rt::invalid_enum_discriminant(),
39381 }
39382 }
39383 }
39384 }
39385 impl Descriptor {
39386 #[allow(unused_unsafe, clippy::all)]
39387 /// Return the attributes of an open file or directory.
39388 ///
39389 /// Note: This is similar to `fstat` in POSIX, except that it does not return
39390 /// device and inode information. For testing whether two descriptors refer to
39391 /// the same underlying filesystem object, use `is-same-object`. To obtain
39392 /// additional data that can be used do determine whether a file has been
39393 /// modified, use `metadata-hash`.
39394 ///
39395 /// Note: This was called `fd_filestat_get` in earlier versions of WASI.
39396 pub fn stat(&self) -> Result<DescriptorStat, ErrorCode> {
39397 unsafe {
39398 #[repr(align(8))]
39399 struct RetArea([::core::mem::MaybeUninit<u8>; 104]);
39400 let mut ret_area = RetArea(
39401 [::core::mem::MaybeUninit::uninit(); 104],
39402 );
39403 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
39404 #[cfg(target_arch = "wasm32")]
39405 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
39406 extern "C" {
39407 #[link_name = "[method]descriptor.stat"]
39408 fn wit_import(_: i32, _: *mut u8);
39409 }
39410 #[cfg(not(target_arch = "wasm32"))]
39411 fn wit_import(_: i32, _: *mut u8) {
39412 unreachable!()
39413 }
39414 wit_import((self).handle() as i32, ptr0);
39415 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
39416 match l1 {
39417 0 => {
39418 let e = {
39419 let l2 = i32::from(*ptr0.add(8).cast::<u8>());
39420 let l3 = *ptr0.add(16).cast::<i64>();
39421 let l4 = *ptr0.add(24).cast::<i64>();
39422 let l5 = i32::from(*ptr0.add(32).cast::<u8>());
39423 let l8 = i32::from(*ptr0.add(56).cast::<u8>());
39424 let l11 = i32::from(*ptr0.add(80).cast::<u8>());
39425 DescriptorStat {
39426 type_: DescriptorType::_lift(l2 as u8),
39427 link_count: l3 as u64,
39428 size: l4 as u64,
39429 data_access_timestamp: match l5 {
39430 0 => None,
39431 1 => {
39432 let e = {
39433 let l6 = *ptr0.add(40).cast::<i64>();
39434 let l7 = *ptr0.add(48).cast::<i32>();
39435 super::super::super::wasi::clocks::wall_clock::Datetime {
39436 seconds: l6 as u64,
39437 nanoseconds: l7 as u32,
39438 }
39439 };
39440 Some(e)
39441 }
39442 _ => _rt::invalid_enum_discriminant(),
39443 },
39444 data_modification_timestamp: match l8 {
39445 0 => None,
39446 1 => {
39447 let e = {
39448 let l9 = *ptr0.add(64).cast::<i64>();
39449 let l10 = *ptr0.add(72).cast::<i32>();
39450 super::super::super::wasi::clocks::wall_clock::Datetime {
39451 seconds: l9 as u64,
39452 nanoseconds: l10 as u32,
39453 }
39454 };
39455 Some(e)
39456 }
39457 _ => _rt::invalid_enum_discriminant(),
39458 },
39459 status_change_timestamp: match l11 {
39460 0 => None,
39461 1 => {
39462 let e = {
39463 let l12 = *ptr0.add(88).cast::<i64>();
39464 let l13 = *ptr0.add(96).cast::<i32>();
39465 super::super::super::wasi::clocks::wall_clock::Datetime {
39466 seconds: l12 as u64,
39467 nanoseconds: l13 as u32,
39468 }
39469 };
39470 Some(e)
39471 }
39472 _ => _rt::invalid_enum_discriminant(),
39473 },
39474 }
39475 };
39476 Ok(e)
39477 }
39478 1 => {
39479 let e = {
39480 let l14 = i32::from(*ptr0.add(8).cast::<u8>());
39481 ErrorCode::_lift(l14 as u8)
39482 };
39483 Err(e)
39484 }
39485 _ => _rt::invalid_enum_discriminant(),
39486 }
39487 }
39488 }
39489 }
39490 impl Descriptor {
39491 #[allow(unused_unsafe, clippy::all)]
39492 /// Return the attributes of a file or directory.
39493 ///
39494 /// Note: This is similar to `fstatat` in POSIX, except that it does not
39495 /// return device and inode information. See the `stat` description for a
39496 /// discussion of alternatives.
39497 ///
39498 /// Note: This was called `path_filestat_get` in earlier versions of WASI.
39499 pub fn stat_at(
39500 &self,
39501 path_flags: PathFlags,
39502 path: &str,
39503 ) -> Result<DescriptorStat, ErrorCode> {
39504 unsafe {
39505 #[repr(align(8))]
39506 struct RetArea([::core::mem::MaybeUninit<u8>; 104]);
39507 let mut ret_area = RetArea(
39508 [::core::mem::MaybeUninit::uninit(); 104],
39509 );
39510 let flags0 = path_flags;
39511 let vec1 = path;
39512 let ptr1 = vec1.as_ptr().cast::<u8>();
39513 let len1 = vec1.len();
39514 let ptr2 = ret_area.0.as_mut_ptr().cast::<u8>();
39515 #[cfg(target_arch = "wasm32")]
39516 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
39517 extern "C" {
39518 #[link_name = "[method]descriptor.stat-at"]
39519 fn wit_import(
39520 _: i32,
39521 _: i32,
39522 _: *mut u8,
39523 _: usize,
39524 _: *mut u8,
39525 );
39526 }
39527 #[cfg(not(target_arch = "wasm32"))]
39528 fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8) {
39529 unreachable!()
39530 }
39531 wit_import(
39532 (self).handle() as i32,
39533 (flags0.bits() >> 0) as i32,
39534 ptr1.cast_mut(),
39535 len1,
39536 ptr2,
39537 );
39538 let l3 = i32::from(*ptr2.add(0).cast::<u8>());
39539 match l3 {
39540 0 => {
39541 let e = {
39542 let l4 = i32::from(*ptr2.add(8).cast::<u8>());
39543 let l5 = *ptr2.add(16).cast::<i64>();
39544 let l6 = *ptr2.add(24).cast::<i64>();
39545 let l7 = i32::from(*ptr2.add(32).cast::<u8>());
39546 let l10 = i32::from(*ptr2.add(56).cast::<u8>());
39547 let l13 = i32::from(*ptr2.add(80).cast::<u8>());
39548 DescriptorStat {
39549 type_: DescriptorType::_lift(l4 as u8),
39550 link_count: l5 as u64,
39551 size: l6 as u64,
39552 data_access_timestamp: match l7 {
39553 0 => None,
39554 1 => {
39555 let e = {
39556 let l8 = *ptr2.add(40).cast::<i64>();
39557 let l9 = *ptr2.add(48).cast::<i32>();
39558 super::super::super::wasi::clocks::wall_clock::Datetime {
39559 seconds: l8 as u64,
39560 nanoseconds: l9 as u32,
39561 }
39562 };
39563 Some(e)
39564 }
39565 _ => _rt::invalid_enum_discriminant(),
39566 },
39567 data_modification_timestamp: match l10 {
39568 0 => None,
39569 1 => {
39570 let e = {
39571 let l11 = *ptr2.add(64).cast::<i64>();
39572 let l12 = *ptr2.add(72).cast::<i32>();
39573 super::super::super::wasi::clocks::wall_clock::Datetime {
39574 seconds: l11 as u64,
39575 nanoseconds: l12 as u32,
39576 }
39577 };
39578 Some(e)
39579 }
39580 _ => _rt::invalid_enum_discriminant(),
39581 },
39582 status_change_timestamp: match l13 {
39583 0 => None,
39584 1 => {
39585 let e = {
39586 let l14 = *ptr2.add(88).cast::<i64>();
39587 let l15 = *ptr2.add(96).cast::<i32>();
39588 super::super::super::wasi::clocks::wall_clock::Datetime {
39589 seconds: l14 as u64,
39590 nanoseconds: l15 as u32,
39591 }
39592 };
39593 Some(e)
39594 }
39595 _ => _rt::invalid_enum_discriminant(),
39596 },
39597 }
39598 };
39599 Ok(e)
39600 }
39601 1 => {
39602 let e = {
39603 let l16 = i32::from(*ptr2.add(8).cast::<u8>());
39604 ErrorCode::_lift(l16 as u8)
39605 };
39606 Err(e)
39607 }
39608 _ => _rt::invalid_enum_discriminant(),
39609 }
39610 }
39611 }
39612 }
39613 impl Descriptor {
39614 #[allow(unused_unsafe, clippy::all)]
39615 /// Adjust the timestamps of a file or directory.
39616 ///
39617 /// Note: This is similar to `utimensat` in POSIX.
39618 ///
39619 /// Note: This was called `path_filestat_set_times` in earlier versions of
39620 /// WASI.
39621 pub fn set_times_at(
39622 &self,
39623 path_flags: PathFlags,
39624 path: &str,
39625 data_access_timestamp: NewTimestamp,
39626 data_modification_timestamp: NewTimestamp,
39627 ) -> Result<(), ErrorCode> {
39628 unsafe {
39629 #[repr(align(1))]
39630 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
39631 let mut ret_area = RetArea(
39632 [::core::mem::MaybeUninit::uninit(); 2],
39633 );
39634 let flags0 = path_flags;
39635 let vec1 = path;
39636 let ptr1 = vec1.as_ptr().cast::<u8>();
39637 let len1 = vec1.len();
39638 let (result3_0, result3_1, result3_2) = match data_access_timestamp {
39639 NewTimestamp::NoChange => (0i32, 0i64, 0i32),
39640 NewTimestamp::Now => (1i32, 0i64, 0i32),
39641 NewTimestamp::Timestamp(e) => {
39642 let super::super::super::wasi::clocks::wall_clock::Datetime {
39643 seconds: seconds2,
39644 nanoseconds: nanoseconds2,
39645 } = e;
39646 (2i32, _rt::as_i64(seconds2), _rt::as_i32(nanoseconds2))
39647 }
39648 };
39649 let (result5_0, result5_1, result5_2) = match data_modification_timestamp {
39650 NewTimestamp::NoChange => (0i32, 0i64, 0i32),
39651 NewTimestamp::Now => (1i32, 0i64, 0i32),
39652 NewTimestamp::Timestamp(e) => {
39653 let super::super::super::wasi::clocks::wall_clock::Datetime {
39654 seconds: seconds4,
39655 nanoseconds: nanoseconds4,
39656 } = e;
39657 (2i32, _rt::as_i64(seconds4), _rt::as_i32(nanoseconds4))
39658 }
39659 };
39660 let ptr6 = ret_area.0.as_mut_ptr().cast::<u8>();
39661 #[cfg(target_arch = "wasm32")]
39662 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
39663 extern "C" {
39664 #[link_name = "[method]descriptor.set-times-at"]
39665 fn wit_import(
39666 _: i32,
39667 _: i32,
39668 _: *mut u8,
39669 _: usize,
39670 _: i32,
39671 _: i64,
39672 _: i32,
39673 _: i32,
39674 _: i64,
39675 _: i32,
39676 _: *mut u8,
39677 );
39678 }
39679 #[cfg(not(target_arch = "wasm32"))]
39680 fn wit_import(
39681 _: i32,
39682 _: i32,
39683 _: *mut u8,
39684 _: usize,
39685 _: i32,
39686 _: i64,
39687 _: i32,
39688 _: i32,
39689 _: i64,
39690 _: i32,
39691 _: *mut u8,
39692 ) {
39693 unreachable!()
39694 }
39695 wit_import(
39696 (self).handle() as i32,
39697 (flags0.bits() >> 0) as i32,
39698 ptr1.cast_mut(),
39699 len1,
39700 result3_0,
39701 result3_1,
39702 result3_2,
39703 result5_0,
39704 result5_1,
39705 result5_2,
39706 ptr6,
39707 );
39708 let l7 = i32::from(*ptr6.add(0).cast::<u8>());
39709 match l7 {
39710 0 => {
39711 let e = ();
39712 Ok(e)
39713 }
39714 1 => {
39715 let e = {
39716 let l8 = i32::from(*ptr6.add(1).cast::<u8>());
39717 ErrorCode::_lift(l8 as u8)
39718 };
39719 Err(e)
39720 }
39721 _ => _rt::invalid_enum_discriminant(),
39722 }
39723 }
39724 }
39725 }
39726 impl Descriptor {
39727 #[allow(unused_unsafe, clippy::all)]
39728 /// Create a hard link.
39729 ///
39730 /// Note: This is similar to `linkat` in POSIX.
39731 pub fn link_at(
39732 &self,
39733 old_path_flags: PathFlags,
39734 old_path: &str,
39735 new_descriptor: &Descriptor,
39736 new_path: &str,
39737 ) -> Result<(), ErrorCode> {
39738 unsafe {
39739 #[repr(align(1))]
39740 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
39741 let mut ret_area = RetArea(
39742 [::core::mem::MaybeUninit::uninit(); 2],
39743 );
39744 let flags0 = old_path_flags;
39745 let vec1 = old_path;
39746 let ptr1 = vec1.as_ptr().cast::<u8>();
39747 let len1 = vec1.len();
39748 let vec2 = new_path;
39749 let ptr2 = vec2.as_ptr().cast::<u8>();
39750 let len2 = vec2.len();
39751 let ptr3 = ret_area.0.as_mut_ptr().cast::<u8>();
39752 #[cfg(target_arch = "wasm32")]
39753 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
39754 extern "C" {
39755 #[link_name = "[method]descriptor.link-at"]
39756 fn wit_import(
39757 _: i32,
39758 _: i32,
39759 _: *mut u8,
39760 _: usize,
39761 _: i32,
39762 _: *mut u8,
39763 _: usize,
39764 _: *mut u8,
39765 );
39766 }
39767 #[cfg(not(target_arch = "wasm32"))]
39768 fn wit_import(
39769 _: i32,
39770 _: i32,
39771 _: *mut u8,
39772 _: usize,
39773 _: i32,
39774 _: *mut u8,
39775 _: usize,
39776 _: *mut u8,
39777 ) {
39778 unreachable!()
39779 }
39780 wit_import(
39781 (self).handle() as i32,
39782 (flags0.bits() >> 0) as i32,
39783 ptr1.cast_mut(),
39784 len1,
39785 (new_descriptor).handle() as i32,
39786 ptr2.cast_mut(),
39787 len2,
39788 ptr3,
39789 );
39790 let l4 = i32::from(*ptr3.add(0).cast::<u8>());
39791 match l4 {
39792 0 => {
39793 let e = ();
39794 Ok(e)
39795 }
39796 1 => {
39797 let e = {
39798 let l5 = i32::from(*ptr3.add(1).cast::<u8>());
39799 ErrorCode::_lift(l5 as u8)
39800 };
39801 Err(e)
39802 }
39803 _ => _rt::invalid_enum_discriminant(),
39804 }
39805 }
39806 }
39807 }
39808 impl Descriptor {
39809 #[allow(unused_unsafe, clippy::all)]
39810 /// Open a file or directory.
39811 ///
39812 /// The returned descriptor is not guaranteed to be the lowest-numbered
39813 /// descriptor not currently open/ it is randomized to prevent applications
39814 /// from depending on making assumptions about indexes, since this is
39815 /// error-prone in multi-threaded contexts. The returned descriptor is
39816 /// guaranteed to be less than 2**31.
39817 ///
39818 /// If `flags` contains `descriptor-flags::mutate-directory`, and the base
39819 /// descriptor doesn't have `descriptor-flags::mutate-directory` set,
39820 /// `open-at` fails with `error-code::read-only`.
39821 ///
39822 /// If `flags` contains `write` or `mutate-directory`, or `open-flags`
39823 /// contains `truncate` or `create`, and the base descriptor doesn't have
39824 /// `descriptor-flags::mutate-directory` set, `open-at` fails with
39825 /// `error-code::read-only`.
39826 ///
39827 /// Note: This is similar to `openat` in POSIX.
39828 pub fn open_at(
39829 &self,
39830 path_flags: PathFlags,
39831 path: &str,
39832 open_flags: OpenFlags,
39833 flags: DescriptorFlags,
39834 ) -> Result<Descriptor, ErrorCode> {
39835 unsafe {
39836 #[repr(align(4))]
39837 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
39838 let mut ret_area = RetArea(
39839 [::core::mem::MaybeUninit::uninit(); 8],
39840 );
39841 let flags0 = path_flags;
39842 let vec1 = path;
39843 let ptr1 = vec1.as_ptr().cast::<u8>();
39844 let len1 = vec1.len();
39845 let flags2 = open_flags;
39846 let flags3 = flags;
39847 let ptr4 = ret_area.0.as_mut_ptr().cast::<u8>();
39848 #[cfg(target_arch = "wasm32")]
39849 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
39850 extern "C" {
39851 #[link_name = "[method]descriptor.open-at"]
39852 fn wit_import(
39853 _: i32,
39854 _: i32,
39855 _: *mut u8,
39856 _: usize,
39857 _: i32,
39858 _: i32,
39859 _: *mut u8,
39860 );
39861 }
39862 #[cfg(not(target_arch = "wasm32"))]
39863 fn wit_import(
39864 _: i32,
39865 _: i32,
39866 _: *mut u8,
39867 _: usize,
39868 _: i32,
39869 _: i32,
39870 _: *mut u8,
39871 ) {
39872 unreachable!()
39873 }
39874 wit_import(
39875 (self).handle() as i32,
39876 (flags0.bits() >> 0) as i32,
39877 ptr1.cast_mut(),
39878 len1,
39879 (flags2.bits() >> 0) as i32,
39880 (flags3.bits() >> 0) as i32,
39881 ptr4,
39882 );
39883 let l5 = i32::from(*ptr4.add(0).cast::<u8>());
39884 match l5 {
39885 0 => {
39886 let e = {
39887 let l6 = *ptr4.add(4).cast::<i32>();
39888 Descriptor::from_handle(l6 as u32)
39889 };
39890 Ok(e)
39891 }
39892 1 => {
39893 let e = {
39894 let l7 = i32::from(*ptr4.add(4).cast::<u8>());
39895 ErrorCode::_lift(l7 as u8)
39896 };
39897 Err(e)
39898 }
39899 _ => _rt::invalid_enum_discriminant(),
39900 }
39901 }
39902 }
39903 }
39904 impl Descriptor {
39905 #[allow(unused_unsafe, clippy::all)]
39906 /// Read the contents of a symbolic link.
39907 ///
39908 /// If the contents contain an absolute or rooted path in the underlying
39909 /// filesystem, this function fails with `error-code::not-permitted`.
39910 ///
39911 /// Note: This is similar to `readlinkat` in POSIX.
39912 pub fn readlink_at(&self, path: &str) -> Result<_rt::String, ErrorCode> {
39913 unsafe {
39914 #[repr(align(4))]
39915 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
39916 let mut ret_area = RetArea(
39917 [::core::mem::MaybeUninit::uninit(); 12],
39918 );
39919 let vec0 = path;
39920 let ptr0 = vec0.as_ptr().cast::<u8>();
39921 let len0 = vec0.len();
39922 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
39923 #[cfg(target_arch = "wasm32")]
39924 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
39925 extern "C" {
39926 #[link_name = "[method]descriptor.readlink-at"]
39927 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
39928 }
39929 #[cfg(not(target_arch = "wasm32"))]
39930 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
39931 unreachable!()
39932 }
39933 wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
39934 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
39935 match l2 {
39936 0 => {
39937 let e = {
39938 let l3 = *ptr1.add(4).cast::<*mut u8>();
39939 let l4 = *ptr1.add(8).cast::<usize>();
39940 let len5 = l4;
39941 let bytes5 = _rt::Vec::from_raw_parts(
39942 l3.cast(),
39943 len5,
39944 len5,
39945 );
39946 _rt::string_lift(bytes5)
39947 };
39948 Ok(e)
39949 }
39950 1 => {
39951 let e = {
39952 let l6 = i32::from(*ptr1.add(4).cast::<u8>());
39953 ErrorCode::_lift(l6 as u8)
39954 };
39955 Err(e)
39956 }
39957 _ => _rt::invalid_enum_discriminant(),
39958 }
39959 }
39960 }
39961 }
39962 impl Descriptor {
39963 #[allow(unused_unsafe, clippy::all)]
39964 /// Remove a directory.
39965 ///
39966 /// Return `error-code::not-empty` if the directory is not empty.
39967 ///
39968 /// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.
39969 pub fn remove_directory_at(&self, path: &str) -> Result<(), ErrorCode> {
39970 unsafe {
39971 #[repr(align(1))]
39972 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
39973 let mut ret_area = RetArea(
39974 [::core::mem::MaybeUninit::uninit(); 2],
39975 );
39976 let vec0 = path;
39977 let ptr0 = vec0.as_ptr().cast::<u8>();
39978 let len0 = vec0.len();
39979 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
39980 #[cfg(target_arch = "wasm32")]
39981 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
39982 extern "C" {
39983 #[link_name = "[method]descriptor.remove-directory-at"]
39984 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
39985 }
39986 #[cfg(not(target_arch = "wasm32"))]
39987 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
39988 unreachable!()
39989 }
39990 wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
39991 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
39992 match l2 {
39993 0 => {
39994 let e = ();
39995 Ok(e)
39996 }
39997 1 => {
39998 let e = {
39999 let l3 = i32::from(*ptr1.add(1).cast::<u8>());
40000 ErrorCode::_lift(l3 as u8)
40001 };
40002 Err(e)
40003 }
40004 _ => _rt::invalid_enum_discriminant(),
40005 }
40006 }
40007 }
40008 }
40009 impl Descriptor {
40010 #[allow(unused_unsafe, clippy::all)]
40011 /// Rename a filesystem object.
40012 ///
40013 /// Note: This is similar to `renameat` in POSIX.
40014 pub fn rename_at(
40015 &self,
40016 old_path: &str,
40017 new_descriptor: &Descriptor,
40018 new_path: &str,
40019 ) -> Result<(), ErrorCode> {
40020 unsafe {
40021 #[repr(align(1))]
40022 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
40023 let mut ret_area = RetArea(
40024 [::core::mem::MaybeUninit::uninit(); 2],
40025 );
40026 let vec0 = old_path;
40027 let ptr0 = vec0.as_ptr().cast::<u8>();
40028 let len0 = vec0.len();
40029 let vec1 = new_path;
40030 let ptr1 = vec1.as_ptr().cast::<u8>();
40031 let len1 = vec1.len();
40032 let ptr2 = ret_area.0.as_mut_ptr().cast::<u8>();
40033 #[cfg(target_arch = "wasm32")]
40034 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
40035 extern "C" {
40036 #[link_name = "[method]descriptor.rename-at"]
40037 fn wit_import(
40038 _: i32,
40039 _: *mut u8,
40040 _: usize,
40041 _: i32,
40042 _: *mut u8,
40043 _: usize,
40044 _: *mut u8,
40045 );
40046 }
40047 #[cfg(not(target_arch = "wasm32"))]
40048 fn wit_import(
40049 _: i32,
40050 _: *mut u8,
40051 _: usize,
40052 _: i32,
40053 _: *mut u8,
40054 _: usize,
40055 _: *mut u8,
40056 ) {
40057 unreachable!()
40058 }
40059 wit_import(
40060 (self).handle() as i32,
40061 ptr0.cast_mut(),
40062 len0,
40063 (new_descriptor).handle() as i32,
40064 ptr1.cast_mut(),
40065 len1,
40066 ptr2,
40067 );
40068 let l3 = i32::from(*ptr2.add(0).cast::<u8>());
40069 match l3 {
40070 0 => {
40071 let e = ();
40072 Ok(e)
40073 }
40074 1 => {
40075 let e = {
40076 let l4 = i32::from(*ptr2.add(1).cast::<u8>());
40077 ErrorCode::_lift(l4 as u8)
40078 };
40079 Err(e)
40080 }
40081 _ => _rt::invalid_enum_discriminant(),
40082 }
40083 }
40084 }
40085 }
40086 impl Descriptor {
40087 #[allow(unused_unsafe, clippy::all)]
40088 /// Create a symbolic link (also known as a "symlink").
40089 ///
40090 /// If `old-path` starts with `/`, the function fails with
40091 /// `error-code::not-permitted`.
40092 ///
40093 /// Note: This is similar to `symlinkat` in POSIX.
40094 pub fn symlink_at(
40095 &self,
40096 old_path: &str,
40097 new_path: &str,
40098 ) -> Result<(), ErrorCode> {
40099 unsafe {
40100 #[repr(align(1))]
40101 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
40102 let mut ret_area = RetArea(
40103 [::core::mem::MaybeUninit::uninit(); 2],
40104 );
40105 let vec0 = old_path;
40106 let ptr0 = vec0.as_ptr().cast::<u8>();
40107 let len0 = vec0.len();
40108 let vec1 = new_path;
40109 let ptr1 = vec1.as_ptr().cast::<u8>();
40110 let len1 = vec1.len();
40111 let ptr2 = ret_area.0.as_mut_ptr().cast::<u8>();
40112 #[cfg(target_arch = "wasm32")]
40113 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
40114 extern "C" {
40115 #[link_name = "[method]descriptor.symlink-at"]
40116 fn wit_import(
40117 _: i32,
40118 _: *mut u8,
40119 _: usize,
40120 _: *mut u8,
40121 _: usize,
40122 _: *mut u8,
40123 );
40124 }
40125 #[cfg(not(target_arch = "wasm32"))]
40126 fn wit_import(
40127 _: i32,
40128 _: *mut u8,
40129 _: usize,
40130 _: *mut u8,
40131 _: usize,
40132 _: *mut u8,
40133 ) {
40134 unreachable!()
40135 }
40136 wit_import(
40137 (self).handle() as i32,
40138 ptr0.cast_mut(),
40139 len0,
40140 ptr1.cast_mut(),
40141 len1,
40142 ptr2,
40143 );
40144 let l3 = i32::from(*ptr2.add(0).cast::<u8>());
40145 match l3 {
40146 0 => {
40147 let e = ();
40148 Ok(e)
40149 }
40150 1 => {
40151 let e = {
40152 let l4 = i32::from(*ptr2.add(1).cast::<u8>());
40153 ErrorCode::_lift(l4 as u8)
40154 };
40155 Err(e)
40156 }
40157 _ => _rt::invalid_enum_discriminant(),
40158 }
40159 }
40160 }
40161 }
40162 impl Descriptor {
40163 #[allow(unused_unsafe, clippy::all)]
40164 /// Unlink a filesystem object that is not a directory.
40165 ///
40166 /// Return `error-code::is-directory` if the path refers to a directory.
40167 /// Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.
40168 pub fn unlink_file_at(&self, path: &str) -> Result<(), ErrorCode> {
40169 unsafe {
40170 #[repr(align(1))]
40171 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
40172 let mut ret_area = RetArea(
40173 [::core::mem::MaybeUninit::uninit(); 2],
40174 );
40175 let vec0 = path;
40176 let ptr0 = vec0.as_ptr().cast::<u8>();
40177 let len0 = vec0.len();
40178 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
40179 #[cfg(target_arch = "wasm32")]
40180 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
40181 extern "C" {
40182 #[link_name = "[method]descriptor.unlink-file-at"]
40183 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
40184 }
40185 #[cfg(not(target_arch = "wasm32"))]
40186 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
40187 unreachable!()
40188 }
40189 wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
40190 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
40191 match l2 {
40192 0 => {
40193 let e = ();
40194 Ok(e)
40195 }
40196 1 => {
40197 let e = {
40198 let l3 = i32::from(*ptr1.add(1).cast::<u8>());
40199 ErrorCode::_lift(l3 as u8)
40200 };
40201 Err(e)
40202 }
40203 _ => _rt::invalid_enum_discriminant(),
40204 }
40205 }
40206 }
40207 }
40208 impl Descriptor {
40209 #[allow(unused_unsafe, clippy::all)]
40210 /// Test whether two descriptors refer to the same filesystem object.
40211 ///
40212 /// In POSIX, this corresponds to testing whether the two descriptors have the
40213 /// same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers.
40214 /// wasi-filesystem does not expose device and inode numbers, so this function
40215 /// may be used instead.
40216 pub fn is_same_object(&self, other: &Descriptor) -> bool {
40217 unsafe {
40218 #[cfg(target_arch = "wasm32")]
40219 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
40220 extern "C" {
40221 #[link_name = "[method]descriptor.is-same-object"]
40222 fn wit_import(_: i32, _: i32) -> i32;
40223 }
40224 #[cfg(not(target_arch = "wasm32"))]
40225 fn wit_import(_: i32, _: i32) -> i32 {
40226 unreachable!()
40227 }
40228 let ret = wit_import(
40229 (self).handle() as i32,
40230 (other).handle() as i32,
40231 );
40232 _rt::bool_lift(ret as u8)
40233 }
40234 }
40235 }
40236 impl Descriptor {
40237 #[allow(unused_unsafe, clippy::all)]
40238 /// Return a hash of the metadata associated with a filesystem object referred
40239 /// to by a descriptor.
40240 ///
40241 /// This returns a hash of the last-modification timestamp and file size, and
40242 /// may also include the inode number, device number, birth timestamp, and
40243 /// other metadata fields that may change when the file is modified or
40244 /// replaced. It may also include a secret value chosen by the
40245 /// implementation and not otherwise exposed.
40246 ///
40247 /// Implementations are encourated to provide the following properties:
40248 ///
40249 /// - If the file is not modified or replaced, the computed hash value should
40250 /// usually not change.
40251 /// - If the object is modified or replaced, the computed hash value should
40252 /// usually change.
40253 /// - The inputs to the hash should not be easily computable from the
40254 /// computed hash.
40255 ///
40256 /// However, none of these is required.
40257 pub fn metadata_hash(&self) -> Result<MetadataHashValue, ErrorCode> {
40258 unsafe {
40259 #[repr(align(8))]
40260 struct RetArea([::core::mem::MaybeUninit<u8>; 24]);
40261 let mut ret_area = RetArea(
40262 [::core::mem::MaybeUninit::uninit(); 24],
40263 );
40264 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
40265 #[cfg(target_arch = "wasm32")]
40266 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
40267 extern "C" {
40268 #[link_name = "[method]descriptor.metadata-hash"]
40269 fn wit_import(_: i32, _: *mut u8);
40270 }
40271 #[cfg(not(target_arch = "wasm32"))]
40272 fn wit_import(_: i32, _: *mut u8) {
40273 unreachable!()
40274 }
40275 wit_import((self).handle() as i32, ptr0);
40276 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
40277 match l1 {
40278 0 => {
40279 let e = {
40280 let l2 = *ptr0.add(8).cast::<i64>();
40281 let l3 = *ptr0.add(16).cast::<i64>();
40282 MetadataHashValue {
40283 lower: l2 as u64,
40284 upper: l3 as u64,
40285 }
40286 };
40287 Ok(e)
40288 }
40289 1 => {
40290 let e = {
40291 let l4 = i32::from(*ptr0.add(8).cast::<u8>());
40292 ErrorCode::_lift(l4 as u8)
40293 };
40294 Err(e)
40295 }
40296 _ => _rt::invalid_enum_discriminant(),
40297 }
40298 }
40299 }
40300 }
40301 impl Descriptor {
40302 #[allow(unused_unsafe, clippy::all)]
40303 /// Return a hash of the metadata associated with a filesystem object referred
40304 /// to by a directory descriptor and a relative path.
40305 ///
40306 /// This performs the same hash computation as `metadata-hash`.
40307 pub fn metadata_hash_at(
40308 &self,
40309 path_flags: PathFlags,
40310 path: &str,
40311 ) -> Result<MetadataHashValue, ErrorCode> {
40312 unsafe {
40313 #[repr(align(8))]
40314 struct RetArea([::core::mem::MaybeUninit<u8>; 24]);
40315 let mut ret_area = RetArea(
40316 [::core::mem::MaybeUninit::uninit(); 24],
40317 );
40318 let flags0 = path_flags;
40319 let vec1 = path;
40320 let ptr1 = vec1.as_ptr().cast::<u8>();
40321 let len1 = vec1.len();
40322 let ptr2 = ret_area.0.as_mut_ptr().cast::<u8>();
40323 #[cfg(target_arch = "wasm32")]
40324 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
40325 extern "C" {
40326 #[link_name = "[method]descriptor.metadata-hash-at"]
40327 fn wit_import(
40328 _: i32,
40329 _: i32,
40330 _: *mut u8,
40331 _: usize,
40332 _: *mut u8,
40333 );
40334 }
40335 #[cfg(not(target_arch = "wasm32"))]
40336 fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8) {
40337 unreachable!()
40338 }
40339 wit_import(
40340 (self).handle() as i32,
40341 (flags0.bits() >> 0) as i32,
40342 ptr1.cast_mut(),
40343 len1,
40344 ptr2,
40345 );
40346 let l3 = i32::from(*ptr2.add(0).cast::<u8>());
40347 match l3 {
40348 0 => {
40349 let e = {
40350 let l4 = *ptr2.add(8).cast::<i64>();
40351 let l5 = *ptr2.add(16).cast::<i64>();
40352 MetadataHashValue {
40353 lower: l4 as u64,
40354 upper: l5 as u64,
40355 }
40356 };
40357 Ok(e)
40358 }
40359 1 => {
40360 let e = {
40361 let l6 = i32::from(*ptr2.add(8).cast::<u8>());
40362 ErrorCode::_lift(l6 as u8)
40363 };
40364 Err(e)
40365 }
40366 _ => _rt::invalid_enum_discriminant(),
40367 }
40368 }
40369 }
40370 }
40371 impl DirectoryEntryStream {
40372 #[allow(unused_unsafe, clippy::all)]
40373 /// Read a single directory entry from a `directory-entry-stream`.
40374 pub fn read_directory_entry(
40375 &self,
40376 ) -> Result<Option<DirectoryEntry>, ErrorCode> {
40377 unsafe {
40378 #[repr(align(4))]
40379 struct RetArea([::core::mem::MaybeUninit<u8>; 20]);
40380 let mut ret_area = RetArea(
40381 [::core::mem::MaybeUninit::uninit(); 20],
40382 );
40383 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
40384 #[cfg(target_arch = "wasm32")]
40385 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
40386 extern "C" {
40387 #[link_name = "[method]directory-entry-stream.read-directory-entry"]
40388 fn wit_import(_: i32, _: *mut u8);
40389 }
40390 #[cfg(not(target_arch = "wasm32"))]
40391 fn wit_import(_: i32, _: *mut u8) {
40392 unreachable!()
40393 }
40394 wit_import((self).handle() as i32, ptr0);
40395 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
40396 match l1 {
40397 0 => {
40398 let e = {
40399 let l2 = i32::from(*ptr0.add(4).cast::<u8>());
40400 match l2 {
40401 0 => None,
40402 1 => {
40403 let e = {
40404 let l3 = i32::from(*ptr0.add(8).cast::<u8>());
40405 let l4 = *ptr0.add(12).cast::<*mut u8>();
40406 let l5 = *ptr0.add(16).cast::<usize>();
40407 let len6 = l5;
40408 let bytes6 = _rt::Vec::from_raw_parts(
40409 l4.cast(),
40410 len6,
40411 len6,
40412 );
40413 DirectoryEntry {
40414 type_: DescriptorType::_lift(l3 as u8),
40415 name: _rt::string_lift(bytes6),
40416 }
40417 };
40418 Some(e)
40419 }
40420 _ => _rt::invalid_enum_discriminant(),
40421 }
40422 };
40423 Ok(e)
40424 }
40425 1 => {
40426 let e = {
40427 let l7 = i32::from(*ptr0.add(4).cast::<u8>());
40428 ErrorCode::_lift(l7 as u8)
40429 };
40430 Err(e)
40431 }
40432 _ => _rt::invalid_enum_discriminant(),
40433 }
40434 }
40435 }
40436 }
40437 #[allow(unused_unsafe, clippy::all)]
40438 /// Attempts to extract a filesystem-related `error-code` from the stream
40439 /// `error` provided.
40440 ///
40441 /// Stream operations which return `stream-error::last-operation-failed`
40442 /// have a payload with more information about the operation that failed.
40443 /// This payload can be passed through to this function to see if there's
40444 /// filesystem-related information about the error to return.
40445 ///
40446 /// Note that this function is fallible because not all stream-related
40447 /// errors are filesystem-related errors.
40448 pub fn filesystem_error_code(err: &Error) -> Option<ErrorCode> {
40449 unsafe {
40450 #[repr(align(1))]
40451 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
40452 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]);
40453 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
40454 #[cfg(target_arch = "wasm32")]
40455 #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")]
40456 extern "C" {
40457 #[link_name = "filesystem-error-code"]
40458 fn wit_import(_: i32, _: *mut u8);
40459 }
40460 #[cfg(not(target_arch = "wasm32"))]
40461 fn wit_import(_: i32, _: *mut u8) {
40462 unreachable!()
40463 }
40464 wit_import((err).handle() as i32, ptr0);
40465 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
40466 match l1 {
40467 0 => None,
40468 1 => {
40469 let e = {
40470 let l2 = i32::from(*ptr0.add(1).cast::<u8>());
40471 ErrorCode::_lift(l2 as u8)
40472 };
40473 Some(e)
40474 }
40475 _ => _rt::invalid_enum_discriminant(),
40476 }
40477 }
40478 }
40479 }
40480 #[allow(dead_code, clippy::all)]
40481 pub mod preopens {
40482 #[used]
40483 #[doc(hidden)]
40484 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
40485 use super::super::super::_rt;
40486 pub type Descriptor = super::super::super::wasi::filesystem::types::Descriptor;
40487 #[allow(unused_unsafe, clippy::all)]
40488 /// Return the set of preopened directories, and their path.
40489 pub fn get_directories() -> _rt::Vec<(Descriptor, _rt::String)> {
40490 unsafe {
40491 #[repr(align(4))]
40492 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
40493 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
40494 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
40495 #[cfg(target_arch = "wasm32")]
40496 #[link(wasm_import_module = "wasi:filesystem/preopens@0.2.0")]
40497 extern "C" {
40498 #[link_name = "get-directories"]
40499 fn wit_import(_: *mut u8);
40500 }
40501 #[cfg(not(target_arch = "wasm32"))]
40502 fn wit_import(_: *mut u8) {
40503 unreachable!()
40504 }
40505 wit_import(ptr0);
40506 let l1 = *ptr0.add(0).cast::<*mut u8>();
40507 let l2 = *ptr0.add(4).cast::<usize>();
40508 let base7 = l1;
40509 let len7 = l2;
40510 let mut result7 = _rt::Vec::with_capacity(len7);
40511 for i in 0..len7 {
40512 let base = base7.add(i * 12);
40513 let e7 = {
40514 let l3 = *base.add(0).cast::<i32>();
40515 let l4 = *base.add(4).cast::<*mut u8>();
40516 let l5 = *base.add(8).cast::<usize>();
40517 let len6 = l5;
40518 let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6);
40519 (
40520 super::super::super::wasi::filesystem::types::Descriptor::from_handle(
40521 l3 as u32,
40522 ),
40523 _rt::string_lift(bytes6),
40524 )
40525 };
40526 result7.push(e7);
40527 }
40528 _rt::cabi_dealloc(base7, len7 * 12, 4);
40529 result7
40530 }
40531 }
40532 }
40533 }
40534 pub mod http {
40535 /// This interface defines all of the types and methods for implementing
40536 /// HTTP Requests and Responses, both incoming and outgoing, as well as
40537 /// their headers, trailers, and bodies.
40538 #[allow(dead_code, clippy::all)]
40539 pub mod types {
40540 #[used]
40541 #[doc(hidden)]
40542 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
40543 use super::super::super::_rt;
40544 pub type Duration = super::super::super::wasi::clocks::monotonic_clock::Duration;
40545 pub type InputStream = super::super::super::wasi::io::streams::InputStream;
40546 pub type OutputStream = super::super::super::wasi::io::streams::OutputStream;
40547 pub type IoError = super::super::super::wasi::io::error::Error;
40548 pub type Pollable = super::super::super::wasi::io::poll::Pollable;
40549 /// This type corresponds to HTTP standard Methods.
40550 #[derive(Clone)]
40551 pub enum Method {
40552 Get,
40553 Head,
40554 Post,
40555 Put,
40556 Delete,
40557 Connect,
40558 Options,
40559 Trace,
40560 Patch,
40561 Other(_rt::String),
40562 }
40563 impl ::core::fmt::Debug for Method {
40564 fn fmt(
40565 &self,
40566 f: &mut ::core::fmt::Formatter<'_>,
40567 ) -> ::core::fmt::Result {
40568 match self {
40569 Method::Get => f.debug_tuple("Method::Get").finish(),
40570 Method::Head => f.debug_tuple("Method::Head").finish(),
40571 Method::Post => f.debug_tuple("Method::Post").finish(),
40572 Method::Put => f.debug_tuple("Method::Put").finish(),
40573 Method::Delete => f.debug_tuple("Method::Delete").finish(),
40574 Method::Connect => f.debug_tuple("Method::Connect").finish(),
40575 Method::Options => f.debug_tuple("Method::Options").finish(),
40576 Method::Trace => f.debug_tuple("Method::Trace").finish(),
40577 Method::Patch => f.debug_tuple("Method::Patch").finish(),
40578 Method::Other(e) => {
40579 f.debug_tuple("Method::Other").field(e).finish()
40580 }
40581 }
40582 }
40583 }
40584 /// This type corresponds to HTTP standard Related Schemes.
40585 #[derive(Clone)]
40586 pub enum Scheme {
40587 Http,
40588 Https,
40589 Other(_rt::String),
40590 }
40591 impl ::core::fmt::Debug for Scheme {
40592 fn fmt(
40593 &self,
40594 f: &mut ::core::fmt::Formatter<'_>,
40595 ) -> ::core::fmt::Result {
40596 match self {
40597 Scheme::Http => f.debug_tuple("Scheme::Http").finish(),
40598 Scheme::Https => f.debug_tuple("Scheme::Https").finish(),
40599 Scheme::Other(e) => {
40600 f.debug_tuple("Scheme::Other").field(e).finish()
40601 }
40602 }
40603 }
40604 }
40605 /// Defines the case payload type for `DNS-error` above:
40606 #[derive(Clone)]
40607 pub struct DnsErrorPayload {
40608 pub rcode: Option<_rt::String>,
40609 pub info_code: Option<u16>,
40610 }
40611 impl ::core::fmt::Debug for DnsErrorPayload {
40612 fn fmt(
40613 &self,
40614 f: &mut ::core::fmt::Formatter<'_>,
40615 ) -> ::core::fmt::Result {
40616 f.debug_struct("DnsErrorPayload")
40617 .field("rcode", &self.rcode)
40618 .field("info-code", &self.info_code)
40619 .finish()
40620 }
40621 }
40622 /// Defines the case payload type for `TLS-alert-received` above:
40623 #[derive(Clone)]
40624 pub struct TlsAlertReceivedPayload {
40625 pub alert_id: Option<u8>,
40626 pub alert_message: Option<_rt::String>,
40627 }
40628 impl ::core::fmt::Debug for TlsAlertReceivedPayload {
40629 fn fmt(
40630 &self,
40631 f: &mut ::core::fmt::Formatter<'_>,
40632 ) -> ::core::fmt::Result {
40633 f.debug_struct("TlsAlertReceivedPayload")
40634 .field("alert-id", &self.alert_id)
40635 .field("alert-message", &self.alert_message)
40636 .finish()
40637 }
40638 }
40639 /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above:
40640 #[derive(Clone)]
40641 pub struct FieldSizePayload {
40642 pub field_name: Option<_rt::String>,
40643 pub field_size: Option<u32>,
40644 }
40645 impl ::core::fmt::Debug for FieldSizePayload {
40646 fn fmt(
40647 &self,
40648 f: &mut ::core::fmt::Formatter<'_>,
40649 ) -> ::core::fmt::Result {
40650 f.debug_struct("FieldSizePayload")
40651 .field("field-name", &self.field_name)
40652 .field("field-size", &self.field_size)
40653 .finish()
40654 }
40655 }
40656 /// These cases are inspired by the IANA HTTP Proxy Error Types:
40657 /// https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types
40658 #[derive(Clone)]
40659 pub enum ErrorCode {
40660 DnsTimeout,
40661 DnsError(DnsErrorPayload),
40662 DestinationNotFound,
40663 DestinationUnavailable,
40664 DestinationIpProhibited,
40665 DestinationIpUnroutable,
40666 ConnectionRefused,
40667 ConnectionTerminated,
40668 ConnectionTimeout,
40669 ConnectionReadTimeout,
40670 ConnectionWriteTimeout,
40671 ConnectionLimitReached,
40672 TlsProtocolError,
40673 TlsCertificateError,
40674 TlsAlertReceived(TlsAlertReceivedPayload),
40675 HttpRequestDenied,
40676 HttpRequestLengthRequired,
40677 HttpRequestBodySize(Option<u64>),
40678 HttpRequestMethodInvalid,
40679 HttpRequestUriInvalid,
40680 HttpRequestUriTooLong,
40681 HttpRequestHeaderSectionSize(Option<u32>),
40682 HttpRequestHeaderSize(Option<FieldSizePayload>),
40683 HttpRequestTrailerSectionSize(Option<u32>),
40684 HttpRequestTrailerSize(FieldSizePayload),
40685 HttpResponseIncomplete,
40686 HttpResponseHeaderSectionSize(Option<u32>),
40687 HttpResponseHeaderSize(FieldSizePayload),
40688 HttpResponseBodySize(Option<u64>),
40689 HttpResponseTrailerSectionSize(Option<u32>),
40690 HttpResponseTrailerSize(FieldSizePayload),
40691 HttpResponseTransferCoding(Option<_rt::String>),
40692 HttpResponseContentCoding(Option<_rt::String>),
40693 HttpResponseTimeout,
40694 HttpUpgradeFailed,
40695 HttpProtocolError,
40696 LoopDetected,
40697 ConfigurationError,
40698 /// This is a catch-all error for anything that doesn't fit cleanly into a
40699 /// more specific case. It also includes an optional string for an
40700 /// unstructured description of the error. Users should not depend on the
40701 /// string for diagnosing errors, as it's not required to be consistent
40702 /// between implementations.
40703 InternalError(Option<_rt::String>),
40704 }
40705 impl ::core::fmt::Debug for ErrorCode {
40706 fn fmt(
40707 &self,
40708 f: &mut ::core::fmt::Formatter<'_>,
40709 ) -> ::core::fmt::Result {
40710 match self {
40711 ErrorCode::DnsTimeout => {
40712 f.debug_tuple("ErrorCode::DnsTimeout").finish()
40713 }
40714 ErrorCode::DnsError(e) => {
40715 f.debug_tuple("ErrorCode::DnsError").field(e).finish()
40716 }
40717 ErrorCode::DestinationNotFound => {
40718 f.debug_tuple("ErrorCode::DestinationNotFound").finish()
40719 }
40720 ErrorCode::DestinationUnavailable => {
40721 f.debug_tuple("ErrorCode::DestinationUnavailable").finish()
40722 }
40723 ErrorCode::DestinationIpProhibited => {
40724 f.debug_tuple("ErrorCode::DestinationIpProhibited").finish()
40725 }
40726 ErrorCode::DestinationIpUnroutable => {
40727 f.debug_tuple("ErrorCode::DestinationIpUnroutable").finish()
40728 }
40729 ErrorCode::ConnectionRefused => {
40730 f.debug_tuple("ErrorCode::ConnectionRefused").finish()
40731 }
40732 ErrorCode::ConnectionTerminated => {
40733 f.debug_tuple("ErrorCode::ConnectionTerminated").finish()
40734 }
40735 ErrorCode::ConnectionTimeout => {
40736 f.debug_tuple("ErrorCode::ConnectionTimeout").finish()
40737 }
40738 ErrorCode::ConnectionReadTimeout => {
40739 f.debug_tuple("ErrorCode::ConnectionReadTimeout").finish()
40740 }
40741 ErrorCode::ConnectionWriteTimeout => {
40742 f.debug_tuple("ErrorCode::ConnectionWriteTimeout").finish()
40743 }
40744 ErrorCode::ConnectionLimitReached => {
40745 f.debug_tuple("ErrorCode::ConnectionLimitReached").finish()
40746 }
40747 ErrorCode::TlsProtocolError => {
40748 f.debug_tuple("ErrorCode::TlsProtocolError").finish()
40749 }
40750 ErrorCode::TlsCertificateError => {
40751 f.debug_tuple("ErrorCode::TlsCertificateError").finish()
40752 }
40753 ErrorCode::TlsAlertReceived(e) => {
40754 f.debug_tuple("ErrorCode::TlsAlertReceived")
40755 .field(e)
40756 .finish()
40757 }
40758 ErrorCode::HttpRequestDenied => {
40759 f.debug_tuple("ErrorCode::HttpRequestDenied").finish()
40760 }
40761 ErrorCode::HttpRequestLengthRequired => {
40762 f.debug_tuple("ErrorCode::HttpRequestLengthRequired")
40763 .finish()
40764 }
40765 ErrorCode::HttpRequestBodySize(e) => {
40766 f.debug_tuple("ErrorCode::HttpRequestBodySize")
40767 .field(e)
40768 .finish()
40769 }
40770 ErrorCode::HttpRequestMethodInvalid => {
40771 f.debug_tuple("ErrorCode::HttpRequestMethodInvalid").finish()
40772 }
40773 ErrorCode::HttpRequestUriInvalid => {
40774 f.debug_tuple("ErrorCode::HttpRequestUriInvalid").finish()
40775 }
40776 ErrorCode::HttpRequestUriTooLong => {
40777 f.debug_tuple("ErrorCode::HttpRequestUriTooLong").finish()
40778 }
40779 ErrorCode::HttpRequestHeaderSectionSize(e) => {
40780 f.debug_tuple("ErrorCode::HttpRequestHeaderSectionSize")
40781 .field(e)
40782 .finish()
40783 }
40784 ErrorCode::HttpRequestHeaderSize(e) => {
40785 f.debug_tuple("ErrorCode::HttpRequestHeaderSize")
40786 .field(e)
40787 .finish()
40788 }
40789 ErrorCode::HttpRequestTrailerSectionSize(e) => {
40790 f.debug_tuple("ErrorCode::HttpRequestTrailerSectionSize")
40791 .field(e)
40792 .finish()
40793 }
40794 ErrorCode::HttpRequestTrailerSize(e) => {
40795 f.debug_tuple("ErrorCode::HttpRequestTrailerSize")
40796 .field(e)
40797 .finish()
40798 }
40799 ErrorCode::HttpResponseIncomplete => {
40800 f.debug_tuple("ErrorCode::HttpResponseIncomplete").finish()
40801 }
40802 ErrorCode::HttpResponseHeaderSectionSize(e) => {
40803 f.debug_tuple("ErrorCode::HttpResponseHeaderSectionSize")
40804 .field(e)
40805 .finish()
40806 }
40807 ErrorCode::HttpResponseHeaderSize(e) => {
40808 f.debug_tuple("ErrorCode::HttpResponseHeaderSize")
40809 .field(e)
40810 .finish()
40811 }
40812 ErrorCode::HttpResponseBodySize(e) => {
40813 f.debug_tuple("ErrorCode::HttpResponseBodySize")
40814 .field(e)
40815 .finish()
40816 }
40817 ErrorCode::HttpResponseTrailerSectionSize(e) => {
40818 f.debug_tuple("ErrorCode::HttpResponseTrailerSectionSize")
40819 .field(e)
40820 .finish()
40821 }
40822 ErrorCode::HttpResponseTrailerSize(e) => {
40823 f.debug_tuple("ErrorCode::HttpResponseTrailerSize")
40824 .field(e)
40825 .finish()
40826 }
40827 ErrorCode::HttpResponseTransferCoding(e) => {
40828 f.debug_tuple("ErrorCode::HttpResponseTransferCoding")
40829 .field(e)
40830 .finish()
40831 }
40832 ErrorCode::HttpResponseContentCoding(e) => {
40833 f.debug_tuple("ErrorCode::HttpResponseContentCoding")
40834 .field(e)
40835 .finish()
40836 }
40837 ErrorCode::HttpResponseTimeout => {
40838 f.debug_tuple("ErrorCode::HttpResponseTimeout").finish()
40839 }
40840 ErrorCode::HttpUpgradeFailed => {
40841 f.debug_tuple("ErrorCode::HttpUpgradeFailed").finish()
40842 }
40843 ErrorCode::HttpProtocolError => {
40844 f.debug_tuple("ErrorCode::HttpProtocolError").finish()
40845 }
40846 ErrorCode::LoopDetected => {
40847 f.debug_tuple("ErrorCode::LoopDetected").finish()
40848 }
40849 ErrorCode::ConfigurationError => {
40850 f.debug_tuple("ErrorCode::ConfigurationError").finish()
40851 }
40852 ErrorCode::InternalError(e) => {
40853 f.debug_tuple("ErrorCode::InternalError").field(e).finish()
40854 }
40855 }
40856 }
40857 }
40858 impl ::core::fmt::Display for ErrorCode {
40859 fn fmt(
40860 &self,
40861 f: &mut ::core::fmt::Formatter<'_>,
40862 ) -> ::core::fmt::Result {
40863 write!(f, "{:?}", self)
40864 }
40865 }
40866 impl std::error::Error for ErrorCode {}
40867 /// This type enumerates the different kinds of errors that may occur when
40868 /// setting or appending to a `fields` resource.
40869 #[derive(Clone, Copy)]
40870 pub enum HeaderError {
40871 /// This error indicates that a `field-key` or `field-value` was
40872 /// syntactically invalid when used with an operation that sets headers in a
40873 /// `fields`.
40874 InvalidSyntax,
40875 /// This error indicates that a forbidden `field-key` was used when trying
40876 /// to set a header in a `fields`.
40877 Forbidden,
40878 /// This error indicates that the operation on the `fields` was not
40879 /// permitted because the fields are immutable.
40880 Immutable,
40881 }
40882 impl ::core::fmt::Debug for HeaderError {
40883 fn fmt(
40884 &self,
40885 f: &mut ::core::fmt::Formatter<'_>,
40886 ) -> ::core::fmt::Result {
40887 match self {
40888 HeaderError::InvalidSyntax => {
40889 f.debug_tuple("HeaderError::InvalidSyntax").finish()
40890 }
40891 HeaderError::Forbidden => {
40892 f.debug_tuple("HeaderError::Forbidden").finish()
40893 }
40894 HeaderError::Immutable => {
40895 f.debug_tuple("HeaderError::Immutable").finish()
40896 }
40897 }
40898 }
40899 }
40900 impl ::core::fmt::Display for HeaderError {
40901 fn fmt(
40902 &self,
40903 f: &mut ::core::fmt::Formatter<'_>,
40904 ) -> ::core::fmt::Result {
40905 write!(f, "{:?}", self)
40906 }
40907 }
40908 impl std::error::Error for HeaderError {}
40909 /// Field keys are always strings.
40910 pub type FieldKey = _rt::String;
40911 /// Field values should always be ASCII strings. However, in
40912 /// reality, HTTP implementations often have to interpret malformed values,
40913 /// so they are provided as a list of bytes.
40914 pub type FieldValue = _rt::Vec<u8>;
40915 /// This following block defines the `fields` resource which corresponds to
40916 /// HTTP standard Fields. Fields are a common representation used for both
40917 /// Headers and Trailers.
40918 ///
40919 /// A `fields` may be mutable or immutable. A `fields` created using the
40920 /// constructor, `from-list`, or `clone` will be mutable, but a `fields`
40921 /// resource given by other means (including, but not limited to,
40922 /// `incoming-request.headers`, `outgoing-request.headers`) might be be
40923 /// immutable. In an immutable fields, the `set`, `append`, and `delete`
40924 /// operations will fail with `header-error.immutable`.
40925 #[derive(Debug)]
40926 #[repr(transparent)]
40927 pub struct Fields {
40928 handle: _rt::Resource<Fields>,
40929 }
40930 impl Fields {
40931 #[doc(hidden)]
40932 pub unsafe fn from_handle(handle: u32) -> Self {
40933 Self {
40934 handle: _rt::Resource::from_handle(handle),
40935 }
40936 }
40937 #[doc(hidden)]
40938 pub fn take_handle(&self) -> u32 {
40939 _rt::Resource::take_handle(&self.handle)
40940 }
40941 #[doc(hidden)]
40942 pub fn handle(&self) -> u32 {
40943 _rt::Resource::handle(&self.handle)
40944 }
40945 }
40946 unsafe impl _rt::WasmResource for Fields {
40947 #[inline]
40948 unsafe fn drop(_handle: u32) {
40949 #[cfg(not(target_arch = "wasm32"))]
40950 unreachable!();
40951 #[cfg(target_arch = "wasm32")]
40952 {
40953 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
40954 extern "C" {
40955 #[link_name = "[resource-drop]fields"]
40956 fn drop(_: u32);
40957 }
40958 drop(_handle);
40959 }
40960 }
40961 }
40962 /// Headers is an alias for Fields.
40963 pub type Headers = Fields;
40964 /// Trailers is an alias for Fields.
40965 pub type Trailers = Fields;
40966 /// Represents an incoming HTTP Request.
40967 #[derive(Debug)]
40968 #[repr(transparent)]
40969 pub struct IncomingRequest {
40970 handle: _rt::Resource<IncomingRequest>,
40971 }
40972 impl IncomingRequest {
40973 #[doc(hidden)]
40974 pub unsafe fn from_handle(handle: u32) -> Self {
40975 Self {
40976 handle: _rt::Resource::from_handle(handle),
40977 }
40978 }
40979 #[doc(hidden)]
40980 pub fn take_handle(&self) -> u32 {
40981 _rt::Resource::take_handle(&self.handle)
40982 }
40983 #[doc(hidden)]
40984 pub fn handle(&self) -> u32 {
40985 _rt::Resource::handle(&self.handle)
40986 }
40987 }
40988 unsafe impl _rt::WasmResource for IncomingRequest {
40989 #[inline]
40990 unsafe fn drop(_handle: u32) {
40991 #[cfg(not(target_arch = "wasm32"))]
40992 unreachable!();
40993 #[cfg(target_arch = "wasm32")]
40994 {
40995 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
40996 extern "C" {
40997 #[link_name = "[resource-drop]incoming-request"]
40998 fn drop(_: u32);
40999 }
41000 drop(_handle);
41001 }
41002 }
41003 }
41004 /// Represents an outgoing HTTP Request.
41005 #[derive(Debug)]
41006 #[repr(transparent)]
41007 pub struct OutgoingRequest {
41008 handle: _rt::Resource<OutgoingRequest>,
41009 }
41010 impl OutgoingRequest {
41011 #[doc(hidden)]
41012 pub unsafe fn from_handle(handle: u32) -> Self {
41013 Self {
41014 handle: _rt::Resource::from_handle(handle),
41015 }
41016 }
41017 #[doc(hidden)]
41018 pub fn take_handle(&self) -> u32 {
41019 _rt::Resource::take_handle(&self.handle)
41020 }
41021 #[doc(hidden)]
41022 pub fn handle(&self) -> u32 {
41023 _rt::Resource::handle(&self.handle)
41024 }
41025 }
41026 unsafe impl _rt::WasmResource for OutgoingRequest {
41027 #[inline]
41028 unsafe fn drop(_handle: u32) {
41029 #[cfg(not(target_arch = "wasm32"))]
41030 unreachable!();
41031 #[cfg(target_arch = "wasm32")]
41032 {
41033 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
41034 extern "C" {
41035 #[link_name = "[resource-drop]outgoing-request"]
41036 fn drop(_: u32);
41037 }
41038 drop(_handle);
41039 }
41040 }
41041 }
41042 /// Parameters for making an HTTP Request. Each of these parameters is
41043 /// currently an optional timeout applicable to the transport layer of the
41044 /// HTTP protocol.
41045 ///
41046 /// These timeouts are separate from any the user may use to bound a
41047 /// blocking call to `wasi:io/poll.poll`.
41048 #[derive(Debug)]
41049 #[repr(transparent)]
41050 pub struct RequestOptions {
41051 handle: _rt::Resource<RequestOptions>,
41052 }
41053 impl RequestOptions {
41054 #[doc(hidden)]
41055 pub unsafe fn from_handle(handle: u32) -> Self {
41056 Self {
41057 handle: _rt::Resource::from_handle(handle),
41058 }
41059 }
41060 #[doc(hidden)]
41061 pub fn take_handle(&self) -> u32 {
41062 _rt::Resource::take_handle(&self.handle)
41063 }
41064 #[doc(hidden)]
41065 pub fn handle(&self) -> u32 {
41066 _rt::Resource::handle(&self.handle)
41067 }
41068 }
41069 unsafe impl _rt::WasmResource for RequestOptions {
41070 #[inline]
41071 unsafe fn drop(_handle: u32) {
41072 #[cfg(not(target_arch = "wasm32"))]
41073 unreachable!();
41074 #[cfg(target_arch = "wasm32")]
41075 {
41076 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
41077 extern "C" {
41078 #[link_name = "[resource-drop]request-options"]
41079 fn drop(_: u32);
41080 }
41081 drop(_handle);
41082 }
41083 }
41084 }
41085 /// Represents the ability to send an HTTP Response.
41086 ///
41087 /// This resource is used by the `wasi:http/incoming-handler` interface to
41088 /// allow a Response to be sent corresponding to the Request provided as the
41089 /// other argument to `incoming-handler.handle`.
41090 #[derive(Debug)]
41091 #[repr(transparent)]
41092 pub struct ResponseOutparam {
41093 handle: _rt::Resource<ResponseOutparam>,
41094 }
41095 impl ResponseOutparam {
41096 #[doc(hidden)]
41097 pub unsafe fn from_handle(handle: u32) -> Self {
41098 Self {
41099 handle: _rt::Resource::from_handle(handle),
41100 }
41101 }
41102 #[doc(hidden)]
41103 pub fn take_handle(&self) -> u32 {
41104 _rt::Resource::take_handle(&self.handle)
41105 }
41106 #[doc(hidden)]
41107 pub fn handle(&self) -> u32 {
41108 _rt::Resource::handle(&self.handle)
41109 }
41110 }
41111 unsafe impl _rt::WasmResource for ResponseOutparam {
41112 #[inline]
41113 unsafe fn drop(_handle: u32) {
41114 #[cfg(not(target_arch = "wasm32"))]
41115 unreachable!();
41116 #[cfg(target_arch = "wasm32")]
41117 {
41118 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
41119 extern "C" {
41120 #[link_name = "[resource-drop]response-outparam"]
41121 fn drop(_: u32);
41122 }
41123 drop(_handle);
41124 }
41125 }
41126 }
41127 /// This type corresponds to the HTTP standard Status Code.
41128 pub type StatusCode = u16;
41129 /// Represents an incoming HTTP Response.
41130 #[derive(Debug)]
41131 #[repr(transparent)]
41132 pub struct IncomingResponse {
41133 handle: _rt::Resource<IncomingResponse>,
41134 }
41135 impl IncomingResponse {
41136 #[doc(hidden)]
41137 pub unsafe fn from_handle(handle: u32) -> Self {
41138 Self {
41139 handle: _rt::Resource::from_handle(handle),
41140 }
41141 }
41142 #[doc(hidden)]
41143 pub fn take_handle(&self) -> u32 {
41144 _rt::Resource::take_handle(&self.handle)
41145 }
41146 #[doc(hidden)]
41147 pub fn handle(&self) -> u32 {
41148 _rt::Resource::handle(&self.handle)
41149 }
41150 }
41151 unsafe impl _rt::WasmResource for IncomingResponse {
41152 #[inline]
41153 unsafe fn drop(_handle: u32) {
41154 #[cfg(not(target_arch = "wasm32"))]
41155 unreachable!();
41156 #[cfg(target_arch = "wasm32")]
41157 {
41158 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
41159 extern "C" {
41160 #[link_name = "[resource-drop]incoming-response"]
41161 fn drop(_: u32);
41162 }
41163 drop(_handle);
41164 }
41165 }
41166 }
41167 /// Represents an incoming HTTP Request or Response's Body.
41168 ///
41169 /// A body has both its contents - a stream of bytes - and a (possibly
41170 /// empty) set of trailers, indicating that the full contents of the
41171 /// body have been received. This resource represents the contents as
41172 /// an `input-stream` and the delivery of trailers as a `future-trailers`,
41173 /// and ensures that the user of this interface may only be consuming either
41174 /// the body contents or waiting on trailers at any given time.
41175 #[derive(Debug)]
41176 #[repr(transparent)]
41177 pub struct IncomingBody {
41178 handle: _rt::Resource<IncomingBody>,
41179 }
41180 impl IncomingBody {
41181 #[doc(hidden)]
41182 pub unsafe fn from_handle(handle: u32) -> Self {
41183 Self {
41184 handle: _rt::Resource::from_handle(handle),
41185 }
41186 }
41187 #[doc(hidden)]
41188 pub fn take_handle(&self) -> u32 {
41189 _rt::Resource::take_handle(&self.handle)
41190 }
41191 #[doc(hidden)]
41192 pub fn handle(&self) -> u32 {
41193 _rt::Resource::handle(&self.handle)
41194 }
41195 }
41196 unsafe impl _rt::WasmResource for IncomingBody {
41197 #[inline]
41198 unsafe fn drop(_handle: u32) {
41199 #[cfg(not(target_arch = "wasm32"))]
41200 unreachable!();
41201 #[cfg(target_arch = "wasm32")]
41202 {
41203 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
41204 extern "C" {
41205 #[link_name = "[resource-drop]incoming-body"]
41206 fn drop(_: u32);
41207 }
41208 drop(_handle);
41209 }
41210 }
41211 }
41212 /// Represents a future which may eventaully return trailers, or an error.
41213 ///
41214 /// In the case that the incoming HTTP Request or Response did not have any
41215 /// trailers, this future will resolve to the empty set of trailers once the
41216 /// complete Request or Response body has been received.
41217 #[derive(Debug)]
41218 #[repr(transparent)]
41219 pub struct FutureTrailers {
41220 handle: _rt::Resource<FutureTrailers>,
41221 }
41222 impl FutureTrailers {
41223 #[doc(hidden)]
41224 pub unsafe fn from_handle(handle: u32) -> Self {
41225 Self {
41226 handle: _rt::Resource::from_handle(handle),
41227 }
41228 }
41229 #[doc(hidden)]
41230 pub fn take_handle(&self) -> u32 {
41231 _rt::Resource::take_handle(&self.handle)
41232 }
41233 #[doc(hidden)]
41234 pub fn handle(&self) -> u32 {
41235 _rt::Resource::handle(&self.handle)
41236 }
41237 }
41238 unsafe impl _rt::WasmResource for FutureTrailers {
41239 #[inline]
41240 unsafe fn drop(_handle: u32) {
41241 #[cfg(not(target_arch = "wasm32"))]
41242 unreachable!();
41243 #[cfg(target_arch = "wasm32")]
41244 {
41245 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
41246 extern "C" {
41247 #[link_name = "[resource-drop]future-trailers"]
41248 fn drop(_: u32);
41249 }
41250 drop(_handle);
41251 }
41252 }
41253 }
41254 /// Represents an outgoing HTTP Response.
41255 #[derive(Debug)]
41256 #[repr(transparent)]
41257 pub struct OutgoingResponse {
41258 handle: _rt::Resource<OutgoingResponse>,
41259 }
41260 impl OutgoingResponse {
41261 #[doc(hidden)]
41262 pub unsafe fn from_handle(handle: u32) -> Self {
41263 Self {
41264 handle: _rt::Resource::from_handle(handle),
41265 }
41266 }
41267 #[doc(hidden)]
41268 pub fn take_handle(&self) -> u32 {
41269 _rt::Resource::take_handle(&self.handle)
41270 }
41271 #[doc(hidden)]
41272 pub fn handle(&self) -> u32 {
41273 _rt::Resource::handle(&self.handle)
41274 }
41275 }
41276 unsafe impl _rt::WasmResource for OutgoingResponse {
41277 #[inline]
41278 unsafe fn drop(_handle: u32) {
41279 #[cfg(not(target_arch = "wasm32"))]
41280 unreachable!();
41281 #[cfg(target_arch = "wasm32")]
41282 {
41283 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
41284 extern "C" {
41285 #[link_name = "[resource-drop]outgoing-response"]
41286 fn drop(_: u32);
41287 }
41288 drop(_handle);
41289 }
41290 }
41291 }
41292 /// Represents an outgoing HTTP Request or Response's Body.
41293 ///
41294 /// A body has both its contents - a stream of bytes - and a (possibly
41295 /// empty) set of trailers, inducating the full contents of the body
41296 /// have been sent. This resource represents the contents as an
41297 /// `output-stream` child resource, and the completion of the body (with
41298 /// optional trailers) with a static function that consumes the
41299 /// `outgoing-body` resource, and ensures that the user of this interface
41300 /// may not write to the body contents after the body has been finished.
41301 ///
41302 /// If the user code drops this resource, as opposed to calling the static
41303 /// method `finish`, the implementation should treat the body as incomplete,
41304 /// and that an error has occured. The implementation should propogate this
41305 /// error to the HTTP protocol by whatever means it has available,
41306 /// including: corrupting the body on the wire, aborting the associated
41307 /// Request, or sending a late status code for the Response.
41308 #[derive(Debug)]
41309 #[repr(transparent)]
41310 pub struct OutgoingBody {
41311 handle: _rt::Resource<OutgoingBody>,
41312 }
41313 impl OutgoingBody {
41314 #[doc(hidden)]
41315 pub unsafe fn from_handle(handle: u32) -> Self {
41316 Self {
41317 handle: _rt::Resource::from_handle(handle),
41318 }
41319 }
41320 #[doc(hidden)]
41321 pub fn take_handle(&self) -> u32 {
41322 _rt::Resource::take_handle(&self.handle)
41323 }
41324 #[doc(hidden)]
41325 pub fn handle(&self) -> u32 {
41326 _rt::Resource::handle(&self.handle)
41327 }
41328 }
41329 unsafe impl _rt::WasmResource for OutgoingBody {
41330 #[inline]
41331 unsafe fn drop(_handle: u32) {
41332 #[cfg(not(target_arch = "wasm32"))]
41333 unreachable!();
41334 #[cfg(target_arch = "wasm32")]
41335 {
41336 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
41337 extern "C" {
41338 #[link_name = "[resource-drop]outgoing-body"]
41339 fn drop(_: u32);
41340 }
41341 drop(_handle);
41342 }
41343 }
41344 }
41345 /// Represents a future which may eventaully return an incoming HTTP
41346 /// Response, or an error.
41347 ///
41348 /// This resource is returned by the `wasi:http/outgoing-handler` interface to
41349 /// provide the HTTP Response corresponding to the sent Request.
41350 #[derive(Debug)]
41351 #[repr(transparent)]
41352 pub struct FutureIncomingResponse {
41353 handle: _rt::Resource<FutureIncomingResponse>,
41354 }
41355 impl FutureIncomingResponse {
41356 #[doc(hidden)]
41357 pub unsafe fn from_handle(handle: u32) -> Self {
41358 Self {
41359 handle: _rt::Resource::from_handle(handle),
41360 }
41361 }
41362 #[doc(hidden)]
41363 pub fn take_handle(&self) -> u32 {
41364 _rt::Resource::take_handle(&self.handle)
41365 }
41366 #[doc(hidden)]
41367 pub fn handle(&self) -> u32 {
41368 _rt::Resource::handle(&self.handle)
41369 }
41370 }
41371 unsafe impl _rt::WasmResource for FutureIncomingResponse {
41372 #[inline]
41373 unsafe fn drop(_handle: u32) {
41374 #[cfg(not(target_arch = "wasm32"))]
41375 unreachable!();
41376 #[cfg(target_arch = "wasm32")]
41377 {
41378 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
41379 extern "C" {
41380 #[link_name = "[resource-drop]future-incoming-response"]
41381 fn drop(_: u32);
41382 }
41383 drop(_handle);
41384 }
41385 }
41386 }
41387 #[allow(unused_unsafe, clippy::all)]
41388 /// Attempts to extract a http-related `error` from the wasi:io `error`
41389 /// provided.
41390 ///
41391 /// Stream operations which return
41392 /// `wasi:io/stream/stream-error::last-operation-failed` have a payload of
41393 /// type `wasi:io/error/error` with more information about the operation
41394 /// that failed. This payload can be passed through to this function to see
41395 /// if there's http-related information about the error to return.
41396 ///
41397 /// Note that this function is fallible because not all io-errors are
41398 /// http-related errors.
41399 pub fn http_error_code(err: &IoError) -> Option<ErrorCode> {
41400 unsafe {
41401 #[repr(align(8))]
41402 struct RetArea([::core::mem::MaybeUninit<u8>; 40]);
41403 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 40]);
41404 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
41405 #[cfg(target_arch = "wasm32")]
41406 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
41407 extern "C" {
41408 #[link_name = "http-error-code"]
41409 fn wit_import(_: i32, _: *mut u8);
41410 }
41411 #[cfg(not(target_arch = "wasm32"))]
41412 fn wit_import(_: i32, _: *mut u8) {
41413 unreachable!()
41414 }
41415 wit_import((err).handle() as i32, ptr0);
41416 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
41417 match l1 {
41418 0 => None,
41419 1 => {
41420 let e = {
41421 let l2 = i32::from(*ptr0.add(8).cast::<u8>());
41422 let v64 = match l2 {
41423 0 => ErrorCode::DnsTimeout,
41424 1 => {
41425 let e64 = {
41426 let l3 = i32::from(*ptr0.add(16).cast::<u8>());
41427 let l7 = i32::from(*ptr0.add(28).cast::<u8>());
41428 DnsErrorPayload {
41429 rcode: match l3 {
41430 0 => None,
41431 1 => {
41432 let e = {
41433 let l4 = *ptr0.add(20).cast::<*mut u8>();
41434 let l5 = *ptr0.add(24).cast::<usize>();
41435 let len6 = l5;
41436 let bytes6 = _rt::Vec::from_raw_parts(
41437 l4.cast(),
41438 len6,
41439 len6,
41440 );
41441 _rt::string_lift(bytes6)
41442 };
41443 Some(e)
41444 }
41445 _ => _rt::invalid_enum_discriminant(),
41446 },
41447 info_code: match l7 {
41448 0 => None,
41449 1 => {
41450 let e = {
41451 let l8 = i32::from(*ptr0.add(30).cast::<u16>());
41452 l8 as u16
41453 };
41454 Some(e)
41455 }
41456 _ => _rt::invalid_enum_discriminant(),
41457 },
41458 }
41459 };
41460 ErrorCode::DnsError(e64)
41461 }
41462 2 => ErrorCode::DestinationNotFound,
41463 3 => ErrorCode::DestinationUnavailable,
41464 4 => ErrorCode::DestinationIpProhibited,
41465 5 => ErrorCode::DestinationIpUnroutable,
41466 6 => ErrorCode::ConnectionRefused,
41467 7 => ErrorCode::ConnectionTerminated,
41468 8 => ErrorCode::ConnectionTimeout,
41469 9 => ErrorCode::ConnectionReadTimeout,
41470 10 => ErrorCode::ConnectionWriteTimeout,
41471 11 => ErrorCode::ConnectionLimitReached,
41472 12 => ErrorCode::TlsProtocolError,
41473 13 => ErrorCode::TlsCertificateError,
41474 14 => {
41475 let e64 = {
41476 let l9 = i32::from(*ptr0.add(16).cast::<u8>());
41477 let l11 = i32::from(*ptr0.add(20).cast::<u8>());
41478 TlsAlertReceivedPayload {
41479 alert_id: match l9 {
41480 0 => None,
41481 1 => {
41482 let e = {
41483 let l10 = i32::from(*ptr0.add(17).cast::<u8>());
41484 l10 as u8
41485 };
41486 Some(e)
41487 }
41488 _ => _rt::invalid_enum_discriminant(),
41489 },
41490 alert_message: match l11 {
41491 0 => None,
41492 1 => {
41493 let e = {
41494 let l12 = *ptr0.add(24).cast::<*mut u8>();
41495 let l13 = *ptr0.add(28).cast::<usize>();
41496 let len14 = l13;
41497 let bytes14 = _rt::Vec::from_raw_parts(
41498 l12.cast(),
41499 len14,
41500 len14,
41501 );
41502 _rt::string_lift(bytes14)
41503 };
41504 Some(e)
41505 }
41506 _ => _rt::invalid_enum_discriminant(),
41507 },
41508 }
41509 };
41510 ErrorCode::TlsAlertReceived(e64)
41511 }
41512 15 => ErrorCode::HttpRequestDenied,
41513 16 => ErrorCode::HttpRequestLengthRequired,
41514 17 => {
41515 let e64 = {
41516 let l15 = i32::from(*ptr0.add(16).cast::<u8>());
41517 match l15 {
41518 0 => None,
41519 1 => {
41520 let e = {
41521 let l16 = *ptr0.add(24).cast::<i64>();
41522 l16 as u64
41523 };
41524 Some(e)
41525 }
41526 _ => _rt::invalid_enum_discriminant(),
41527 }
41528 };
41529 ErrorCode::HttpRequestBodySize(e64)
41530 }
41531 18 => ErrorCode::HttpRequestMethodInvalid,
41532 19 => ErrorCode::HttpRequestUriInvalid,
41533 20 => ErrorCode::HttpRequestUriTooLong,
41534 21 => {
41535 let e64 = {
41536 let l17 = i32::from(*ptr0.add(16).cast::<u8>());
41537 match l17 {
41538 0 => None,
41539 1 => {
41540 let e = {
41541 let l18 = *ptr0.add(20).cast::<i32>();
41542 l18 as u32
41543 };
41544 Some(e)
41545 }
41546 _ => _rt::invalid_enum_discriminant(),
41547 }
41548 };
41549 ErrorCode::HttpRequestHeaderSectionSize(e64)
41550 }
41551 22 => {
41552 let e64 = {
41553 let l19 = i32::from(*ptr0.add(16).cast::<u8>());
41554 match l19 {
41555 0 => None,
41556 1 => {
41557 let e = {
41558 let l20 = i32::from(*ptr0.add(20).cast::<u8>());
41559 let l24 = i32::from(*ptr0.add(32).cast::<u8>());
41560 FieldSizePayload {
41561 field_name: match l20 {
41562 0 => None,
41563 1 => {
41564 let e = {
41565 let l21 = *ptr0.add(24).cast::<*mut u8>();
41566 let l22 = *ptr0.add(28).cast::<usize>();
41567 let len23 = l22;
41568 let bytes23 = _rt::Vec::from_raw_parts(
41569 l21.cast(),
41570 len23,
41571 len23,
41572 );
41573 _rt::string_lift(bytes23)
41574 };
41575 Some(e)
41576 }
41577 _ => _rt::invalid_enum_discriminant(),
41578 },
41579 field_size: match l24 {
41580 0 => None,
41581 1 => {
41582 let e = {
41583 let l25 = *ptr0.add(36).cast::<i32>();
41584 l25 as u32
41585 };
41586 Some(e)
41587 }
41588 _ => _rt::invalid_enum_discriminant(),
41589 },
41590 }
41591 };
41592 Some(e)
41593 }
41594 _ => _rt::invalid_enum_discriminant(),
41595 }
41596 };
41597 ErrorCode::HttpRequestHeaderSize(e64)
41598 }
41599 23 => {
41600 let e64 = {
41601 let l26 = i32::from(*ptr0.add(16).cast::<u8>());
41602 match l26 {
41603 0 => None,
41604 1 => {
41605 let e = {
41606 let l27 = *ptr0.add(20).cast::<i32>();
41607 l27 as u32
41608 };
41609 Some(e)
41610 }
41611 _ => _rt::invalid_enum_discriminant(),
41612 }
41613 };
41614 ErrorCode::HttpRequestTrailerSectionSize(e64)
41615 }
41616 24 => {
41617 let e64 = {
41618 let l28 = i32::from(*ptr0.add(16).cast::<u8>());
41619 let l32 = i32::from(*ptr0.add(28).cast::<u8>());
41620 FieldSizePayload {
41621 field_name: match l28 {
41622 0 => None,
41623 1 => {
41624 let e = {
41625 let l29 = *ptr0.add(20).cast::<*mut u8>();
41626 let l30 = *ptr0.add(24).cast::<usize>();
41627 let len31 = l30;
41628 let bytes31 = _rt::Vec::from_raw_parts(
41629 l29.cast(),
41630 len31,
41631 len31,
41632 );
41633 _rt::string_lift(bytes31)
41634 };
41635 Some(e)
41636 }
41637 _ => _rt::invalid_enum_discriminant(),
41638 },
41639 field_size: match l32 {
41640 0 => None,
41641 1 => {
41642 let e = {
41643 let l33 = *ptr0.add(32).cast::<i32>();
41644 l33 as u32
41645 };
41646 Some(e)
41647 }
41648 _ => _rt::invalid_enum_discriminant(),
41649 },
41650 }
41651 };
41652 ErrorCode::HttpRequestTrailerSize(e64)
41653 }
41654 25 => ErrorCode::HttpResponseIncomplete,
41655 26 => {
41656 let e64 = {
41657 let l34 = i32::from(*ptr0.add(16).cast::<u8>());
41658 match l34 {
41659 0 => None,
41660 1 => {
41661 let e = {
41662 let l35 = *ptr0.add(20).cast::<i32>();
41663 l35 as u32
41664 };
41665 Some(e)
41666 }
41667 _ => _rt::invalid_enum_discriminant(),
41668 }
41669 };
41670 ErrorCode::HttpResponseHeaderSectionSize(e64)
41671 }
41672 27 => {
41673 let e64 = {
41674 let l36 = i32::from(*ptr0.add(16).cast::<u8>());
41675 let l40 = i32::from(*ptr0.add(28).cast::<u8>());
41676 FieldSizePayload {
41677 field_name: match l36 {
41678 0 => None,
41679 1 => {
41680 let e = {
41681 let l37 = *ptr0.add(20).cast::<*mut u8>();
41682 let l38 = *ptr0.add(24).cast::<usize>();
41683 let len39 = l38;
41684 let bytes39 = _rt::Vec::from_raw_parts(
41685 l37.cast(),
41686 len39,
41687 len39,
41688 );
41689 _rt::string_lift(bytes39)
41690 };
41691 Some(e)
41692 }
41693 _ => _rt::invalid_enum_discriminant(),
41694 },
41695 field_size: match l40 {
41696 0 => None,
41697 1 => {
41698 let e = {
41699 let l41 = *ptr0.add(32).cast::<i32>();
41700 l41 as u32
41701 };
41702 Some(e)
41703 }
41704 _ => _rt::invalid_enum_discriminant(),
41705 },
41706 }
41707 };
41708 ErrorCode::HttpResponseHeaderSize(e64)
41709 }
41710 28 => {
41711 let e64 = {
41712 let l42 = i32::from(*ptr0.add(16).cast::<u8>());
41713 match l42 {
41714 0 => None,
41715 1 => {
41716 let e = {
41717 let l43 = *ptr0.add(24).cast::<i64>();
41718 l43 as u64
41719 };
41720 Some(e)
41721 }
41722 _ => _rt::invalid_enum_discriminant(),
41723 }
41724 };
41725 ErrorCode::HttpResponseBodySize(e64)
41726 }
41727 29 => {
41728 let e64 = {
41729 let l44 = i32::from(*ptr0.add(16).cast::<u8>());
41730 match l44 {
41731 0 => None,
41732 1 => {
41733 let e = {
41734 let l45 = *ptr0.add(20).cast::<i32>();
41735 l45 as u32
41736 };
41737 Some(e)
41738 }
41739 _ => _rt::invalid_enum_discriminant(),
41740 }
41741 };
41742 ErrorCode::HttpResponseTrailerSectionSize(e64)
41743 }
41744 30 => {
41745 let e64 = {
41746 let l46 = i32::from(*ptr0.add(16).cast::<u8>());
41747 let l50 = i32::from(*ptr0.add(28).cast::<u8>());
41748 FieldSizePayload {
41749 field_name: match l46 {
41750 0 => None,
41751 1 => {
41752 let e = {
41753 let l47 = *ptr0.add(20).cast::<*mut u8>();
41754 let l48 = *ptr0.add(24).cast::<usize>();
41755 let len49 = l48;
41756 let bytes49 = _rt::Vec::from_raw_parts(
41757 l47.cast(),
41758 len49,
41759 len49,
41760 );
41761 _rt::string_lift(bytes49)
41762 };
41763 Some(e)
41764 }
41765 _ => _rt::invalid_enum_discriminant(),
41766 },
41767 field_size: match l50 {
41768 0 => None,
41769 1 => {
41770 let e = {
41771 let l51 = *ptr0.add(32).cast::<i32>();
41772 l51 as u32
41773 };
41774 Some(e)
41775 }
41776 _ => _rt::invalid_enum_discriminant(),
41777 },
41778 }
41779 };
41780 ErrorCode::HttpResponseTrailerSize(e64)
41781 }
41782 31 => {
41783 let e64 = {
41784 let l52 = i32::from(*ptr0.add(16).cast::<u8>());
41785 match l52 {
41786 0 => None,
41787 1 => {
41788 let e = {
41789 let l53 = *ptr0.add(20).cast::<*mut u8>();
41790 let l54 = *ptr0.add(24).cast::<usize>();
41791 let len55 = l54;
41792 let bytes55 = _rt::Vec::from_raw_parts(
41793 l53.cast(),
41794 len55,
41795 len55,
41796 );
41797 _rt::string_lift(bytes55)
41798 };
41799 Some(e)
41800 }
41801 _ => _rt::invalid_enum_discriminant(),
41802 }
41803 };
41804 ErrorCode::HttpResponseTransferCoding(e64)
41805 }
41806 32 => {
41807 let e64 = {
41808 let l56 = i32::from(*ptr0.add(16).cast::<u8>());
41809 match l56 {
41810 0 => None,
41811 1 => {
41812 let e = {
41813 let l57 = *ptr0.add(20).cast::<*mut u8>();
41814 let l58 = *ptr0.add(24).cast::<usize>();
41815 let len59 = l58;
41816 let bytes59 = _rt::Vec::from_raw_parts(
41817 l57.cast(),
41818 len59,
41819 len59,
41820 );
41821 _rt::string_lift(bytes59)
41822 };
41823 Some(e)
41824 }
41825 _ => _rt::invalid_enum_discriminant(),
41826 }
41827 };
41828 ErrorCode::HttpResponseContentCoding(e64)
41829 }
41830 33 => ErrorCode::HttpResponseTimeout,
41831 34 => ErrorCode::HttpUpgradeFailed,
41832 35 => ErrorCode::HttpProtocolError,
41833 36 => ErrorCode::LoopDetected,
41834 37 => ErrorCode::ConfigurationError,
41835 n => {
41836 debug_assert_eq!(n, 38, "invalid enum discriminant");
41837 let e64 = {
41838 let l60 = i32::from(*ptr0.add(16).cast::<u8>());
41839 match l60 {
41840 0 => None,
41841 1 => {
41842 let e = {
41843 let l61 = *ptr0.add(20).cast::<*mut u8>();
41844 let l62 = *ptr0.add(24).cast::<usize>();
41845 let len63 = l62;
41846 let bytes63 = _rt::Vec::from_raw_parts(
41847 l61.cast(),
41848 len63,
41849 len63,
41850 );
41851 _rt::string_lift(bytes63)
41852 };
41853 Some(e)
41854 }
41855 _ => _rt::invalid_enum_discriminant(),
41856 }
41857 };
41858 ErrorCode::InternalError(e64)
41859 }
41860 };
41861 v64
41862 };
41863 Some(e)
41864 }
41865 _ => _rt::invalid_enum_discriminant(),
41866 }
41867 }
41868 }
41869 impl Fields {
41870 #[allow(unused_unsafe, clippy::all)]
41871 /// Construct an empty HTTP Fields.
41872 ///
41873 /// The resulting `fields` is mutable.
41874 pub fn new() -> Self {
41875 unsafe {
41876 #[cfg(target_arch = "wasm32")]
41877 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
41878 extern "C" {
41879 #[link_name = "[constructor]fields"]
41880 fn wit_import() -> i32;
41881 }
41882 #[cfg(not(target_arch = "wasm32"))]
41883 fn wit_import() -> i32 {
41884 unreachable!()
41885 }
41886 let ret = wit_import();
41887 Fields::from_handle(ret as u32)
41888 }
41889 }
41890 }
41891 impl Fields {
41892 #[allow(unused_unsafe, clippy::all)]
41893 /// Construct an HTTP Fields.
41894 ///
41895 /// The resulting `fields` is mutable.
41896 ///
41897 /// The list represents each key-value pair in the Fields. Keys
41898 /// which have multiple values are represented by multiple entries in this
41899 /// list with the same key.
41900 ///
41901 /// The tuple is a pair of the field key, represented as a string, and
41902 /// Value, represented as a list of bytes. In a valid Fields, all keys
41903 /// and values are valid UTF-8 strings. However, values are not always
41904 /// well-formed, so they are represented as a raw list of bytes.
41905 ///
41906 /// An error result will be returned if any header or value was
41907 /// syntactically invalid, or if a header was forbidden.
41908 pub fn from_list(
41909 entries: &[(FieldKey, FieldValue)],
41910 ) -> Result<Fields, HeaderError> {
41911 unsafe {
41912 #[repr(align(4))]
41913 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
41914 let mut ret_area = RetArea(
41915 [::core::mem::MaybeUninit::uninit(); 8],
41916 );
41917 let vec3 = entries;
41918 let len3 = vec3.len();
41919 let layout3 = _rt::alloc::Layout::from_size_align_unchecked(
41920 vec3.len() * 16,
41921 4,
41922 );
41923 let result3 = if layout3.size() != 0 {
41924 let ptr = _rt::alloc::alloc(layout3).cast::<u8>();
41925 if ptr.is_null() {
41926 _rt::alloc::handle_alloc_error(layout3);
41927 }
41928 ptr
41929 } else {
41930 ::core::ptr::null_mut()
41931 };
41932 for (i, e) in vec3.into_iter().enumerate() {
41933 let base = result3.add(i * 16);
41934 {
41935 let (t0_0, t0_1) = e;
41936 let vec1 = t0_0;
41937 let ptr1 = vec1.as_ptr().cast::<u8>();
41938 let len1 = vec1.len();
41939 *base.add(4).cast::<usize>() = len1;
41940 *base.add(0).cast::<*mut u8>() = ptr1.cast_mut();
41941 let vec2 = t0_1;
41942 let ptr2 = vec2.as_ptr().cast::<u8>();
41943 let len2 = vec2.len();
41944 *base.add(12).cast::<usize>() = len2;
41945 *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
41946 }
41947 }
41948 let ptr4 = ret_area.0.as_mut_ptr().cast::<u8>();
41949 #[cfg(target_arch = "wasm32")]
41950 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
41951 extern "C" {
41952 #[link_name = "[static]fields.from-list"]
41953 fn wit_import(_: *mut u8, _: usize, _: *mut u8);
41954 }
41955 #[cfg(not(target_arch = "wasm32"))]
41956 fn wit_import(_: *mut u8, _: usize, _: *mut u8) {
41957 unreachable!()
41958 }
41959 wit_import(result3, len3, ptr4);
41960 let l5 = i32::from(*ptr4.add(0).cast::<u8>());
41961 if layout3.size() != 0 {
41962 _rt::alloc::dealloc(result3.cast(), layout3);
41963 }
41964 match l5 {
41965 0 => {
41966 let e = {
41967 let l6 = *ptr4.add(4).cast::<i32>();
41968 Fields::from_handle(l6 as u32)
41969 };
41970 Ok(e)
41971 }
41972 1 => {
41973 let e = {
41974 let l7 = i32::from(*ptr4.add(4).cast::<u8>());
41975 let v8 = match l7 {
41976 0 => HeaderError::InvalidSyntax,
41977 1 => HeaderError::Forbidden,
41978 n => {
41979 debug_assert_eq!(n, 2, "invalid enum discriminant");
41980 HeaderError::Immutable
41981 }
41982 };
41983 v8
41984 };
41985 Err(e)
41986 }
41987 _ => _rt::invalid_enum_discriminant(),
41988 }
41989 }
41990 }
41991 }
41992 impl Fields {
41993 #[allow(unused_unsafe, clippy::all)]
41994 /// Get all of the values corresponding to a key. If the key is not present
41995 /// in this `fields`, an empty list is returned. However, if the key is
41996 /// present but empty, this is represented by a list with one or more
41997 /// empty field-values present.
41998 pub fn get(&self, name: &FieldKey) -> _rt::Vec<FieldValue> {
41999 unsafe {
42000 #[repr(align(4))]
42001 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
42002 let mut ret_area = RetArea(
42003 [::core::mem::MaybeUninit::uninit(); 8],
42004 );
42005 let vec0 = name;
42006 let ptr0 = vec0.as_ptr().cast::<u8>();
42007 let len0 = vec0.len();
42008 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
42009 #[cfg(target_arch = "wasm32")]
42010 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42011 extern "C" {
42012 #[link_name = "[method]fields.get"]
42013 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
42014 }
42015 #[cfg(not(target_arch = "wasm32"))]
42016 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
42017 unreachable!()
42018 }
42019 wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
42020 let l2 = *ptr1.add(0).cast::<*mut u8>();
42021 let l3 = *ptr1.add(4).cast::<usize>();
42022 let base7 = l2;
42023 let len7 = l3;
42024 let mut result7 = _rt::Vec::with_capacity(len7);
42025 for i in 0..len7 {
42026 let base = base7.add(i * 8);
42027 let e7 = {
42028 let l4 = *base.add(0).cast::<*mut u8>();
42029 let l5 = *base.add(4).cast::<usize>();
42030 let len6 = l5;
42031 _rt::Vec::from_raw_parts(l4.cast(), len6, len6)
42032 };
42033 result7.push(e7);
42034 }
42035 _rt::cabi_dealloc(base7, len7 * 8, 4);
42036 result7
42037 }
42038 }
42039 }
42040 impl Fields {
42041 #[allow(unused_unsafe, clippy::all)]
42042 /// Returns `true` when the key is present in this `fields`. If the key is
42043 /// syntactically invalid, `false` is returned.
42044 pub fn has(&self, name: &FieldKey) -> bool {
42045 unsafe {
42046 let vec0 = name;
42047 let ptr0 = vec0.as_ptr().cast::<u8>();
42048 let len0 = vec0.len();
42049 #[cfg(target_arch = "wasm32")]
42050 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42051 extern "C" {
42052 #[link_name = "[method]fields.has"]
42053 fn wit_import(_: i32, _: *mut u8, _: usize) -> i32;
42054 }
42055 #[cfg(not(target_arch = "wasm32"))]
42056 fn wit_import(_: i32, _: *mut u8, _: usize) -> i32 {
42057 unreachable!()
42058 }
42059 let ret = wit_import(
42060 (self).handle() as i32,
42061 ptr0.cast_mut(),
42062 len0,
42063 );
42064 _rt::bool_lift(ret as u8)
42065 }
42066 }
42067 }
42068 impl Fields {
42069 #[allow(unused_unsafe, clippy::all)]
42070 /// Set all of the values for a key. Clears any existing values for that
42071 /// key, if they have been set.
42072 ///
42073 /// Fails with `header-error.immutable` if the `fields` are immutable.
42074 pub fn set(
42075 &self,
42076 name: &FieldKey,
42077 value: &[FieldValue],
42078 ) -> Result<(), HeaderError> {
42079 unsafe {
42080 #[repr(align(1))]
42081 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
42082 let mut ret_area = RetArea(
42083 [::core::mem::MaybeUninit::uninit(); 2],
42084 );
42085 let vec0 = name;
42086 let ptr0 = vec0.as_ptr().cast::<u8>();
42087 let len0 = vec0.len();
42088 let vec2 = value;
42089 let len2 = vec2.len();
42090 let layout2 = _rt::alloc::Layout::from_size_align_unchecked(
42091 vec2.len() * 8,
42092 4,
42093 );
42094 let result2 = if layout2.size() != 0 {
42095 let ptr = _rt::alloc::alloc(layout2).cast::<u8>();
42096 if ptr.is_null() {
42097 _rt::alloc::handle_alloc_error(layout2);
42098 }
42099 ptr
42100 } else {
42101 ::core::ptr::null_mut()
42102 };
42103 for (i, e) in vec2.into_iter().enumerate() {
42104 let base = result2.add(i * 8);
42105 {
42106 let vec1 = e;
42107 let ptr1 = vec1.as_ptr().cast::<u8>();
42108 let len1 = vec1.len();
42109 *base.add(4).cast::<usize>() = len1;
42110 *base.add(0).cast::<*mut u8>() = ptr1.cast_mut();
42111 }
42112 }
42113 let ptr3 = ret_area.0.as_mut_ptr().cast::<u8>();
42114 #[cfg(target_arch = "wasm32")]
42115 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42116 extern "C" {
42117 #[link_name = "[method]fields.set"]
42118 fn wit_import(
42119 _: i32,
42120 _: *mut u8,
42121 _: usize,
42122 _: *mut u8,
42123 _: usize,
42124 _: *mut u8,
42125 );
42126 }
42127 #[cfg(not(target_arch = "wasm32"))]
42128 fn wit_import(
42129 _: i32,
42130 _: *mut u8,
42131 _: usize,
42132 _: *mut u8,
42133 _: usize,
42134 _: *mut u8,
42135 ) {
42136 unreachable!()
42137 }
42138 wit_import(
42139 (self).handle() as i32,
42140 ptr0.cast_mut(),
42141 len0,
42142 result2,
42143 len2,
42144 ptr3,
42145 );
42146 let l4 = i32::from(*ptr3.add(0).cast::<u8>());
42147 if layout2.size() != 0 {
42148 _rt::alloc::dealloc(result2.cast(), layout2);
42149 }
42150 match l4 {
42151 0 => {
42152 let e = ();
42153 Ok(e)
42154 }
42155 1 => {
42156 let e = {
42157 let l5 = i32::from(*ptr3.add(1).cast::<u8>());
42158 let v6 = match l5 {
42159 0 => HeaderError::InvalidSyntax,
42160 1 => HeaderError::Forbidden,
42161 n => {
42162 debug_assert_eq!(n, 2, "invalid enum discriminant");
42163 HeaderError::Immutable
42164 }
42165 };
42166 v6
42167 };
42168 Err(e)
42169 }
42170 _ => _rt::invalid_enum_discriminant(),
42171 }
42172 }
42173 }
42174 }
42175 impl Fields {
42176 #[allow(unused_unsafe, clippy::all)]
42177 /// Delete all values for a key. Does nothing if no values for the key
42178 /// exist.
42179 ///
42180 /// Fails with `header-error.immutable` if the `fields` are immutable.
42181 pub fn delete(&self, name: &FieldKey) -> Result<(), HeaderError> {
42182 unsafe {
42183 #[repr(align(1))]
42184 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
42185 let mut ret_area = RetArea(
42186 [::core::mem::MaybeUninit::uninit(); 2],
42187 );
42188 let vec0 = name;
42189 let ptr0 = vec0.as_ptr().cast::<u8>();
42190 let len0 = vec0.len();
42191 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
42192 #[cfg(target_arch = "wasm32")]
42193 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42194 extern "C" {
42195 #[link_name = "[method]fields.delete"]
42196 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
42197 }
42198 #[cfg(not(target_arch = "wasm32"))]
42199 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
42200 unreachable!()
42201 }
42202 wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
42203 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
42204 match l2 {
42205 0 => {
42206 let e = ();
42207 Ok(e)
42208 }
42209 1 => {
42210 let e = {
42211 let l3 = i32::from(*ptr1.add(1).cast::<u8>());
42212 let v4 = match l3 {
42213 0 => HeaderError::InvalidSyntax,
42214 1 => HeaderError::Forbidden,
42215 n => {
42216 debug_assert_eq!(n, 2, "invalid enum discriminant");
42217 HeaderError::Immutable
42218 }
42219 };
42220 v4
42221 };
42222 Err(e)
42223 }
42224 _ => _rt::invalid_enum_discriminant(),
42225 }
42226 }
42227 }
42228 }
42229 impl Fields {
42230 #[allow(unused_unsafe, clippy::all)]
42231 /// Append a value for a key. Does not change or delete any existing
42232 /// values for that key.
42233 ///
42234 /// Fails with `header-error.immutable` if the `fields` are immutable.
42235 pub fn append(
42236 &self,
42237 name: &FieldKey,
42238 value: &FieldValue,
42239 ) -> Result<(), HeaderError> {
42240 unsafe {
42241 #[repr(align(1))]
42242 struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
42243 let mut ret_area = RetArea(
42244 [::core::mem::MaybeUninit::uninit(); 2],
42245 );
42246 let vec0 = name;
42247 let ptr0 = vec0.as_ptr().cast::<u8>();
42248 let len0 = vec0.len();
42249 let vec1 = value;
42250 let ptr1 = vec1.as_ptr().cast::<u8>();
42251 let len1 = vec1.len();
42252 let ptr2 = ret_area.0.as_mut_ptr().cast::<u8>();
42253 #[cfg(target_arch = "wasm32")]
42254 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42255 extern "C" {
42256 #[link_name = "[method]fields.append"]
42257 fn wit_import(
42258 _: i32,
42259 _: *mut u8,
42260 _: usize,
42261 _: *mut u8,
42262 _: usize,
42263 _: *mut u8,
42264 );
42265 }
42266 #[cfg(not(target_arch = "wasm32"))]
42267 fn wit_import(
42268 _: i32,
42269 _: *mut u8,
42270 _: usize,
42271 _: *mut u8,
42272 _: usize,
42273 _: *mut u8,
42274 ) {
42275 unreachable!()
42276 }
42277 wit_import(
42278 (self).handle() as i32,
42279 ptr0.cast_mut(),
42280 len0,
42281 ptr1.cast_mut(),
42282 len1,
42283 ptr2,
42284 );
42285 let l3 = i32::from(*ptr2.add(0).cast::<u8>());
42286 match l3 {
42287 0 => {
42288 let e = ();
42289 Ok(e)
42290 }
42291 1 => {
42292 let e = {
42293 let l4 = i32::from(*ptr2.add(1).cast::<u8>());
42294 let v5 = match l4 {
42295 0 => HeaderError::InvalidSyntax,
42296 1 => HeaderError::Forbidden,
42297 n => {
42298 debug_assert_eq!(n, 2, "invalid enum discriminant");
42299 HeaderError::Immutable
42300 }
42301 };
42302 v5
42303 };
42304 Err(e)
42305 }
42306 _ => _rt::invalid_enum_discriminant(),
42307 }
42308 }
42309 }
42310 }
42311 impl Fields {
42312 #[allow(unused_unsafe, clippy::all)]
42313 /// Retrieve the full set of keys and values in the Fields. Like the
42314 /// constructor, the list represents each key-value pair.
42315 ///
42316 /// The outer list represents each key-value pair in the Fields. Keys
42317 /// which have multiple values are represented by multiple entries in this
42318 /// list with the same key.
42319 pub fn entries(&self) -> _rt::Vec<(FieldKey, FieldValue)> {
42320 unsafe {
42321 #[repr(align(4))]
42322 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
42323 let mut ret_area = RetArea(
42324 [::core::mem::MaybeUninit::uninit(); 8],
42325 );
42326 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
42327 #[cfg(target_arch = "wasm32")]
42328 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42329 extern "C" {
42330 #[link_name = "[method]fields.entries"]
42331 fn wit_import(_: i32, _: *mut u8);
42332 }
42333 #[cfg(not(target_arch = "wasm32"))]
42334 fn wit_import(_: i32, _: *mut u8) {
42335 unreachable!()
42336 }
42337 wit_import((self).handle() as i32, ptr0);
42338 let l1 = *ptr0.add(0).cast::<*mut u8>();
42339 let l2 = *ptr0.add(4).cast::<usize>();
42340 let base9 = l1;
42341 let len9 = l2;
42342 let mut result9 = _rt::Vec::with_capacity(len9);
42343 for i in 0..len9 {
42344 let base = base9.add(i * 16);
42345 let e9 = {
42346 let l3 = *base.add(0).cast::<*mut u8>();
42347 let l4 = *base.add(4).cast::<usize>();
42348 let len5 = l4;
42349 let bytes5 = _rt::Vec::from_raw_parts(
42350 l3.cast(),
42351 len5,
42352 len5,
42353 );
42354 let l6 = *base.add(8).cast::<*mut u8>();
42355 let l7 = *base.add(12).cast::<usize>();
42356 let len8 = l7;
42357 (
42358 _rt::string_lift(bytes5),
42359 _rt::Vec::from_raw_parts(l6.cast(), len8, len8),
42360 )
42361 };
42362 result9.push(e9);
42363 }
42364 _rt::cabi_dealloc(base9, len9 * 16, 4);
42365 result9
42366 }
42367 }
42368 }
42369 impl Fields {
42370 #[allow(unused_unsafe, clippy::all)]
42371 /// Make a deep copy of the Fields. Equivelant in behavior to calling the
42372 /// `fields` constructor on the return value of `entries`. The resulting
42373 /// `fields` is mutable.
42374 pub fn clone(&self) -> Fields {
42375 unsafe {
42376 #[cfg(target_arch = "wasm32")]
42377 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42378 extern "C" {
42379 #[link_name = "[method]fields.clone"]
42380 fn wit_import(_: i32) -> i32;
42381 }
42382 #[cfg(not(target_arch = "wasm32"))]
42383 fn wit_import(_: i32) -> i32 {
42384 unreachable!()
42385 }
42386 let ret = wit_import((self).handle() as i32);
42387 Fields::from_handle(ret as u32)
42388 }
42389 }
42390 }
42391 impl IncomingRequest {
42392 #[allow(unused_unsafe, clippy::all)]
42393 /// Returns the method of the incoming request.
42394 pub fn method(&self) -> Method {
42395 unsafe {
42396 #[repr(align(4))]
42397 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
42398 let mut ret_area = RetArea(
42399 [::core::mem::MaybeUninit::uninit(); 12],
42400 );
42401 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
42402 #[cfg(target_arch = "wasm32")]
42403 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42404 extern "C" {
42405 #[link_name = "[method]incoming-request.method"]
42406 fn wit_import(_: i32, _: *mut u8);
42407 }
42408 #[cfg(not(target_arch = "wasm32"))]
42409 fn wit_import(_: i32, _: *mut u8) {
42410 unreachable!()
42411 }
42412 wit_import((self).handle() as i32, ptr0);
42413 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
42414 let v5 = match l1 {
42415 0 => Method::Get,
42416 1 => Method::Head,
42417 2 => Method::Post,
42418 3 => Method::Put,
42419 4 => Method::Delete,
42420 5 => Method::Connect,
42421 6 => Method::Options,
42422 7 => Method::Trace,
42423 8 => Method::Patch,
42424 n => {
42425 debug_assert_eq!(n, 9, "invalid enum discriminant");
42426 let e5 = {
42427 let l2 = *ptr0.add(4).cast::<*mut u8>();
42428 let l3 = *ptr0.add(8).cast::<usize>();
42429 let len4 = l3;
42430 let bytes4 = _rt::Vec::from_raw_parts(
42431 l2.cast(),
42432 len4,
42433 len4,
42434 );
42435 _rt::string_lift(bytes4)
42436 };
42437 Method::Other(e5)
42438 }
42439 };
42440 v5
42441 }
42442 }
42443 }
42444 impl IncomingRequest {
42445 #[allow(unused_unsafe, clippy::all)]
42446 /// Returns the path with query parameters from the request, as a string.
42447 pub fn path_with_query(&self) -> Option<_rt::String> {
42448 unsafe {
42449 #[repr(align(4))]
42450 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
42451 let mut ret_area = RetArea(
42452 [::core::mem::MaybeUninit::uninit(); 12],
42453 );
42454 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
42455 #[cfg(target_arch = "wasm32")]
42456 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42457 extern "C" {
42458 #[link_name = "[method]incoming-request.path-with-query"]
42459 fn wit_import(_: i32, _: *mut u8);
42460 }
42461 #[cfg(not(target_arch = "wasm32"))]
42462 fn wit_import(_: i32, _: *mut u8) {
42463 unreachable!()
42464 }
42465 wit_import((self).handle() as i32, ptr0);
42466 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
42467 match l1 {
42468 0 => None,
42469 1 => {
42470 let e = {
42471 let l2 = *ptr0.add(4).cast::<*mut u8>();
42472 let l3 = *ptr0.add(8).cast::<usize>();
42473 let len4 = l3;
42474 let bytes4 = _rt::Vec::from_raw_parts(
42475 l2.cast(),
42476 len4,
42477 len4,
42478 );
42479 _rt::string_lift(bytes4)
42480 };
42481 Some(e)
42482 }
42483 _ => _rt::invalid_enum_discriminant(),
42484 }
42485 }
42486 }
42487 }
42488 impl IncomingRequest {
42489 #[allow(unused_unsafe, clippy::all)]
42490 /// Returns the protocol scheme from the request.
42491 pub fn scheme(&self) -> Option<Scheme> {
42492 unsafe {
42493 #[repr(align(4))]
42494 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
42495 let mut ret_area = RetArea(
42496 [::core::mem::MaybeUninit::uninit(); 16],
42497 );
42498 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
42499 #[cfg(target_arch = "wasm32")]
42500 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42501 extern "C" {
42502 #[link_name = "[method]incoming-request.scheme"]
42503 fn wit_import(_: i32, _: *mut u8);
42504 }
42505 #[cfg(not(target_arch = "wasm32"))]
42506 fn wit_import(_: i32, _: *mut u8) {
42507 unreachable!()
42508 }
42509 wit_import((self).handle() as i32, ptr0);
42510 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
42511 match l1 {
42512 0 => None,
42513 1 => {
42514 let e = {
42515 let l2 = i32::from(*ptr0.add(4).cast::<u8>());
42516 let v6 = match l2 {
42517 0 => Scheme::Http,
42518 1 => Scheme::Https,
42519 n => {
42520 debug_assert_eq!(n, 2, "invalid enum discriminant");
42521 let e6 = {
42522 let l3 = *ptr0.add(8).cast::<*mut u8>();
42523 let l4 = *ptr0.add(12).cast::<usize>();
42524 let len5 = l4;
42525 let bytes5 = _rt::Vec::from_raw_parts(
42526 l3.cast(),
42527 len5,
42528 len5,
42529 );
42530 _rt::string_lift(bytes5)
42531 };
42532 Scheme::Other(e6)
42533 }
42534 };
42535 v6
42536 };
42537 Some(e)
42538 }
42539 _ => _rt::invalid_enum_discriminant(),
42540 }
42541 }
42542 }
42543 }
42544 impl IncomingRequest {
42545 #[allow(unused_unsafe, clippy::all)]
42546 /// Returns the authority from the request, if it was present.
42547 pub fn authority(&self) -> Option<_rt::String> {
42548 unsafe {
42549 #[repr(align(4))]
42550 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
42551 let mut ret_area = RetArea(
42552 [::core::mem::MaybeUninit::uninit(); 12],
42553 );
42554 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
42555 #[cfg(target_arch = "wasm32")]
42556 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42557 extern "C" {
42558 #[link_name = "[method]incoming-request.authority"]
42559 fn wit_import(_: i32, _: *mut u8);
42560 }
42561 #[cfg(not(target_arch = "wasm32"))]
42562 fn wit_import(_: i32, _: *mut u8) {
42563 unreachable!()
42564 }
42565 wit_import((self).handle() as i32, ptr0);
42566 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
42567 match l1 {
42568 0 => None,
42569 1 => {
42570 let e = {
42571 let l2 = *ptr0.add(4).cast::<*mut u8>();
42572 let l3 = *ptr0.add(8).cast::<usize>();
42573 let len4 = l3;
42574 let bytes4 = _rt::Vec::from_raw_parts(
42575 l2.cast(),
42576 len4,
42577 len4,
42578 );
42579 _rt::string_lift(bytes4)
42580 };
42581 Some(e)
42582 }
42583 _ => _rt::invalid_enum_discriminant(),
42584 }
42585 }
42586 }
42587 }
42588 impl IncomingRequest {
42589 #[allow(unused_unsafe, clippy::all)]
42590 /// Get the `headers` associated with the request.
42591 ///
42592 /// The returned `headers` resource is immutable: `set`, `append`, and
42593 /// `delete` operations will fail with `header-error.immutable`.
42594 ///
42595 /// The `headers` returned are a child resource: it must be dropped before
42596 /// the parent `incoming-request` is dropped. Dropping this
42597 /// `incoming-request` before all children are dropped will trap.
42598 pub fn headers(&self) -> Headers {
42599 unsafe {
42600 #[cfg(target_arch = "wasm32")]
42601 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42602 extern "C" {
42603 #[link_name = "[method]incoming-request.headers"]
42604 fn wit_import(_: i32) -> i32;
42605 }
42606 #[cfg(not(target_arch = "wasm32"))]
42607 fn wit_import(_: i32) -> i32 {
42608 unreachable!()
42609 }
42610 let ret = wit_import((self).handle() as i32);
42611 Fields::from_handle(ret as u32)
42612 }
42613 }
42614 }
42615 impl IncomingRequest {
42616 #[allow(unused_unsafe, clippy::all)]
42617 /// Gives the `incoming-body` associated with this request. Will only
42618 /// return success at most once, and subsequent calls will return error.
42619 pub fn consume(&self) -> Result<IncomingBody, ()> {
42620 unsafe {
42621 #[repr(align(4))]
42622 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
42623 let mut ret_area = RetArea(
42624 [::core::mem::MaybeUninit::uninit(); 8],
42625 );
42626 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
42627 #[cfg(target_arch = "wasm32")]
42628 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42629 extern "C" {
42630 #[link_name = "[method]incoming-request.consume"]
42631 fn wit_import(_: i32, _: *mut u8);
42632 }
42633 #[cfg(not(target_arch = "wasm32"))]
42634 fn wit_import(_: i32, _: *mut u8) {
42635 unreachable!()
42636 }
42637 wit_import((self).handle() as i32, ptr0);
42638 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
42639 match l1 {
42640 0 => {
42641 let e = {
42642 let l2 = *ptr0.add(4).cast::<i32>();
42643 IncomingBody::from_handle(l2 as u32)
42644 };
42645 Ok(e)
42646 }
42647 1 => {
42648 let e = ();
42649 Err(e)
42650 }
42651 _ => _rt::invalid_enum_discriminant(),
42652 }
42653 }
42654 }
42655 }
42656 impl OutgoingRequest {
42657 #[allow(unused_unsafe, clippy::all)]
42658 /// Construct a new `outgoing-request` with a default `method` of `GET`, and
42659 /// `none` values for `path-with-query`, `scheme`, and `authority`.
42660 ///
42661 /// * `headers` is the HTTP Headers for the Request.
42662 ///
42663 /// It is possible to construct, or manipulate with the accessor functions
42664 /// below, an `outgoing-request` with an invalid combination of `scheme`
42665 /// and `authority`, or `headers` which are not permitted to be sent.
42666 /// It is the obligation of the `outgoing-handler.handle` implementation
42667 /// to reject invalid constructions of `outgoing-request`.
42668 pub fn new(headers: Headers) -> Self {
42669 unsafe {
42670 #[cfg(target_arch = "wasm32")]
42671 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42672 extern "C" {
42673 #[link_name = "[constructor]outgoing-request"]
42674 fn wit_import(_: i32) -> i32;
42675 }
42676 #[cfg(not(target_arch = "wasm32"))]
42677 fn wit_import(_: i32) -> i32 {
42678 unreachable!()
42679 }
42680 let ret = wit_import((&headers).take_handle() as i32);
42681 OutgoingRequest::from_handle(ret as u32)
42682 }
42683 }
42684 }
42685 impl OutgoingRequest {
42686 #[allow(unused_unsafe, clippy::all)]
42687 /// Returns the resource corresponding to the outgoing Body for this
42688 /// Request.
42689 ///
42690 /// Returns success on the first call: the `outgoing-body` resource for
42691 /// this `outgoing-request` can be retrieved at most once. Subsequent
42692 /// calls will return error.
42693 pub fn body(&self) -> Result<OutgoingBody, ()> {
42694 unsafe {
42695 #[repr(align(4))]
42696 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
42697 let mut ret_area = RetArea(
42698 [::core::mem::MaybeUninit::uninit(); 8],
42699 );
42700 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
42701 #[cfg(target_arch = "wasm32")]
42702 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42703 extern "C" {
42704 #[link_name = "[method]outgoing-request.body"]
42705 fn wit_import(_: i32, _: *mut u8);
42706 }
42707 #[cfg(not(target_arch = "wasm32"))]
42708 fn wit_import(_: i32, _: *mut u8) {
42709 unreachable!()
42710 }
42711 wit_import((self).handle() as i32, ptr0);
42712 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
42713 match l1 {
42714 0 => {
42715 let e = {
42716 let l2 = *ptr0.add(4).cast::<i32>();
42717 OutgoingBody::from_handle(l2 as u32)
42718 };
42719 Ok(e)
42720 }
42721 1 => {
42722 let e = ();
42723 Err(e)
42724 }
42725 _ => _rt::invalid_enum_discriminant(),
42726 }
42727 }
42728 }
42729 }
42730 impl OutgoingRequest {
42731 #[allow(unused_unsafe, clippy::all)]
42732 /// Get the Method for the Request.
42733 pub fn method(&self) -> Method {
42734 unsafe {
42735 #[repr(align(4))]
42736 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
42737 let mut ret_area = RetArea(
42738 [::core::mem::MaybeUninit::uninit(); 12],
42739 );
42740 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
42741 #[cfg(target_arch = "wasm32")]
42742 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42743 extern "C" {
42744 #[link_name = "[method]outgoing-request.method"]
42745 fn wit_import(_: i32, _: *mut u8);
42746 }
42747 #[cfg(not(target_arch = "wasm32"))]
42748 fn wit_import(_: i32, _: *mut u8) {
42749 unreachable!()
42750 }
42751 wit_import((self).handle() as i32, ptr0);
42752 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
42753 let v5 = match l1 {
42754 0 => Method::Get,
42755 1 => Method::Head,
42756 2 => Method::Post,
42757 3 => Method::Put,
42758 4 => Method::Delete,
42759 5 => Method::Connect,
42760 6 => Method::Options,
42761 7 => Method::Trace,
42762 8 => Method::Patch,
42763 n => {
42764 debug_assert_eq!(n, 9, "invalid enum discriminant");
42765 let e5 = {
42766 let l2 = *ptr0.add(4).cast::<*mut u8>();
42767 let l3 = *ptr0.add(8).cast::<usize>();
42768 let len4 = l3;
42769 let bytes4 = _rt::Vec::from_raw_parts(
42770 l2.cast(),
42771 len4,
42772 len4,
42773 );
42774 _rt::string_lift(bytes4)
42775 };
42776 Method::Other(e5)
42777 }
42778 };
42779 v5
42780 }
42781 }
42782 }
42783 impl OutgoingRequest {
42784 #[allow(unused_unsafe, clippy::all)]
42785 /// Set the Method for the Request. Fails if the string present in a
42786 /// `method.other` argument is not a syntactically valid method.
42787 pub fn set_method(&self, method: &Method) -> Result<(), ()> {
42788 unsafe {
42789 let (result1_0, result1_1, result1_2) = match method {
42790 Method::Get => (0i32, ::core::ptr::null_mut(), 0usize),
42791 Method::Head => (1i32, ::core::ptr::null_mut(), 0usize),
42792 Method::Post => (2i32, ::core::ptr::null_mut(), 0usize),
42793 Method::Put => (3i32, ::core::ptr::null_mut(), 0usize),
42794 Method::Delete => (4i32, ::core::ptr::null_mut(), 0usize),
42795 Method::Connect => (5i32, ::core::ptr::null_mut(), 0usize),
42796 Method::Options => (6i32, ::core::ptr::null_mut(), 0usize),
42797 Method::Trace => (7i32, ::core::ptr::null_mut(), 0usize),
42798 Method::Patch => (8i32, ::core::ptr::null_mut(), 0usize),
42799 Method::Other(e) => {
42800 let vec0 = e;
42801 let ptr0 = vec0.as_ptr().cast::<u8>();
42802 let len0 = vec0.len();
42803 (9i32, ptr0.cast_mut(), len0)
42804 }
42805 };
42806 #[cfg(target_arch = "wasm32")]
42807 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42808 extern "C" {
42809 #[link_name = "[method]outgoing-request.set-method"]
42810 fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32;
42811 }
42812 #[cfg(not(target_arch = "wasm32"))]
42813 fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 {
42814 unreachable!()
42815 }
42816 let ret = wit_import(
42817 (self).handle() as i32,
42818 result1_0,
42819 result1_1,
42820 result1_2,
42821 );
42822 match ret {
42823 0 => {
42824 let e = ();
42825 Ok(e)
42826 }
42827 1 => {
42828 let e = ();
42829 Err(e)
42830 }
42831 _ => _rt::invalid_enum_discriminant(),
42832 }
42833 }
42834 }
42835 }
42836 impl OutgoingRequest {
42837 #[allow(unused_unsafe, clippy::all)]
42838 /// Get the combination of the HTTP Path and Query for the Request.
42839 /// When `none`, this represents an empty Path and empty Query.
42840 pub fn path_with_query(&self) -> Option<_rt::String> {
42841 unsafe {
42842 #[repr(align(4))]
42843 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
42844 let mut ret_area = RetArea(
42845 [::core::mem::MaybeUninit::uninit(); 12],
42846 );
42847 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
42848 #[cfg(target_arch = "wasm32")]
42849 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42850 extern "C" {
42851 #[link_name = "[method]outgoing-request.path-with-query"]
42852 fn wit_import(_: i32, _: *mut u8);
42853 }
42854 #[cfg(not(target_arch = "wasm32"))]
42855 fn wit_import(_: i32, _: *mut u8) {
42856 unreachable!()
42857 }
42858 wit_import((self).handle() as i32, ptr0);
42859 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
42860 match l1 {
42861 0 => None,
42862 1 => {
42863 let e = {
42864 let l2 = *ptr0.add(4).cast::<*mut u8>();
42865 let l3 = *ptr0.add(8).cast::<usize>();
42866 let len4 = l3;
42867 let bytes4 = _rt::Vec::from_raw_parts(
42868 l2.cast(),
42869 len4,
42870 len4,
42871 );
42872 _rt::string_lift(bytes4)
42873 };
42874 Some(e)
42875 }
42876 _ => _rt::invalid_enum_discriminant(),
42877 }
42878 }
42879 }
42880 }
42881 impl OutgoingRequest {
42882 #[allow(unused_unsafe, clippy::all)]
42883 /// Set the combination of the HTTP Path and Query for the Request.
42884 /// When `none`, this represents an empty Path and empty Query. Fails is the
42885 /// string given is not a syntactically valid path and query uri component.
42886 pub fn set_path_with_query(
42887 &self,
42888 path_with_query: Option<&str>,
42889 ) -> Result<(), ()> {
42890 unsafe {
42891 let (result1_0, result1_1, result1_2) = match path_with_query {
42892 Some(e) => {
42893 let vec0 = e;
42894 let ptr0 = vec0.as_ptr().cast::<u8>();
42895 let len0 = vec0.len();
42896 (1i32, ptr0.cast_mut(), len0)
42897 }
42898 None => (0i32, ::core::ptr::null_mut(), 0usize),
42899 };
42900 #[cfg(target_arch = "wasm32")]
42901 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42902 extern "C" {
42903 #[link_name = "[method]outgoing-request.set-path-with-query"]
42904 fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32;
42905 }
42906 #[cfg(not(target_arch = "wasm32"))]
42907 fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 {
42908 unreachable!()
42909 }
42910 let ret = wit_import(
42911 (self).handle() as i32,
42912 result1_0,
42913 result1_1,
42914 result1_2,
42915 );
42916 match ret {
42917 0 => {
42918 let e = ();
42919 Ok(e)
42920 }
42921 1 => {
42922 let e = ();
42923 Err(e)
42924 }
42925 _ => _rt::invalid_enum_discriminant(),
42926 }
42927 }
42928 }
42929 }
42930 impl OutgoingRequest {
42931 #[allow(unused_unsafe, clippy::all)]
42932 /// Get the HTTP Related Scheme for the Request. When `none`, the
42933 /// implementation may choose an appropriate default scheme.
42934 pub fn scheme(&self) -> Option<Scheme> {
42935 unsafe {
42936 #[repr(align(4))]
42937 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
42938 let mut ret_area = RetArea(
42939 [::core::mem::MaybeUninit::uninit(); 16],
42940 );
42941 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
42942 #[cfg(target_arch = "wasm32")]
42943 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
42944 extern "C" {
42945 #[link_name = "[method]outgoing-request.scheme"]
42946 fn wit_import(_: i32, _: *mut u8);
42947 }
42948 #[cfg(not(target_arch = "wasm32"))]
42949 fn wit_import(_: i32, _: *mut u8) {
42950 unreachable!()
42951 }
42952 wit_import((self).handle() as i32, ptr0);
42953 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
42954 match l1 {
42955 0 => None,
42956 1 => {
42957 let e = {
42958 let l2 = i32::from(*ptr0.add(4).cast::<u8>());
42959 let v6 = match l2 {
42960 0 => Scheme::Http,
42961 1 => Scheme::Https,
42962 n => {
42963 debug_assert_eq!(n, 2, "invalid enum discriminant");
42964 let e6 = {
42965 let l3 = *ptr0.add(8).cast::<*mut u8>();
42966 let l4 = *ptr0.add(12).cast::<usize>();
42967 let len5 = l4;
42968 let bytes5 = _rt::Vec::from_raw_parts(
42969 l3.cast(),
42970 len5,
42971 len5,
42972 );
42973 _rt::string_lift(bytes5)
42974 };
42975 Scheme::Other(e6)
42976 }
42977 };
42978 v6
42979 };
42980 Some(e)
42981 }
42982 _ => _rt::invalid_enum_discriminant(),
42983 }
42984 }
42985 }
42986 }
42987 impl OutgoingRequest {
42988 #[allow(unused_unsafe, clippy::all)]
42989 /// Set the HTTP Related Scheme for the Request. When `none`, the
42990 /// implementation may choose an appropriate default scheme. Fails if the
42991 /// string given is not a syntactically valid uri scheme.
42992 pub fn set_scheme(&self, scheme: Option<&Scheme>) -> Result<(), ()> {
42993 unsafe {
42994 let (result2_0, result2_1, result2_2, result2_3) = match scheme {
42995 Some(e) => {
42996 let (result1_0, result1_1, result1_2) = match e {
42997 Scheme::Http => (0i32, ::core::ptr::null_mut(), 0usize),
42998 Scheme::Https => (1i32, ::core::ptr::null_mut(), 0usize),
42999 Scheme::Other(e) => {
43000 let vec0 = e;
43001 let ptr0 = vec0.as_ptr().cast::<u8>();
43002 let len0 = vec0.len();
43003 (2i32, ptr0.cast_mut(), len0)
43004 }
43005 };
43006 (1i32, result1_0, result1_1, result1_2)
43007 }
43008 None => (0i32, 0i32, ::core::ptr::null_mut(), 0usize),
43009 };
43010 #[cfg(target_arch = "wasm32")]
43011 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
43012 extern "C" {
43013 #[link_name = "[method]outgoing-request.set-scheme"]
43014 fn wit_import(
43015 _: i32,
43016 _: i32,
43017 _: i32,
43018 _: *mut u8,
43019 _: usize,
43020 ) -> i32;
43021 }
43022 #[cfg(not(target_arch = "wasm32"))]
43023 fn wit_import(
43024 _: i32,
43025 _: i32,
43026 _: i32,
43027 _: *mut u8,
43028 _: usize,
43029 ) -> i32 {
43030 unreachable!()
43031 }
43032 let ret = wit_import(
43033 (self).handle() as i32,
43034 result2_0,
43035 result2_1,
43036 result2_2,
43037 result2_3,
43038 );
43039 match ret {
43040 0 => {
43041 let e = ();
43042 Ok(e)
43043 }
43044 1 => {
43045 let e = ();
43046 Err(e)
43047 }
43048 _ => _rt::invalid_enum_discriminant(),
43049 }
43050 }
43051 }
43052 }
43053 impl OutgoingRequest {
43054 #[allow(unused_unsafe, clippy::all)]
43055 /// Get the HTTP Authority for the Request. A value of `none` may be used
43056 /// with Related Schemes which do not require an Authority. The HTTP and
43057 /// HTTPS schemes always require an authority.
43058 pub fn authority(&self) -> Option<_rt::String> {
43059 unsafe {
43060 #[repr(align(4))]
43061 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
43062 let mut ret_area = RetArea(
43063 [::core::mem::MaybeUninit::uninit(); 12],
43064 );
43065 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
43066 #[cfg(target_arch = "wasm32")]
43067 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
43068 extern "C" {
43069 #[link_name = "[method]outgoing-request.authority"]
43070 fn wit_import(_: i32, _: *mut u8);
43071 }
43072 #[cfg(not(target_arch = "wasm32"))]
43073 fn wit_import(_: i32, _: *mut u8) {
43074 unreachable!()
43075 }
43076 wit_import((self).handle() as i32, ptr0);
43077 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
43078 match l1 {
43079 0 => None,
43080 1 => {
43081 let e = {
43082 let l2 = *ptr0.add(4).cast::<*mut u8>();
43083 let l3 = *ptr0.add(8).cast::<usize>();
43084 let len4 = l3;
43085 let bytes4 = _rt::Vec::from_raw_parts(
43086 l2.cast(),
43087 len4,
43088 len4,
43089 );
43090 _rt::string_lift(bytes4)
43091 };
43092 Some(e)
43093 }
43094 _ => _rt::invalid_enum_discriminant(),
43095 }
43096 }
43097 }
43098 }
43099 impl OutgoingRequest {
43100 #[allow(unused_unsafe, clippy::all)]
43101 /// Set the HTTP Authority for the Request. A value of `none` may be used
43102 /// with Related Schemes which do not require an Authority. The HTTP and
43103 /// HTTPS schemes always require an authority. Fails if the string given is
43104 /// not a syntactically valid uri authority.
43105 pub fn set_authority(&self, authority: Option<&str>) -> Result<(), ()> {
43106 unsafe {
43107 let (result1_0, result1_1, result1_2) = match authority {
43108 Some(e) => {
43109 let vec0 = e;
43110 let ptr0 = vec0.as_ptr().cast::<u8>();
43111 let len0 = vec0.len();
43112 (1i32, ptr0.cast_mut(), len0)
43113 }
43114 None => (0i32, ::core::ptr::null_mut(), 0usize),
43115 };
43116 #[cfg(target_arch = "wasm32")]
43117 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
43118 extern "C" {
43119 #[link_name = "[method]outgoing-request.set-authority"]
43120 fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32;
43121 }
43122 #[cfg(not(target_arch = "wasm32"))]
43123 fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 {
43124 unreachable!()
43125 }
43126 let ret = wit_import(
43127 (self).handle() as i32,
43128 result1_0,
43129 result1_1,
43130 result1_2,
43131 );
43132 match ret {
43133 0 => {
43134 let e = ();
43135 Ok(e)
43136 }
43137 1 => {
43138 let e = ();
43139 Err(e)
43140 }
43141 _ => _rt::invalid_enum_discriminant(),
43142 }
43143 }
43144 }
43145 }
43146 impl OutgoingRequest {
43147 #[allow(unused_unsafe, clippy::all)]
43148 /// Get the headers associated with the Request.
43149 ///
43150 /// The returned `headers` resource is immutable: `set`, `append`, and
43151 /// `delete` operations will fail with `header-error.immutable`.
43152 ///
43153 /// This headers resource is a child: it must be dropped before the parent
43154 /// `outgoing-request` is dropped, or its ownership is transfered to
43155 /// another component by e.g. `outgoing-handler.handle`.
43156 pub fn headers(&self) -> Headers {
43157 unsafe {
43158 #[cfg(target_arch = "wasm32")]
43159 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
43160 extern "C" {
43161 #[link_name = "[method]outgoing-request.headers"]
43162 fn wit_import(_: i32) -> i32;
43163 }
43164 #[cfg(not(target_arch = "wasm32"))]
43165 fn wit_import(_: i32) -> i32 {
43166 unreachable!()
43167 }
43168 let ret = wit_import((self).handle() as i32);
43169 Fields::from_handle(ret as u32)
43170 }
43171 }
43172 }
43173 impl RequestOptions {
43174 #[allow(unused_unsafe, clippy::all)]
43175 /// Construct a default `request-options` value.
43176 pub fn new() -> Self {
43177 unsafe {
43178 #[cfg(target_arch = "wasm32")]
43179 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
43180 extern "C" {
43181 #[link_name = "[constructor]request-options"]
43182 fn wit_import() -> i32;
43183 }
43184 #[cfg(not(target_arch = "wasm32"))]
43185 fn wit_import() -> i32 {
43186 unreachable!()
43187 }
43188 let ret = wit_import();
43189 RequestOptions::from_handle(ret as u32)
43190 }
43191 }
43192 }
43193 impl RequestOptions {
43194 #[allow(unused_unsafe, clippy::all)]
43195 /// The timeout for the initial connect to the HTTP Server.
43196 pub fn connect_timeout(&self) -> Option<Duration> {
43197 unsafe {
43198 #[repr(align(8))]
43199 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
43200 let mut ret_area = RetArea(
43201 [::core::mem::MaybeUninit::uninit(); 16],
43202 );
43203 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
43204 #[cfg(target_arch = "wasm32")]
43205 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
43206 extern "C" {
43207 #[link_name = "[method]request-options.connect-timeout"]
43208 fn wit_import(_: i32, _: *mut u8);
43209 }
43210 #[cfg(not(target_arch = "wasm32"))]
43211 fn wit_import(_: i32, _: *mut u8) {
43212 unreachable!()
43213 }
43214 wit_import((self).handle() as i32, ptr0);
43215 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
43216 match l1 {
43217 0 => None,
43218 1 => {
43219 let e = {
43220 let l2 = *ptr0.add(8).cast::<i64>();
43221 l2 as u64
43222 };
43223 Some(e)
43224 }
43225 _ => _rt::invalid_enum_discriminant(),
43226 }
43227 }
43228 }
43229 }
43230 impl RequestOptions {
43231 #[allow(unused_unsafe, clippy::all)]
43232 /// Set the timeout for the initial connect to the HTTP Server. An error
43233 /// return value indicates that this timeout is not supported.
43234 pub fn set_connect_timeout(
43235 &self,
43236 duration: Option<Duration>,
43237 ) -> Result<(), ()> {
43238 unsafe {
43239 let (result0_0, result0_1) = match duration {
43240 Some(e) => (1i32, _rt::as_i64(e)),
43241 None => (0i32, 0i64),
43242 };
43243 #[cfg(target_arch = "wasm32")]
43244 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
43245 extern "C" {
43246 #[link_name = "[method]request-options.set-connect-timeout"]
43247 fn wit_import(_: i32, _: i32, _: i64) -> i32;
43248 }
43249 #[cfg(not(target_arch = "wasm32"))]
43250 fn wit_import(_: i32, _: i32, _: i64) -> i32 {
43251 unreachable!()
43252 }
43253 let ret = wit_import(
43254 (self).handle() as i32,
43255 result0_0,
43256 result0_1,
43257 );
43258 match ret {
43259 0 => {
43260 let e = ();
43261 Ok(e)
43262 }
43263 1 => {
43264 let e = ();
43265 Err(e)
43266 }
43267 _ => _rt::invalid_enum_discriminant(),
43268 }
43269 }
43270 }
43271 }
43272 impl RequestOptions {
43273 #[allow(unused_unsafe, clippy::all)]
43274 /// The timeout for receiving the first byte of the Response body.
43275 pub fn first_byte_timeout(&self) -> Option<Duration> {
43276 unsafe {
43277 #[repr(align(8))]
43278 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
43279 let mut ret_area = RetArea(
43280 [::core::mem::MaybeUninit::uninit(); 16],
43281 );
43282 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
43283 #[cfg(target_arch = "wasm32")]
43284 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
43285 extern "C" {
43286 #[link_name = "[method]request-options.first-byte-timeout"]
43287 fn wit_import(_: i32, _: *mut u8);
43288 }
43289 #[cfg(not(target_arch = "wasm32"))]
43290 fn wit_import(_: i32, _: *mut u8) {
43291 unreachable!()
43292 }
43293 wit_import((self).handle() as i32, ptr0);
43294 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
43295 match l1 {
43296 0 => None,
43297 1 => {
43298 let e = {
43299 let l2 = *ptr0.add(8).cast::<i64>();
43300 l2 as u64
43301 };
43302 Some(e)
43303 }
43304 _ => _rt::invalid_enum_discriminant(),
43305 }
43306 }
43307 }
43308 }
43309 impl RequestOptions {
43310 #[allow(unused_unsafe, clippy::all)]
43311 /// Set the timeout for receiving the first byte of the Response body. An
43312 /// error return value indicates that this timeout is not supported.
43313 pub fn set_first_byte_timeout(
43314 &self,
43315 duration: Option<Duration>,
43316 ) -> Result<(), ()> {
43317 unsafe {
43318 let (result0_0, result0_1) = match duration {
43319 Some(e) => (1i32, _rt::as_i64(e)),
43320 None => (0i32, 0i64),
43321 };
43322 #[cfg(target_arch = "wasm32")]
43323 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
43324 extern "C" {
43325 #[link_name = "[method]request-options.set-first-byte-timeout"]
43326 fn wit_import(_: i32, _: i32, _: i64) -> i32;
43327 }
43328 #[cfg(not(target_arch = "wasm32"))]
43329 fn wit_import(_: i32, _: i32, _: i64) -> i32 {
43330 unreachable!()
43331 }
43332 let ret = wit_import(
43333 (self).handle() as i32,
43334 result0_0,
43335 result0_1,
43336 );
43337 match ret {
43338 0 => {
43339 let e = ();
43340 Ok(e)
43341 }
43342 1 => {
43343 let e = ();
43344 Err(e)
43345 }
43346 _ => _rt::invalid_enum_discriminant(),
43347 }
43348 }
43349 }
43350 }
43351 impl RequestOptions {
43352 #[allow(unused_unsafe, clippy::all)]
43353 /// The timeout for receiving subsequent chunks of bytes in the Response
43354 /// body stream.
43355 pub fn between_bytes_timeout(&self) -> Option<Duration> {
43356 unsafe {
43357 #[repr(align(8))]
43358 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
43359 let mut ret_area = RetArea(
43360 [::core::mem::MaybeUninit::uninit(); 16],
43361 );
43362 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
43363 #[cfg(target_arch = "wasm32")]
43364 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
43365 extern "C" {
43366 #[link_name = "[method]request-options.between-bytes-timeout"]
43367 fn wit_import(_: i32, _: *mut u8);
43368 }
43369 #[cfg(not(target_arch = "wasm32"))]
43370 fn wit_import(_: i32, _: *mut u8) {
43371 unreachable!()
43372 }
43373 wit_import((self).handle() as i32, ptr0);
43374 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
43375 match l1 {
43376 0 => None,
43377 1 => {
43378 let e = {
43379 let l2 = *ptr0.add(8).cast::<i64>();
43380 l2 as u64
43381 };
43382 Some(e)
43383 }
43384 _ => _rt::invalid_enum_discriminant(),
43385 }
43386 }
43387 }
43388 }
43389 impl RequestOptions {
43390 #[allow(unused_unsafe, clippy::all)]
43391 /// Set the timeout for receiving subsequent chunks of bytes in the Response
43392 /// body stream. An error return value indicates that this timeout is not
43393 /// supported.
43394 pub fn set_between_bytes_timeout(
43395 &self,
43396 duration: Option<Duration>,
43397 ) -> Result<(), ()> {
43398 unsafe {
43399 let (result0_0, result0_1) = match duration {
43400 Some(e) => (1i32, _rt::as_i64(e)),
43401 None => (0i32, 0i64),
43402 };
43403 #[cfg(target_arch = "wasm32")]
43404 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
43405 extern "C" {
43406 #[link_name = "[method]request-options.set-between-bytes-timeout"]
43407 fn wit_import(_: i32, _: i32, _: i64) -> i32;
43408 }
43409 #[cfg(not(target_arch = "wasm32"))]
43410 fn wit_import(_: i32, _: i32, _: i64) -> i32 {
43411 unreachable!()
43412 }
43413 let ret = wit_import(
43414 (self).handle() as i32,
43415 result0_0,
43416 result0_1,
43417 );
43418 match ret {
43419 0 => {
43420 let e = ();
43421 Ok(e)
43422 }
43423 1 => {
43424 let e = ();
43425 Err(e)
43426 }
43427 _ => _rt::invalid_enum_discriminant(),
43428 }
43429 }
43430 }
43431 }
43432 impl ResponseOutparam {
43433 #[allow(unused_unsafe, clippy::all)]
43434 /// Set the value of the `response-outparam` to either send a response,
43435 /// or indicate an error.
43436 ///
43437 /// This method consumes the `response-outparam` to ensure that it is
43438 /// called at most once. If it is never called, the implementation
43439 /// will respond with an error.
43440 ///
43441 /// The user may provide an `error` to `response` to allow the
43442 /// implementation determine how to respond with an HTTP error response.
43443 pub fn set(
43444 param: ResponseOutparam,
43445 response: Result<OutgoingResponse, ErrorCode>,
43446 ) {
43447 unsafe {
43448 let (
43449 result38_0,
43450 result38_1,
43451 result38_2,
43452 result38_3,
43453 result38_4,
43454 result38_5,
43455 result38_6,
43456 result38_7,
43457 ) = match &response {
43458 Ok(e) => {
43459 (
43460 0i32,
43461 (e).take_handle() as i32,
43462 0i32,
43463 ::core::mem::MaybeUninit::<u64>::zeroed(),
43464 ::core::ptr::null_mut(),
43465 ::core::ptr::null_mut(),
43466 0usize,
43467 0i32,
43468 )
43469 }
43470 Err(e) => {
43471 let (
43472 result37_0,
43473 result37_1,
43474 result37_2,
43475 result37_3,
43476 result37_4,
43477 result37_5,
43478 result37_6,
43479 ) = match e {
43480 ErrorCode::DnsTimeout => {
43481 (
43482 0i32,
43483 0i32,
43484 ::core::mem::MaybeUninit::<u64>::zeroed(),
43485 ::core::ptr::null_mut(),
43486 ::core::ptr::null_mut(),
43487 0usize,
43488 0i32,
43489 )
43490 }
43491 ErrorCode::DnsError(e) => {
43492 let DnsErrorPayload {
43493 rcode: rcode0,
43494 info_code: info_code0,
43495 } = e;
43496 let (result2_0, result2_1, result2_2) = match rcode0 {
43497 Some(e) => {
43498 let vec1 = e;
43499 let ptr1 = vec1.as_ptr().cast::<u8>();
43500 let len1 = vec1.len();
43501 (1i32, ptr1.cast_mut(), len1)
43502 }
43503 None => (0i32, ::core::ptr::null_mut(), 0usize),
43504 };
43505 let (result3_0, result3_1) = match info_code0 {
43506 Some(e) => (1i32, _rt::as_i32(e)),
43507 None => (0i32, 0i32),
43508 };
43509 (
43510 1i32,
43511 result2_0,
43512 {
43513 let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
43514 t.as_mut_ptr().cast::<*mut u8>().write(result2_1);
43515 t
43516 },
43517 result2_2 as *mut u8,
43518 result3_0 as *mut u8,
43519 result3_1 as usize,
43520 0i32,
43521 )
43522 }
43523 ErrorCode::DestinationNotFound => {
43524 (
43525 2i32,
43526 0i32,
43527 ::core::mem::MaybeUninit::<u64>::zeroed(),
43528 ::core::ptr::null_mut(),
43529 ::core::ptr::null_mut(),
43530 0usize,
43531 0i32,
43532 )
43533 }
43534 ErrorCode::DestinationUnavailable => {
43535 (
43536 3i32,
43537 0i32,
43538 ::core::mem::MaybeUninit::<u64>::zeroed(),
43539 ::core::ptr::null_mut(),
43540 ::core::ptr::null_mut(),
43541 0usize,
43542 0i32,
43543 )
43544 }
43545 ErrorCode::DestinationIpProhibited => {
43546 (
43547 4i32,
43548 0i32,
43549 ::core::mem::MaybeUninit::<u64>::zeroed(),
43550 ::core::ptr::null_mut(),
43551 ::core::ptr::null_mut(),
43552 0usize,
43553 0i32,
43554 )
43555 }
43556 ErrorCode::DestinationIpUnroutable => {
43557 (
43558 5i32,
43559 0i32,
43560 ::core::mem::MaybeUninit::<u64>::zeroed(),
43561 ::core::ptr::null_mut(),
43562 ::core::ptr::null_mut(),
43563 0usize,
43564 0i32,
43565 )
43566 }
43567 ErrorCode::ConnectionRefused => {
43568 (
43569 6i32,
43570 0i32,
43571 ::core::mem::MaybeUninit::<u64>::zeroed(),
43572 ::core::ptr::null_mut(),
43573 ::core::ptr::null_mut(),
43574 0usize,
43575 0i32,
43576 )
43577 }
43578 ErrorCode::ConnectionTerminated => {
43579 (
43580 7i32,
43581 0i32,
43582 ::core::mem::MaybeUninit::<u64>::zeroed(),
43583 ::core::ptr::null_mut(),
43584 ::core::ptr::null_mut(),
43585 0usize,
43586 0i32,
43587 )
43588 }
43589 ErrorCode::ConnectionTimeout => {
43590 (
43591 8i32,
43592 0i32,
43593 ::core::mem::MaybeUninit::<u64>::zeroed(),
43594 ::core::ptr::null_mut(),
43595 ::core::ptr::null_mut(),
43596 0usize,
43597 0i32,
43598 )
43599 }
43600 ErrorCode::ConnectionReadTimeout => {
43601 (
43602 9i32,
43603 0i32,
43604 ::core::mem::MaybeUninit::<u64>::zeroed(),
43605 ::core::ptr::null_mut(),
43606 ::core::ptr::null_mut(),
43607 0usize,
43608 0i32,
43609 )
43610 }
43611 ErrorCode::ConnectionWriteTimeout => {
43612 (
43613 10i32,
43614 0i32,
43615 ::core::mem::MaybeUninit::<u64>::zeroed(),
43616 ::core::ptr::null_mut(),
43617 ::core::ptr::null_mut(),
43618 0usize,
43619 0i32,
43620 )
43621 }
43622 ErrorCode::ConnectionLimitReached => {
43623 (
43624 11i32,
43625 0i32,
43626 ::core::mem::MaybeUninit::<u64>::zeroed(),
43627 ::core::ptr::null_mut(),
43628 ::core::ptr::null_mut(),
43629 0usize,
43630 0i32,
43631 )
43632 }
43633 ErrorCode::TlsProtocolError => {
43634 (
43635 12i32,
43636 0i32,
43637 ::core::mem::MaybeUninit::<u64>::zeroed(),
43638 ::core::ptr::null_mut(),
43639 ::core::ptr::null_mut(),
43640 0usize,
43641 0i32,
43642 )
43643 }
43644 ErrorCode::TlsCertificateError => {
43645 (
43646 13i32,
43647 0i32,
43648 ::core::mem::MaybeUninit::<u64>::zeroed(),
43649 ::core::ptr::null_mut(),
43650 ::core::ptr::null_mut(),
43651 0usize,
43652 0i32,
43653 )
43654 }
43655 ErrorCode::TlsAlertReceived(e) => {
43656 let TlsAlertReceivedPayload {
43657 alert_id: alert_id4,
43658 alert_message: alert_message4,
43659 } = e;
43660 let (result5_0, result5_1) = match alert_id4 {
43661 Some(e) => (1i32, _rt::as_i32(e)),
43662 None => (0i32, 0i32),
43663 };
43664 let (result7_0, result7_1, result7_2) = match alert_message4 {
43665 Some(e) => {
43666 let vec6 = e;
43667 let ptr6 = vec6.as_ptr().cast::<u8>();
43668 let len6 = vec6.len();
43669 (1i32, ptr6.cast_mut(), len6)
43670 }
43671 None => (0i32, ::core::ptr::null_mut(), 0usize),
43672 };
43673 (
43674 14i32,
43675 result5_0,
43676 ::core::mem::MaybeUninit::new(i64::from(result5_1) as u64),
43677 result7_0 as *mut u8,
43678 result7_1,
43679 result7_2,
43680 0i32,
43681 )
43682 }
43683 ErrorCode::HttpRequestDenied => {
43684 (
43685 15i32,
43686 0i32,
43687 ::core::mem::MaybeUninit::<u64>::zeroed(),
43688 ::core::ptr::null_mut(),
43689 ::core::ptr::null_mut(),
43690 0usize,
43691 0i32,
43692 )
43693 }
43694 ErrorCode::HttpRequestLengthRequired => {
43695 (
43696 16i32,
43697 0i32,
43698 ::core::mem::MaybeUninit::<u64>::zeroed(),
43699 ::core::ptr::null_mut(),
43700 ::core::ptr::null_mut(),
43701 0usize,
43702 0i32,
43703 )
43704 }
43705 ErrorCode::HttpRequestBodySize(e) => {
43706 let (result8_0, result8_1) = match e {
43707 Some(e) => (1i32, _rt::as_i64(e)),
43708 None => (0i32, 0i64),
43709 };
43710 (
43711 17i32,
43712 result8_0,
43713 ::core::mem::MaybeUninit::new(result8_1 as u64),
43714 ::core::ptr::null_mut(),
43715 ::core::ptr::null_mut(),
43716 0usize,
43717 0i32,
43718 )
43719 }
43720 ErrorCode::HttpRequestMethodInvalid => {
43721 (
43722 18i32,
43723 0i32,
43724 ::core::mem::MaybeUninit::<u64>::zeroed(),
43725 ::core::ptr::null_mut(),
43726 ::core::ptr::null_mut(),
43727 0usize,
43728 0i32,
43729 )
43730 }
43731 ErrorCode::HttpRequestUriInvalid => {
43732 (
43733 19i32,
43734 0i32,
43735 ::core::mem::MaybeUninit::<u64>::zeroed(),
43736 ::core::ptr::null_mut(),
43737 ::core::ptr::null_mut(),
43738 0usize,
43739 0i32,
43740 )
43741 }
43742 ErrorCode::HttpRequestUriTooLong => {
43743 (
43744 20i32,
43745 0i32,
43746 ::core::mem::MaybeUninit::<u64>::zeroed(),
43747 ::core::ptr::null_mut(),
43748 ::core::ptr::null_mut(),
43749 0usize,
43750 0i32,
43751 )
43752 }
43753 ErrorCode::HttpRequestHeaderSectionSize(e) => {
43754 let (result9_0, result9_1) = match e {
43755 Some(e) => (1i32, _rt::as_i32(e)),
43756 None => (0i32, 0i32),
43757 };
43758 (
43759 21i32,
43760 result9_0,
43761 ::core::mem::MaybeUninit::new(i64::from(result9_1) as u64),
43762 ::core::ptr::null_mut(),
43763 ::core::ptr::null_mut(),
43764 0usize,
43765 0i32,
43766 )
43767 }
43768 ErrorCode::HttpRequestHeaderSize(e) => {
43769 let (
43770 result14_0,
43771 result14_1,
43772 result14_2,
43773 result14_3,
43774 result14_4,
43775 result14_5,
43776 ) = match e {
43777 Some(e) => {
43778 let FieldSizePayload {
43779 field_name: field_name10,
43780 field_size: field_size10,
43781 } = e;
43782 let (result12_0, result12_1, result12_2) = match field_name10 {
43783 Some(e) => {
43784 let vec11 = e;
43785 let ptr11 = vec11.as_ptr().cast::<u8>();
43786 let len11 = vec11.len();
43787 (1i32, ptr11.cast_mut(), len11)
43788 }
43789 None => (0i32, ::core::ptr::null_mut(), 0usize),
43790 };
43791 let (result13_0, result13_1) = match field_size10 {
43792 Some(e) => (1i32, _rt::as_i32(e)),
43793 None => (0i32, 0i32),
43794 };
43795 (
43796 1i32,
43797 result12_0,
43798 result12_1,
43799 result12_2,
43800 result13_0,
43801 result13_1,
43802 )
43803 }
43804 None => {
43805 (0i32, 0i32, ::core::ptr::null_mut(), 0usize, 0i32, 0i32)
43806 }
43807 };
43808 (
43809 22i32,
43810 result14_0,
43811 ::core::mem::MaybeUninit::new(i64::from(result14_1) as u64),
43812 result14_2,
43813 result14_3 as *mut u8,
43814 result14_4 as usize,
43815 result14_5,
43816 )
43817 }
43818 ErrorCode::HttpRequestTrailerSectionSize(e) => {
43819 let (result15_0, result15_1) = match e {
43820 Some(e) => (1i32, _rt::as_i32(e)),
43821 None => (0i32, 0i32),
43822 };
43823 (
43824 23i32,
43825 result15_0,
43826 ::core::mem::MaybeUninit::new(i64::from(result15_1) as u64),
43827 ::core::ptr::null_mut(),
43828 ::core::ptr::null_mut(),
43829 0usize,
43830 0i32,
43831 )
43832 }
43833 ErrorCode::HttpRequestTrailerSize(e) => {
43834 let FieldSizePayload {
43835 field_name: field_name16,
43836 field_size: field_size16,
43837 } = e;
43838 let (result18_0, result18_1, result18_2) = match field_name16 {
43839 Some(e) => {
43840 let vec17 = e;
43841 let ptr17 = vec17.as_ptr().cast::<u8>();
43842 let len17 = vec17.len();
43843 (1i32, ptr17.cast_mut(), len17)
43844 }
43845 None => (0i32, ::core::ptr::null_mut(), 0usize),
43846 };
43847 let (result19_0, result19_1) = match field_size16 {
43848 Some(e) => (1i32, _rt::as_i32(e)),
43849 None => (0i32, 0i32),
43850 };
43851 (
43852 24i32,
43853 result18_0,
43854 {
43855 let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
43856 t.as_mut_ptr().cast::<*mut u8>().write(result18_1);
43857 t
43858 },
43859 result18_2 as *mut u8,
43860 result19_0 as *mut u8,
43861 result19_1 as usize,
43862 0i32,
43863 )
43864 }
43865 ErrorCode::HttpResponseIncomplete => {
43866 (
43867 25i32,
43868 0i32,
43869 ::core::mem::MaybeUninit::<u64>::zeroed(),
43870 ::core::ptr::null_mut(),
43871 ::core::ptr::null_mut(),
43872 0usize,
43873 0i32,
43874 )
43875 }
43876 ErrorCode::HttpResponseHeaderSectionSize(e) => {
43877 let (result20_0, result20_1) = match e {
43878 Some(e) => (1i32, _rt::as_i32(e)),
43879 None => (0i32, 0i32),
43880 };
43881 (
43882 26i32,
43883 result20_0,
43884 ::core::mem::MaybeUninit::new(i64::from(result20_1) as u64),
43885 ::core::ptr::null_mut(),
43886 ::core::ptr::null_mut(),
43887 0usize,
43888 0i32,
43889 )
43890 }
43891 ErrorCode::HttpResponseHeaderSize(e) => {
43892 let FieldSizePayload {
43893 field_name: field_name21,
43894 field_size: field_size21,
43895 } = e;
43896 let (result23_0, result23_1, result23_2) = match field_name21 {
43897 Some(e) => {
43898 let vec22 = e;
43899 let ptr22 = vec22.as_ptr().cast::<u8>();
43900 let len22 = vec22.len();
43901 (1i32, ptr22.cast_mut(), len22)
43902 }
43903 None => (0i32, ::core::ptr::null_mut(), 0usize),
43904 };
43905 let (result24_0, result24_1) = match field_size21 {
43906 Some(e) => (1i32, _rt::as_i32(e)),
43907 None => (0i32, 0i32),
43908 };
43909 (
43910 27i32,
43911 result23_0,
43912 {
43913 let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
43914 t.as_mut_ptr().cast::<*mut u8>().write(result23_1);
43915 t
43916 },
43917 result23_2 as *mut u8,
43918 result24_0 as *mut u8,
43919 result24_1 as usize,
43920 0i32,
43921 )
43922 }
43923 ErrorCode::HttpResponseBodySize(e) => {
43924 let (result25_0, result25_1) = match e {
43925 Some(e) => (1i32, _rt::as_i64(e)),
43926 None => (0i32, 0i64),
43927 };
43928 (
43929 28i32,
43930 result25_0,
43931 ::core::mem::MaybeUninit::new(result25_1 as u64),
43932 ::core::ptr::null_mut(),
43933 ::core::ptr::null_mut(),
43934 0usize,
43935 0i32,
43936 )
43937 }
43938 ErrorCode::HttpResponseTrailerSectionSize(e) => {
43939 let (result26_0, result26_1) = match e {
43940 Some(e) => (1i32, _rt::as_i32(e)),
43941 None => (0i32, 0i32),
43942 };
43943 (
43944 29i32,
43945 result26_0,
43946 ::core::mem::MaybeUninit::new(i64::from(result26_1) as u64),
43947 ::core::ptr::null_mut(),
43948 ::core::ptr::null_mut(),
43949 0usize,
43950 0i32,
43951 )
43952 }
43953 ErrorCode::HttpResponseTrailerSize(e) => {
43954 let FieldSizePayload {
43955 field_name: field_name27,
43956 field_size: field_size27,
43957 } = e;
43958 let (result29_0, result29_1, result29_2) = match field_name27 {
43959 Some(e) => {
43960 let vec28 = e;
43961 let ptr28 = vec28.as_ptr().cast::<u8>();
43962 let len28 = vec28.len();
43963 (1i32, ptr28.cast_mut(), len28)
43964 }
43965 None => (0i32, ::core::ptr::null_mut(), 0usize),
43966 };
43967 let (result30_0, result30_1) = match field_size27 {
43968 Some(e) => (1i32, _rt::as_i32(e)),
43969 None => (0i32, 0i32),
43970 };
43971 (
43972 30i32,
43973 result29_0,
43974 {
43975 let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
43976 t.as_mut_ptr().cast::<*mut u8>().write(result29_1);
43977 t
43978 },
43979 result29_2 as *mut u8,
43980 result30_0 as *mut u8,
43981 result30_1 as usize,
43982 0i32,
43983 )
43984 }
43985 ErrorCode::HttpResponseTransferCoding(e) => {
43986 let (result32_0, result32_1, result32_2) = match e {
43987 Some(e) => {
43988 let vec31 = e;
43989 let ptr31 = vec31.as_ptr().cast::<u8>();
43990 let len31 = vec31.len();
43991 (1i32, ptr31.cast_mut(), len31)
43992 }
43993 None => (0i32, ::core::ptr::null_mut(), 0usize),
43994 };
43995 (
43996 31i32,
43997 result32_0,
43998 {
43999 let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
44000 t.as_mut_ptr().cast::<*mut u8>().write(result32_1);
44001 t
44002 },
44003 result32_2 as *mut u8,
44004 ::core::ptr::null_mut(),
44005 0usize,
44006 0i32,
44007 )
44008 }
44009 ErrorCode::HttpResponseContentCoding(e) => {
44010 let (result34_0, result34_1, result34_2) = match e {
44011 Some(e) => {
44012 let vec33 = e;
44013 let ptr33 = vec33.as_ptr().cast::<u8>();
44014 let len33 = vec33.len();
44015 (1i32, ptr33.cast_mut(), len33)
44016 }
44017 None => (0i32, ::core::ptr::null_mut(), 0usize),
44018 };
44019 (
44020 32i32,
44021 result34_0,
44022 {
44023 let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
44024 t.as_mut_ptr().cast::<*mut u8>().write(result34_1);
44025 t
44026 },
44027 result34_2 as *mut u8,
44028 ::core::ptr::null_mut(),
44029 0usize,
44030 0i32,
44031 )
44032 }
44033 ErrorCode::HttpResponseTimeout => {
44034 (
44035 33i32,
44036 0i32,
44037 ::core::mem::MaybeUninit::<u64>::zeroed(),
44038 ::core::ptr::null_mut(),
44039 ::core::ptr::null_mut(),
44040 0usize,
44041 0i32,
44042 )
44043 }
44044 ErrorCode::HttpUpgradeFailed => {
44045 (
44046 34i32,
44047 0i32,
44048 ::core::mem::MaybeUninit::<u64>::zeroed(),
44049 ::core::ptr::null_mut(),
44050 ::core::ptr::null_mut(),
44051 0usize,
44052 0i32,
44053 )
44054 }
44055 ErrorCode::HttpProtocolError => {
44056 (
44057 35i32,
44058 0i32,
44059 ::core::mem::MaybeUninit::<u64>::zeroed(),
44060 ::core::ptr::null_mut(),
44061 ::core::ptr::null_mut(),
44062 0usize,
44063 0i32,
44064 )
44065 }
44066 ErrorCode::LoopDetected => {
44067 (
44068 36i32,
44069 0i32,
44070 ::core::mem::MaybeUninit::<u64>::zeroed(),
44071 ::core::ptr::null_mut(),
44072 ::core::ptr::null_mut(),
44073 0usize,
44074 0i32,
44075 )
44076 }
44077 ErrorCode::ConfigurationError => {
44078 (
44079 37i32,
44080 0i32,
44081 ::core::mem::MaybeUninit::<u64>::zeroed(),
44082 ::core::ptr::null_mut(),
44083 ::core::ptr::null_mut(),
44084 0usize,
44085 0i32,
44086 )
44087 }
44088 ErrorCode::InternalError(e) => {
44089 let (result36_0, result36_1, result36_2) = match e {
44090 Some(e) => {
44091 let vec35 = e;
44092 let ptr35 = vec35.as_ptr().cast::<u8>();
44093 let len35 = vec35.len();
44094 (1i32, ptr35.cast_mut(), len35)
44095 }
44096 None => (0i32, ::core::ptr::null_mut(), 0usize),
44097 };
44098 (
44099 38i32,
44100 result36_0,
44101 {
44102 let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
44103 t.as_mut_ptr().cast::<*mut u8>().write(result36_1);
44104 t
44105 },
44106 result36_2 as *mut u8,
44107 ::core::ptr::null_mut(),
44108 0usize,
44109 0i32,
44110 )
44111 }
44112 };
44113 (
44114 1i32,
44115 result37_0,
44116 result37_1,
44117 result37_2,
44118 result37_3,
44119 result37_4,
44120 result37_5,
44121 result37_6,
44122 )
44123 }
44124 };
44125 #[cfg(target_arch = "wasm32")]
44126 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
44127 extern "C" {
44128 #[link_name = "[static]response-outparam.set"]
44129 fn wit_import(
44130 _: i32,
44131 _: i32,
44132 _: i32,
44133 _: i32,
44134 _: ::core::mem::MaybeUninit<u64>,
44135 _: *mut u8,
44136 _: *mut u8,
44137 _: usize,
44138 _: i32,
44139 );
44140 }
44141 #[cfg(not(target_arch = "wasm32"))]
44142 fn wit_import(
44143 _: i32,
44144 _: i32,
44145 _: i32,
44146 _: i32,
44147 _: ::core::mem::MaybeUninit<u64>,
44148 _: *mut u8,
44149 _: *mut u8,
44150 _: usize,
44151 _: i32,
44152 ) {
44153 unreachable!()
44154 }
44155 wit_import(
44156 (¶m).take_handle() as i32,
44157 result38_0,
44158 result38_1,
44159 result38_2,
44160 result38_3,
44161 result38_4,
44162 result38_5,
44163 result38_6,
44164 result38_7,
44165 );
44166 }
44167 }
44168 }
44169 impl IncomingResponse {
44170 #[allow(unused_unsafe, clippy::all)]
44171 /// Returns the status code from the incoming response.
44172 pub fn status(&self) -> StatusCode {
44173 unsafe {
44174 #[cfg(target_arch = "wasm32")]
44175 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
44176 extern "C" {
44177 #[link_name = "[method]incoming-response.status"]
44178 fn wit_import(_: i32) -> i32;
44179 }
44180 #[cfg(not(target_arch = "wasm32"))]
44181 fn wit_import(_: i32) -> i32 {
44182 unreachable!()
44183 }
44184 let ret = wit_import((self).handle() as i32);
44185 ret as u16
44186 }
44187 }
44188 }
44189 impl IncomingResponse {
44190 #[allow(unused_unsafe, clippy::all)]
44191 /// Returns the headers from the incoming response.
44192 ///
44193 /// The returned `headers` resource is immutable: `set`, `append`, and
44194 /// `delete` operations will fail with `header-error.immutable`.
44195 ///
44196 /// This headers resource is a child: it must be dropped before the parent
44197 /// `incoming-response` is dropped.
44198 pub fn headers(&self) -> Headers {
44199 unsafe {
44200 #[cfg(target_arch = "wasm32")]
44201 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
44202 extern "C" {
44203 #[link_name = "[method]incoming-response.headers"]
44204 fn wit_import(_: i32) -> i32;
44205 }
44206 #[cfg(not(target_arch = "wasm32"))]
44207 fn wit_import(_: i32) -> i32 {
44208 unreachable!()
44209 }
44210 let ret = wit_import((self).handle() as i32);
44211 Fields::from_handle(ret as u32)
44212 }
44213 }
44214 }
44215 impl IncomingResponse {
44216 #[allow(unused_unsafe, clippy::all)]
44217 /// Returns the incoming body. May be called at most once. Returns error
44218 /// if called additional times.
44219 pub fn consume(&self) -> Result<IncomingBody, ()> {
44220 unsafe {
44221 #[repr(align(4))]
44222 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
44223 let mut ret_area = RetArea(
44224 [::core::mem::MaybeUninit::uninit(); 8],
44225 );
44226 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
44227 #[cfg(target_arch = "wasm32")]
44228 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
44229 extern "C" {
44230 #[link_name = "[method]incoming-response.consume"]
44231 fn wit_import(_: i32, _: *mut u8);
44232 }
44233 #[cfg(not(target_arch = "wasm32"))]
44234 fn wit_import(_: i32, _: *mut u8) {
44235 unreachable!()
44236 }
44237 wit_import((self).handle() as i32, ptr0);
44238 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
44239 match l1 {
44240 0 => {
44241 let e = {
44242 let l2 = *ptr0.add(4).cast::<i32>();
44243 IncomingBody::from_handle(l2 as u32)
44244 };
44245 Ok(e)
44246 }
44247 1 => {
44248 let e = ();
44249 Err(e)
44250 }
44251 _ => _rt::invalid_enum_discriminant(),
44252 }
44253 }
44254 }
44255 }
44256 impl IncomingBody {
44257 #[allow(unused_unsafe, clippy::all)]
44258 /// Returns the contents of the body, as a stream of bytes.
44259 ///
44260 /// Returns success on first call: the stream representing the contents
44261 /// can be retrieved at most once. Subsequent calls will return error.
44262 ///
44263 /// The returned `input-stream` resource is a child: it must be dropped
44264 /// before the parent `incoming-body` is dropped, or consumed by
44265 /// `incoming-body.finish`.
44266 ///
44267 /// This invariant ensures that the implementation can determine whether
44268 /// the user is consuming the contents of the body, waiting on the
44269 /// `future-trailers` to be ready, or neither. This allows for network
44270 /// backpressure is to be applied when the user is consuming the body,
44271 /// and for that backpressure to not inhibit delivery of the trailers if
44272 /// the user does not read the entire body.
44273 pub fn stream(&self) -> Result<InputStream, ()> {
44274 unsafe {
44275 #[repr(align(4))]
44276 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
44277 let mut ret_area = RetArea(
44278 [::core::mem::MaybeUninit::uninit(); 8],
44279 );
44280 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
44281 #[cfg(target_arch = "wasm32")]
44282 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
44283 extern "C" {
44284 #[link_name = "[method]incoming-body.stream"]
44285 fn wit_import(_: i32, _: *mut u8);
44286 }
44287 #[cfg(not(target_arch = "wasm32"))]
44288 fn wit_import(_: i32, _: *mut u8) {
44289 unreachable!()
44290 }
44291 wit_import((self).handle() as i32, ptr0);
44292 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
44293 match l1 {
44294 0 => {
44295 let e = {
44296 let l2 = *ptr0.add(4).cast::<i32>();
44297 super::super::super::wasi::io::streams::InputStream::from_handle(
44298 l2 as u32,
44299 )
44300 };
44301 Ok(e)
44302 }
44303 1 => {
44304 let e = ();
44305 Err(e)
44306 }
44307 _ => _rt::invalid_enum_discriminant(),
44308 }
44309 }
44310 }
44311 }
44312 impl IncomingBody {
44313 #[allow(unused_unsafe, clippy::all)]
44314 /// Takes ownership of `incoming-body`, and returns a `future-trailers`.
44315 /// This function will trap if the `input-stream` child is still alive.
44316 pub fn finish(this: IncomingBody) -> FutureTrailers {
44317 unsafe {
44318 #[cfg(target_arch = "wasm32")]
44319 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
44320 extern "C" {
44321 #[link_name = "[static]incoming-body.finish"]
44322 fn wit_import(_: i32) -> i32;
44323 }
44324 #[cfg(not(target_arch = "wasm32"))]
44325 fn wit_import(_: i32) -> i32 {
44326 unreachable!()
44327 }
44328 let ret = wit_import((&this).take_handle() as i32);
44329 FutureTrailers::from_handle(ret as u32)
44330 }
44331 }
44332 }
44333 impl FutureTrailers {
44334 #[allow(unused_unsafe, clippy::all)]
44335 /// Returns a pollable which becomes ready when either the trailers have
44336 /// been received, or an error has occured. When this pollable is ready,
44337 /// the `get` method will return `some`.
44338 pub fn subscribe(&self) -> Pollable {
44339 unsafe {
44340 #[cfg(target_arch = "wasm32")]
44341 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
44342 extern "C" {
44343 #[link_name = "[method]future-trailers.subscribe"]
44344 fn wit_import(_: i32) -> i32;
44345 }
44346 #[cfg(not(target_arch = "wasm32"))]
44347 fn wit_import(_: i32) -> i32 {
44348 unreachable!()
44349 }
44350 let ret = wit_import((self).handle() as i32);
44351 super::super::super::wasi::io::poll::Pollable::from_handle(
44352 ret as u32,
44353 )
44354 }
44355 }
44356 }
44357 impl FutureTrailers {
44358 #[allow(unused_unsafe, clippy::all)]
44359 /// Returns the contents of the trailers, or an error which occured,
44360 /// once the future is ready.
44361 ///
44362 /// The outer `option` represents future readiness. Users can wait on this
44363 /// `option` to become `some` using the `subscribe` method.
44364 ///
44365 /// The outer `result` is used to retrieve the trailers or error at most
44366 /// once. It will be success on the first call in which the outer option
44367 /// is `some`, and error on subsequent calls.
44368 ///
44369 /// The inner `result` represents that either the HTTP Request or Response
44370 /// body, as well as any trailers, were received successfully, or that an
44371 /// error occured receiving them. The optional `trailers` indicates whether
44372 /// or not trailers were present in the body.
44373 ///
44374 /// When some `trailers` are returned by this method, the `trailers`
44375 /// resource is immutable, and a child. Use of the `set`, `append`, or
44376 /// `delete` methods will return an error, and the resource must be
44377 /// dropped before the parent `future-trailers` is dropped.
44378 pub fn get(
44379 &self,
44380 ) -> Option<Result<Result<Option<Trailers>, ErrorCode>, ()>> {
44381 unsafe {
44382 #[repr(align(8))]
44383 struct RetArea([::core::mem::MaybeUninit<u8>; 56]);
44384 let mut ret_area = RetArea(
44385 [::core::mem::MaybeUninit::uninit(); 56],
44386 );
44387 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
44388 #[cfg(target_arch = "wasm32")]
44389 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
44390 extern "C" {
44391 #[link_name = "[method]future-trailers.get"]
44392 fn wit_import(_: i32, _: *mut u8);
44393 }
44394 #[cfg(not(target_arch = "wasm32"))]
44395 fn wit_import(_: i32, _: *mut u8) {
44396 unreachable!()
44397 }
44398 wit_import((self).handle() as i32, ptr0);
44399 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
44400 match l1 {
44401 0 => None,
44402 1 => {
44403 let e = {
44404 let l2 = i32::from(*ptr0.add(8).cast::<u8>());
44405 match l2 {
44406 0 => {
44407 let e = {
44408 let l3 = i32::from(*ptr0.add(16).cast::<u8>());
44409 match l3 {
44410 0 => {
44411 let e = {
44412 let l4 = i32::from(*ptr0.add(24).cast::<u8>());
44413 match l4 {
44414 0 => None,
44415 1 => {
44416 let e = {
44417 let l5 = *ptr0.add(28).cast::<i32>();
44418 Fields::from_handle(l5 as u32)
44419 };
44420 Some(e)
44421 }
44422 _ => _rt::invalid_enum_discriminant(),
44423 }
44424 };
44425 Ok(e)
44426 }
44427 1 => {
44428 let e = {
44429 let l6 = i32::from(*ptr0.add(24).cast::<u8>());
44430 let v68 = match l6 {
44431 0 => ErrorCode::DnsTimeout,
44432 1 => {
44433 let e68 = {
44434 let l7 = i32::from(*ptr0.add(32).cast::<u8>());
44435 let l11 = i32::from(*ptr0.add(44).cast::<u8>());
44436 DnsErrorPayload {
44437 rcode: match l7 {
44438 0 => None,
44439 1 => {
44440 let e = {
44441 let l8 = *ptr0.add(36).cast::<*mut u8>();
44442 let l9 = *ptr0.add(40).cast::<usize>();
44443 let len10 = l9;
44444 let bytes10 = _rt::Vec::from_raw_parts(
44445 l8.cast(),
44446 len10,
44447 len10,
44448 );
44449 _rt::string_lift(bytes10)
44450 };
44451 Some(e)
44452 }
44453 _ => _rt::invalid_enum_discriminant(),
44454 },
44455 info_code: match l11 {
44456 0 => None,
44457 1 => {
44458 let e = {
44459 let l12 = i32::from(*ptr0.add(46).cast::<u16>());
44460 l12 as u16
44461 };
44462 Some(e)
44463 }
44464 _ => _rt::invalid_enum_discriminant(),
44465 },
44466 }
44467 };
44468 ErrorCode::DnsError(e68)
44469 }
44470 2 => ErrorCode::DestinationNotFound,
44471 3 => ErrorCode::DestinationUnavailable,
44472 4 => ErrorCode::DestinationIpProhibited,
44473 5 => ErrorCode::DestinationIpUnroutable,
44474 6 => ErrorCode::ConnectionRefused,
44475 7 => ErrorCode::ConnectionTerminated,
44476 8 => ErrorCode::ConnectionTimeout,
44477 9 => ErrorCode::ConnectionReadTimeout,
44478 10 => ErrorCode::ConnectionWriteTimeout,
44479 11 => ErrorCode::ConnectionLimitReached,
44480 12 => ErrorCode::TlsProtocolError,
44481 13 => ErrorCode::TlsCertificateError,
44482 14 => {
44483 let e68 = {
44484 let l13 = i32::from(*ptr0.add(32).cast::<u8>());
44485 let l15 = i32::from(*ptr0.add(36).cast::<u8>());
44486 TlsAlertReceivedPayload {
44487 alert_id: match l13 {
44488 0 => None,
44489 1 => {
44490 let e = {
44491 let l14 = i32::from(*ptr0.add(33).cast::<u8>());
44492 l14 as u8
44493 };
44494 Some(e)
44495 }
44496 _ => _rt::invalid_enum_discriminant(),
44497 },
44498 alert_message: match l15 {
44499 0 => None,
44500 1 => {
44501 let e = {
44502 let l16 = *ptr0.add(40).cast::<*mut u8>();
44503 let l17 = *ptr0.add(44).cast::<usize>();
44504 let len18 = l17;
44505 let bytes18 = _rt::Vec::from_raw_parts(
44506 l16.cast(),
44507 len18,
44508 len18,
44509 );
44510 _rt::string_lift(bytes18)
44511 };
44512 Some(e)
44513 }
44514 _ => _rt::invalid_enum_discriminant(),
44515 },
44516 }
44517 };
44518 ErrorCode::TlsAlertReceived(e68)
44519 }
44520 15 => ErrorCode::HttpRequestDenied,
44521 16 => ErrorCode::HttpRequestLengthRequired,
44522 17 => {
44523 let e68 = {
44524 let l19 = i32::from(*ptr0.add(32).cast::<u8>());
44525 match l19 {
44526 0 => None,
44527 1 => {
44528 let e = {
44529 let l20 = *ptr0.add(40).cast::<i64>();
44530 l20 as u64
44531 };
44532 Some(e)
44533 }
44534 _ => _rt::invalid_enum_discriminant(),
44535 }
44536 };
44537 ErrorCode::HttpRequestBodySize(e68)
44538 }
44539 18 => ErrorCode::HttpRequestMethodInvalid,
44540 19 => ErrorCode::HttpRequestUriInvalid,
44541 20 => ErrorCode::HttpRequestUriTooLong,
44542 21 => {
44543 let e68 = {
44544 let l21 = i32::from(*ptr0.add(32).cast::<u8>());
44545 match l21 {
44546 0 => None,
44547 1 => {
44548 let e = {
44549 let l22 = *ptr0.add(36).cast::<i32>();
44550 l22 as u32
44551 };
44552 Some(e)
44553 }
44554 _ => _rt::invalid_enum_discriminant(),
44555 }
44556 };
44557 ErrorCode::HttpRequestHeaderSectionSize(e68)
44558 }
44559 22 => {
44560 let e68 = {
44561 let l23 = i32::from(*ptr0.add(32).cast::<u8>());
44562 match l23 {
44563 0 => None,
44564 1 => {
44565 let e = {
44566 let l24 = i32::from(*ptr0.add(36).cast::<u8>());
44567 let l28 = i32::from(*ptr0.add(48).cast::<u8>());
44568 FieldSizePayload {
44569 field_name: match l24 {
44570 0 => None,
44571 1 => {
44572 let e = {
44573 let l25 = *ptr0.add(40).cast::<*mut u8>();
44574 let l26 = *ptr0.add(44).cast::<usize>();
44575 let len27 = l26;
44576 let bytes27 = _rt::Vec::from_raw_parts(
44577 l25.cast(),
44578 len27,
44579 len27,
44580 );
44581 _rt::string_lift(bytes27)
44582 };
44583 Some(e)
44584 }
44585 _ => _rt::invalid_enum_discriminant(),
44586 },
44587 field_size: match l28 {
44588 0 => None,
44589 1 => {
44590 let e = {
44591 let l29 = *ptr0.add(52).cast::<i32>();
44592 l29 as u32
44593 };
44594 Some(e)
44595 }
44596 _ => _rt::invalid_enum_discriminant(),
44597 },
44598 }
44599 };
44600 Some(e)
44601 }
44602 _ => _rt::invalid_enum_discriminant(),
44603 }
44604 };
44605 ErrorCode::HttpRequestHeaderSize(e68)
44606 }
44607 23 => {
44608 let e68 = {
44609 let l30 = i32::from(*ptr0.add(32).cast::<u8>());
44610 match l30 {
44611 0 => None,
44612 1 => {
44613 let e = {
44614 let l31 = *ptr0.add(36).cast::<i32>();
44615 l31 as u32
44616 };
44617 Some(e)
44618 }
44619 _ => _rt::invalid_enum_discriminant(),
44620 }
44621 };
44622 ErrorCode::HttpRequestTrailerSectionSize(e68)
44623 }
44624 24 => {
44625 let e68 = {
44626 let l32 = i32::from(*ptr0.add(32).cast::<u8>());
44627 let l36 = i32::from(*ptr0.add(44).cast::<u8>());
44628 FieldSizePayload {
44629 field_name: match l32 {
44630 0 => None,
44631 1 => {
44632 let e = {
44633 let l33 = *ptr0.add(36).cast::<*mut u8>();
44634 let l34 = *ptr0.add(40).cast::<usize>();
44635 let len35 = l34;
44636 let bytes35 = _rt::Vec::from_raw_parts(
44637 l33.cast(),
44638 len35,
44639 len35,
44640 );
44641 _rt::string_lift(bytes35)
44642 };
44643 Some(e)
44644 }
44645 _ => _rt::invalid_enum_discriminant(),
44646 },
44647 field_size: match l36 {
44648 0 => None,
44649 1 => {
44650 let e = {
44651 let l37 = *ptr0.add(48).cast::<i32>();
44652 l37 as u32
44653 };
44654 Some(e)
44655 }
44656 _ => _rt::invalid_enum_discriminant(),
44657 },
44658 }
44659 };
44660 ErrorCode::HttpRequestTrailerSize(e68)
44661 }
44662 25 => ErrorCode::HttpResponseIncomplete,
44663 26 => {
44664 let e68 = {
44665 let l38 = i32::from(*ptr0.add(32).cast::<u8>());
44666 match l38 {
44667 0 => None,
44668 1 => {
44669 let e = {
44670 let l39 = *ptr0.add(36).cast::<i32>();
44671 l39 as u32
44672 };
44673 Some(e)
44674 }
44675 _ => _rt::invalid_enum_discriminant(),
44676 }
44677 };
44678 ErrorCode::HttpResponseHeaderSectionSize(e68)
44679 }
44680 27 => {
44681 let e68 = {
44682 let l40 = i32::from(*ptr0.add(32).cast::<u8>());
44683 let l44 = i32::from(*ptr0.add(44).cast::<u8>());
44684 FieldSizePayload {
44685 field_name: match l40 {
44686 0 => None,
44687 1 => {
44688 let e = {
44689 let l41 = *ptr0.add(36).cast::<*mut u8>();
44690 let l42 = *ptr0.add(40).cast::<usize>();
44691 let len43 = l42;
44692 let bytes43 = _rt::Vec::from_raw_parts(
44693 l41.cast(),
44694 len43,
44695 len43,
44696 );
44697 _rt::string_lift(bytes43)
44698 };
44699 Some(e)
44700 }
44701 _ => _rt::invalid_enum_discriminant(),
44702 },
44703 field_size: match l44 {
44704 0 => None,
44705 1 => {
44706 let e = {
44707 let l45 = *ptr0.add(48).cast::<i32>();
44708 l45 as u32
44709 };
44710 Some(e)
44711 }
44712 _ => _rt::invalid_enum_discriminant(),
44713 },
44714 }
44715 };
44716 ErrorCode::HttpResponseHeaderSize(e68)
44717 }
44718 28 => {
44719 let e68 = {
44720 let l46 = i32::from(*ptr0.add(32).cast::<u8>());
44721 match l46 {
44722 0 => None,
44723 1 => {
44724 let e = {
44725 let l47 = *ptr0.add(40).cast::<i64>();
44726 l47 as u64
44727 };
44728 Some(e)
44729 }
44730 _ => _rt::invalid_enum_discriminant(),
44731 }
44732 };
44733 ErrorCode::HttpResponseBodySize(e68)
44734 }
44735 29 => {
44736 let e68 = {
44737 let l48 = i32::from(*ptr0.add(32).cast::<u8>());
44738 match l48 {
44739 0 => None,
44740 1 => {
44741 let e = {
44742 let l49 = *ptr0.add(36).cast::<i32>();
44743 l49 as u32
44744 };
44745 Some(e)
44746 }
44747 _ => _rt::invalid_enum_discriminant(),
44748 }
44749 };
44750 ErrorCode::HttpResponseTrailerSectionSize(e68)
44751 }
44752 30 => {
44753 let e68 = {
44754 let l50 = i32::from(*ptr0.add(32).cast::<u8>());
44755 let l54 = i32::from(*ptr0.add(44).cast::<u8>());
44756 FieldSizePayload {
44757 field_name: match l50 {
44758 0 => None,
44759 1 => {
44760 let e = {
44761 let l51 = *ptr0.add(36).cast::<*mut u8>();
44762 let l52 = *ptr0.add(40).cast::<usize>();
44763 let len53 = l52;
44764 let bytes53 = _rt::Vec::from_raw_parts(
44765 l51.cast(),
44766 len53,
44767 len53,
44768 );
44769 _rt::string_lift(bytes53)
44770 };
44771 Some(e)
44772 }
44773 _ => _rt::invalid_enum_discriminant(),
44774 },
44775 field_size: match l54 {
44776 0 => None,
44777 1 => {
44778 let e = {
44779 let l55 = *ptr0.add(48).cast::<i32>();
44780 l55 as u32
44781 };
44782 Some(e)
44783 }
44784 _ => _rt::invalid_enum_discriminant(),
44785 },
44786 }
44787 };
44788 ErrorCode::HttpResponseTrailerSize(e68)
44789 }
44790 31 => {
44791 let e68 = {
44792 let l56 = i32::from(*ptr0.add(32).cast::<u8>());
44793 match l56 {
44794 0 => None,
44795 1 => {
44796 let e = {
44797 let l57 = *ptr0.add(36).cast::<*mut u8>();
44798 let l58 = *ptr0.add(40).cast::<usize>();
44799 let len59 = l58;
44800 let bytes59 = _rt::Vec::from_raw_parts(
44801 l57.cast(),
44802 len59,
44803 len59,
44804 );
44805 _rt::string_lift(bytes59)
44806 };
44807 Some(e)
44808 }
44809 _ => _rt::invalid_enum_discriminant(),
44810 }
44811 };
44812 ErrorCode::HttpResponseTransferCoding(e68)
44813 }
44814 32 => {
44815 let e68 = {
44816 let l60 = i32::from(*ptr0.add(32).cast::<u8>());
44817 match l60 {
44818 0 => None,
44819 1 => {
44820 let e = {
44821 let l61 = *ptr0.add(36).cast::<*mut u8>();
44822 let l62 = *ptr0.add(40).cast::<usize>();
44823 let len63 = l62;
44824 let bytes63 = _rt::Vec::from_raw_parts(
44825 l61.cast(),
44826 len63,
44827 len63,
44828 );
44829 _rt::string_lift(bytes63)
44830 };
44831 Some(e)
44832 }
44833 _ => _rt::invalid_enum_discriminant(),
44834 }
44835 };
44836 ErrorCode::HttpResponseContentCoding(e68)
44837 }
44838 33 => ErrorCode::HttpResponseTimeout,
44839 34 => ErrorCode::HttpUpgradeFailed,
44840 35 => ErrorCode::HttpProtocolError,
44841 36 => ErrorCode::LoopDetected,
44842 37 => ErrorCode::ConfigurationError,
44843 n => {
44844 debug_assert_eq!(n, 38, "invalid enum discriminant");
44845 let e68 = {
44846 let l64 = i32::from(*ptr0.add(32).cast::<u8>());
44847 match l64 {
44848 0 => None,
44849 1 => {
44850 let e = {
44851 let l65 = *ptr0.add(36).cast::<*mut u8>();
44852 let l66 = *ptr0.add(40).cast::<usize>();
44853 let len67 = l66;
44854 let bytes67 = _rt::Vec::from_raw_parts(
44855 l65.cast(),
44856 len67,
44857 len67,
44858 );
44859 _rt::string_lift(bytes67)
44860 };
44861 Some(e)
44862 }
44863 _ => _rt::invalid_enum_discriminant(),
44864 }
44865 };
44866 ErrorCode::InternalError(e68)
44867 }
44868 };
44869 v68
44870 };
44871 Err(e)
44872 }
44873 _ => _rt::invalid_enum_discriminant(),
44874 }
44875 };
44876 Ok(e)
44877 }
44878 1 => {
44879 let e = ();
44880 Err(e)
44881 }
44882 _ => _rt::invalid_enum_discriminant(),
44883 }
44884 };
44885 Some(e)
44886 }
44887 _ => _rt::invalid_enum_discriminant(),
44888 }
44889 }
44890 }
44891 }
44892 impl OutgoingResponse {
44893 #[allow(unused_unsafe, clippy::all)]
44894 /// Construct an `outgoing-response`, with a default `status-code` of `200`.
44895 /// If a different `status-code` is needed, it must be set via the
44896 /// `set-status-code` method.
44897 ///
44898 /// * `headers` is the HTTP Headers for the Response.
44899 pub fn new(headers: Headers) -> Self {
44900 unsafe {
44901 #[cfg(target_arch = "wasm32")]
44902 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
44903 extern "C" {
44904 #[link_name = "[constructor]outgoing-response"]
44905 fn wit_import(_: i32) -> i32;
44906 }
44907 #[cfg(not(target_arch = "wasm32"))]
44908 fn wit_import(_: i32) -> i32 {
44909 unreachable!()
44910 }
44911 let ret = wit_import((&headers).take_handle() as i32);
44912 OutgoingResponse::from_handle(ret as u32)
44913 }
44914 }
44915 }
44916 impl OutgoingResponse {
44917 #[allow(unused_unsafe, clippy::all)]
44918 /// Get the HTTP Status Code for the Response.
44919 pub fn status_code(&self) -> StatusCode {
44920 unsafe {
44921 #[cfg(target_arch = "wasm32")]
44922 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
44923 extern "C" {
44924 #[link_name = "[method]outgoing-response.status-code"]
44925 fn wit_import(_: i32) -> i32;
44926 }
44927 #[cfg(not(target_arch = "wasm32"))]
44928 fn wit_import(_: i32) -> i32 {
44929 unreachable!()
44930 }
44931 let ret = wit_import((self).handle() as i32);
44932 ret as u16
44933 }
44934 }
44935 }
44936 impl OutgoingResponse {
44937 #[allow(unused_unsafe, clippy::all)]
44938 /// Set the HTTP Status Code for the Response. Fails if the status-code
44939 /// given is not a valid http status code.
44940 pub fn set_status_code(
44941 &self,
44942 status_code: StatusCode,
44943 ) -> Result<(), ()> {
44944 unsafe {
44945 #[cfg(target_arch = "wasm32")]
44946 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
44947 extern "C" {
44948 #[link_name = "[method]outgoing-response.set-status-code"]
44949 fn wit_import(_: i32, _: i32) -> i32;
44950 }
44951 #[cfg(not(target_arch = "wasm32"))]
44952 fn wit_import(_: i32, _: i32) -> i32 {
44953 unreachable!()
44954 }
44955 let ret = wit_import(
44956 (self).handle() as i32,
44957 _rt::as_i32(status_code),
44958 );
44959 match ret {
44960 0 => {
44961 let e = ();
44962 Ok(e)
44963 }
44964 1 => {
44965 let e = ();
44966 Err(e)
44967 }
44968 _ => _rt::invalid_enum_discriminant(),
44969 }
44970 }
44971 }
44972 }
44973 impl OutgoingResponse {
44974 #[allow(unused_unsafe, clippy::all)]
44975 /// Get the headers associated with the Request.
44976 ///
44977 /// The returned `headers` resource is immutable: `set`, `append`, and
44978 /// `delete` operations will fail with `header-error.immutable`.
44979 ///
44980 /// This headers resource is a child: it must be dropped before the parent
44981 /// `outgoing-request` is dropped, or its ownership is transfered to
44982 /// another component by e.g. `outgoing-handler.handle`.
44983 pub fn headers(&self) -> Headers {
44984 unsafe {
44985 #[cfg(target_arch = "wasm32")]
44986 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
44987 extern "C" {
44988 #[link_name = "[method]outgoing-response.headers"]
44989 fn wit_import(_: i32) -> i32;
44990 }
44991 #[cfg(not(target_arch = "wasm32"))]
44992 fn wit_import(_: i32) -> i32 {
44993 unreachable!()
44994 }
44995 let ret = wit_import((self).handle() as i32);
44996 Fields::from_handle(ret as u32)
44997 }
44998 }
44999 }
45000 impl OutgoingResponse {
45001 #[allow(unused_unsafe, clippy::all)]
45002 /// Returns the resource corresponding to the outgoing Body for this Response.
45003 ///
45004 /// Returns success on the first call: the `outgoing-body` resource for
45005 /// this `outgoing-response` can be retrieved at most once. Subsequent
45006 /// calls will return error.
45007 pub fn body(&self) -> Result<OutgoingBody, ()> {
45008 unsafe {
45009 #[repr(align(4))]
45010 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
45011 let mut ret_area = RetArea(
45012 [::core::mem::MaybeUninit::uninit(); 8],
45013 );
45014 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
45015 #[cfg(target_arch = "wasm32")]
45016 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
45017 extern "C" {
45018 #[link_name = "[method]outgoing-response.body"]
45019 fn wit_import(_: i32, _: *mut u8);
45020 }
45021 #[cfg(not(target_arch = "wasm32"))]
45022 fn wit_import(_: i32, _: *mut u8) {
45023 unreachable!()
45024 }
45025 wit_import((self).handle() as i32, ptr0);
45026 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
45027 match l1 {
45028 0 => {
45029 let e = {
45030 let l2 = *ptr0.add(4).cast::<i32>();
45031 OutgoingBody::from_handle(l2 as u32)
45032 };
45033 Ok(e)
45034 }
45035 1 => {
45036 let e = ();
45037 Err(e)
45038 }
45039 _ => _rt::invalid_enum_discriminant(),
45040 }
45041 }
45042 }
45043 }
45044 impl OutgoingBody {
45045 #[allow(unused_unsafe, clippy::all)]
45046 /// Returns a stream for writing the body contents.
45047 ///
45048 /// The returned `output-stream` is a child resource: it must be dropped
45049 /// before the parent `outgoing-body` resource is dropped (or finished),
45050 /// otherwise the `outgoing-body` drop or `finish` will trap.
45051 ///
45052 /// Returns success on the first call: the `output-stream` resource for
45053 /// this `outgoing-body` may be retrieved at most once. Subsequent calls
45054 /// will return error.
45055 pub fn write(&self) -> Result<OutputStream, ()> {
45056 unsafe {
45057 #[repr(align(4))]
45058 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
45059 let mut ret_area = RetArea(
45060 [::core::mem::MaybeUninit::uninit(); 8],
45061 );
45062 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
45063 #[cfg(target_arch = "wasm32")]
45064 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
45065 extern "C" {
45066 #[link_name = "[method]outgoing-body.write"]
45067 fn wit_import(_: i32, _: *mut u8);
45068 }
45069 #[cfg(not(target_arch = "wasm32"))]
45070 fn wit_import(_: i32, _: *mut u8) {
45071 unreachable!()
45072 }
45073 wit_import((self).handle() as i32, ptr0);
45074 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
45075 match l1 {
45076 0 => {
45077 let e = {
45078 let l2 = *ptr0.add(4).cast::<i32>();
45079 super::super::super::wasi::io::streams::OutputStream::from_handle(
45080 l2 as u32,
45081 )
45082 };
45083 Ok(e)
45084 }
45085 1 => {
45086 let e = ();
45087 Err(e)
45088 }
45089 _ => _rt::invalid_enum_discriminant(),
45090 }
45091 }
45092 }
45093 }
45094 impl OutgoingBody {
45095 #[allow(unused_unsafe, clippy::all)]
45096 /// Finalize an outgoing body, optionally providing trailers. This must be
45097 /// called to signal that the response is complete. If the `outgoing-body`
45098 /// is dropped without calling `outgoing-body.finalize`, the implementation
45099 /// should treat the body as corrupted.
45100 ///
45101 /// Fails if the body's `outgoing-request` or `outgoing-response` was
45102 /// constructed with a Content-Length header, and the contents written
45103 /// to the body (via `write`) does not match the value given in the
45104 /// Content-Length.
45105 pub fn finish(
45106 this: OutgoingBody,
45107 trailers: Option<Trailers>,
45108 ) -> Result<(), ErrorCode> {
45109 unsafe {
45110 #[repr(align(8))]
45111 struct RetArea([::core::mem::MaybeUninit<u8>; 40]);
45112 let mut ret_area = RetArea(
45113 [::core::mem::MaybeUninit::uninit(); 40],
45114 );
45115 let (result0_0, result0_1) = match &trailers {
45116 Some(e) => (1i32, (e).take_handle() as i32),
45117 None => (0i32, 0i32),
45118 };
45119 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
45120 #[cfg(target_arch = "wasm32")]
45121 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
45122 extern "C" {
45123 #[link_name = "[static]outgoing-body.finish"]
45124 fn wit_import(_: i32, _: i32, _: i32, _: *mut u8);
45125 }
45126 #[cfg(not(target_arch = "wasm32"))]
45127 fn wit_import(_: i32, _: i32, _: i32, _: *mut u8) {
45128 unreachable!()
45129 }
45130 wit_import(
45131 (&this).take_handle() as i32,
45132 result0_0,
45133 result0_1,
45134 ptr1,
45135 );
45136 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
45137 match l2 {
45138 0 => {
45139 let e = ();
45140 Ok(e)
45141 }
45142 1 => {
45143 let e = {
45144 let l3 = i32::from(*ptr1.add(8).cast::<u8>());
45145 let v65 = match l3 {
45146 0 => ErrorCode::DnsTimeout,
45147 1 => {
45148 let e65 = {
45149 let l4 = i32::from(*ptr1.add(16).cast::<u8>());
45150 let l8 = i32::from(*ptr1.add(28).cast::<u8>());
45151 DnsErrorPayload {
45152 rcode: match l4 {
45153 0 => None,
45154 1 => {
45155 let e = {
45156 let l5 = *ptr1.add(20).cast::<*mut u8>();
45157 let l6 = *ptr1.add(24).cast::<usize>();
45158 let len7 = l6;
45159 let bytes7 = _rt::Vec::from_raw_parts(
45160 l5.cast(),
45161 len7,
45162 len7,
45163 );
45164 _rt::string_lift(bytes7)
45165 };
45166 Some(e)
45167 }
45168 _ => _rt::invalid_enum_discriminant(),
45169 },
45170 info_code: match l8 {
45171 0 => None,
45172 1 => {
45173 let e = {
45174 let l9 = i32::from(*ptr1.add(30).cast::<u16>());
45175 l9 as u16
45176 };
45177 Some(e)
45178 }
45179 _ => _rt::invalid_enum_discriminant(),
45180 },
45181 }
45182 };
45183 ErrorCode::DnsError(e65)
45184 }
45185 2 => ErrorCode::DestinationNotFound,
45186 3 => ErrorCode::DestinationUnavailable,
45187 4 => ErrorCode::DestinationIpProhibited,
45188 5 => ErrorCode::DestinationIpUnroutable,
45189 6 => ErrorCode::ConnectionRefused,
45190 7 => ErrorCode::ConnectionTerminated,
45191 8 => ErrorCode::ConnectionTimeout,
45192 9 => ErrorCode::ConnectionReadTimeout,
45193 10 => ErrorCode::ConnectionWriteTimeout,
45194 11 => ErrorCode::ConnectionLimitReached,
45195 12 => ErrorCode::TlsProtocolError,
45196 13 => ErrorCode::TlsCertificateError,
45197 14 => {
45198 let e65 = {
45199 let l10 = i32::from(*ptr1.add(16).cast::<u8>());
45200 let l12 = i32::from(*ptr1.add(20).cast::<u8>());
45201 TlsAlertReceivedPayload {
45202 alert_id: match l10 {
45203 0 => None,
45204 1 => {
45205 let e = {
45206 let l11 = i32::from(*ptr1.add(17).cast::<u8>());
45207 l11 as u8
45208 };
45209 Some(e)
45210 }
45211 _ => _rt::invalid_enum_discriminant(),
45212 },
45213 alert_message: match l12 {
45214 0 => None,
45215 1 => {
45216 let e = {
45217 let l13 = *ptr1.add(24).cast::<*mut u8>();
45218 let l14 = *ptr1.add(28).cast::<usize>();
45219 let len15 = l14;
45220 let bytes15 = _rt::Vec::from_raw_parts(
45221 l13.cast(),
45222 len15,
45223 len15,
45224 );
45225 _rt::string_lift(bytes15)
45226 };
45227 Some(e)
45228 }
45229 _ => _rt::invalid_enum_discriminant(),
45230 },
45231 }
45232 };
45233 ErrorCode::TlsAlertReceived(e65)
45234 }
45235 15 => ErrorCode::HttpRequestDenied,
45236 16 => ErrorCode::HttpRequestLengthRequired,
45237 17 => {
45238 let e65 = {
45239 let l16 = i32::from(*ptr1.add(16).cast::<u8>());
45240 match l16 {
45241 0 => None,
45242 1 => {
45243 let e = {
45244 let l17 = *ptr1.add(24).cast::<i64>();
45245 l17 as u64
45246 };
45247 Some(e)
45248 }
45249 _ => _rt::invalid_enum_discriminant(),
45250 }
45251 };
45252 ErrorCode::HttpRequestBodySize(e65)
45253 }
45254 18 => ErrorCode::HttpRequestMethodInvalid,
45255 19 => ErrorCode::HttpRequestUriInvalid,
45256 20 => ErrorCode::HttpRequestUriTooLong,
45257 21 => {
45258 let e65 = {
45259 let l18 = i32::from(*ptr1.add(16).cast::<u8>());
45260 match l18 {
45261 0 => None,
45262 1 => {
45263 let e = {
45264 let l19 = *ptr1.add(20).cast::<i32>();
45265 l19 as u32
45266 };
45267 Some(e)
45268 }
45269 _ => _rt::invalid_enum_discriminant(),
45270 }
45271 };
45272 ErrorCode::HttpRequestHeaderSectionSize(e65)
45273 }
45274 22 => {
45275 let e65 = {
45276 let l20 = i32::from(*ptr1.add(16).cast::<u8>());
45277 match l20 {
45278 0 => None,
45279 1 => {
45280 let e = {
45281 let l21 = i32::from(*ptr1.add(20).cast::<u8>());
45282 let l25 = i32::from(*ptr1.add(32).cast::<u8>());
45283 FieldSizePayload {
45284 field_name: match l21 {
45285 0 => None,
45286 1 => {
45287 let e = {
45288 let l22 = *ptr1.add(24).cast::<*mut u8>();
45289 let l23 = *ptr1.add(28).cast::<usize>();
45290 let len24 = l23;
45291 let bytes24 = _rt::Vec::from_raw_parts(
45292 l22.cast(),
45293 len24,
45294 len24,
45295 );
45296 _rt::string_lift(bytes24)
45297 };
45298 Some(e)
45299 }
45300 _ => _rt::invalid_enum_discriminant(),
45301 },
45302 field_size: match l25 {
45303 0 => None,
45304 1 => {
45305 let e = {
45306 let l26 = *ptr1.add(36).cast::<i32>();
45307 l26 as u32
45308 };
45309 Some(e)
45310 }
45311 _ => _rt::invalid_enum_discriminant(),
45312 },
45313 }
45314 };
45315 Some(e)
45316 }
45317 _ => _rt::invalid_enum_discriminant(),
45318 }
45319 };
45320 ErrorCode::HttpRequestHeaderSize(e65)
45321 }
45322 23 => {
45323 let e65 = {
45324 let l27 = i32::from(*ptr1.add(16).cast::<u8>());
45325 match l27 {
45326 0 => None,
45327 1 => {
45328 let e = {
45329 let l28 = *ptr1.add(20).cast::<i32>();
45330 l28 as u32
45331 };
45332 Some(e)
45333 }
45334 _ => _rt::invalid_enum_discriminant(),
45335 }
45336 };
45337 ErrorCode::HttpRequestTrailerSectionSize(e65)
45338 }
45339 24 => {
45340 let e65 = {
45341 let l29 = i32::from(*ptr1.add(16).cast::<u8>());
45342 let l33 = i32::from(*ptr1.add(28).cast::<u8>());
45343 FieldSizePayload {
45344 field_name: match l29 {
45345 0 => None,
45346 1 => {
45347 let e = {
45348 let l30 = *ptr1.add(20).cast::<*mut u8>();
45349 let l31 = *ptr1.add(24).cast::<usize>();
45350 let len32 = l31;
45351 let bytes32 = _rt::Vec::from_raw_parts(
45352 l30.cast(),
45353 len32,
45354 len32,
45355 );
45356 _rt::string_lift(bytes32)
45357 };
45358 Some(e)
45359 }
45360 _ => _rt::invalid_enum_discriminant(),
45361 },
45362 field_size: match l33 {
45363 0 => None,
45364 1 => {
45365 let e = {
45366 let l34 = *ptr1.add(32).cast::<i32>();
45367 l34 as u32
45368 };
45369 Some(e)
45370 }
45371 _ => _rt::invalid_enum_discriminant(),
45372 },
45373 }
45374 };
45375 ErrorCode::HttpRequestTrailerSize(e65)
45376 }
45377 25 => ErrorCode::HttpResponseIncomplete,
45378 26 => {
45379 let e65 = {
45380 let l35 = i32::from(*ptr1.add(16).cast::<u8>());
45381 match l35 {
45382 0 => None,
45383 1 => {
45384 let e = {
45385 let l36 = *ptr1.add(20).cast::<i32>();
45386 l36 as u32
45387 };
45388 Some(e)
45389 }
45390 _ => _rt::invalid_enum_discriminant(),
45391 }
45392 };
45393 ErrorCode::HttpResponseHeaderSectionSize(e65)
45394 }
45395 27 => {
45396 let e65 = {
45397 let l37 = i32::from(*ptr1.add(16).cast::<u8>());
45398 let l41 = i32::from(*ptr1.add(28).cast::<u8>());
45399 FieldSizePayload {
45400 field_name: match l37 {
45401 0 => None,
45402 1 => {
45403 let e = {
45404 let l38 = *ptr1.add(20).cast::<*mut u8>();
45405 let l39 = *ptr1.add(24).cast::<usize>();
45406 let len40 = l39;
45407 let bytes40 = _rt::Vec::from_raw_parts(
45408 l38.cast(),
45409 len40,
45410 len40,
45411 );
45412 _rt::string_lift(bytes40)
45413 };
45414 Some(e)
45415 }
45416 _ => _rt::invalid_enum_discriminant(),
45417 },
45418 field_size: match l41 {
45419 0 => None,
45420 1 => {
45421 let e = {
45422 let l42 = *ptr1.add(32).cast::<i32>();
45423 l42 as u32
45424 };
45425 Some(e)
45426 }
45427 _ => _rt::invalid_enum_discriminant(),
45428 },
45429 }
45430 };
45431 ErrorCode::HttpResponseHeaderSize(e65)
45432 }
45433 28 => {
45434 let e65 = {
45435 let l43 = i32::from(*ptr1.add(16).cast::<u8>());
45436 match l43 {
45437 0 => None,
45438 1 => {
45439 let e = {
45440 let l44 = *ptr1.add(24).cast::<i64>();
45441 l44 as u64
45442 };
45443 Some(e)
45444 }
45445 _ => _rt::invalid_enum_discriminant(),
45446 }
45447 };
45448 ErrorCode::HttpResponseBodySize(e65)
45449 }
45450 29 => {
45451 let e65 = {
45452 let l45 = i32::from(*ptr1.add(16).cast::<u8>());
45453 match l45 {
45454 0 => None,
45455 1 => {
45456 let e = {
45457 let l46 = *ptr1.add(20).cast::<i32>();
45458 l46 as u32
45459 };
45460 Some(e)
45461 }
45462 _ => _rt::invalid_enum_discriminant(),
45463 }
45464 };
45465 ErrorCode::HttpResponseTrailerSectionSize(e65)
45466 }
45467 30 => {
45468 let e65 = {
45469 let l47 = i32::from(*ptr1.add(16).cast::<u8>());
45470 let l51 = i32::from(*ptr1.add(28).cast::<u8>());
45471 FieldSizePayload {
45472 field_name: match l47 {
45473 0 => None,
45474 1 => {
45475 let e = {
45476 let l48 = *ptr1.add(20).cast::<*mut u8>();
45477 let l49 = *ptr1.add(24).cast::<usize>();
45478 let len50 = l49;
45479 let bytes50 = _rt::Vec::from_raw_parts(
45480 l48.cast(),
45481 len50,
45482 len50,
45483 );
45484 _rt::string_lift(bytes50)
45485 };
45486 Some(e)
45487 }
45488 _ => _rt::invalid_enum_discriminant(),
45489 },
45490 field_size: match l51 {
45491 0 => None,
45492 1 => {
45493 let e = {
45494 let l52 = *ptr1.add(32).cast::<i32>();
45495 l52 as u32
45496 };
45497 Some(e)
45498 }
45499 _ => _rt::invalid_enum_discriminant(),
45500 },
45501 }
45502 };
45503 ErrorCode::HttpResponseTrailerSize(e65)
45504 }
45505 31 => {
45506 let e65 = {
45507 let l53 = i32::from(*ptr1.add(16).cast::<u8>());
45508 match l53 {
45509 0 => None,
45510 1 => {
45511 let e = {
45512 let l54 = *ptr1.add(20).cast::<*mut u8>();
45513 let l55 = *ptr1.add(24).cast::<usize>();
45514 let len56 = l55;
45515 let bytes56 = _rt::Vec::from_raw_parts(
45516 l54.cast(),
45517 len56,
45518 len56,
45519 );
45520 _rt::string_lift(bytes56)
45521 };
45522 Some(e)
45523 }
45524 _ => _rt::invalid_enum_discriminant(),
45525 }
45526 };
45527 ErrorCode::HttpResponseTransferCoding(e65)
45528 }
45529 32 => {
45530 let e65 = {
45531 let l57 = i32::from(*ptr1.add(16).cast::<u8>());
45532 match l57 {
45533 0 => None,
45534 1 => {
45535 let e = {
45536 let l58 = *ptr1.add(20).cast::<*mut u8>();
45537 let l59 = *ptr1.add(24).cast::<usize>();
45538 let len60 = l59;
45539 let bytes60 = _rt::Vec::from_raw_parts(
45540 l58.cast(),
45541 len60,
45542 len60,
45543 );
45544 _rt::string_lift(bytes60)
45545 };
45546 Some(e)
45547 }
45548 _ => _rt::invalid_enum_discriminant(),
45549 }
45550 };
45551 ErrorCode::HttpResponseContentCoding(e65)
45552 }
45553 33 => ErrorCode::HttpResponseTimeout,
45554 34 => ErrorCode::HttpUpgradeFailed,
45555 35 => ErrorCode::HttpProtocolError,
45556 36 => ErrorCode::LoopDetected,
45557 37 => ErrorCode::ConfigurationError,
45558 n => {
45559 debug_assert_eq!(n, 38, "invalid enum discriminant");
45560 let e65 = {
45561 let l61 = i32::from(*ptr1.add(16).cast::<u8>());
45562 match l61 {
45563 0 => None,
45564 1 => {
45565 let e = {
45566 let l62 = *ptr1.add(20).cast::<*mut u8>();
45567 let l63 = *ptr1.add(24).cast::<usize>();
45568 let len64 = l63;
45569 let bytes64 = _rt::Vec::from_raw_parts(
45570 l62.cast(),
45571 len64,
45572 len64,
45573 );
45574 _rt::string_lift(bytes64)
45575 };
45576 Some(e)
45577 }
45578 _ => _rt::invalid_enum_discriminant(),
45579 }
45580 };
45581 ErrorCode::InternalError(e65)
45582 }
45583 };
45584 v65
45585 };
45586 Err(e)
45587 }
45588 _ => _rt::invalid_enum_discriminant(),
45589 }
45590 }
45591 }
45592 }
45593 impl FutureIncomingResponse {
45594 #[allow(unused_unsafe, clippy::all)]
45595 /// Returns a pollable which becomes ready when either the Response has
45596 /// been received, or an error has occured. When this pollable is ready,
45597 /// the `get` method will return `some`.
45598 pub fn subscribe(&self) -> Pollable {
45599 unsafe {
45600 #[cfg(target_arch = "wasm32")]
45601 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
45602 extern "C" {
45603 #[link_name = "[method]future-incoming-response.subscribe"]
45604 fn wit_import(_: i32) -> i32;
45605 }
45606 #[cfg(not(target_arch = "wasm32"))]
45607 fn wit_import(_: i32) -> i32 {
45608 unreachable!()
45609 }
45610 let ret = wit_import((self).handle() as i32);
45611 super::super::super::wasi::io::poll::Pollable::from_handle(
45612 ret as u32,
45613 )
45614 }
45615 }
45616 }
45617 impl FutureIncomingResponse {
45618 #[allow(unused_unsafe, clippy::all)]
45619 /// Returns the incoming HTTP Response, or an error, once one is ready.
45620 ///
45621 /// The outer `option` represents future readiness. Users can wait on this
45622 /// `option` to become `some` using the `subscribe` method.
45623 ///
45624 /// The outer `result` is used to retrieve the response or error at most
45625 /// once. It will be success on the first call in which the outer option
45626 /// is `some`, and error on subsequent calls.
45627 ///
45628 /// The inner `result` represents that either the incoming HTTP Response
45629 /// status and headers have recieved successfully, or that an error
45630 /// occured. Errors may also occur while consuming the response body,
45631 /// but those will be reported by the `incoming-body` and its
45632 /// `output-stream` child.
45633 pub fn get(
45634 &self,
45635 ) -> Option<Result<Result<IncomingResponse, ErrorCode>, ()>> {
45636 unsafe {
45637 #[repr(align(8))]
45638 struct RetArea([::core::mem::MaybeUninit<u8>; 56]);
45639 let mut ret_area = RetArea(
45640 [::core::mem::MaybeUninit::uninit(); 56],
45641 );
45642 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
45643 #[cfg(target_arch = "wasm32")]
45644 #[link(wasm_import_module = "wasi:http/types@0.2.0")]
45645 extern "C" {
45646 #[link_name = "[method]future-incoming-response.get"]
45647 fn wit_import(_: i32, _: *mut u8);
45648 }
45649 #[cfg(not(target_arch = "wasm32"))]
45650 fn wit_import(_: i32, _: *mut u8) {
45651 unreachable!()
45652 }
45653 wit_import((self).handle() as i32, ptr0);
45654 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
45655 match l1 {
45656 0 => None,
45657 1 => {
45658 let e = {
45659 let l2 = i32::from(*ptr0.add(8).cast::<u8>());
45660 match l2 {
45661 0 => {
45662 let e = {
45663 let l3 = i32::from(*ptr0.add(16).cast::<u8>());
45664 match l3 {
45665 0 => {
45666 let e = {
45667 let l4 = *ptr0.add(24).cast::<i32>();
45668 IncomingResponse::from_handle(l4 as u32)
45669 };
45670 Ok(e)
45671 }
45672 1 => {
45673 let e = {
45674 let l5 = i32::from(*ptr0.add(24).cast::<u8>());
45675 let v67 = match l5 {
45676 0 => ErrorCode::DnsTimeout,
45677 1 => {
45678 let e67 = {
45679 let l6 = i32::from(*ptr0.add(32).cast::<u8>());
45680 let l10 = i32::from(*ptr0.add(44).cast::<u8>());
45681 DnsErrorPayload {
45682 rcode: match l6 {
45683 0 => None,
45684 1 => {
45685 let e = {
45686 let l7 = *ptr0.add(36).cast::<*mut u8>();
45687 let l8 = *ptr0.add(40).cast::<usize>();
45688 let len9 = l8;
45689 let bytes9 = _rt::Vec::from_raw_parts(
45690 l7.cast(),
45691 len9,
45692 len9,
45693 );
45694 _rt::string_lift(bytes9)
45695 };
45696 Some(e)
45697 }
45698 _ => _rt::invalid_enum_discriminant(),
45699 },
45700 info_code: match l10 {
45701 0 => None,
45702 1 => {
45703 let e = {
45704 let l11 = i32::from(*ptr0.add(46).cast::<u16>());
45705 l11 as u16
45706 };
45707 Some(e)
45708 }
45709 _ => _rt::invalid_enum_discriminant(),
45710 },
45711 }
45712 };
45713 ErrorCode::DnsError(e67)
45714 }
45715 2 => ErrorCode::DestinationNotFound,
45716 3 => ErrorCode::DestinationUnavailable,
45717 4 => ErrorCode::DestinationIpProhibited,
45718 5 => ErrorCode::DestinationIpUnroutable,
45719 6 => ErrorCode::ConnectionRefused,
45720 7 => ErrorCode::ConnectionTerminated,
45721 8 => ErrorCode::ConnectionTimeout,
45722 9 => ErrorCode::ConnectionReadTimeout,
45723 10 => ErrorCode::ConnectionWriteTimeout,
45724 11 => ErrorCode::ConnectionLimitReached,
45725 12 => ErrorCode::TlsProtocolError,
45726 13 => ErrorCode::TlsCertificateError,
45727 14 => {
45728 let e67 = {
45729 let l12 = i32::from(*ptr0.add(32).cast::<u8>());
45730 let l14 = i32::from(*ptr0.add(36).cast::<u8>());
45731 TlsAlertReceivedPayload {
45732 alert_id: match l12 {
45733 0 => None,
45734 1 => {
45735 let e = {
45736 let l13 = i32::from(*ptr0.add(33).cast::<u8>());
45737 l13 as u8
45738 };
45739 Some(e)
45740 }
45741 _ => _rt::invalid_enum_discriminant(),
45742 },
45743 alert_message: match l14 {
45744 0 => None,
45745 1 => {
45746 let e = {
45747 let l15 = *ptr0.add(40).cast::<*mut u8>();
45748 let l16 = *ptr0.add(44).cast::<usize>();
45749 let len17 = l16;
45750 let bytes17 = _rt::Vec::from_raw_parts(
45751 l15.cast(),
45752 len17,
45753 len17,
45754 );
45755 _rt::string_lift(bytes17)
45756 };
45757 Some(e)
45758 }
45759 _ => _rt::invalid_enum_discriminant(),
45760 },
45761 }
45762 };
45763 ErrorCode::TlsAlertReceived(e67)
45764 }
45765 15 => ErrorCode::HttpRequestDenied,
45766 16 => ErrorCode::HttpRequestLengthRequired,
45767 17 => {
45768 let e67 = {
45769 let l18 = i32::from(*ptr0.add(32).cast::<u8>());
45770 match l18 {
45771 0 => None,
45772 1 => {
45773 let e = {
45774 let l19 = *ptr0.add(40).cast::<i64>();
45775 l19 as u64
45776 };
45777 Some(e)
45778 }
45779 _ => _rt::invalid_enum_discriminant(),
45780 }
45781 };
45782 ErrorCode::HttpRequestBodySize(e67)
45783 }
45784 18 => ErrorCode::HttpRequestMethodInvalid,
45785 19 => ErrorCode::HttpRequestUriInvalid,
45786 20 => ErrorCode::HttpRequestUriTooLong,
45787 21 => {
45788 let e67 = {
45789 let l20 = i32::from(*ptr0.add(32).cast::<u8>());
45790 match l20 {
45791 0 => None,
45792 1 => {
45793 let e = {
45794 let l21 = *ptr0.add(36).cast::<i32>();
45795 l21 as u32
45796 };
45797 Some(e)
45798 }
45799 _ => _rt::invalid_enum_discriminant(),
45800 }
45801 };
45802 ErrorCode::HttpRequestHeaderSectionSize(e67)
45803 }
45804 22 => {
45805 let e67 = {
45806 let l22 = i32::from(*ptr0.add(32).cast::<u8>());
45807 match l22 {
45808 0 => None,
45809 1 => {
45810 let e = {
45811 let l23 = i32::from(*ptr0.add(36).cast::<u8>());
45812 let l27 = i32::from(*ptr0.add(48).cast::<u8>());
45813 FieldSizePayload {
45814 field_name: match l23 {
45815 0 => None,
45816 1 => {
45817 let e = {
45818 let l24 = *ptr0.add(40).cast::<*mut u8>();
45819 let l25 = *ptr0.add(44).cast::<usize>();
45820 let len26 = l25;
45821 let bytes26 = _rt::Vec::from_raw_parts(
45822 l24.cast(),
45823 len26,
45824 len26,
45825 );
45826 _rt::string_lift(bytes26)
45827 };
45828 Some(e)
45829 }
45830 _ => _rt::invalid_enum_discriminant(),
45831 },
45832 field_size: match l27 {
45833 0 => None,
45834 1 => {
45835 let e = {
45836 let l28 = *ptr0.add(52).cast::<i32>();
45837 l28 as u32
45838 };
45839 Some(e)
45840 }
45841 _ => _rt::invalid_enum_discriminant(),
45842 },
45843 }
45844 };
45845 Some(e)
45846 }
45847 _ => _rt::invalid_enum_discriminant(),
45848 }
45849 };
45850 ErrorCode::HttpRequestHeaderSize(e67)
45851 }
45852 23 => {
45853 let e67 = {
45854 let l29 = i32::from(*ptr0.add(32).cast::<u8>());
45855 match l29 {
45856 0 => None,
45857 1 => {
45858 let e = {
45859 let l30 = *ptr0.add(36).cast::<i32>();
45860 l30 as u32
45861 };
45862 Some(e)
45863 }
45864 _ => _rt::invalid_enum_discriminant(),
45865 }
45866 };
45867 ErrorCode::HttpRequestTrailerSectionSize(e67)
45868 }
45869 24 => {
45870 let e67 = {
45871 let l31 = i32::from(*ptr0.add(32).cast::<u8>());
45872 let l35 = i32::from(*ptr0.add(44).cast::<u8>());
45873 FieldSizePayload {
45874 field_name: match l31 {
45875 0 => None,
45876 1 => {
45877 let e = {
45878 let l32 = *ptr0.add(36).cast::<*mut u8>();
45879 let l33 = *ptr0.add(40).cast::<usize>();
45880 let len34 = l33;
45881 let bytes34 = _rt::Vec::from_raw_parts(
45882 l32.cast(),
45883 len34,
45884 len34,
45885 );
45886 _rt::string_lift(bytes34)
45887 };
45888 Some(e)
45889 }
45890 _ => _rt::invalid_enum_discriminant(),
45891 },
45892 field_size: match l35 {
45893 0 => None,
45894 1 => {
45895 let e = {
45896 let l36 = *ptr0.add(48).cast::<i32>();
45897 l36 as u32
45898 };
45899 Some(e)
45900 }
45901 _ => _rt::invalid_enum_discriminant(),
45902 },
45903 }
45904 };
45905 ErrorCode::HttpRequestTrailerSize(e67)
45906 }
45907 25 => ErrorCode::HttpResponseIncomplete,
45908 26 => {
45909 let e67 = {
45910 let l37 = i32::from(*ptr0.add(32).cast::<u8>());
45911 match l37 {
45912 0 => None,
45913 1 => {
45914 let e = {
45915 let l38 = *ptr0.add(36).cast::<i32>();
45916 l38 as u32
45917 };
45918 Some(e)
45919 }
45920 _ => _rt::invalid_enum_discriminant(),
45921 }
45922 };
45923 ErrorCode::HttpResponseHeaderSectionSize(e67)
45924 }
45925 27 => {
45926 let e67 = {
45927 let l39 = i32::from(*ptr0.add(32).cast::<u8>());
45928 let l43 = i32::from(*ptr0.add(44).cast::<u8>());
45929 FieldSizePayload {
45930 field_name: match l39 {
45931 0 => None,
45932 1 => {
45933 let e = {
45934 let l40 = *ptr0.add(36).cast::<*mut u8>();
45935 let l41 = *ptr0.add(40).cast::<usize>();
45936 let len42 = l41;
45937 let bytes42 = _rt::Vec::from_raw_parts(
45938 l40.cast(),
45939 len42,
45940 len42,
45941 );
45942 _rt::string_lift(bytes42)
45943 };
45944 Some(e)
45945 }
45946 _ => _rt::invalid_enum_discriminant(),
45947 },
45948 field_size: match l43 {
45949 0 => None,
45950 1 => {
45951 let e = {
45952 let l44 = *ptr0.add(48).cast::<i32>();
45953 l44 as u32
45954 };
45955 Some(e)
45956 }
45957 _ => _rt::invalid_enum_discriminant(),
45958 },
45959 }
45960 };
45961 ErrorCode::HttpResponseHeaderSize(e67)
45962 }
45963 28 => {
45964 let e67 = {
45965 let l45 = i32::from(*ptr0.add(32).cast::<u8>());
45966 match l45 {
45967 0 => None,
45968 1 => {
45969 let e = {
45970 let l46 = *ptr0.add(40).cast::<i64>();
45971 l46 as u64
45972 };
45973 Some(e)
45974 }
45975 _ => _rt::invalid_enum_discriminant(),
45976 }
45977 };
45978 ErrorCode::HttpResponseBodySize(e67)
45979 }
45980 29 => {
45981 let e67 = {
45982 let l47 = i32::from(*ptr0.add(32).cast::<u8>());
45983 match l47 {
45984 0 => None,
45985 1 => {
45986 let e = {
45987 let l48 = *ptr0.add(36).cast::<i32>();
45988 l48 as u32
45989 };
45990 Some(e)
45991 }
45992 _ => _rt::invalid_enum_discriminant(),
45993 }
45994 };
45995 ErrorCode::HttpResponseTrailerSectionSize(e67)
45996 }
45997 30 => {
45998 let e67 = {
45999 let l49 = i32::from(*ptr0.add(32).cast::<u8>());
46000 let l53 = i32::from(*ptr0.add(44).cast::<u8>());
46001 FieldSizePayload {
46002 field_name: match l49 {
46003 0 => None,
46004 1 => {
46005 let e = {
46006 let l50 = *ptr0.add(36).cast::<*mut u8>();
46007 let l51 = *ptr0.add(40).cast::<usize>();
46008 let len52 = l51;
46009 let bytes52 = _rt::Vec::from_raw_parts(
46010 l50.cast(),
46011 len52,
46012 len52,
46013 );
46014 _rt::string_lift(bytes52)
46015 };
46016 Some(e)
46017 }
46018 _ => _rt::invalid_enum_discriminant(),
46019 },
46020 field_size: match l53 {
46021 0 => None,
46022 1 => {
46023 let e = {
46024 let l54 = *ptr0.add(48).cast::<i32>();
46025 l54 as u32
46026 };
46027 Some(e)
46028 }
46029 _ => _rt::invalid_enum_discriminant(),
46030 },
46031 }
46032 };
46033 ErrorCode::HttpResponseTrailerSize(e67)
46034 }
46035 31 => {
46036 let e67 = {
46037 let l55 = i32::from(*ptr0.add(32).cast::<u8>());
46038 match l55 {
46039 0 => None,
46040 1 => {
46041 let e = {
46042 let l56 = *ptr0.add(36).cast::<*mut u8>();
46043 let l57 = *ptr0.add(40).cast::<usize>();
46044 let len58 = l57;
46045 let bytes58 = _rt::Vec::from_raw_parts(
46046 l56.cast(),
46047 len58,
46048 len58,
46049 );
46050 _rt::string_lift(bytes58)
46051 };
46052 Some(e)
46053 }
46054 _ => _rt::invalid_enum_discriminant(),
46055 }
46056 };
46057 ErrorCode::HttpResponseTransferCoding(e67)
46058 }
46059 32 => {
46060 let e67 = {
46061 let l59 = i32::from(*ptr0.add(32).cast::<u8>());
46062 match l59 {
46063 0 => None,
46064 1 => {
46065 let e = {
46066 let l60 = *ptr0.add(36).cast::<*mut u8>();
46067 let l61 = *ptr0.add(40).cast::<usize>();
46068 let len62 = l61;
46069 let bytes62 = _rt::Vec::from_raw_parts(
46070 l60.cast(),
46071 len62,
46072 len62,
46073 );
46074 _rt::string_lift(bytes62)
46075 };
46076 Some(e)
46077 }
46078 _ => _rt::invalid_enum_discriminant(),
46079 }
46080 };
46081 ErrorCode::HttpResponseContentCoding(e67)
46082 }
46083 33 => ErrorCode::HttpResponseTimeout,
46084 34 => ErrorCode::HttpUpgradeFailed,
46085 35 => ErrorCode::HttpProtocolError,
46086 36 => ErrorCode::LoopDetected,
46087 37 => ErrorCode::ConfigurationError,
46088 n => {
46089 debug_assert_eq!(n, 38, "invalid enum discriminant");
46090 let e67 = {
46091 let l63 = i32::from(*ptr0.add(32).cast::<u8>());
46092 match l63 {
46093 0 => None,
46094 1 => {
46095 let e = {
46096 let l64 = *ptr0.add(36).cast::<*mut u8>();
46097 let l65 = *ptr0.add(40).cast::<usize>();
46098 let len66 = l65;
46099 let bytes66 = _rt::Vec::from_raw_parts(
46100 l64.cast(),
46101 len66,
46102 len66,
46103 );
46104 _rt::string_lift(bytes66)
46105 };
46106 Some(e)
46107 }
46108 _ => _rt::invalid_enum_discriminant(),
46109 }
46110 };
46111 ErrorCode::InternalError(e67)
46112 }
46113 };
46114 v67
46115 };
46116 Err(e)
46117 }
46118 _ => _rt::invalid_enum_discriminant(),
46119 }
46120 };
46121 Ok(e)
46122 }
46123 1 => {
46124 let e = ();
46125 Err(e)
46126 }
46127 _ => _rt::invalid_enum_discriminant(),
46128 }
46129 };
46130 Some(e)
46131 }
46132 _ => _rt::invalid_enum_discriminant(),
46133 }
46134 }
46135 }
46136 }
46137 }
46138 /// This interface defines a handler of outgoing HTTP Requests. It should be
46139 /// imported by components which wish to make HTTP Requests.
46140 #[allow(dead_code, clippy::all)]
46141 pub mod outgoing_handler {
46142 #[used]
46143 #[doc(hidden)]
46144 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
46145 use super::super::super::_rt;
46146 pub type OutgoingRequest = super::super::super::wasi::http::types::OutgoingRequest;
46147 pub type RequestOptions = super::super::super::wasi::http::types::RequestOptions;
46148 pub type FutureIncomingResponse = super::super::super::wasi::http::types::FutureIncomingResponse;
46149 pub type ErrorCode = super::super::super::wasi::http::types::ErrorCode;
46150 #[allow(unused_unsafe, clippy::all)]
46151 /// This function is invoked with an outgoing HTTP Request, and it returns
46152 /// a resource `future-incoming-response` which represents an HTTP Response
46153 /// which may arrive in the future.
46154 ///
46155 /// The `options` argument accepts optional parameters for the HTTP
46156 /// protocol's transport layer.
46157 ///
46158 /// This function may return an error if the `outgoing-request` is invalid
46159 /// or not allowed to be made. Otherwise, protocol errors are reported
46160 /// through the `future-incoming-response`.
46161 pub fn handle(
46162 request: OutgoingRequest,
46163 options: Option<RequestOptions>,
46164 ) -> Result<FutureIncomingResponse, ErrorCode> {
46165 unsafe {
46166 #[repr(align(8))]
46167 struct RetArea([::core::mem::MaybeUninit<u8>; 40]);
46168 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 40]);
46169 let (result0_0, result0_1) = match &options {
46170 Some(e) => (1i32, (e).take_handle() as i32),
46171 None => (0i32, 0i32),
46172 };
46173 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
46174 #[cfg(target_arch = "wasm32")]
46175 #[link(wasm_import_module = "wasi:http/outgoing-handler@0.2.0")]
46176 extern "C" {
46177 #[link_name = "handle"]
46178 fn wit_import(_: i32, _: i32, _: i32, _: *mut u8);
46179 }
46180 #[cfg(not(target_arch = "wasm32"))]
46181 fn wit_import(_: i32, _: i32, _: i32, _: *mut u8) {
46182 unreachable!()
46183 }
46184 wit_import(
46185 (&request).take_handle() as i32,
46186 result0_0,
46187 result0_1,
46188 ptr1,
46189 );
46190 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
46191 match l2 {
46192 0 => {
46193 let e = {
46194 let l3 = *ptr1.add(8).cast::<i32>();
46195 super::super::super::wasi::http::types::FutureIncomingResponse::from_handle(
46196 l3 as u32,
46197 )
46198 };
46199 Ok(e)
46200 }
46201 1 => {
46202 let e = {
46203 let l4 = i32::from(*ptr1.add(8).cast::<u8>());
46204 use super::super::super::wasi::http::types::ErrorCode as V66;
46205 let v66 = match l4 {
46206 0 => V66::DnsTimeout,
46207 1 => {
46208 let e66 = {
46209 let l5 = i32::from(*ptr1.add(16).cast::<u8>());
46210 let l9 = i32::from(*ptr1.add(28).cast::<u8>());
46211 super::super::super::wasi::http::types::DnsErrorPayload {
46212 rcode: match l5 {
46213 0 => None,
46214 1 => {
46215 let e = {
46216 let l6 = *ptr1.add(20).cast::<*mut u8>();
46217 let l7 = *ptr1.add(24).cast::<usize>();
46218 let len8 = l7;
46219 let bytes8 = _rt::Vec::from_raw_parts(
46220 l6.cast(),
46221 len8,
46222 len8,
46223 );
46224 _rt::string_lift(bytes8)
46225 };
46226 Some(e)
46227 }
46228 _ => _rt::invalid_enum_discriminant(),
46229 },
46230 info_code: match l9 {
46231 0 => None,
46232 1 => {
46233 let e = {
46234 let l10 = i32::from(*ptr1.add(30).cast::<u16>());
46235 l10 as u16
46236 };
46237 Some(e)
46238 }
46239 _ => _rt::invalid_enum_discriminant(),
46240 },
46241 }
46242 };
46243 V66::DnsError(e66)
46244 }
46245 2 => V66::DestinationNotFound,
46246 3 => V66::DestinationUnavailable,
46247 4 => V66::DestinationIpProhibited,
46248 5 => V66::DestinationIpUnroutable,
46249 6 => V66::ConnectionRefused,
46250 7 => V66::ConnectionTerminated,
46251 8 => V66::ConnectionTimeout,
46252 9 => V66::ConnectionReadTimeout,
46253 10 => V66::ConnectionWriteTimeout,
46254 11 => V66::ConnectionLimitReached,
46255 12 => V66::TlsProtocolError,
46256 13 => V66::TlsCertificateError,
46257 14 => {
46258 let e66 = {
46259 let l11 = i32::from(*ptr1.add(16).cast::<u8>());
46260 let l13 = i32::from(*ptr1.add(20).cast::<u8>());
46261 super::super::super::wasi::http::types::TlsAlertReceivedPayload {
46262 alert_id: match l11 {
46263 0 => None,
46264 1 => {
46265 let e = {
46266 let l12 = i32::from(*ptr1.add(17).cast::<u8>());
46267 l12 as u8
46268 };
46269 Some(e)
46270 }
46271 _ => _rt::invalid_enum_discriminant(),
46272 },
46273 alert_message: match l13 {
46274 0 => None,
46275 1 => {
46276 let e = {
46277 let l14 = *ptr1.add(24).cast::<*mut u8>();
46278 let l15 = *ptr1.add(28).cast::<usize>();
46279 let len16 = l15;
46280 let bytes16 = _rt::Vec::from_raw_parts(
46281 l14.cast(),
46282 len16,
46283 len16,
46284 );
46285 _rt::string_lift(bytes16)
46286 };
46287 Some(e)
46288 }
46289 _ => _rt::invalid_enum_discriminant(),
46290 },
46291 }
46292 };
46293 V66::TlsAlertReceived(e66)
46294 }
46295 15 => V66::HttpRequestDenied,
46296 16 => V66::HttpRequestLengthRequired,
46297 17 => {
46298 let e66 = {
46299 let l17 = i32::from(*ptr1.add(16).cast::<u8>());
46300 match l17 {
46301 0 => None,
46302 1 => {
46303 let e = {
46304 let l18 = *ptr1.add(24).cast::<i64>();
46305 l18 as u64
46306 };
46307 Some(e)
46308 }
46309 _ => _rt::invalid_enum_discriminant(),
46310 }
46311 };
46312 V66::HttpRequestBodySize(e66)
46313 }
46314 18 => V66::HttpRequestMethodInvalid,
46315 19 => V66::HttpRequestUriInvalid,
46316 20 => V66::HttpRequestUriTooLong,
46317 21 => {
46318 let e66 = {
46319 let l19 = i32::from(*ptr1.add(16).cast::<u8>());
46320 match l19 {
46321 0 => None,
46322 1 => {
46323 let e = {
46324 let l20 = *ptr1.add(20).cast::<i32>();
46325 l20 as u32
46326 };
46327 Some(e)
46328 }
46329 _ => _rt::invalid_enum_discriminant(),
46330 }
46331 };
46332 V66::HttpRequestHeaderSectionSize(e66)
46333 }
46334 22 => {
46335 let e66 = {
46336 let l21 = i32::from(*ptr1.add(16).cast::<u8>());
46337 match l21 {
46338 0 => None,
46339 1 => {
46340 let e = {
46341 let l22 = i32::from(*ptr1.add(20).cast::<u8>());
46342 let l26 = i32::from(*ptr1.add(32).cast::<u8>());
46343 super::super::super::wasi::http::types::FieldSizePayload {
46344 field_name: match l22 {
46345 0 => None,
46346 1 => {
46347 let e = {
46348 let l23 = *ptr1.add(24).cast::<*mut u8>();
46349 let l24 = *ptr1.add(28).cast::<usize>();
46350 let len25 = l24;
46351 let bytes25 = _rt::Vec::from_raw_parts(
46352 l23.cast(),
46353 len25,
46354 len25,
46355 );
46356 _rt::string_lift(bytes25)
46357 };
46358 Some(e)
46359 }
46360 _ => _rt::invalid_enum_discriminant(),
46361 },
46362 field_size: match l26 {
46363 0 => None,
46364 1 => {
46365 let e = {
46366 let l27 = *ptr1.add(36).cast::<i32>();
46367 l27 as u32
46368 };
46369 Some(e)
46370 }
46371 _ => _rt::invalid_enum_discriminant(),
46372 },
46373 }
46374 };
46375 Some(e)
46376 }
46377 _ => _rt::invalid_enum_discriminant(),
46378 }
46379 };
46380 V66::HttpRequestHeaderSize(e66)
46381 }
46382 23 => {
46383 let e66 = {
46384 let l28 = i32::from(*ptr1.add(16).cast::<u8>());
46385 match l28 {
46386 0 => None,
46387 1 => {
46388 let e = {
46389 let l29 = *ptr1.add(20).cast::<i32>();
46390 l29 as u32
46391 };
46392 Some(e)
46393 }
46394 _ => _rt::invalid_enum_discriminant(),
46395 }
46396 };
46397 V66::HttpRequestTrailerSectionSize(e66)
46398 }
46399 24 => {
46400 let e66 = {
46401 let l30 = i32::from(*ptr1.add(16).cast::<u8>());
46402 let l34 = i32::from(*ptr1.add(28).cast::<u8>());
46403 super::super::super::wasi::http::types::FieldSizePayload {
46404 field_name: match l30 {
46405 0 => None,
46406 1 => {
46407 let e = {
46408 let l31 = *ptr1.add(20).cast::<*mut u8>();
46409 let l32 = *ptr1.add(24).cast::<usize>();
46410 let len33 = l32;
46411 let bytes33 = _rt::Vec::from_raw_parts(
46412 l31.cast(),
46413 len33,
46414 len33,
46415 );
46416 _rt::string_lift(bytes33)
46417 };
46418 Some(e)
46419 }
46420 _ => _rt::invalid_enum_discriminant(),
46421 },
46422 field_size: match l34 {
46423 0 => None,
46424 1 => {
46425 let e = {
46426 let l35 = *ptr1.add(32).cast::<i32>();
46427 l35 as u32
46428 };
46429 Some(e)
46430 }
46431 _ => _rt::invalid_enum_discriminant(),
46432 },
46433 }
46434 };
46435 V66::HttpRequestTrailerSize(e66)
46436 }
46437 25 => V66::HttpResponseIncomplete,
46438 26 => {
46439 let e66 = {
46440 let l36 = i32::from(*ptr1.add(16).cast::<u8>());
46441 match l36 {
46442 0 => None,
46443 1 => {
46444 let e = {
46445 let l37 = *ptr1.add(20).cast::<i32>();
46446 l37 as u32
46447 };
46448 Some(e)
46449 }
46450 _ => _rt::invalid_enum_discriminant(),
46451 }
46452 };
46453 V66::HttpResponseHeaderSectionSize(e66)
46454 }
46455 27 => {
46456 let e66 = {
46457 let l38 = i32::from(*ptr1.add(16).cast::<u8>());
46458 let l42 = i32::from(*ptr1.add(28).cast::<u8>());
46459 super::super::super::wasi::http::types::FieldSizePayload {
46460 field_name: match l38 {
46461 0 => None,
46462 1 => {
46463 let e = {
46464 let l39 = *ptr1.add(20).cast::<*mut u8>();
46465 let l40 = *ptr1.add(24).cast::<usize>();
46466 let len41 = l40;
46467 let bytes41 = _rt::Vec::from_raw_parts(
46468 l39.cast(),
46469 len41,
46470 len41,
46471 );
46472 _rt::string_lift(bytes41)
46473 };
46474 Some(e)
46475 }
46476 _ => _rt::invalid_enum_discriminant(),
46477 },
46478 field_size: match l42 {
46479 0 => None,
46480 1 => {
46481 let e = {
46482 let l43 = *ptr1.add(32).cast::<i32>();
46483 l43 as u32
46484 };
46485 Some(e)
46486 }
46487 _ => _rt::invalid_enum_discriminant(),
46488 },
46489 }
46490 };
46491 V66::HttpResponseHeaderSize(e66)
46492 }
46493 28 => {
46494 let e66 = {
46495 let l44 = i32::from(*ptr1.add(16).cast::<u8>());
46496 match l44 {
46497 0 => None,
46498 1 => {
46499 let e = {
46500 let l45 = *ptr1.add(24).cast::<i64>();
46501 l45 as u64
46502 };
46503 Some(e)
46504 }
46505 _ => _rt::invalid_enum_discriminant(),
46506 }
46507 };
46508 V66::HttpResponseBodySize(e66)
46509 }
46510 29 => {
46511 let e66 = {
46512 let l46 = i32::from(*ptr1.add(16).cast::<u8>());
46513 match l46 {
46514 0 => None,
46515 1 => {
46516 let e = {
46517 let l47 = *ptr1.add(20).cast::<i32>();
46518 l47 as u32
46519 };
46520 Some(e)
46521 }
46522 _ => _rt::invalid_enum_discriminant(),
46523 }
46524 };
46525 V66::HttpResponseTrailerSectionSize(e66)
46526 }
46527 30 => {
46528 let e66 = {
46529 let l48 = i32::from(*ptr1.add(16).cast::<u8>());
46530 let l52 = i32::from(*ptr1.add(28).cast::<u8>());
46531 super::super::super::wasi::http::types::FieldSizePayload {
46532 field_name: match l48 {
46533 0 => None,
46534 1 => {
46535 let e = {
46536 let l49 = *ptr1.add(20).cast::<*mut u8>();
46537 let l50 = *ptr1.add(24).cast::<usize>();
46538 let len51 = l50;
46539 let bytes51 = _rt::Vec::from_raw_parts(
46540 l49.cast(),
46541 len51,
46542 len51,
46543 );
46544 _rt::string_lift(bytes51)
46545 };
46546 Some(e)
46547 }
46548 _ => _rt::invalid_enum_discriminant(),
46549 },
46550 field_size: match l52 {
46551 0 => None,
46552 1 => {
46553 let e = {
46554 let l53 = *ptr1.add(32).cast::<i32>();
46555 l53 as u32
46556 };
46557 Some(e)
46558 }
46559 _ => _rt::invalid_enum_discriminant(),
46560 },
46561 }
46562 };
46563 V66::HttpResponseTrailerSize(e66)
46564 }
46565 31 => {
46566 let e66 = {
46567 let l54 = i32::from(*ptr1.add(16).cast::<u8>());
46568 match l54 {
46569 0 => None,
46570 1 => {
46571 let e = {
46572 let l55 = *ptr1.add(20).cast::<*mut u8>();
46573 let l56 = *ptr1.add(24).cast::<usize>();
46574 let len57 = l56;
46575 let bytes57 = _rt::Vec::from_raw_parts(
46576 l55.cast(),
46577 len57,
46578 len57,
46579 );
46580 _rt::string_lift(bytes57)
46581 };
46582 Some(e)
46583 }
46584 _ => _rt::invalid_enum_discriminant(),
46585 }
46586 };
46587 V66::HttpResponseTransferCoding(e66)
46588 }
46589 32 => {
46590 let e66 = {
46591 let l58 = i32::from(*ptr1.add(16).cast::<u8>());
46592 match l58 {
46593 0 => None,
46594 1 => {
46595 let e = {
46596 let l59 = *ptr1.add(20).cast::<*mut u8>();
46597 let l60 = *ptr1.add(24).cast::<usize>();
46598 let len61 = l60;
46599 let bytes61 = _rt::Vec::from_raw_parts(
46600 l59.cast(),
46601 len61,
46602 len61,
46603 );
46604 _rt::string_lift(bytes61)
46605 };
46606 Some(e)
46607 }
46608 _ => _rt::invalid_enum_discriminant(),
46609 }
46610 };
46611 V66::HttpResponseContentCoding(e66)
46612 }
46613 33 => V66::HttpResponseTimeout,
46614 34 => V66::HttpUpgradeFailed,
46615 35 => V66::HttpProtocolError,
46616 36 => V66::LoopDetected,
46617 37 => V66::ConfigurationError,
46618 n => {
46619 debug_assert_eq!(n, 38, "invalid enum discriminant");
46620 let e66 = {
46621 let l62 = i32::from(*ptr1.add(16).cast::<u8>());
46622 match l62 {
46623 0 => None,
46624 1 => {
46625 let e = {
46626 let l63 = *ptr1.add(20).cast::<*mut u8>();
46627 let l64 = *ptr1.add(24).cast::<usize>();
46628 let len65 = l64;
46629 let bytes65 = _rt::Vec::from_raw_parts(
46630 l63.cast(),
46631 len65,
46632 len65,
46633 );
46634 _rt::string_lift(bytes65)
46635 };
46636 Some(e)
46637 }
46638 _ => _rt::invalid_enum_discriminant(),
46639 }
46640 };
46641 V66::InternalError(e66)
46642 }
46643 };
46644 v66
46645 };
46646 Err(e)
46647 }
46648 _ => _rt::invalid_enum_discriminant(),
46649 }
46650 }
46651 }
46652 }
46653 }
46654 pub mod io {
46655 /// A poll API intended to let users wait for I/O events on multiple handles
46656 /// at once.
46657 #[allow(dead_code, clippy::all)]
46658 pub mod poll {
46659 #[used]
46660 #[doc(hidden)]
46661 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
46662 use super::super::super::_rt;
46663 /// `pollable` epresents a single I/O event which may be ready, or not.
46664 #[derive(Debug)]
46665 #[repr(transparent)]
46666 pub struct Pollable {
46667 handle: _rt::Resource<Pollable>,
46668 }
46669 impl Pollable {
46670 #[doc(hidden)]
46671 pub unsafe fn from_handle(handle: u32) -> Self {
46672 Self {
46673 handle: _rt::Resource::from_handle(handle),
46674 }
46675 }
46676 #[doc(hidden)]
46677 pub fn take_handle(&self) -> u32 {
46678 _rt::Resource::take_handle(&self.handle)
46679 }
46680 #[doc(hidden)]
46681 pub fn handle(&self) -> u32 {
46682 _rt::Resource::handle(&self.handle)
46683 }
46684 }
46685 unsafe impl _rt::WasmResource for Pollable {
46686 #[inline]
46687 unsafe fn drop(_handle: u32) {
46688 #[cfg(not(target_arch = "wasm32"))]
46689 unreachable!();
46690 #[cfg(target_arch = "wasm32")]
46691 {
46692 #[link(wasm_import_module = "wasi:io/poll@0.2.0")]
46693 extern "C" {
46694 #[link_name = "[resource-drop]pollable"]
46695 fn drop(_: u32);
46696 }
46697 drop(_handle);
46698 }
46699 }
46700 }
46701 impl Pollable {
46702 #[allow(unused_unsafe, clippy::all)]
46703 /// Return the readiness of a pollable. This function never blocks.
46704 ///
46705 /// Returns `true` when the pollable is ready, and `false` otherwise.
46706 pub fn ready(&self) -> bool {
46707 unsafe {
46708 #[cfg(target_arch = "wasm32")]
46709 #[link(wasm_import_module = "wasi:io/poll@0.2.0")]
46710 extern "C" {
46711 #[link_name = "[method]pollable.ready"]
46712 fn wit_import(_: i32) -> i32;
46713 }
46714 #[cfg(not(target_arch = "wasm32"))]
46715 fn wit_import(_: i32) -> i32 {
46716 unreachable!()
46717 }
46718 let ret = wit_import((self).handle() as i32);
46719 _rt::bool_lift(ret as u8)
46720 }
46721 }
46722 }
46723 impl Pollable {
46724 #[allow(unused_unsafe, clippy::all)]
46725 /// `block` returns immediately if the pollable is ready, and otherwise
46726 /// blocks until ready.
46727 ///
46728 /// This function is equivalent to calling `poll.poll` on a list
46729 /// containing only this pollable.
46730 pub fn block(&self) {
46731 unsafe {
46732 #[cfg(target_arch = "wasm32")]
46733 #[link(wasm_import_module = "wasi:io/poll@0.2.0")]
46734 extern "C" {
46735 #[link_name = "[method]pollable.block"]
46736 fn wit_import(_: i32);
46737 }
46738 #[cfg(not(target_arch = "wasm32"))]
46739 fn wit_import(_: i32) {
46740 unreachable!()
46741 }
46742 wit_import((self).handle() as i32);
46743 }
46744 }
46745 }
46746 #[allow(unused_unsafe, clippy::all)]
46747 /// Poll for completion on a set of pollables.
46748 ///
46749 /// This function takes a list of pollables, which identify I/O sources of
46750 /// interest, and waits until one or more of the events is ready for I/O.
46751 ///
46752 /// The result `list<u32>` contains one or more indices of handles in the
46753 /// argument list that is ready for I/O.
46754 ///
46755 /// If the list contains more elements than can be indexed with a `u32`
46756 /// value, this function traps.
46757 ///
46758 /// A timeout can be implemented by adding a pollable from the
46759 /// wasi-clocks API to the list.
46760 ///
46761 /// This function does not return a `result`; polling in itself does not
46762 /// do any I/O so it doesn't fail. If any of the I/O sources identified by
46763 /// the pollables has an error, it is indicated by marking the source as
46764 /// being reaedy for I/O.
46765 pub fn poll(in_: &[&Pollable]) -> _rt::Vec<u32> {
46766 unsafe {
46767 #[repr(align(4))]
46768 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
46769 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
46770 let vec0 = in_;
46771 let len0 = vec0.len();
46772 let layout0 = _rt::alloc::Layout::from_size_align_unchecked(
46773 vec0.len() * 4,
46774 4,
46775 );
46776 let result0 = if layout0.size() != 0 {
46777 let ptr = _rt::alloc::alloc(layout0).cast::<u8>();
46778 if ptr.is_null() {
46779 _rt::alloc::handle_alloc_error(layout0);
46780 }
46781 ptr
46782 } else {
46783 ::core::ptr::null_mut()
46784 };
46785 for (i, e) in vec0.into_iter().enumerate() {
46786 let base = result0.add(i * 4);
46787 {
46788 *base.add(0).cast::<i32>() = (e).handle() as i32;
46789 }
46790 }
46791 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
46792 #[cfg(target_arch = "wasm32")]
46793 #[link(wasm_import_module = "wasi:io/poll@0.2.0")]
46794 extern "C" {
46795 #[link_name = "poll"]
46796 fn wit_import(_: *mut u8, _: usize, _: *mut u8);
46797 }
46798 #[cfg(not(target_arch = "wasm32"))]
46799 fn wit_import(_: *mut u8, _: usize, _: *mut u8) {
46800 unreachable!()
46801 }
46802 wit_import(result0, len0, ptr1);
46803 let l2 = *ptr1.add(0).cast::<*mut u8>();
46804 let l3 = *ptr1.add(4).cast::<usize>();
46805 let len4 = l3;
46806 if layout0.size() != 0 {
46807 _rt::alloc::dealloc(result0.cast(), layout0);
46808 }
46809 _rt::Vec::from_raw_parts(l2.cast(), len4, len4)
46810 }
46811 }
46812 }
46813 #[allow(dead_code, clippy::all)]
46814 pub mod error {
46815 #[used]
46816 #[doc(hidden)]
46817 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
46818 use super::super::super::_rt;
46819 /// A resource which represents some error information.
46820 ///
46821 /// The only method provided by this resource is `to-debug-string`,
46822 /// which provides some human-readable information about the error.
46823 ///
46824 /// In the `wasi:io` package, this resource is returned through the
46825 /// `wasi:io/streams/stream-error` type.
46826 ///
46827 /// To provide more specific error information, other interfaces may
46828 /// provide functions to further "downcast" this error into more specific
46829 /// error information. For example, `error`s returned in streams derived
46830 /// from filesystem types to be described using the filesystem's own
46831 /// error-code type, using the function
46832 /// `wasi:filesystem/types/filesystem-error-code`, which takes a parameter
46833 /// `borrow<error>` and returns
46834 /// `option<wasi:filesystem/types/error-code>`.
46835 ///
46836 /// The set of functions which can "downcast" an `error` into a more
46837 /// concrete type is open.
46838 #[derive(Debug)]
46839 #[repr(transparent)]
46840 pub struct Error {
46841 handle: _rt::Resource<Error>,
46842 }
46843 impl Error {
46844 #[doc(hidden)]
46845 pub unsafe fn from_handle(handle: u32) -> Self {
46846 Self {
46847 handle: _rt::Resource::from_handle(handle),
46848 }
46849 }
46850 #[doc(hidden)]
46851 pub fn take_handle(&self) -> u32 {
46852 _rt::Resource::take_handle(&self.handle)
46853 }
46854 #[doc(hidden)]
46855 pub fn handle(&self) -> u32 {
46856 _rt::Resource::handle(&self.handle)
46857 }
46858 }
46859 unsafe impl _rt::WasmResource for Error {
46860 #[inline]
46861 unsafe fn drop(_handle: u32) {
46862 #[cfg(not(target_arch = "wasm32"))]
46863 unreachable!();
46864 #[cfg(target_arch = "wasm32")]
46865 {
46866 #[link(wasm_import_module = "wasi:io/error@0.2.0")]
46867 extern "C" {
46868 #[link_name = "[resource-drop]error"]
46869 fn drop(_: u32);
46870 }
46871 drop(_handle);
46872 }
46873 }
46874 }
46875 impl Error {
46876 #[allow(unused_unsafe, clippy::all)]
46877 /// Returns a string that is suitable to assist humans in debugging
46878 /// this error.
46879 ///
46880 /// WARNING: The returned string should not be consumed mechanically!
46881 /// It may change across platforms, hosts, or other implementation
46882 /// details. Parsing this string is a major platform-compatibility
46883 /// hazard.
46884 pub fn to_debug_string(&self) -> _rt::String {
46885 unsafe {
46886 #[repr(align(4))]
46887 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
46888 let mut ret_area = RetArea(
46889 [::core::mem::MaybeUninit::uninit(); 8],
46890 );
46891 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
46892 #[cfg(target_arch = "wasm32")]
46893 #[link(wasm_import_module = "wasi:io/error@0.2.0")]
46894 extern "C" {
46895 #[link_name = "[method]error.to-debug-string"]
46896 fn wit_import(_: i32, _: *mut u8);
46897 }
46898 #[cfg(not(target_arch = "wasm32"))]
46899 fn wit_import(_: i32, _: *mut u8) {
46900 unreachable!()
46901 }
46902 wit_import((self).handle() as i32, ptr0);
46903 let l1 = *ptr0.add(0).cast::<*mut u8>();
46904 let l2 = *ptr0.add(4).cast::<usize>();
46905 let len3 = l2;
46906 let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3);
46907 _rt::string_lift(bytes3)
46908 }
46909 }
46910 }
46911 }
46912 /// WASI I/O is an I/O abstraction API which is currently focused on providing
46913 /// stream types.
46914 ///
46915 /// In the future, the component model is expected to add built-in stream types;
46916 /// when it does, they are expected to subsume this API.
46917 #[allow(dead_code, clippy::all)]
46918 pub mod streams {
46919 #[used]
46920 #[doc(hidden)]
46921 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
46922 use super::super::super::_rt;
46923 pub type Error = super::super::super::wasi::io::error::Error;
46924 pub type Pollable = super::super::super::wasi::io::poll::Pollable;
46925 /// An error for input-stream and output-stream operations.
46926 pub enum StreamError {
46927 /// The last operation (a write or flush) failed before completion.
46928 ///
46929 /// More information is available in the `error` payload.
46930 LastOperationFailed(Error),
46931 /// The stream is closed: no more input will be accepted by the
46932 /// stream. A closed output-stream will return this error on all
46933 /// future operations.
46934 Closed,
46935 }
46936 impl ::core::fmt::Debug for StreamError {
46937 fn fmt(
46938 &self,
46939 f: &mut ::core::fmt::Formatter<'_>,
46940 ) -> ::core::fmt::Result {
46941 match self {
46942 StreamError::LastOperationFailed(e) => {
46943 f.debug_tuple("StreamError::LastOperationFailed")
46944 .field(e)
46945 .finish()
46946 }
46947 StreamError::Closed => {
46948 f.debug_tuple("StreamError::Closed").finish()
46949 }
46950 }
46951 }
46952 }
46953 impl ::core::fmt::Display for StreamError {
46954 fn fmt(
46955 &self,
46956 f: &mut ::core::fmt::Formatter<'_>,
46957 ) -> ::core::fmt::Result {
46958 write!(f, "{:?}", self)
46959 }
46960 }
46961 impl std::error::Error for StreamError {}
46962 /// An input bytestream.
46963 ///
46964 /// `input-stream`s are *non-blocking* to the extent practical on underlying
46965 /// platforms. I/O operations always return promptly; if fewer bytes are
46966 /// promptly available than requested, they return the number of bytes promptly
46967 /// available, which could even be zero. To wait for data to be available,
46968 /// use the `subscribe` function to obtain a `pollable` which can be polled
46969 /// for using `wasi:io/poll`.
46970 #[derive(Debug)]
46971 #[repr(transparent)]
46972 pub struct InputStream {
46973 handle: _rt::Resource<InputStream>,
46974 }
46975 impl InputStream {
46976 #[doc(hidden)]
46977 pub unsafe fn from_handle(handle: u32) -> Self {
46978 Self {
46979 handle: _rt::Resource::from_handle(handle),
46980 }
46981 }
46982 #[doc(hidden)]
46983 pub fn take_handle(&self) -> u32 {
46984 _rt::Resource::take_handle(&self.handle)
46985 }
46986 #[doc(hidden)]
46987 pub fn handle(&self) -> u32 {
46988 _rt::Resource::handle(&self.handle)
46989 }
46990 }
46991 unsafe impl _rt::WasmResource for InputStream {
46992 #[inline]
46993 unsafe fn drop(_handle: u32) {
46994 #[cfg(not(target_arch = "wasm32"))]
46995 unreachable!();
46996 #[cfg(target_arch = "wasm32")]
46997 {
46998 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
46999 extern "C" {
47000 #[link_name = "[resource-drop]input-stream"]
47001 fn drop(_: u32);
47002 }
47003 drop(_handle);
47004 }
47005 }
47006 }
47007 /// An output bytestream.
47008 ///
47009 /// `output-stream`s are *non-blocking* to the extent practical on
47010 /// underlying platforms. Except where specified otherwise, I/O operations also
47011 /// always return promptly, after the number of bytes that can be written
47012 /// promptly, which could even be zero. To wait for the stream to be ready to
47013 /// accept data, the `subscribe` function to obtain a `pollable` which can be
47014 /// polled for using `wasi:io/poll`.
47015 #[derive(Debug)]
47016 #[repr(transparent)]
47017 pub struct OutputStream {
47018 handle: _rt::Resource<OutputStream>,
47019 }
47020 impl OutputStream {
47021 #[doc(hidden)]
47022 pub unsafe fn from_handle(handle: u32) -> Self {
47023 Self {
47024 handle: _rt::Resource::from_handle(handle),
47025 }
47026 }
47027 #[doc(hidden)]
47028 pub fn take_handle(&self) -> u32 {
47029 _rt::Resource::take_handle(&self.handle)
47030 }
47031 #[doc(hidden)]
47032 pub fn handle(&self) -> u32 {
47033 _rt::Resource::handle(&self.handle)
47034 }
47035 }
47036 unsafe impl _rt::WasmResource for OutputStream {
47037 #[inline]
47038 unsafe fn drop(_handle: u32) {
47039 #[cfg(not(target_arch = "wasm32"))]
47040 unreachable!();
47041 #[cfg(target_arch = "wasm32")]
47042 {
47043 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47044 extern "C" {
47045 #[link_name = "[resource-drop]output-stream"]
47046 fn drop(_: u32);
47047 }
47048 drop(_handle);
47049 }
47050 }
47051 }
47052 impl InputStream {
47053 #[allow(unused_unsafe, clippy::all)]
47054 /// Perform a non-blocking read from the stream.
47055 ///
47056 /// This function returns a list of bytes containing the read data,
47057 /// when successful. The returned list will contain up to `len` bytes;
47058 /// it may return fewer than requested, but not more. The list is
47059 /// empty when no bytes are available for reading at this time. The
47060 /// pollable given by `subscribe` will be ready when more bytes are
47061 /// available.
47062 ///
47063 /// This function fails with a `stream-error` when the operation
47064 /// encounters an error, giving `last-operation-failed`, or when the
47065 /// stream is closed, giving `closed`.
47066 ///
47067 /// When the caller gives a `len` of 0, it represents a request to
47068 /// read 0 bytes. If the stream is still open, this call should
47069 /// succeed and return an empty list, or otherwise fail with `closed`.
47070 ///
47071 /// The `len` parameter is a `u64`, which could represent a list of u8 which
47072 /// is not possible to allocate in wasm32, or not desirable to allocate as
47073 /// as a return value by the callee. The callee may return a list of bytes
47074 /// less than `len` in size while more bytes are available for reading.
47075 pub fn read(&self, len: u64) -> Result<_rt::Vec<u8>, StreamError> {
47076 unsafe {
47077 #[repr(align(4))]
47078 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
47079 let mut ret_area = RetArea(
47080 [::core::mem::MaybeUninit::uninit(); 12],
47081 );
47082 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
47083 #[cfg(target_arch = "wasm32")]
47084 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47085 extern "C" {
47086 #[link_name = "[method]input-stream.read"]
47087 fn wit_import(_: i32, _: i64, _: *mut u8);
47088 }
47089 #[cfg(not(target_arch = "wasm32"))]
47090 fn wit_import(_: i32, _: i64, _: *mut u8) {
47091 unreachable!()
47092 }
47093 wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0);
47094 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
47095 match l1 {
47096 0 => {
47097 let e = {
47098 let l2 = *ptr0.add(4).cast::<*mut u8>();
47099 let l3 = *ptr0.add(8).cast::<usize>();
47100 let len4 = l3;
47101 _rt::Vec::from_raw_parts(l2.cast(), len4, len4)
47102 };
47103 Ok(e)
47104 }
47105 1 => {
47106 let e = {
47107 let l5 = i32::from(*ptr0.add(4).cast::<u8>());
47108 let v7 = match l5 {
47109 0 => {
47110 let e7 = {
47111 let l6 = *ptr0.add(8).cast::<i32>();
47112 super::super::super::wasi::io::error::Error::from_handle(
47113 l6 as u32,
47114 )
47115 };
47116 StreamError::LastOperationFailed(e7)
47117 }
47118 n => {
47119 debug_assert_eq!(n, 1, "invalid enum discriminant");
47120 StreamError::Closed
47121 }
47122 };
47123 v7
47124 };
47125 Err(e)
47126 }
47127 _ => _rt::invalid_enum_discriminant(),
47128 }
47129 }
47130 }
47131 }
47132 impl InputStream {
47133 #[allow(unused_unsafe, clippy::all)]
47134 /// Read bytes from a stream, after blocking until at least one byte can
47135 /// be read. Except for blocking, behavior is identical to `read`.
47136 pub fn blocking_read(
47137 &self,
47138 len: u64,
47139 ) -> Result<_rt::Vec<u8>, StreamError> {
47140 unsafe {
47141 #[repr(align(4))]
47142 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
47143 let mut ret_area = RetArea(
47144 [::core::mem::MaybeUninit::uninit(); 12],
47145 );
47146 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
47147 #[cfg(target_arch = "wasm32")]
47148 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47149 extern "C" {
47150 #[link_name = "[method]input-stream.blocking-read"]
47151 fn wit_import(_: i32, _: i64, _: *mut u8);
47152 }
47153 #[cfg(not(target_arch = "wasm32"))]
47154 fn wit_import(_: i32, _: i64, _: *mut u8) {
47155 unreachable!()
47156 }
47157 wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0);
47158 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
47159 match l1 {
47160 0 => {
47161 let e = {
47162 let l2 = *ptr0.add(4).cast::<*mut u8>();
47163 let l3 = *ptr0.add(8).cast::<usize>();
47164 let len4 = l3;
47165 _rt::Vec::from_raw_parts(l2.cast(), len4, len4)
47166 };
47167 Ok(e)
47168 }
47169 1 => {
47170 let e = {
47171 let l5 = i32::from(*ptr0.add(4).cast::<u8>());
47172 let v7 = match l5 {
47173 0 => {
47174 let e7 = {
47175 let l6 = *ptr0.add(8).cast::<i32>();
47176 super::super::super::wasi::io::error::Error::from_handle(
47177 l6 as u32,
47178 )
47179 };
47180 StreamError::LastOperationFailed(e7)
47181 }
47182 n => {
47183 debug_assert_eq!(n, 1, "invalid enum discriminant");
47184 StreamError::Closed
47185 }
47186 };
47187 v7
47188 };
47189 Err(e)
47190 }
47191 _ => _rt::invalid_enum_discriminant(),
47192 }
47193 }
47194 }
47195 }
47196 impl InputStream {
47197 #[allow(unused_unsafe, clippy::all)]
47198 /// Skip bytes from a stream. Returns number of bytes skipped.
47199 ///
47200 /// Behaves identical to `read`, except instead of returning a list
47201 /// of bytes, returns the number of bytes consumed from the stream.
47202 pub fn skip(&self, len: u64) -> Result<u64, StreamError> {
47203 unsafe {
47204 #[repr(align(8))]
47205 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
47206 let mut ret_area = RetArea(
47207 [::core::mem::MaybeUninit::uninit(); 16],
47208 );
47209 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
47210 #[cfg(target_arch = "wasm32")]
47211 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47212 extern "C" {
47213 #[link_name = "[method]input-stream.skip"]
47214 fn wit_import(_: i32, _: i64, _: *mut u8);
47215 }
47216 #[cfg(not(target_arch = "wasm32"))]
47217 fn wit_import(_: i32, _: i64, _: *mut u8) {
47218 unreachable!()
47219 }
47220 wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0);
47221 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
47222 match l1 {
47223 0 => {
47224 let e = {
47225 let l2 = *ptr0.add(8).cast::<i64>();
47226 l2 as u64
47227 };
47228 Ok(e)
47229 }
47230 1 => {
47231 let e = {
47232 let l3 = i32::from(*ptr0.add(8).cast::<u8>());
47233 let v5 = match l3 {
47234 0 => {
47235 let e5 = {
47236 let l4 = *ptr0.add(12).cast::<i32>();
47237 super::super::super::wasi::io::error::Error::from_handle(
47238 l4 as u32,
47239 )
47240 };
47241 StreamError::LastOperationFailed(e5)
47242 }
47243 n => {
47244 debug_assert_eq!(n, 1, "invalid enum discriminant");
47245 StreamError::Closed
47246 }
47247 };
47248 v5
47249 };
47250 Err(e)
47251 }
47252 _ => _rt::invalid_enum_discriminant(),
47253 }
47254 }
47255 }
47256 }
47257 impl InputStream {
47258 #[allow(unused_unsafe, clippy::all)]
47259 /// Skip bytes from a stream, after blocking until at least one byte
47260 /// can be skipped. Except for blocking behavior, identical to `skip`.
47261 pub fn blocking_skip(&self, len: u64) -> Result<u64, StreamError> {
47262 unsafe {
47263 #[repr(align(8))]
47264 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
47265 let mut ret_area = RetArea(
47266 [::core::mem::MaybeUninit::uninit(); 16],
47267 );
47268 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
47269 #[cfg(target_arch = "wasm32")]
47270 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47271 extern "C" {
47272 #[link_name = "[method]input-stream.blocking-skip"]
47273 fn wit_import(_: i32, _: i64, _: *mut u8);
47274 }
47275 #[cfg(not(target_arch = "wasm32"))]
47276 fn wit_import(_: i32, _: i64, _: *mut u8) {
47277 unreachable!()
47278 }
47279 wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0);
47280 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
47281 match l1 {
47282 0 => {
47283 let e = {
47284 let l2 = *ptr0.add(8).cast::<i64>();
47285 l2 as u64
47286 };
47287 Ok(e)
47288 }
47289 1 => {
47290 let e = {
47291 let l3 = i32::from(*ptr0.add(8).cast::<u8>());
47292 let v5 = match l3 {
47293 0 => {
47294 let e5 = {
47295 let l4 = *ptr0.add(12).cast::<i32>();
47296 super::super::super::wasi::io::error::Error::from_handle(
47297 l4 as u32,
47298 )
47299 };
47300 StreamError::LastOperationFailed(e5)
47301 }
47302 n => {
47303 debug_assert_eq!(n, 1, "invalid enum discriminant");
47304 StreamError::Closed
47305 }
47306 };
47307 v5
47308 };
47309 Err(e)
47310 }
47311 _ => _rt::invalid_enum_discriminant(),
47312 }
47313 }
47314 }
47315 }
47316 impl InputStream {
47317 #[allow(unused_unsafe, clippy::all)]
47318 /// Create a `pollable` which will resolve once either the specified stream
47319 /// has bytes available to read or the other end of the stream has been
47320 /// closed.
47321 /// The created `pollable` is a child resource of the `input-stream`.
47322 /// Implementations may trap if the `input-stream` is dropped before
47323 /// all derived `pollable`s created with this function are dropped.
47324 pub fn subscribe(&self) -> Pollable {
47325 unsafe {
47326 #[cfg(target_arch = "wasm32")]
47327 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47328 extern "C" {
47329 #[link_name = "[method]input-stream.subscribe"]
47330 fn wit_import(_: i32) -> i32;
47331 }
47332 #[cfg(not(target_arch = "wasm32"))]
47333 fn wit_import(_: i32) -> i32 {
47334 unreachable!()
47335 }
47336 let ret = wit_import((self).handle() as i32);
47337 super::super::super::wasi::io::poll::Pollable::from_handle(
47338 ret as u32,
47339 )
47340 }
47341 }
47342 }
47343 impl OutputStream {
47344 #[allow(unused_unsafe, clippy::all)]
47345 /// Check readiness for writing. This function never blocks.
47346 ///
47347 /// Returns the number of bytes permitted for the next call to `write`,
47348 /// or an error. Calling `write` with more bytes than this function has
47349 /// permitted will trap.
47350 ///
47351 /// When this function returns 0 bytes, the `subscribe` pollable will
47352 /// become ready when this function will report at least 1 byte, or an
47353 /// error.
47354 pub fn check_write(&self) -> Result<u64, StreamError> {
47355 unsafe {
47356 #[repr(align(8))]
47357 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
47358 let mut ret_area = RetArea(
47359 [::core::mem::MaybeUninit::uninit(); 16],
47360 );
47361 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
47362 #[cfg(target_arch = "wasm32")]
47363 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47364 extern "C" {
47365 #[link_name = "[method]output-stream.check-write"]
47366 fn wit_import(_: i32, _: *mut u8);
47367 }
47368 #[cfg(not(target_arch = "wasm32"))]
47369 fn wit_import(_: i32, _: *mut u8) {
47370 unreachable!()
47371 }
47372 wit_import((self).handle() as i32, ptr0);
47373 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
47374 match l1 {
47375 0 => {
47376 let e = {
47377 let l2 = *ptr0.add(8).cast::<i64>();
47378 l2 as u64
47379 };
47380 Ok(e)
47381 }
47382 1 => {
47383 let e = {
47384 let l3 = i32::from(*ptr0.add(8).cast::<u8>());
47385 let v5 = match l3 {
47386 0 => {
47387 let e5 = {
47388 let l4 = *ptr0.add(12).cast::<i32>();
47389 super::super::super::wasi::io::error::Error::from_handle(
47390 l4 as u32,
47391 )
47392 };
47393 StreamError::LastOperationFailed(e5)
47394 }
47395 n => {
47396 debug_assert_eq!(n, 1, "invalid enum discriminant");
47397 StreamError::Closed
47398 }
47399 };
47400 v5
47401 };
47402 Err(e)
47403 }
47404 _ => _rt::invalid_enum_discriminant(),
47405 }
47406 }
47407 }
47408 }
47409 impl OutputStream {
47410 #[allow(unused_unsafe, clippy::all)]
47411 /// Perform a write. This function never blocks.
47412 ///
47413 /// Precondition: check-write gave permit of Ok(n) and contents has a
47414 /// length of less than or equal to n. Otherwise, this function will trap.
47415 ///
47416 /// returns Err(closed) without writing if the stream has closed since
47417 /// the last call to check-write provided a permit.
47418 pub fn write(&self, contents: &[u8]) -> Result<(), StreamError> {
47419 unsafe {
47420 #[repr(align(4))]
47421 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
47422 let mut ret_area = RetArea(
47423 [::core::mem::MaybeUninit::uninit(); 12],
47424 );
47425 let vec0 = contents;
47426 let ptr0 = vec0.as_ptr().cast::<u8>();
47427 let len0 = vec0.len();
47428 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
47429 #[cfg(target_arch = "wasm32")]
47430 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47431 extern "C" {
47432 #[link_name = "[method]output-stream.write"]
47433 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
47434 }
47435 #[cfg(not(target_arch = "wasm32"))]
47436 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
47437 unreachable!()
47438 }
47439 wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
47440 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
47441 match l2 {
47442 0 => {
47443 let e = ();
47444 Ok(e)
47445 }
47446 1 => {
47447 let e = {
47448 let l3 = i32::from(*ptr1.add(4).cast::<u8>());
47449 let v5 = match l3 {
47450 0 => {
47451 let e5 = {
47452 let l4 = *ptr1.add(8).cast::<i32>();
47453 super::super::super::wasi::io::error::Error::from_handle(
47454 l4 as u32,
47455 )
47456 };
47457 StreamError::LastOperationFailed(e5)
47458 }
47459 n => {
47460 debug_assert_eq!(n, 1, "invalid enum discriminant");
47461 StreamError::Closed
47462 }
47463 };
47464 v5
47465 };
47466 Err(e)
47467 }
47468 _ => _rt::invalid_enum_discriminant(),
47469 }
47470 }
47471 }
47472 }
47473 impl OutputStream {
47474 #[allow(unused_unsafe, clippy::all)]
47475 /// Perform a write of up to 4096 bytes, and then flush the stream. Block
47476 /// until all of these operations are complete, or an error occurs.
47477 ///
47478 /// This is a convenience wrapper around the use of `check-write`,
47479 /// `subscribe`, `write`, and `flush`, and is implemented with the
47480 /// following pseudo-code:
47481 ///
47482 /// ```text
47483 /// let pollable = this.subscribe();
47484 /// while !contents.is_empty() {
47485 /// // Wait for the stream to become writable
47486 /// poll-one(pollable);
47487 /// let Ok(n) = this.check-write(); // eliding error handling
47488 /// let len = min(n, contents.len());
47489 /// let (chunk, rest) = contents.split_at(len);
47490 /// this.write(chunk ); // eliding error handling
47491 /// contents = rest;
47492 /// }
47493 /// this.flush();
47494 /// // Wait for completion of `flush`
47495 /// poll-one(pollable);
47496 /// // Check for any errors that arose during `flush`
47497 /// let _ = this.check-write(); // eliding error handling
47498 /// ```
47499 pub fn blocking_write_and_flush(
47500 &self,
47501 contents: &[u8],
47502 ) -> Result<(), StreamError> {
47503 unsafe {
47504 #[repr(align(4))]
47505 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
47506 let mut ret_area = RetArea(
47507 [::core::mem::MaybeUninit::uninit(); 12],
47508 );
47509 let vec0 = contents;
47510 let ptr0 = vec0.as_ptr().cast::<u8>();
47511 let len0 = vec0.len();
47512 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
47513 #[cfg(target_arch = "wasm32")]
47514 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47515 extern "C" {
47516 #[link_name = "[method]output-stream.blocking-write-and-flush"]
47517 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
47518 }
47519 #[cfg(not(target_arch = "wasm32"))]
47520 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
47521 unreachable!()
47522 }
47523 wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
47524 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
47525 match l2 {
47526 0 => {
47527 let e = ();
47528 Ok(e)
47529 }
47530 1 => {
47531 let e = {
47532 let l3 = i32::from(*ptr1.add(4).cast::<u8>());
47533 let v5 = match l3 {
47534 0 => {
47535 let e5 = {
47536 let l4 = *ptr1.add(8).cast::<i32>();
47537 super::super::super::wasi::io::error::Error::from_handle(
47538 l4 as u32,
47539 )
47540 };
47541 StreamError::LastOperationFailed(e5)
47542 }
47543 n => {
47544 debug_assert_eq!(n, 1, "invalid enum discriminant");
47545 StreamError::Closed
47546 }
47547 };
47548 v5
47549 };
47550 Err(e)
47551 }
47552 _ => _rt::invalid_enum_discriminant(),
47553 }
47554 }
47555 }
47556 }
47557 impl OutputStream {
47558 #[allow(unused_unsafe, clippy::all)]
47559 /// Request to flush buffered output. This function never blocks.
47560 ///
47561 /// This tells the output-stream that the caller intends any buffered
47562 /// output to be flushed. the output which is expected to be flushed
47563 /// is all that has been passed to `write` prior to this call.
47564 ///
47565 /// Upon calling this function, the `output-stream` will not accept any
47566 /// writes (`check-write` will return `ok(0)`) until the flush has
47567 /// completed. The `subscribe` pollable will become ready when the
47568 /// flush has completed and the stream can accept more writes.
47569 pub fn flush(&self) -> Result<(), StreamError> {
47570 unsafe {
47571 #[repr(align(4))]
47572 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
47573 let mut ret_area = RetArea(
47574 [::core::mem::MaybeUninit::uninit(); 12],
47575 );
47576 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
47577 #[cfg(target_arch = "wasm32")]
47578 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47579 extern "C" {
47580 #[link_name = "[method]output-stream.flush"]
47581 fn wit_import(_: i32, _: *mut u8);
47582 }
47583 #[cfg(not(target_arch = "wasm32"))]
47584 fn wit_import(_: i32, _: *mut u8) {
47585 unreachable!()
47586 }
47587 wit_import((self).handle() as i32, ptr0);
47588 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
47589 match l1 {
47590 0 => {
47591 let e = ();
47592 Ok(e)
47593 }
47594 1 => {
47595 let e = {
47596 let l2 = i32::from(*ptr0.add(4).cast::<u8>());
47597 let v4 = match l2 {
47598 0 => {
47599 let e4 = {
47600 let l3 = *ptr0.add(8).cast::<i32>();
47601 super::super::super::wasi::io::error::Error::from_handle(
47602 l3 as u32,
47603 )
47604 };
47605 StreamError::LastOperationFailed(e4)
47606 }
47607 n => {
47608 debug_assert_eq!(n, 1, "invalid enum discriminant");
47609 StreamError::Closed
47610 }
47611 };
47612 v4
47613 };
47614 Err(e)
47615 }
47616 _ => _rt::invalid_enum_discriminant(),
47617 }
47618 }
47619 }
47620 }
47621 impl OutputStream {
47622 #[allow(unused_unsafe, clippy::all)]
47623 /// Request to flush buffered output, and block until flush completes
47624 /// and stream is ready for writing again.
47625 pub fn blocking_flush(&self) -> Result<(), StreamError> {
47626 unsafe {
47627 #[repr(align(4))]
47628 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
47629 let mut ret_area = RetArea(
47630 [::core::mem::MaybeUninit::uninit(); 12],
47631 );
47632 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
47633 #[cfg(target_arch = "wasm32")]
47634 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47635 extern "C" {
47636 #[link_name = "[method]output-stream.blocking-flush"]
47637 fn wit_import(_: i32, _: *mut u8);
47638 }
47639 #[cfg(not(target_arch = "wasm32"))]
47640 fn wit_import(_: i32, _: *mut u8) {
47641 unreachable!()
47642 }
47643 wit_import((self).handle() as i32, ptr0);
47644 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
47645 match l1 {
47646 0 => {
47647 let e = ();
47648 Ok(e)
47649 }
47650 1 => {
47651 let e = {
47652 let l2 = i32::from(*ptr0.add(4).cast::<u8>());
47653 let v4 = match l2 {
47654 0 => {
47655 let e4 = {
47656 let l3 = *ptr0.add(8).cast::<i32>();
47657 super::super::super::wasi::io::error::Error::from_handle(
47658 l3 as u32,
47659 )
47660 };
47661 StreamError::LastOperationFailed(e4)
47662 }
47663 n => {
47664 debug_assert_eq!(n, 1, "invalid enum discriminant");
47665 StreamError::Closed
47666 }
47667 };
47668 v4
47669 };
47670 Err(e)
47671 }
47672 _ => _rt::invalid_enum_discriminant(),
47673 }
47674 }
47675 }
47676 }
47677 impl OutputStream {
47678 #[allow(unused_unsafe, clippy::all)]
47679 /// Create a `pollable` which will resolve once the output-stream
47680 /// is ready for more writing, or an error has occured. When this
47681 /// pollable is ready, `check-write` will return `ok(n)` with n>0, or an
47682 /// error.
47683 ///
47684 /// If the stream is closed, this pollable is always ready immediately.
47685 ///
47686 /// The created `pollable` is a child resource of the `output-stream`.
47687 /// Implementations may trap if the `output-stream` is dropped before
47688 /// all derived `pollable`s created with this function are dropped.
47689 pub fn subscribe(&self) -> Pollable {
47690 unsafe {
47691 #[cfg(target_arch = "wasm32")]
47692 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47693 extern "C" {
47694 #[link_name = "[method]output-stream.subscribe"]
47695 fn wit_import(_: i32) -> i32;
47696 }
47697 #[cfg(not(target_arch = "wasm32"))]
47698 fn wit_import(_: i32) -> i32 {
47699 unreachable!()
47700 }
47701 let ret = wit_import((self).handle() as i32);
47702 super::super::super::wasi::io::poll::Pollable::from_handle(
47703 ret as u32,
47704 )
47705 }
47706 }
47707 }
47708 impl OutputStream {
47709 #[allow(unused_unsafe, clippy::all)]
47710 /// Write zeroes to a stream.
47711 ///
47712 /// this should be used precisely like `write` with the exact same
47713 /// preconditions (must use check-write first), but instead of
47714 /// passing a list of bytes, you simply pass the number of zero-bytes
47715 /// that should be written.
47716 pub fn write_zeroes(&self, len: u64) -> Result<(), StreamError> {
47717 unsafe {
47718 #[repr(align(4))]
47719 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
47720 let mut ret_area = RetArea(
47721 [::core::mem::MaybeUninit::uninit(); 12],
47722 );
47723 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
47724 #[cfg(target_arch = "wasm32")]
47725 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47726 extern "C" {
47727 #[link_name = "[method]output-stream.write-zeroes"]
47728 fn wit_import(_: i32, _: i64, _: *mut u8);
47729 }
47730 #[cfg(not(target_arch = "wasm32"))]
47731 fn wit_import(_: i32, _: i64, _: *mut u8) {
47732 unreachable!()
47733 }
47734 wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0);
47735 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
47736 match l1 {
47737 0 => {
47738 let e = ();
47739 Ok(e)
47740 }
47741 1 => {
47742 let e = {
47743 let l2 = i32::from(*ptr0.add(4).cast::<u8>());
47744 let v4 = match l2 {
47745 0 => {
47746 let e4 = {
47747 let l3 = *ptr0.add(8).cast::<i32>();
47748 super::super::super::wasi::io::error::Error::from_handle(
47749 l3 as u32,
47750 )
47751 };
47752 StreamError::LastOperationFailed(e4)
47753 }
47754 n => {
47755 debug_assert_eq!(n, 1, "invalid enum discriminant");
47756 StreamError::Closed
47757 }
47758 };
47759 v4
47760 };
47761 Err(e)
47762 }
47763 _ => _rt::invalid_enum_discriminant(),
47764 }
47765 }
47766 }
47767 }
47768 impl OutputStream {
47769 #[allow(unused_unsafe, clippy::all)]
47770 /// Perform a write of up to 4096 zeroes, and then flush the stream.
47771 /// Block until all of these operations are complete, or an error
47772 /// occurs.
47773 ///
47774 /// This is a convenience wrapper around the use of `check-write`,
47775 /// `subscribe`, `write-zeroes`, and `flush`, and is implemented with
47776 /// the following pseudo-code:
47777 ///
47778 /// ```text
47779 /// let pollable = this.subscribe();
47780 /// while num_zeroes != 0 {
47781 /// // Wait for the stream to become writable
47782 /// poll-one(pollable);
47783 /// let Ok(n) = this.check-write(); // eliding error handling
47784 /// let len = min(n, num_zeroes);
47785 /// this.write-zeroes(len); // eliding error handling
47786 /// num_zeroes -= len;
47787 /// }
47788 /// this.flush();
47789 /// // Wait for completion of `flush`
47790 /// poll-one(pollable);
47791 /// // Check for any errors that arose during `flush`
47792 /// let _ = this.check-write(); // eliding error handling
47793 /// ```
47794 pub fn blocking_write_zeroes_and_flush(
47795 &self,
47796 len: u64,
47797 ) -> Result<(), StreamError> {
47798 unsafe {
47799 #[repr(align(4))]
47800 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
47801 let mut ret_area = RetArea(
47802 [::core::mem::MaybeUninit::uninit(); 12],
47803 );
47804 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
47805 #[cfg(target_arch = "wasm32")]
47806 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47807 extern "C" {
47808 #[link_name = "[method]output-stream.blocking-write-zeroes-and-flush"]
47809 fn wit_import(_: i32, _: i64, _: *mut u8);
47810 }
47811 #[cfg(not(target_arch = "wasm32"))]
47812 fn wit_import(_: i32, _: i64, _: *mut u8) {
47813 unreachable!()
47814 }
47815 wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0);
47816 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
47817 match l1 {
47818 0 => {
47819 let e = ();
47820 Ok(e)
47821 }
47822 1 => {
47823 let e = {
47824 let l2 = i32::from(*ptr0.add(4).cast::<u8>());
47825 let v4 = match l2 {
47826 0 => {
47827 let e4 = {
47828 let l3 = *ptr0.add(8).cast::<i32>();
47829 super::super::super::wasi::io::error::Error::from_handle(
47830 l3 as u32,
47831 )
47832 };
47833 StreamError::LastOperationFailed(e4)
47834 }
47835 n => {
47836 debug_assert_eq!(n, 1, "invalid enum discriminant");
47837 StreamError::Closed
47838 }
47839 };
47840 v4
47841 };
47842 Err(e)
47843 }
47844 _ => _rt::invalid_enum_discriminant(),
47845 }
47846 }
47847 }
47848 }
47849 impl OutputStream {
47850 #[allow(unused_unsafe, clippy::all)]
47851 /// Read from one stream and write to another.
47852 ///
47853 /// The behavior of splice is equivelant to:
47854 /// 1. calling `check-write` on the `output-stream`
47855 /// 2. calling `read` on the `input-stream` with the smaller of the
47856 /// `check-write` permitted length and the `len` provided to `splice`
47857 /// 3. calling `write` on the `output-stream` with that read data.
47858 ///
47859 /// Any error reported by the call to `check-write`, `read`, or
47860 /// `write` ends the splice and reports that error.
47861 ///
47862 /// This function returns the number of bytes transferred; it may be less
47863 /// than `len`.
47864 pub fn splice(
47865 &self,
47866 src: &InputStream,
47867 len: u64,
47868 ) -> Result<u64, StreamError> {
47869 unsafe {
47870 #[repr(align(8))]
47871 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
47872 let mut ret_area = RetArea(
47873 [::core::mem::MaybeUninit::uninit(); 16],
47874 );
47875 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
47876 #[cfg(target_arch = "wasm32")]
47877 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47878 extern "C" {
47879 #[link_name = "[method]output-stream.splice"]
47880 fn wit_import(_: i32, _: i32, _: i64, _: *mut u8);
47881 }
47882 #[cfg(not(target_arch = "wasm32"))]
47883 fn wit_import(_: i32, _: i32, _: i64, _: *mut u8) {
47884 unreachable!()
47885 }
47886 wit_import(
47887 (self).handle() as i32,
47888 (src).handle() as i32,
47889 _rt::as_i64(&len),
47890 ptr0,
47891 );
47892 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
47893 match l1 {
47894 0 => {
47895 let e = {
47896 let l2 = *ptr0.add(8).cast::<i64>();
47897 l2 as u64
47898 };
47899 Ok(e)
47900 }
47901 1 => {
47902 let e = {
47903 let l3 = i32::from(*ptr0.add(8).cast::<u8>());
47904 let v5 = match l3 {
47905 0 => {
47906 let e5 = {
47907 let l4 = *ptr0.add(12).cast::<i32>();
47908 super::super::super::wasi::io::error::Error::from_handle(
47909 l4 as u32,
47910 )
47911 };
47912 StreamError::LastOperationFailed(e5)
47913 }
47914 n => {
47915 debug_assert_eq!(n, 1, "invalid enum discriminant");
47916 StreamError::Closed
47917 }
47918 };
47919 v5
47920 };
47921 Err(e)
47922 }
47923 _ => _rt::invalid_enum_discriminant(),
47924 }
47925 }
47926 }
47927 }
47928 impl OutputStream {
47929 #[allow(unused_unsafe, clippy::all)]
47930 /// Read from one stream and write to another, with blocking.
47931 ///
47932 /// This is similar to `splice`, except that it blocks until the
47933 /// `output-stream` is ready for writing, and the `input-stream`
47934 /// is ready for reading, before performing the `splice`.
47935 pub fn blocking_splice(
47936 &self,
47937 src: &InputStream,
47938 len: u64,
47939 ) -> Result<u64, StreamError> {
47940 unsafe {
47941 #[repr(align(8))]
47942 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
47943 let mut ret_area = RetArea(
47944 [::core::mem::MaybeUninit::uninit(); 16],
47945 );
47946 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
47947 #[cfg(target_arch = "wasm32")]
47948 #[link(wasm_import_module = "wasi:io/streams@0.2.0")]
47949 extern "C" {
47950 #[link_name = "[method]output-stream.blocking-splice"]
47951 fn wit_import(_: i32, _: i32, _: i64, _: *mut u8);
47952 }
47953 #[cfg(not(target_arch = "wasm32"))]
47954 fn wit_import(_: i32, _: i32, _: i64, _: *mut u8) {
47955 unreachable!()
47956 }
47957 wit_import(
47958 (self).handle() as i32,
47959 (src).handle() as i32,
47960 _rt::as_i64(&len),
47961 ptr0,
47962 );
47963 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
47964 match l1 {
47965 0 => {
47966 let e = {
47967 let l2 = *ptr0.add(8).cast::<i64>();
47968 l2 as u64
47969 };
47970 Ok(e)
47971 }
47972 1 => {
47973 let e = {
47974 let l3 = i32::from(*ptr0.add(8).cast::<u8>());
47975 let v5 = match l3 {
47976 0 => {
47977 let e5 = {
47978 let l4 = *ptr0.add(12).cast::<i32>();
47979 super::super::super::wasi::io::error::Error::from_handle(
47980 l4 as u32,
47981 )
47982 };
47983 StreamError::LastOperationFailed(e5)
47984 }
47985 n => {
47986 debug_assert_eq!(n, 1, "invalid enum discriminant");
47987 StreamError::Closed
47988 }
47989 };
47990 v5
47991 };
47992 Err(e)
47993 }
47994 _ => _rt::invalid_enum_discriminant(),
47995 }
47996 }
47997 }
47998 }
47999 }
48000 }
48001 pub mod keyvalue {
48002 #[allow(dead_code, clippy::all)]
48003 pub mod wasi_keyvalue_error {
48004 #[used]
48005 #[doc(hidden)]
48006 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
48007 use super::super::super::_rt;
48008 /// An error resource type for keyvalue operations.
48009 ///
48010 /// Common errors:
48011 /// - Connectivity errors (e.g. network errors): when the client cannot establish
48012 /// a connection to the keyvalue service.
48013 /// - Authentication and Authorization errors: when the client fails to authenticate
48014 /// or does not have the required permissions to perform the operation.
48015 /// - Data errors: when the client sends incompatible or corrupted data.
48016 /// - Resource errors: when the system runs out of resources (e.g. memory).
48017 /// - Internal errors: unexpected errors on the server side.
48018 ///
48019 /// Currently, this provides only one function to return a string representation
48020 /// of the error. In the future, this will be extended to provide more information
48021 /// about the error.
48022 /// Soon: switch to `resource error { ... }`
48023 #[derive(Debug)]
48024 #[repr(transparent)]
48025 pub struct Error {
48026 handle: _rt::Resource<Error>,
48027 }
48028 impl Error {
48029 #[doc(hidden)]
48030 pub unsafe fn from_handle(handle: u32) -> Self {
48031 Self {
48032 handle: _rt::Resource::from_handle(handle),
48033 }
48034 }
48035 #[doc(hidden)]
48036 pub fn take_handle(&self) -> u32 {
48037 _rt::Resource::take_handle(&self.handle)
48038 }
48039 #[doc(hidden)]
48040 pub fn handle(&self) -> u32 {
48041 _rt::Resource::handle(&self.handle)
48042 }
48043 }
48044 unsafe impl _rt::WasmResource for Error {
48045 #[inline]
48046 unsafe fn drop(_handle: u32) {
48047 #[cfg(not(target_arch = "wasm32"))]
48048 unreachable!();
48049 #[cfg(target_arch = "wasm32")]
48050 {
48051 #[link(
48052 wasm_import_module = "wasi:keyvalue/wasi-keyvalue-error@0.1.0"
48053 )]
48054 extern "C" {
48055 #[link_name = "[resource-drop]error"]
48056 fn drop(_: u32);
48057 }
48058 drop(_handle);
48059 }
48060 }
48061 }
48062 impl Error {
48063 #[allow(unused_unsafe, clippy::all)]
48064 pub fn trace(&self) -> _rt::String {
48065 unsafe {
48066 #[repr(align(4))]
48067 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
48068 let mut ret_area = RetArea(
48069 [::core::mem::MaybeUninit::uninit(); 8],
48070 );
48071 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
48072 #[cfg(target_arch = "wasm32")]
48073 #[link(
48074 wasm_import_module = "wasi:keyvalue/wasi-keyvalue-error@0.1.0"
48075 )]
48076 extern "C" {
48077 #[link_name = "[method]error.trace"]
48078 fn wit_import(_: i32, _: *mut u8);
48079 }
48080 #[cfg(not(target_arch = "wasm32"))]
48081 fn wit_import(_: i32, _: *mut u8) {
48082 unreachable!()
48083 }
48084 wit_import((self).handle() as i32, ptr0);
48085 let l1 = *ptr0.add(0).cast::<*mut u8>();
48086 let l2 = *ptr0.add(4).cast::<usize>();
48087 let len3 = l2;
48088 let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3);
48089 _rt::string_lift(bytes3)
48090 }
48091 }
48092 }
48093 }
48094 /// A generic keyvalue interface for WASI.
48095 #[allow(dead_code, clippy::all)]
48096 pub mod types {
48097 #[used]
48098 #[doc(hidden)]
48099 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
48100 use super::super::super::_rt;
48101 pub type InputStream = super::super::super::wasi::io::streams::InputStream;
48102 pub type OutputStream = super::super::super::wasi::io::streams::OutputStream;
48103 pub type Error = super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error;
48104 /// A bucket is a collection of key-value pairs. Each key-value pair is stored
48105 /// as a entry in the bucket, and the bucket itself acts as a collection of all
48106 /// these entries.
48107 ///
48108 /// It is worth noting that the exact terminology for bucket in key-value stores
48109 /// can very depending on the specific implementation. For example,
48110 /// 1. Amazon DynamoDB calls a collection of key-value pairs a table
48111 /// 2. Redis has hashes, sets, and sorted sets as different types of collections
48112 /// 3. Cassandra calls a collection of key-value pairs a column family
48113 /// 4. MongoDB calls a collection of key-value pairs a collection
48114 /// 5. Riak calls a collection of key-value pairs a bucket
48115 /// 6. Memcached calls a collection of key-value pairs a slab
48116 /// 7. Azure Cosmos DB calls a collection of key-value pairs a container
48117 ///
48118 /// In this interface, we use the term `bucket` to refer to a collection of key-value
48119 /// Soon: switch to `resource bucket { ... }`
48120 #[derive(Debug)]
48121 #[repr(transparent)]
48122 pub struct Bucket {
48123 handle: _rt::Resource<Bucket>,
48124 }
48125 impl Bucket {
48126 #[doc(hidden)]
48127 pub unsafe fn from_handle(handle: u32) -> Self {
48128 Self {
48129 handle: _rt::Resource::from_handle(handle),
48130 }
48131 }
48132 #[doc(hidden)]
48133 pub fn take_handle(&self) -> u32 {
48134 _rt::Resource::take_handle(&self.handle)
48135 }
48136 #[doc(hidden)]
48137 pub fn handle(&self) -> u32 {
48138 _rt::Resource::handle(&self.handle)
48139 }
48140 }
48141 unsafe impl _rt::WasmResource for Bucket {
48142 #[inline]
48143 unsafe fn drop(_handle: u32) {
48144 #[cfg(not(target_arch = "wasm32"))]
48145 unreachable!();
48146 #[cfg(target_arch = "wasm32")]
48147 {
48148 #[link(wasm_import_module = "wasi:keyvalue/types@0.1.0")]
48149 extern "C" {
48150 #[link_name = "[resource-drop]bucket"]
48151 fn drop(_: u32);
48152 }
48153 drop(_handle);
48154 }
48155 }
48156 }
48157 /// A key is a unique identifier for a value in a bucket. The key is used to
48158 /// retrieve the value from the bucket.
48159 pub type Key = _rt::String;
48160 /// A value is the data stored in a key-value pair. The value can be of any type
48161 /// that can be represented in a byte array. It provides a way to write the value
48162 /// to the output-stream defined in the `wasi-io` interface.
48163 /// Soon: switch to `resource value { ... }`
48164 #[derive(Debug)]
48165 #[repr(transparent)]
48166 pub struct OutgoingValue {
48167 handle: _rt::Resource<OutgoingValue>,
48168 }
48169 impl OutgoingValue {
48170 #[doc(hidden)]
48171 pub unsafe fn from_handle(handle: u32) -> Self {
48172 Self {
48173 handle: _rt::Resource::from_handle(handle),
48174 }
48175 }
48176 #[doc(hidden)]
48177 pub fn take_handle(&self) -> u32 {
48178 _rt::Resource::take_handle(&self.handle)
48179 }
48180 #[doc(hidden)]
48181 pub fn handle(&self) -> u32 {
48182 _rt::Resource::handle(&self.handle)
48183 }
48184 }
48185 unsafe impl _rt::WasmResource for OutgoingValue {
48186 #[inline]
48187 unsafe fn drop(_handle: u32) {
48188 #[cfg(not(target_arch = "wasm32"))]
48189 unreachable!();
48190 #[cfg(target_arch = "wasm32")]
48191 {
48192 #[link(wasm_import_module = "wasi:keyvalue/types@0.1.0")]
48193 extern "C" {
48194 #[link_name = "[resource-drop]outgoing-value"]
48195 fn drop(_: u32);
48196 }
48197 drop(_handle);
48198 }
48199 }
48200 }
48201 pub type OutgoingValueBodyAsync = OutputStream;
48202 pub type OutgoingValueBodySync = _rt::Vec<u8>;
48203 /// A incoming-value is a wrapper around a value. It provides a way to read the value
48204 /// from the `input-stream` defined in the `wasi-io` interface.
48205 ///
48206 /// The incoming-value provides two ways to consume the value:
48207 /// 1. `incoming-value-consume-sync` consumes the value synchronously and returns the
48208 /// value as a `list<u8>`.
48209 /// 2. `incoming-value-consume-async` consumes the value asynchronously and returns the
48210 /// value as an `input-stream`.
48211 /// In addition, it provides a `incoming-value-size` function to get the size of the value.
48212 /// This is useful when the value is large and the caller wants to allocate a buffer of
48213 /// the right size to consume the value.
48214 /// Soon: switch to `resource incoming-value { ... }`
48215 #[derive(Debug)]
48216 #[repr(transparent)]
48217 pub struct IncomingValue {
48218 handle: _rt::Resource<IncomingValue>,
48219 }
48220 impl IncomingValue {
48221 #[doc(hidden)]
48222 pub unsafe fn from_handle(handle: u32) -> Self {
48223 Self {
48224 handle: _rt::Resource::from_handle(handle),
48225 }
48226 }
48227 #[doc(hidden)]
48228 pub fn take_handle(&self) -> u32 {
48229 _rt::Resource::take_handle(&self.handle)
48230 }
48231 #[doc(hidden)]
48232 pub fn handle(&self) -> u32 {
48233 _rt::Resource::handle(&self.handle)
48234 }
48235 }
48236 unsafe impl _rt::WasmResource for IncomingValue {
48237 #[inline]
48238 unsafe fn drop(_handle: u32) {
48239 #[cfg(not(target_arch = "wasm32"))]
48240 unreachable!();
48241 #[cfg(target_arch = "wasm32")]
48242 {
48243 #[link(wasm_import_module = "wasi:keyvalue/types@0.1.0")]
48244 extern "C" {
48245 #[link_name = "[resource-drop]incoming-value"]
48246 fn drop(_: u32);
48247 }
48248 drop(_handle);
48249 }
48250 }
48251 }
48252 pub type IncomingValueAsyncBody = InputStream;
48253 pub type IncomingValueSyncBody = _rt::Vec<u8>;
48254 impl Bucket {
48255 #[allow(unused_unsafe, clippy::all)]
48256 /// Opens a bucket with the given name.
48257 ///
48258 /// If any error occurs, including if the bucket does not exist, it returns an `Err(error)`.
48259 pub fn open_bucket(name: &str) -> Result<Bucket, Error> {
48260 unsafe {
48261 #[repr(align(4))]
48262 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
48263 let mut ret_area = RetArea(
48264 [::core::mem::MaybeUninit::uninit(); 8],
48265 );
48266 let vec0 = name;
48267 let ptr0 = vec0.as_ptr().cast::<u8>();
48268 let len0 = vec0.len();
48269 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
48270 #[cfg(target_arch = "wasm32")]
48271 #[link(wasm_import_module = "wasi:keyvalue/types@0.1.0")]
48272 extern "C" {
48273 #[link_name = "[static]bucket.open-bucket"]
48274 fn wit_import(_: *mut u8, _: usize, _: *mut u8);
48275 }
48276 #[cfg(not(target_arch = "wasm32"))]
48277 fn wit_import(_: *mut u8, _: usize, _: *mut u8) {
48278 unreachable!()
48279 }
48280 wit_import(ptr0.cast_mut(), len0, ptr1);
48281 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
48282 match l2 {
48283 0 => {
48284 let e = {
48285 let l3 = *ptr1.add(4).cast::<i32>();
48286 Bucket::from_handle(l3 as u32)
48287 };
48288 Ok(e)
48289 }
48290 1 => {
48291 let e = {
48292 let l4 = *ptr1.add(4).cast::<i32>();
48293 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
48294 l4 as u32,
48295 )
48296 };
48297 Err(e)
48298 }
48299 _ => _rt::invalid_enum_discriminant(),
48300 }
48301 }
48302 }
48303 }
48304 impl OutgoingValue {
48305 #[allow(unused_unsafe, clippy::all)]
48306 pub fn new_outgoing_value() -> OutgoingValue {
48307 unsafe {
48308 #[cfg(target_arch = "wasm32")]
48309 #[link(wasm_import_module = "wasi:keyvalue/types@0.1.0")]
48310 extern "C" {
48311 #[link_name = "[static]outgoing-value.new-outgoing-value"]
48312 fn wit_import() -> i32;
48313 }
48314 #[cfg(not(target_arch = "wasm32"))]
48315 fn wit_import() -> i32 {
48316 unreachable!()
48317 }
48318 let ret = wit_import();
48319 OutgoingValue::from_handle(ret as u32)
48320 }
48321 }
48322 }
48323 impl OutgoingValue {
48324 #[allow(unused_unsafe, clippy::all)]
48325 /// Writes the value to the output-stream asynchronously.
48326 /// If any other error occurs, it returns an `Err(error)`.
48327 pub fn outgoing_value_write_body_async(
48328 &self,
48329 ) -> Result<OutgoingValueBodyAsync, Error> {
48330 unsafe {
48331 #[repr(align(4))]
48332 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
48333 let mut ret_area = RetArea(
48334 [::core::mem::MaybeUninit::uninit(); 8],
48335 );
48336 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
48337 #[cfg(target_arch = "wasm32")]
48338 #[link(wasm_import_module = "wasi:keyvalue/types@0.1.0")]
48339 extern "C" {
48340 #[link_name = "[method]outgoing-value.outgoing-value-write-body-async"]
48341 fn wit_import(_: i32, _: *mut u8);
48342 }
48343 #[cfg(not(target_arch = "wasm32"))]
48344 fn wit_import(_: i32, _: *mut u8) {
48345 unreachable!()
48346 }
48347 wit_import((self).handle() as i32, ptr0);
48348 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
48349 match l1 {
48350 0 => {
48351 let e = {
48352 let l2 = *ptr0.add(4).cast::<i32>();
48353 super::super::super::wasi::io::streams::OutputStream::from_handle(
48354 l2 as u32,
48355 )
48356 };
48357 Ok(e)
48358 }
48359 1 => {
48360 let e = {
48361 let l3 = *ptr0.add(4).cast::<i32>();
48362 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
48363 l3 as u32,
48364 )
48365 };
48366 Err(e)
48367 }
48368 _ => _rt::invalid_enum_discriminant(),
48369 }
48370 }
48371 }
48372 }
48373 impl OutgoingValue {
48374 #[allow(unused_unsafe, clippy::all)]
48375 /// Writes the value to the output-stream synchronously.
48376 /// If any other error occurs, it returns an `Err(error)`.
48377 pub fn outgoing_value_write_body_sync(
48378 &self,
48379 value: &OutgoingValueBodySync,
48380 ) -> Result<(), Error> {
48381 unsafe {
48382 #[repr(align(4))]
48383 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
48384 let mut ret_area = RetArea(
48385 [::core::mem::MaybeUninit::uninit(); 8],
48386 );
48387 let vec0 = value;
48388 let ptr0 = vec0.as_ptr().cast::<u8>();
48389 let len0 = vec0.len();
48390 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
48391 #[cfg(target_arch = "wasm32")]
48392 #[link(wasm_import_module = "wasi:keyvalue/types@0.1.0")]
48393 extern "C" {
48394 #[link_name = "[method]outgoing-value.outgoing-value-write-body-sync"]
48395 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
48396 }
48397 #[cfg(not(target_arch = "wasm32"))]
48398 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
48399 unreachable!()
48400 }
48401 wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
48402 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
48403 match l2 {
48404 0 => {
48405 let e = ();
48406 Ok(e)
48407 }
48408 1 => {
48409 let e = {
48410 let l3 = *ptr1.add(4).cast::<i32>();
48411 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
48412 l3 as u32,
48413 )
48414 };
48415 Err(e)
48416 }
48417 _ => _rt::invalid_enum_discriminant(),
48418 }
48419 }
48420 }
48421 }
48422 impl IncomingValue {
48423 #[allow(unused_unsafe, clippy::all)]
48424 /// Consumes the value synchronously and returns the value as a list of bytes.
48425 /// If any other error occurs, it returns an `Err(error)`.
48426 pub fn incoming_value_consume_sync(
48427 &self,
48428 ) -> Result<IncomingValueSyncBody, Error> {
48429 unsafe {
48430 #[repr(align(4))]
48431 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
48432 let mut ret_area = RetArea(
48433 [::core::mem::MaybeUninit::uninit(); 12],
48434 );
48435 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
48436 #[cfg(target_arch = "wasm32")]
48437 #[link(wasm_import_module = "wasi:keyvalue/types@0.1.0")]
48438 extern "C" {
48439 #[link_name = "[method]incoming-value.incoming-value-consume-sync"]
48440 fn wit_import(_: i32, _: *mut u8);
48441 }
48442 #[cfg(not(target_arch = "wasm32"))]
48443 fn wit_import(_: i32, _: *mut u8) {
48444 unreachable!()
48445 }
48446 wit_import((self).handle() as i32, ptr0);
48447 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
48448 match l1 {
48449 0 => {
48450 let e = {
48451 let l2 = *ptr0.add(4).cast::<*mut u8>();
48452 let l3 = *ptr0.add(8).cast::<usize>();
48453 let len4 = l3;
48454 _rt::Vec::from_raw_parts(l2.cast(), len4, len4)
48455 };
48456 Ok(e)
48457 }
48458 1 => {
48459 let e = {
48460 let l5 = *ptr0.add(4).cast::<i32>();
48461 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
48462 l5 as u32,
48463 )
48464 };
48465 Err(e)
48466 }
48467 _ => _rt::invalid_enum_discriminant(),
48468 }
48469 }
48470 }
48471 }
48472 impl IncomingValue {
48473 #[allow(unused_unsafe, clippy::all)]
48474 /// Consumes the value asynchronously and returns the value as an `input-stream`.
48475 /// If any other error occurs, it returns an `Err(error)`.
48476 pub fn incoming_value_consume_async(
48477 &self,
48478 ) -> Result<IncomingValueAsyncBody, Error> {
48479 unsafe {
48480 #[repr(align(4))]
48481 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
48482 let mut ret_area = RetArea(
48483 [::core::mem::MaybeUninit::uninit(); 8],
48484 );
48485 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
48486 #[cfg(target_arch = "wasm32")]
48487 #[link(wasm_import_module = "wasi:keyvalue/types@0.1.0")]
48488 extern "C" {
48489 #[link_name = "[method]incoming-value.incoming-value-consume-async"]
48490 fn wit_import(_: i32, _: *mut u8);
48491 }
48492 #[cfg(not(target_arch = "wasm32"))]
48493 fn wit_import(_: i32, _: *mut u8) {
48494 unreachable!()
48495 }
48496 wit_import((self).handle() as i32, ptr0);
48497 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
48498 match l1 {
48499 0 => {
48500 let e = {
48501 let l2 = *ptr0.add(4).cast::<i32>();
48502 super::super::super::wasi::io::streams::InputStream::from_handle(
48503 l2 as u32,
48504 )
48505 };
48506 Ok(e)
48507 }
48508 1 => {
48509 let e = {
48510 let l3 = *ptr0.add(4).cast::<i32>();
48511 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
48512 l3 as u32,
48513 )
48514 };
48515 Err(e)
48516 }
48517 _ => _rt::invalid_enum_discriminant(),
48518 }
48519 }
48520 }
48521 }
48522 impl IncomingValue {
48523 #[allow(unused_unsafe, clippy::all)]
48524 /// The size of the value in bytes.
48525 /// If the size is unknown or unavailable, this function returns an `Err(error)`.
48526 pub fn incoming_value_size(&self) -> Result<u64, Error> {
48527 unsafe {
48528 #[repr(align(8))]
48529 struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
48530 let mut ret_area = RetArea(
48531 [::core::mem::MaybeUninit::uninit(); 16],
48532 );
48533 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
48534 #[cfg(target_arch = "wasm32")]
48535 #[link(wasm_import_module = "wasi:keyvalue/types@0.1.0")]
48536 extern "C" {
48537 #[link_name = "[method]incoming-value.incoming-value-size"]
48538 fn wit_import(_: i32, _: *mut u8);
48539 }
48540 #[cfg(not(target_arch = "wasm32"))]
48541 fn wit_import(_: i32, _: *mut u8) {
48542 unreachable!()
48543 }
48544 wit_import((self).handle() as i32, ptr0);
48545 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
48546 match l1 {
48547 0 => {
48548 let e = {
48549 let l2 = *ptr0.add(8).cast::<i64>();
48550 l2 as u64
48551 };
48552 Ok(e)
48553 }
48554 1 => {
48555 let e = {
48556 let l3 = *ptr0.add(8).cast::<i32>();
48557 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
48558 l3 as u32,
48559 )
48560 };
48561 Err(e)
48562 }
48563 _ => _rt::invalid_enum_discriminant(),
48564 }
48565 }
48566 }
48567 }
48568 }
48569 /// A keyvalue interface that provides eventually consistent batch operations.
48570 ///
48571 /// A batch operation is an operation that operates on multiple keys at once.
48572 ///
48573 /// Batch operations are useful for reducing network round-trip time. For example,
48574 /// if you want to get the values associated with 100 keys, you can either do 100 get
48575 /// operations or you can do 1 batch get operation. The batch operation is
48576 /// faster because it only needs to make 1 network call instead of 100.
48577 ///
48578 /// A batch operation does not guarantee atomicity, meaning that if the batch
48579 /// operation fails, some of the keys may have been modified and some may not.
48580 /// Transactional operations are being worked on and will be added in the future to
48581 /// provide atomicity.
48582 ///
48583 /// Data consistency in a key value store refers to the gaurantee that once a
48584 /// write operation completes, all subsequent read operations will return the
48585 /// value that was written.
48586 ///
48587 /// The level of consistency in batch operations is **eventual consistency**, the same
48588 /// with the readwrite interface. This interface does not guarantee strong consistency,
48589 /// meaning that if a write operation completes, subsequent read operations may not return
48590 /// the value that was written.
48591 #[allow(dead_code, clippy::all)]
48592 pub mod eventual_batch {
48593 #[used]
48594 #[doc(hidden)]
48595 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
48596 use super::super::super::_rt;
48597 pub type Bucket = super::super::super::wasi::keyvalue::types::Bucket;
48598 pub type Error = super::super::super::wasi::keyvalue::types::Error;
48599 pub type Key = super::super::super::wasi::keyvalue::types::Key;
48600 pub type IncomingValue = super::super::super::wasi::keyvalue::types::IncomingValue;
48601 pub type OutgoingValue = super::super::super::wasi::keyvalue::types::OutgoingValue;
48602 #[allow(unused_unsafe, clippy::all)]
48603 /// Get the values associated with the keys in the bucket. It returns a list of
48604 /// incoming-value that can be consumed to get the value associated with the key.
48605 ///
48606 /// If any of the keys do not exist in the bucket, it returns a `none` value for
48607 /// that key in the list.
48608 ///
48609 /// Note that the key-value pairs are guaranteed to be returned in the same order
48610 ///
48611 /// MAY show an out-of-date value if there are concurrent writes to the bucket.
48612 ///
48613 /// If any other error occurs, it returns an `Err(error)`.
48614 pub fn get_many(
48615 bucket: &Bucket,
48616 keys: &[Key],
48617 ) -> Result<_rt::Vec<Option<IncomingValue>>, Error> {
48618 unsafe {
48619 #[repr(align(4))]
48620 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
48621 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]);
48622 let vec1 = keys;
48623 let len1 = vec1.len();
48624 let layout1 = _rt::alloc::Layout::from_size_align_unchecked(
48625 vec1.len() * 8,
48626 4,
48627 );
48628 let result1 = if layout1.size() != 0 {
48629 let ptr = _rt::alloc::alloc(layout1).cast::<u8>();
48630 if ptr.is_null() {
48631 _rt::alloc::handle_alloc_error(layout1);
48632 }
48633 ptr
48634 } else {
48635 ::core::ptr::null_mut()
48636 };
48637 for (i, e) in vec1.into_iter().enumerate() {
48638 let base = result1.add(i * 8);
48639 {
48640 let vec0 = e;
48641 let ptr0 = vec0.as_ptr().cast::<u8>();
48642 let len0 = vec0.len();
48643 *base.add(4).cast::<usize>() = len0;
48644 *base.add(0).cast::<*mut u8>() = ptr0.cast_mut();
48645 }
48646 }
48647 let ptr2 = ret_area.0.as_mut_ptr().cast::<u8>();
48648 #[cfg(target_arch = "wasm32")]
48649 #[link(wasm_import_module = "wasi:keyvalue/eventual-batch@0.1.0")]
48650 extern "C" {
48651 #[link_name = "get-many"]
48652 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
48653 }
48654 #[cfg(not(target_arch = "wasm32"))]
48655 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
48656 unreachable!()
48657 }
48658 wit_import((bucket).handle() as i32, result1, len1, ptr2);
48659 let l3 = i32::from(*ptr2.add(0).cast::<u8>());
48660 if layout1.size() != 0 {
48661 _rt::alloc::dealloc(result1.cast(), layout1);
48662 }
48663 match l3 {
48664 0 => {
48665 let e = {
48666 let l4 = *ptr2.add(4).cast::<*mut u8>();
48667 let l5 = *ptr2.add(8).cast::<usize>();
48668 let base8 = l4;
48669 let len8 = l5;
48670 let mut result8 = _rt::Vec::with_capacity(len8);
48671 for i in 0..len8 {
48672 let base = base8.add(i * 8);
48673 let e8 = {
48674 let l6 = i32::from(*base.add(0).cast::<u8>());
48675 match l6 {
48676 0 => None,
48677 1 => {
48678 let e = {
48679 let l7 = *base.add(4).cast::<i32>();
48680 super::super::super::wasi::keyvalue::types::IncomingValue::from_handle(
48681 l7 as u32,
48682 )
48683 };
48684 Some(e)
48685 }
48686 _ => _rt::invalid_enum_discriminant(),
48687 }
48688 };
48689 result8.push(e8);
48690 }
48691 _rt::cabi_dealloc(base8, len8 * 8, 4);
48692 result8
48693 };
48694 Ok(e)
48695 }
48696 1 => {
48697 let e = {
48698 let l9 = *ptr2.add(4).cast::<i32>();
48699 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
48700 l9 as u32,
48701 )
48702 };
48703 Err(e)
48704 }
48705 _ => _rt::invalid_enum_discriminant(),
48706 }
48707 }
48708 }
48709 #[allow(unused_unsafe, clippy::all)]
48710 /// Get all the keys in the bucket. It returns a list of keys.
48711 ///
48712 /// Note that the keys are not guaranteed to be returned in any particular order.
48713 ///
48714 /// If the bucket is empty, it returns an empty list.
48715 ///
48716 /// MAY show an out-of-date list of keys if there are concurrent writes to the bucket.
48717 ///
48718 /// If any error occurs, it returns an `Err(error)`.
48719 pub fn keys(bucket: &Bucket) -> Result<_rt::Vec<Key>, Error> {
48720 unsafe {
48721 #[repr(align(4))]
48722 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
48723 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]);
48724 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
48725 #[cfg(target_arch = "wasm32")]
48726 #[link(wasm_import_module = "wasi:keyvalue/eventual-batch@0.1.0")]
48727 extern "C" {
48728 #[link_name = "keys"]
48729 fn wit_import(_: i32, _: *mut u8);
48730 }
48731 #[cfg(not(target_arch = "wasm32"))]
48732 fn wit_import(_: i32, _: *mut u8) {
48733 unreachable!()
48734 }
48735 wit_import((bucket).handle() as i32, ptr0);
48736 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
48737 match l1 {
48738 0 => {
48739 let e = {
48740 let l2 = *ptr0.add(4).cast::<*mut u8>();
48741 let l3 = *ptr0.add(8).cast::<usize>();
48742 let base7 = l2;
48743 let len7 = l3;
48744 let mut result7 = _rt::Vec::with_capacity(len7);
48745 for i in 0..len7 {
48746 let base = base7.add(i * 8);
48747 let e7 = {
48748 let l4 = *base.add(0).cast::<*mut u8>();
48749 let l5 = *base.add(4).cast::<usize>();
48750 let len6 = l5;
48751 let bytes6 = _rt::Vec::from_raw_parts(
48752 l4.cast(),
48753 len6,
48754 len6,
48755 );
48756 _rt::string_lift(bytes6)
48757 };
48758 result7.push(e7);
48759 }
48760 _rt::cabi_dealloc(base7, len7 * 8, 4);
48761 result7
48762 };
48763 Ok(e)
48764 }
48765 1 => {
48766 let e = {
48767 let l8 = *ptr0.add(4).cast::<i32>();
48768 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
48769 l8 as u32,
48770 )
48771 };
48772 Err(e)
48773 }
48774 _ => _rt::invalid_enum_discriminant(),
48775 }
48776 }
48777 }
48778 #[allow(unused_unsafe, clippy::all)]
48779 /// Set the values associated with the keys in the bucket. If the key already
48780 /// exists in the bucket, it overwrites the value.
48781 ///
48782 /// Note that the key-value pairs are not guaranteed to be set in the order
48783 /// they are provided.
48784 ///
48785 /// If any of the keys do not exist in the bucket, it creates a new key-value pair.
48786 ///
48787 /// If any other error occurs, it returns an `Err(error)`. When an error occurs, it
48788 /// does not rollback the key-value pairs that were already set. Thus, this batch operation
48789 /// does not guarantee atomicity, implying that some key-value pairs could be
48790 /// set while others might fail.
48791 ///
48792 /// Other concurrent operations may also be able to see the partial results.
48793 pub fn set_many(
48794 bucket: &Bucket,
48795 key_values: &[(Key, &OutgoingValue)],
48796 ) -> Result<(), Error> {
48797 unsafe {
48798 #[repr(align(4))]
48799 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
48800 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
48801 let vec2 = key_values;
48802 let len2 = vec2.len();
48803 let layout2 = _rt::alloc::Layout::from_size_align_unchecked(
48804 vec2.len() * 12,
48805 4,
48806 );
48807 let result2 = if layout2.size() != 0 {
48808 let ptr = _rt::alloc::alloc(layout2).cast::<u8>();
48809 if ptr.is_null() {
48810 _rt::alloc::handle_alloc_error(layout2);
48811 }
48812 ptr
48813 } else {
48814 ::core::ptr::null_mut()
48815 };
48816 for (i, e) in vec2.into_iter().enumerate() {
48817 let base = result2.add(i * 12);
48818 {
48819 let (t0_0, t0_1) = e;
48820 let vec1 = t0_0;
48821 let ptr1 = vec1.as_ptr().cast::<u8>();
48822 let len1 = vec1.len();
48823 *base.add(4).cast::<usize>() = len1;
48824 *base.add(0).cast::<*mut u8>() = ptr1.cast_mut();
48825 *base.add(8).cast::<i32>() = (t0_1).handle() as i32;
48826 }
48827 }
48828 let ptr3 = ret_area.0.as_mut_ptr().cast::<u8>();
48829 #[cfg(target_arch = "wasm32")]
48830 #[link(wasm_import_module = "wasi:keyvalue/eventual-batch@0.1.0")]
48831 extern "C" {
48832 #[link_name = "set-many"]
48833 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
48834 }
48835 #[cfg(not(target_arch = "wasm32"))]
48836 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
48837 unreachable!()
48838 }
48839 wit_import((bucket).handle() as i32, result2, len2, ptr3);
48840 let l4 = i32::from(*ptr3.add(0).cast::<u8>());
48841 if layout2.size() != 0 {
48842 _rt::alloc::dealloc(result2.cast(), layout2);
48843 }
48844 match l4 {
48845 0 => {
48846 let e = ();
48847 Ok(e)
48848 }
48849 1 => {
48850 let e = {
48851 let l5 = *ptr3.add(4).cast::<i32>();
48852 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
48853 l5 as u32,
48854 )
48855 };
48856 Err(e)
48857 }
48858 _ => _rt::invalid_enum_discriminant(),
48859 }
48860 }
48861 }
48862 #[allow(unused_unsafe, clippy::all)]
48863 /// Delete the key-value pairs associated with the keys in the bucket.
48864 ///
48865 /// Note that the key-value pairs are not guaranteed to be deleted in the order
48866 /// they are provided.
48867 ///
48868 /// If any of the keys do not exist in the bucket, it skips the key.
48869 ///
48870 /// If any other error occurs, it returns an `Err(error)`. When an error occurs, it
48871 /// does not rollback the key-value pairs that were already deleted. Thus, this batch operation
48872 /// does not guarantee atomicity, implying that some key-value pairs could be
48873 /// deleted while others might fail.
48874 ///
48875 /// Other concurrent operations may also be able to see the partial results.
48876 pub fn delete_many(bucket: &Bucket, keys: &[Key]) -> Result<(), Error> {
48877 unsafe {
48878 #[repr(align(4))]
48879 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
48880 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
48881 let vec1 = keys;
48882 let len1 = vec1.len();
48883 let layout1 = _rt::alloc::Layout::from_size_align_unchecked(
48884 vec1.len() * 8,
48885 4,
48886 );
48887 let result1 = if layout1.size() != 0 {
48888 let ptr = _rt::alloc::alloc(layout1).cast::<u8>();
48889 if ptr.is_null() {
48890 _rt::alloc::handle_alloc_error(layout1);
48891 }
48892 ptr
48893 } else {
48894 ::core::ptr::null_mut()
48895 };
48896 for (i, e) in vec1.into_iter().enumerate() {
48897 let base = result1.add(i * 8);
48898 {
48899 let vec0 = e;
48900 let ptr0 = vec0.as_ptr().cast::<u8>();
48901 let len0 = vec0.len();
48902 *base.add(4).cast::<usize>() = len0;
48903 *base.add(0).cast::<*mut u8>() = ptr0.cast_mut();
48904 }
48905 }
48906 let ptr2 = ret_area.0.as_mut_ptr().cast::<u8>();
48907 #[cfg(target_arch = "wasm32")]
48908 #[link(wasm_import_module = "wasi:keyvalue/eventual-batch@0.1.0")]
48909 extern "C" {
48910 #[link_name = "delete-many"]
48911 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
48912 }
48913 #[cfg(not(target_arch = "wasm32"))]
48914 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
48915 unreachable!()
48916 }
48917 wit_import((bucket).handle() as i32, result1, len1, ptr2);
48918 let l3 = i32::from(*ptr2.add(0).cast::<u8>());
48919 if layout1.size() != 0 {
48920 _rt::alloc::dealloc(result1.cast(), layout1);
48921 }
48922 match l3 {
48923 0 => {
48924 let e = ();
48925 Ok(e)
48926 }
48927 1 => {
48928 let e = {
48929 let l4 = *ptr2.add(4).cast::<i32>();
48930 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
48931 l4 as u32,
48932 )
48933 };
48934 Err(e)
48935 }
48936 _ => _rt::invalid_enum_discriminant(),
48937 }
48938 }
48939 }
48940 }
48941 /// A keyvalue interface that provides eventually consistent CRUD operations.
48942 ///
48943 /// A CRUD operation is an operation that acts on a single key-value pair.
48944 ///
48945 /// The value in the key-value pair is defined as a `u8` byte array and the intention
48946 /// is that it is the common denominator for all data types defined by different
48947 /// key-value stores to handle data, ensuring compatibility between different
48948 /// key-value stores. Note: the clients will be expecting serialization/deserialization overhead
48949 /// to be handled by the key-value store. The value could be a serialized object from
48950 /// JSON, HTML or vendor-specific data types like AWS S3 objects.
48951 ///
48952 /// Data consistency in a key value store refers to the gaurantee that once a
48953 /// write operation completes, all subsequent read operations will return the
48954 /// value that was written.
48955 ///
48956 /// The level of consistency in readwrite interfaces is **eventual consistency**,
48957 /// which means that if a write operation completes successfully, all subsequent
48958 /// read operations will eventually return the value that was written. In other words,
48959 /// if we pause the updates to the system, the system eventually will return
48960 /// the last updated value for read.
48961 #[allow(dead_code, clippy::all)]
48962 pub mod eventual {
48963 #[used]
48964 #[doc(hidden)]
48965 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
48966 use super::super::super::_rt;
48967 pub type Bucket = super::super::super::wasi::keyvalue::types::Bucket;
48968 pub type Error = super::super::super::wasi::keyvalue::types::Error;
48969 pub type IncomingValue = super::super::super::wasi::keyvalue::types::IncomingValue;
48970 pub type Key = super::super::super::wasi::keyvalue::types::Key;
48971 pub type OutgoingValue = super::super::super::wasi::keyvalue::types::OutgoingValue;
48972 #[allow(unused_unsafe, clippy::all)]
48973 /// Get the value associated with the key in the bucket.
48974 ///
48975 /// The value is returned as an option. If the key-value pair exists in the
48976 /// bucket, it returns `Ok(value)`. If the key does not exist in the
48977 /// bucket, it returns `Ok(none)`.
48978 ///
48979 /// If any other error occurs, it returns an `Err(error)`.
48980 pub fn get(
48981 bucket: &Bucket,
48982 key: &Key,
48983 ) -> Result<Option<IncomingValue>, Error> {
48984 unsafe {
48985 #[repr(align(4))]
48986 struct RetArea([::core::mem::MaybeUninit<u8>; 12]);
48987 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]);
48988 let vec0 = key;
48989 let ptr0 = vec0.as_ptr().cast::<u8>();
48990 let len0 = vec0.len();
48991 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
48992 #[cfg(target_arch = "wasm32")]
48993 #[link(wasm_import_module = "wasi:keyvalue/eventual@0.1.0")]
48994 extern "C" {
48995 #[link_name = "get"]
48996 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
48997 }
48998 #[cfg(not(target_arch = "wasm32"))]
48999 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
49000 unreachable!()
49001 }
49002 wit_import((bucket).handle() as i32, ptr0.cast_mut(), len0, ptr1);
49003 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
49004 match l2 {
49005 0 => {
49006 let e = {
49007 let l3 = i32::from(*ptr1.add(4).cast::<u8>());
49008 match l3 {
49009 0 => None,
49010 1 => {
49011 let e = {
49012 let l4 = *ptr1.add(8).cast::<i32>();
49013 super::super::super::wasi::keyvalue::types::IncomingValue::from_handle(
49014 l4 as u32,
49015 )
49016 };
49017 Some(e)
49018 }
49019 _ => _rt::invalid_enum_discriminant(),
49020 }
49021 };
49022 Ok(e)
49023 }
49024 1 => {
49025 let e = {
49026 let l5 = *ptr1.add(4).cast::<i32>();
49027 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
49028 l5 as u32,
49029 )
49030 };
49031 Err(e)
49032 }
49033 _ => _rt::invalid_enum_discriminant(),
49034 }
49035 }
49036 }
49037 #[allow(unused_unsafe, clippy::all)]
49038 /// Set the value associated with the key in the bucket. If the key already
49039 /// exists in the bucket, it overwrites the value.
49040 ///
49041 /// If the key does not exist in the bucket, it creates a new key-value pair.
49042 ///
49043 /// If any other error occurs, it returns an `Err(error)`.
49044 pub fn set(
49045 bucket: &Bucket,
49046 key: &Key,
49047 outgoing_value: &OutgoingValue,
49048 ) -> Result<(), Error> {
49049 unsafe {
49050 #[repr(align(4))]
49051 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
49052 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
49053 let vec0 = key;
49054 let ptr0 = vec0.as_ptr().cast::<u8>();
49055 let len0 = vec0.len();
49056 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
49057 #[cfg(target_arch = "wasm32")]
49058 #[link(wasm_import_module = "wasi:keyvalue/eventual@0.1.0")]
49059 extern "C" {
49060 #[link_name = "set"]
49061 fn wit_import(_: i32, _: *mut u8, _: usize, _: i32, _: *mut u8);
49062 }
49063 #[cfg(not(target_arch = "wasm32"))]
49064 fn wit_import(_: i32, _: *mut u8, _: usize, _: i32, _: *mut u8) {
49065 unreachable!()
49066 }
49067 wit_import(
49068 (bucket).handle() as i32,
49069 ptr0.cast_mut(),
49070 len0,
49071 (outgoing_value).handle() as i32,
49072 ptr1,
49073 );
49074 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
49075 match l2 {
49076 0 => {
49077 let e = ();
49078 Ok(e)
49079 }
49080 1 => {
49081 let e = {
49082 let l3 = *ptr1.add(4).cast::<i32>();
49083 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
49084 l3 as u32,
49085 )
49086 };
49087 Err(e)
49088 }
49089 _ => _rt::invalid_enum_discriminant(),
49090 }
49091 }
49092 }
49093 #[allow(unused_unsafe, clippy::all)]
49094 /// Delete the key-value pair associated with the key in the bucket.
49095 ///
49096 /// If the key does not exist in the bucket, it does nothing.
49097 ///
49098 /// If any other error occurs, it returns an `Err(error)`.
49099 pub fn delete(bucket: &Bucket, key: &Key) -> Result<(), Error> {
49100 unsafe {
49101 #[repr(align(4))]
49102 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
49103 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
49104 let vec0 = key;
49105 let ptr0 = vec0.as_ptr().cast::<u8>();
49106 let len0 = vec0.len();
49107 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
49108 #[cfg(target_arch = "wasm32")]
49109 #[link(wasm_import_module = "wasi:keyvalue/eventual@0.1.0")]
49110 extern "C" {
49111 #[link_name = "delete"]
49112 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
49113 }
49114 #[cfg(not(target_arch = "wasm32"))]
49115 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
49116 unreachable!()
49117 }
49118 wit_import((bucket).handle() as i32, ptr0.cast_mut(), len0, ptr1);
49119 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
49120 match l2 {
49121 0 => {
49122 let e = ();
49123 Ok(e)
49124 }
49125 1 => {
49126 let e = {
49127 let l3 = *ptr1.add(4).cast::<i32>();
49128 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
49129 l3 as u32,
49130 )
49131 };
49132 Err(e)
49133 }
49134 _ => _rt::invalid_enum_discriminant(),
49135 }
49136 }
49137 }
49138 #[allow(unused_unsafe, clippy::all)]
49139 /// Check if the key exists in the bucket.
49140 ///
49141 /// If the key exists in the bucket, it returns `Ok(true)`. If the key does
49142 /// not exist in the bucket, it returns `Ok(false)`.
49143 ///
49144 /// If any other error occurs, it returns an `Err(error)`.
49145 pub fn exists(bucket: &Bucket, key: &Key) -> Result<bool, Error> {
49146 unsafe {
49147 #[repr(align(4))]
49148 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
49149 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
49150 let vec0 = key;
49151 let ptr0 = vec0.as_ptr().cast::<u8>();
49152 let len0 = vec0.len();
49153 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
49154 #[cfg(target_arch = "wasm32")]
49155 #[link(wasm_import_module = "wasi:keyvalue/eventual@0.1.0")]
49156 extern "C" {
49157 #[link_name = "exists"]
49158 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
49159 }
49160 #[cfg(not(target_arch = "wasm32"))]
49161 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
49162 unreachable!()
49163 }
49164 wit_import((bucket).handle() as i32, ptr0.cast_mut(), len0, ptr1);
49165 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
49166 match l2 {
49167 0 => {
49168 let e = {
49169 let l3 = i32::from(*ptr1.add(4).cast::<u8>());
49170 _rt::bool_lift(l3 as u8)
49171 };
49172 Ok(e)
49173 }
49174 1 => {
49175 let e = {
49176 let l4 = *ptr1.add(4).cast::<i32>();
49177 super::super::super::wasi::keyvalue::wasi_keyvalue_error::Error::from_handle(
49178 l4 as u32,
49179 )
49180 };
49181 Err(e)
49182 }
49183 _ => _rt::invalid_enum_discriminant(),
49184 }
49185 }
49186 }
49187 }
49188 }
49189 pub mod logging {
49190 /// WASI Logging is a logging API intended to let users emit log messages with
49191 /// simple priority levels and context values.
49192 #[allow(dead_code, clippy::all)]
49193 pub mod logging {
49194 #[used]
49195 #[doc(hidden)]
49196 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
49197 /// A log level, describing a kind of message.
49198 #[repr(u8)]
49199 #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
49200 pub enum Level {
49201 /// Describes messages about the values of variables and the flow of
49202 /// control within a program.
49203 Trace,
49204 /// Describes messages likely to be of interest to someone debugging a
49205 /// program.
49206 Debug,
49207 /// Describes messages likely to be of interest to someone monitoring a
49208 /// program.
49209 Info,
49210 /// Describes messages indicating hazardous situations.
49211 Warn,
49212 /// Describes messages indicating serious errors.
49213 Error,
49214 /// Describes messages indicating fatal errors.
49215 Critical,
49216 }
49217 impl ::core::fmt::Debug for Level {
49218 fn fmt(
49219 &self,
49220 f: &mut ::core::fmt::Formatter<'_>,
49221 ) -> ::core::fmt::Result {
49222 match self {
49223 Level::Trace => f.debug_tuple("Level::Trace").finish(),
49224 Level::Debug => f.debug_tuple("Level::Debug").finish(),
49225 Level::Info => f.debug_tuple("Level::Info").finish(),
49226 Level::Warn => f.debug_tuple("Level::Warn").finish(),
49227 Level::Error => f.debug_tuple("Level::Error").finish(),
49228 Level::Critical => f.debug_tuple("Level::Critical").finish(),
49229 }
49230 }
49231 }
49232 impl Level {
49233 #[doc(hidden)]
49234 pub unsafe fn _lift(val: u8) -> Level {
49235 if !cfg!(debug_assertions) {
49236 return ::core::mem::transmute(val);
49237 }
49238 match val {
49239 0 => Level::Trace,
49240 1 => Level::Debug,
49241 2 => Level::Info,
49242 3 => Level::Warn,
49243 4 => Level::Error,
49244 5 => Level::Critical,
49245 _ => panic!("invalid enum discriminant"),
49246 }
49247 }
49248 }
49249 #[allow(unused_unsafe, clippy::all)]
49250 /// Emit a log message.
49251 ///
49252 /// A log message has a `level` describing what kind of message is being
49253 /// sent, a context, which is an uninterpreted string meant to help
49254 /// consumers group similar messages, and a string containing the message
49255 /// text.
49256 pub fn log(level: Level, context: &str, message: &str) {
49257 unsafe {
49258 let vec0 = context;
49259 let ptr0 = vec0.as_ptr().cast::<u8>();
49260 let len0 = vec0.len();
49261 let vec1 = message;
49262 let ptr1 = vec1.as_ptr().cast::<u8>();
49263 let len1 = vec1.len();
49264 #[cfg(target_arch = "wasm32")]
49265 #[link(wasm_import_module = "wasi:logging/logging")]
49266 extern "C" {
49267 #[link_name = "log"]
49268 fn wit_import(
49269 _: i32,
49270 _: *mut u8,
49271 _: usize,
49272 _: *mut u8,
49273 _: usize,
49274 );
49275 }
49276 #[cfg(not(target_arch = "wasm32"))]
49277 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8, _: usize) {
49278 unreachable!()
49279 }
49280 wit_import(
49281 level.clone() as i32,
49282 ptr0.cast_mut(),
49283 len0,
49284 ptr1.cast_mut(),
49285 len1,
49286 );
49287 }
49288 }
49289 }
49290 }
49291 pub mod sockets {
49292 #[allow(dead_code, clippy::all)]
49293 pub mod network {
49294 #[used]
49295 #[doc(hidden)]
49296 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
49297 use super::super::super::_rt;
49298 /// An opaque resource that represents access to (a subset of) the network.
49299 /// This enables context-based security for networking.
49300 /// There is no need for this to map 1:1 to a physical network interface.
49301 #[derive(Debug)]
49302 #[repr(transparent)]
49303 pub struct Network {
49304 handle: _rt::Resource<Network>,
49305 }
49306 impl Network {
49307 #[doc(hidden)]
49308 pub unsafe fn from_handle(handle: u32) -> Self {
49309 Self {
49310 handle: _rt::Resource::from_handle(handle),
49311 }
49312 }
49313 #[doc(hidden)]
49314 pub fn take_handle(&self) -> u32 {
49315 _rt::Resource::take_handle(&self.handle)
49316 }
49317 #[doc(hidden)]
49318 pub fn handle(&self) -> u32 {
49319 _rt::Resource::handle(&self.handle)
49320 }
49321 }
49322 unsafe impl _rt::WasmResource for Network {
49323 #[inline]
49324 unsafe fn drop(_handle: u32) {
49325 #[cfg(not(target_arch = "wasm32"))]
49326 unreachable!();
49327 #[cfg(target_arch = "wasm32")]
49328 {
49329 #[link(wasm_import_module = "wasi:sockets/network@0.2.0")]
49330 extern "C" {
49331 #[link_name = "[resource-drop]network"]
49332 fn drop(_: u32);
49333 }
49334 drop(_handle);
49335 }
49336 }
49337 }
49338 /// Error codes.
49339 ///
49340 /// In theory, every API can return any error code.
49341 /// In practice, API's typically only return the errors documented per API
49342 /// combined with a couple of errors that are always possible:
49343 /// - `unknown`
49344 /// - `access-denied`
49345 /// - `not-supported`
49346 /// - `out-of-memory`
49347 /// - `concurrency-conflict`
49348 ///
49349 /// See each individual API for what the POSIX equivalents are. They sometimes differ per API.
49350 #[repr(u8)]
49351 #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
49352 pub enum ErrorCode {
49353 /// Unknown error
49354 Unknown,
49355 /// Access denied.
49356 ///
49357 /// POSIX equivalent: EACCES, EPERM
49358 AccessDenied,
49359 /// The operation is not supported.
49360 ///
49361 /// POSIX equivalent: EOPNOTSUPP
49362 NotSupported,
49363 /// One of the arguments is invalid.
49364 ///
49365 /// POSIX equivalent: EINVAL
49366 InvalidArgument,
49367 /// Not enough memory to complete the operation.
49368 ///
49369 /// POSIX equivalent: ENOMEM, ENOBUFS, EAI_MEMORY
49370 OutOfMemory,
49371 /// The operation timed out before it could finish completely.
49372 Timeout,
49373 /// This operation is incompatible with another asynchronous operation that is already in progress.
49374 ///
49375 /// POSIX equivalent: EALREADY
49376 ConcurrencyConflict,
49377 /// Trying to finish an asynchronous operation that:
49378 /// - has not been started yet, or:
49379 /// - was already finished by a previous `finish-*` call.
49380 ///
49381 /// Note: this is scheduled to be removed when `future`s are natively supported.
49382 NotInProgress,
49383 /// The operation has been aborted because it could not be completed immediately.
49384 ///
49385 /// Note: this is scheduled to be removed when `future`s are natively supported.
49386 WouldBlock,
49387 /// The operation is not valid in the socket's current state.
49388 InvalidState,
49389 /// A new socket resource could not be created because of a system limit.
49390 NewSocketLimit,
49391 /// A bind operation failed because the provided address is not an address that the `network` can bind to.
49392 AddressNotBindable,
49393 /// A bind operation failed because the provided address is already in use or because there are no ephemeral ports available.
49394 AddressInUse,
49395 /// The remote address is not reachable
49396 RemoteUnreachable,
49397 /// The TCP connection was forcefully rejected
49398 ConnectionRefused,
49399 /// The TCP connection was reset.
49400 ConnectionReset,
49401 /// A TCP connection was aborted.
49402 ConnectionAborted,
49403 /// The size of a datagram sent to a UDP socket exceeded the maximum
49404 /// supported size.
49405 DatagramTooLarge,
49406 /// Name does not exist or has no suitable associated IP addresses.
49407 NameUnresolvable,
49408 /// A temporary failure in name resolution occurred.
49409 TemporaryResolverFailure,
49410 /// A permanent failure in name resolution occurred.
49411 PermanentResolverFailure,
49412 }
49413 impl ErrorCode {
49414 pub fn name(&self) -> &'static str {
49415 match self {
49416 ErrorCode::Unknown => "unknown",
49417 ErrorCode::AccessDenied => "access-denied",
49418 ErrorCode::NotSupported => "not-supported",
49419 ErrorCode::InvalidArgument => "invalid-argument",
49420 ErrorCode::OutOfMemory => "out-of-memory",
49421 ErrorCode::Timeout => "timeout",
49422 ErrorCode::ConcurrencyConflict => "concurrency-conflict",
49423 ErrorCode::NotInProgress => "not-in-progress",
49424 ErrorCode::WouldBlock => "would-block",
49425 ErrorCode::InvalidState => "invalid-state",
49426 ErrorCode::NewSocketLimit => "new-socket-limit",
49427 ErrorCode::AddressNotBindable => "address-not-bindable",
49428 ErrorCode::AddressInUse => "address-in-use",
49429 ErrorCode::RemoteUnreachable => "remote-unreachable",
49430 ErrorCode::ConnectionRefused => "connection-refused",
49431 ErrorCode::ConnectionReset => "connection-reset",
49432 ErrorCode::ConnectionAborted => "connection-aborted",
49433 ErrorCode::DatagramTooLarge => "datagram-too-large",
49434 ErrorCode::NameUnresolvable => "name-unresolvable",
49435 ErrorCode::TemporaryResolverFailure => {
49436 "temporary-resolver-failure"
49437 }
49438 ErrorCode::PermanentResolverFailure => {
49439 "permanent-resolver-failure"
49440 }
49441 }
49442 }
49443 pub fn message(&self) -> &'static str {
49444 match self {
49445 ErrorCode::Unknown => "Unknown error",
49446 ErrorCode::AccessDenied => {
49447 "Access denied.
49448
49449 POSIX equivalent: EACCES, EPERM"
49450 }
49451 ErrorCode::NotSupported => {
49452 "The operation is not supported.
49453
49454 POSIX equivalent: EOPNOTSUPP"
49455 }
49456 ErrorCode::InvalidArgument => {
49457 "One of the arguments is invalid.
49458
49459 POSIX equivalent: EINVAL"
49460 }
49461 ErrorCode::OutOfMemory => {
49462 "Not enough memory to complete the operation.
49463
49464 POSIX equivalent: ENOMEM, ENOBUFS, EAI_MEMORY"
49465 }
49466 ErrorCode::Timeout => {
49467 "The operation timed out before it could finish completely."
49468 }
49469 ErrorCode::ConcurrencyConflict => {
49470 "This operation is incompatible with another asynchronous operation that is already in progress.
49471
49472 POSIX equivalent: EALREADY"
49473 }
49474 ErrorCode::NotInProgress => {
49475 "Trying to finish an asynchronous operation that:
49476 - has not been started yet, or:
49477 - was already finished by a previous `finish-*` call.
49478
49479 Note: this is scheduled to be removed when `future`s are natively supported."
49480 }
49481 ErrorCode::WouldBlock => {
49482 "The operation has been aborted because it could not be completed immediately.
49483
49484 Note: this is scheduled to be removed when `future`s are natively supported."
49485 }
49486 ErrorCode::InvalidState => {
49487 "The operation is not valid in the socket's current state."
49488 }
49489 ErrorCode::NewSocketLimit => {
49490 "A new socket resource could not be created because of a system limit."
49491 }
49492 ErrorCode::AddressNotBindable => {
49493 "A bind operation failed because the provided address is not an address that the `network` can bind to."
49494 }
49495 ErrorCode::AddressInUse => {
49496 "A bind operation failed because the provided address is already in use or because there are no ephemeral ports available."
49497 }
49498 ErrorCode::RemoteUnreachable => {
49499 "The remote address is not reachable"
49500 }
49501 ErrorCode::ConnectionRefused => {
49502 "The TCP connection was forcefully rejected"
49503 }
49504 ErrorCode::ConnectionReset => "The TCP connection was reset.",
49505 ErrorCode::ConnectionAborted => "A TCP connection was aborted.",
49506 ErrorCode::DatagramTooLarge => {
49507 "The size of a datagram sent to a UDP socket exceeded the maximum
49508 supported size."
49509 }
49510 ErrorCode::NameUnresolvable => {
49511 "Name does not exist or has no suitable associated IP addresses."
49512 }
49513 ErrorCode::TemporaryResolverFailure => {
49514 "A temporary failure in name resolution occurred."
49515 }
49516 ErrorCode::PermanentResolverFailure => {
49517 "A permanent failure in name resolution occurred."
49518 }
49519 }
49520 }
49521 }
49522 impl ::core::fmt::Debug for ErrorCode {
49523 fn fmt(
49524 &self,
49525 f: &mut ::core::fmt::Formatter<'_>,
49526 ) -> ::core::fmt::Result {
49527 f.debug_struct("ErrorCode")
49528 .field("code", &(*self as i32))
49529 .field("name", &self.name())
49530 .field("message", &self.message())
49531 .finish()
49532 }
49533 }
49534 impl ::core::fmt::Display for ErrorCode {
49535 fn fmt(
49536 &self,
49537 f: &mut ::core::fmt::Formatter<'_>,
49538 ) -> ::core::fmt::Result {
49539 write!(f, "{} (error {})", self.name(), * self as i32)
49540 }
49541 }
49542 impl std::error::Error for ErrorCode {}
49543 impl ErrorCode {
49544 #[doc(hidden)]
49545 pub unsafe fn _lift(val: u8) -> ErrorCode {
49546 if !cfg!(debug_assertions) {
49547 return ::core::mem::transmute(val);
49548 }
49549 match val {
49550 0 => ErrorCode::Unknown,
49551 1 => ErrorCode::AccessDenied,
49552 2 => ErrorCode::NotSupported,
49553 3 => ErrorCode::InvalidArgument,
49554 4 => ErrorCode::OutOfMemory,
49555 5 => ErrorCode::Timeout,
49556 6 => ErrorCode::ConcurrencyConflict,
49557 7 => ErrorCode::NotInProgress,
49558 8 => ErrorCode::WouldBlock,
49559 9 => ErrorCode::InvalidState,
49560 10 => ErrorCode::NewSocketLimit,
49561 11 => ErrorCode::AddressNotBindable,
49562 12 => ErrorCode::AddressInUse,
49563 13 => ErrorCode::RemoteUnreachable,
49564 14 => ErrorCode::ConnectionRefused,
49565 15 => ErrorCode::ConnectionReset,
49566 16 => ErrorCode::ConnectionAborted,
49567 17 => ErrorCode::DatagramTooLarge,
49568 18 => ErrorCode::NameUnresolvable,
49569 19 => ErrorCode::TemporaryResolverFailure,
49570 20 => ErrorCode::PermanentResolverFailure,
49571 _ => panic!("invalid enum discriminant"),
49572 }
49573 }
49574 }
49575 #[repr(u8)]
49576 #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
49577 pub enum IpAddressFamily {
49578 /// Similar to `AF_INET` in POSIX.
49579 Ipv4,
49580 /// Similar to `AF_INET6` in POSIX.
49581 Ipv6,
49582 }
49583 impl ::core::fmt::Debug for IpAddressFamily {
49584 fn fmt(
49585 &self,
49586 f: &mut ::core::fmt::Formatter<'_>,
49587 ) -> ::core::fmt::Result {
49588 match self {
49589 IpAddressFamily::Ipv4 => {
49590 f.debug_tuple("IpAddressFamily::Ipv4").finish()
49591 }
49592 IpAddressFamily::Ipv6 => {
49593 f.debug_tuple("IpAddressFamily::Ipv6").finish()
49594 }
49595 }
49596 }
49597 }
49598 impl IpAddressFamily {
49599 #[doc(hidden)]
49600 pub unsafe fn _lift(val: u8) -> IpAddressFamily {
49601 if !cfg!(debug_assertions) {
49602 return ::core::mem::transmute(val);
49603 }
49604 match val {
49605 0 => IpAddressFamily::Ipv4,
49606 1 => IpAddressFamily::Ipv6,
49607 _ => panic!("invalid enum discriminant"),
49608 }
49609 }
49610 }
49611 pub type Ipv4Address = (u8, u8, u8, u8);
49612 pub type Ipv6Address = (u16, u16, u16, u16, u16, u16, u16, u16);
49613 #[derive(Clone, Copy)]
49614 pub enum IpAddress {
49615 Ipv4(Ipv4Address),
49616 Ipv6(Ipv6Address),
49617 }
49618 impl ::core::fmt::Debug for IpAddress {
49619 fn fmt(
49620 &self,
49621 f: &mut ::core::fmt::Formatter<'_>,
49622 ) -> ::core::fmt::Result {
49623 match self {
49624 IpAddress::Ipv4(e) => {
49625 f.debug_tuple("IpAddress::Ipv4").field(e).finish()
49626 }
49627 IpAddress::Ipv6(e) => {
49628 f.debug_tuple("IpAddress::Ipv6").field(e).finish()
49629 }
49630 }
49631 }
49632 }
49633 #[repr(C)]
49634 #[derive(Clone, Copy)]
49635 pub struct Ipv4SocketAddress {
49636 /// sin_port
49637 pub port: u16,
49638 /// sin_addr
49639 pub address: Ipv4Address,
49640 }
49641 impl ::core::fmt::Debug for Ipv4SocketAddress {
49642 fn fmt(
49643 &self,
49644 f: &mut ::core::fmt::Formatter<'_>,
49645 ) -> ::core::fmt::Result {
49646 f.debug_struct("Ipv4SocketAddress")
49647 .field("port", &self.port)
49648 .field("address", &self.address)
49649 .finish()
49650 }
49651 }
49652 #[repr(C)]
49653 #[derive(Clone, Copy)]
49654 pub struct Ipv6SocketAddress {
49655 /// sin6_port
49656 pub port: u16,
49657 /// sin6_flowinfo
49658 pub flow_info: u32,
49659 /// sin6_addr
49660 pub address: Ipv6Address,
49661 /// sin6_scope_id
49662 pub scope_id: u32,
49663 }
49664 impl ::core::fmt::Debug for Ipv6SocketAddress {
49665 fn fmt(
49666 &self,
49667 f: &mut ::core::fmt::Formatter<'_>,
49668 ) -> ::core::fmt::Result {
49669 f.debug_struct("Ipv6SocketAddress")
49670 .field("port", &self.port)
49671 .field("flow-info", &self.flow_info)
49672 .field("address", &self.address)
49673 .field("scope-id", &self.scope_id)
49674 .finish()
49675 }
49676 }
49677 #[derive(Clone, Copy)]
49678 pub enum IpSocketAddress {
49679 Ipv4(Ipv4SocketAddress),
49680 Ipv6(Ipv6SocketAddress),
49681 }
49682 impl ::core::fmt::Debug for IpSocketAddress {
49683 fn fmt(
49684 &self,
49685 f: &mut ::core::fmt::Formatter<'_>,
49686 ) -> ::core::fmt::Result {
49687 match self {
49688 IpSocketAddress::Ipv4(e) => {
49689 f.debug_tuple("IpSocketAddress::Ipv4").field(e).finish()
49690 }
49691 IpSocketAddress::Ipv6(e) => {
49692 f.debug_tuple("IpSocketAddress::Ipv6").field(e).finish()
49693 }
49694 }
49695 }
49696 }
49697 }
49698 #[allow(dead_code, clippy::all)]
49699 pub mod ip_name_lookup {
49700 #[used]
49701 #[doc(hidden)]
49702 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
49703 use super::super::super::_rt;
49704 pub type Pollable = super::super::super::wasi::io::poll::Pollable;
49705 pub type Network = super::super::super::wasi::sockets::network::Network;
49706 pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode;
49707 pub type IpAddress = super::super::super::wasi::sockets::network::IpAddress;
49708 #[derive(Debug)]
49709 #[repr(transparent)]
49710 pub struct ResolveAddressStream {
49711 handle: _rt::Resource<ResolveAddressStream>,
49712 }
49713 impl ResolveAddressStream {
49714 #[doc(hidden)]
49715 pub unsafe fn from_handle(handle: u32) -> Self {
49716 Self {
49717 handle: _rt::Resource::from_handle(handle),
49718 }
49719 }
49720 #[doc(hidden)]
49721 pub fn take_handle(&self) -> u32 {
49722 _rt::Resource::take_handle(&self.handle)
49723 }
49724 #[doc(hidden)]
49725 pub fn handle(&self) -> u32 {
49726 _rt::Resource::handle(&self.handle)
49727 }
49728 }
49729 unsafe impl _rt::WasmResource for ResolveAddressStream {
49730 #[inline]
49731 unsafe fn drop(_handle: u32) {
49732 #[cfg(not(target_arch = "wasm32"))]
49733 unreachable!();
49734 #[cfg(target_arch = "wasm32")]
49735 {
49736 #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")]
49737 extern "C" {
49738 #[link_name = "[resource-drop]resolve-address-stream"]
49739 fn drop(_: u32);
49740 }
49741 drop(_handle);
49742 }
49743 }
49744 }
49745 #[allow(unused_unsafe, clippy::all)]
49746 /// Resolve an internet host name to a list of IP addresses.
49747 ///
49748 /// Unicode domain names are automatically converted to ASCII using IDNA encoding.
49749 /// If the input is an IP address string, the address is parsed and returned
49750 /// as-is without making any external requests.
49751 ///
49752 /// See the wasi-socket proposal README.md for a comparison with getaddrinfo.
49753 ///
49754 /// This function never blocks. It either immediately fails or immediately
49755 /// returns successfully with a `resolve-address-stream` that can be used
49756 /// to (asynchronously) fetch the results.
49757 ///
49758 /// # Typical errors
49759 /// - `invalid-argument`: `name` is a syntactically invalid domain name or IP address.
49760 ///
49761 /// # References:
49762 /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>
49763 /// - <https://man7.org/linux/man-pages/man3/getaddrinfo.3.html>
49764 /// - <https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
49765 /// - <https://man.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3>
49766 pub fn resolve_addresses(
49767 network: &Network,
49768 name: &str,
49769 ) -> Result<ResolveAddressStream, ErrorCode> {
49770 unsafe {
49771 #[repr(align(4))]
49772 struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
49773 let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
49774 let vec0 = name;
49775 let ptr0 = vec0.as_ptr().cast::<u8>();
49776 let len0 = vec0.len();
49777 let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
49778 #[cfg(target_arch = "wasm32")]
49779 #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")]
49780 extern "C" {
49781 #[link_name = "resolve-addresses"]
49782 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
49783 }
49784 #[cfg(not(target_arch = "wasm32"))]
49785 fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
49786 unreachable!()
49787 }
49788 wit_import((network).handle() as i32, ptr0.cast_mut(), len0, ptr1);
49789 let l2 = i32::from(*ptr1.add(0).cast::<u8>());
49790 match l2 {
49791 0 => {
49792 let e = {
49793 let l3 = *ptr1.add(4).cast::<i32>();
49794 ResolveAddressStream::from_handle(l3 as u32)
49795 };
49796 Ok(e)
49797 }
49798 1 => {
49799 let e = {
49800 let l4 = i32::from(*ptr1.add(4).cast::<u8>());
49801 super::super::super::wasi::sockets::network::ErrorCode::_lift(
49802 l4 as u8,
49803 )
49804 };
49805 Err(e)
49806 }
49807 _ => _rt::invalid_enum_discriminant(),
49808 }
49809 }
49810 }
49811 impl ResolveAddressStream {
49812 #[allow(unused_unsafe, clippy::all)]
49813 /// Returns the next address from the resolver.
49814 ///
49815 /// This function should be called multiple times. On each call, it will
49816 /// return the next address in connection order preference. If all
49817 /// addresses have been exhausted, this function returns `none`.
49818 ///
49819 /// This function never returns IPv4-mapped IPv6 addresses.
49820 ///
49821 /// # Typical errors
49822 /// - `name-unresolvable`: Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY)
49823 /// - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN)
49824 /// - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL)
49825 /// - `would-block`: A result is not available yet. (EWOULDBLOCK, EAGAIN)
49826 pub fn resolve_next_address(
49827 &self,
49828 ) -> Result<Option<IpAddress>, ErrorCode> {
49829 unsafe {
49830 #[repr(align(2))]
49831 struct RetArea([::core::mem::MaybeUninit<u8>; 22]);
49832 let mut ret_area = RetArea(
49833 [::core::mem::MaybeUninit::uninit(); 22],
49834 );
49835 let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
49836 #[cfg(target_arch = "wasm32")]
49837 #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")]
49838 extern "C" {
49839 #[link_name = "[method]resolve-address-stream.resolve-next-address"]
49840 fn wit_import(_: i32, _: *mut u8);
49841 }
49842 #[cfg(not(target_arch = "wasm32"))]
49843 fn wit_import(_: i32, _: *mut u8) {
49844 unreachable!()
49845 }
49846 wit_import((self).handle() as i32, ptr0);
49847 let l1 = i32::from(*ptr0.add(0).cast::<u8>());
49848 match l1 {
49849 0 => {
49850 let e = {
49851 let l2 = i32::from(*ptr0.add(2).cast::<u8>());
49852 match l2 {
49853 0 => None,
49854 1 => {
49855 let e = {
49856 let l3 = i32::from(*ptr0.add(4).cast::<u8>());
49857 use super::super::super::wasi::sockets::network::IpAddress as V16;
49858 let v16 = match l3 {
49859 0 => {
49860 let e16 = {
49861 let l4 = i32::from(*ptr0.add(6).cast::<u8>());
49862 let l5 = i32::from(*ptr0.add(7).cast::<u8>());
49863 let l6 = i32::from(*ptr0.add(8).cast::<u8>());
49864 let l7 = i32::from(*ptr0.add(9).cast::<u8>());
49865 (l4 as u8, l5 as u8, l6 as u8, l7 as u8)
49866 };
49867 V16::Ipv4(e16)
49868 }
49869 n => {
49870 debug_assert_eq!(n, 1, "invalid enum discriminant");
49871 let e16 = {
49872 let l8 = i32::from(*ptr0.add(6).cast::<u16>());
49873 let l9 = i32::from(*ptr0.add(8).cast::<u16>());
49874 let l10 = i32::from(*ptr0.add(10).cast::<u16>());
49875 let l11 = i32::from(*ptr0.add(12).cast::<u16>());
49876 let l12 = i32::from(*ptr0.add(14).cast::<u16>());
49877 let l13 = i32::from(*ptr0.add(16).cast::<u16>());
49878 let l14 = i32::from(*ptr0.add(18).cast::<u16>());
49879 let l15 = i32::from(*ptr0.add(20).cast::<u16>());
49880 (
49881 l8 as u16,
49882 l9 as u16,
49883 l10 as u16,
49884 l11 as u16,
49885 l12 as u16,
49886 l13 as u16,
49887 l14 as u16,
49888 l15 as u16,
49889 )
49890 };
49891 V16::Ipv6(e16)
49892 }
49893 };
49894 v16
49895 };
49896 Some(e)
49897 }
49898 _ => _rt::invalid_enum_discriminant(),
49899 }
49900 };
49901 Ok(e)
49902 }
49903 1 => {
49904 let e = {
49905 let l17 = i32::from(*ptr0.add(2).cast::<u8>());
49906 super::super::super::wasi::sockets::network::ErrorCode::_lift(
49907 l17 as u8,
49908 )
49909 };
49910 Err(e)
49911 }
49912 _ => _rt::invalid_enum_discriminant(),
49913 }
49914 }
49915 }
49916 }
49917 impl ResolveAddressStream {
49918 #[allow(unused_unsafe, clippy::all)]
49919 /// Create a `pollable` which will resolve once the stream is ready for I/O.
49920 ///
49921 /// Note: this function is here for WASI Preview2 only.
49922 /// It's planned to be removed when `future` is natively supported in Preview3.
49923 pub fn subscribe(&self) -> Pollable {
49924 unsafe {
49925 #[cfg(target_arch = "wasm32")]
49926 #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")]
49927 extern "C" {
49928 #[link_name = "[method]resolve-address-stream.subscribe"]
49929 fn wit_import(_: i32) -> i32;
49930 }
49931 #[cfg(not(target_arch = "wasm32"))]
49932 fn wit_import(_: i32) -> i32 {
49933 unreachable!()
49934 }
49935 let ret = wit_import((self).handle() as i32);
49936 super::super::super::wasi::io::poll::Pollable::from_handle(
49937 ret as u32,
49938 )
49939 }
49940 }
49941 }
49942 }
49943 /// This interface provides a value-export of the default network handle..
49944 #[allow(dead_code, clippy::all)]
49945 pub mod instance_network {
49946 #[used]
49947 #[doc(hidden)]
49948 static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
49949 pub type Network = super::super::super::wasi::sockets::network::Network;
49950 #[allow(unused_unsafe, clippy::all)]
49951 /// Get a handle to the default network.
49952 pub fn instance_network() -> Network {
49953 unsafe {
49954 #[cfg(target_arch = "wasm32")]
49955 #[link(wasm_import_module = "wasi:sockets/instance-network@0.2.0")]
49956 extern "C" {
49957 #[link_name = "instance-network"]
49958 fn wit_import() -> i32;
49959 }
49960 #[cfg(not(target_arch = "wasm32"))]
49961 fn wit_import() -> i32 {
49962 unreachable!()
49963 }
49964 let ret = wit_import();
49965 super::super::super::wasi::sockets::network::Network::from_handle(
49966 ret as u32,
49967 )
49968 }
49969 }
49970 }
49971 }
49972}
49973#[rustfmt::skip]
49974mod _rt {
49975 use core::fmt;
49976 use core::marker;
49977 use core::sync::atomic::{AtomicU32, Ordering::Relaxed};
49978 /// A type which represents a component model resource, either imported or
49979 /// exported into this component.
49980 ///
49981 /// This is a low-level wrapper which handles the lifetime of the resource
49982 /// (namely this has a destructor). The `T` provided defines the component model
49983 /// intrinsics that this wrapper uses.
49984 ///
49985 /// One of the chief purposes of this type is to provide `Deref` implementations
49986 /// to access the underlying data when it is owned.
49987 ///
49988 /// This type is primarily used in generated code for exported and imported
49989 /// resources.
49990 #[repr(transparent)]
49991 pub struct Resource<T: WasmResource> {
49992 handle: AtomicU32,
49993 _marker: marker::PhantomData<T>,
49994 }
49995 /// A trait which all wasm resources implement, namely providing the ability to
49996 /// drop a resource.
49997 ///
49998 /// This generally is implemented by generated code, not user-facing code.
49999 #[allow(clippy::missing_safety_doc)]
50000 pub unsafe trait WasmResource {
50001 /// Invokes the `[resource-drop]...` intrinsic.
50002 unsafe fn drop(handle: u32);
50003 }
50004 impl<T: WasmResource> Resource<T> {
50005 #[doc(hidden)]
50006 pub unsafe fn from_handle(handle: u32) -> Self {
50007 debug_assert!(handle != u32::MAX);
50008 Self {
50009 handle: AtomicU32::new(handle),
50010 _marker: marker::PhantomData,
50011 }
50012 }
50013 /// Takes ownership of the handle owned by `resource`.
50014 ///
50015 /// Note that this ideally would be `into_handle` taking `Resource<T>` by
50016 /// ownership. The code generator does not enable that in all situations,
50017 /// unfortunately, so this is provided instead.
50018 ///
50019 /// Also note that `take_handle` is in theory only ever called on values
50020 /// owned by a generated function. For example a generated function might
50021 /// take `Resource<T>` as an argument but then call `take_handle` on a
50022 /// reference to that argument. In that sense the dynamic nature of
50023 /// `take_handle` should only be exposed internally to generated code, not
50024 /// to user code.
50025 #[doc(hidden)]
50026 pub fn take_handle(resource: &Resource<T>) -> u32 {
50027 resource.handle.swap(u32::MAX, Relaxed)
50028 }
50029 #[doc(hidden)]
50030 pub fn handle(resource: &Resource<T>) -> u32 {
50031 resource.handle.load(Relaxed)
50032 }
50033 }
50034 impl<T: WasmResource> fmt::Debug for Resource<T> {
50035 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
50036 f.debug_struct("Resource").field("handle", &self.handle).finish()
50037 }
50038 }
50039 impl<T: WasmResource> Drop for Resource<T> {
50040 fn drop(&mut self) {
50041 unsafe {
50042 match self.handle.load(Relaxed) {
50043 u32::MAX => {}
50044 other => T::drop(other),
50045 }
50046 }
50047 }
50048 }
50049 pub unsafe fn bool_lift(val: u8) -> bool {
50050 if cfg!(debug_assertions) {
50051 match val {
50052 0 => false,
50053 1 => true,
50054 _ => panic!("invalid bool discriminant"),
50055 }
50056 } else {
50057 val != 0
50058 }
50059 }
50060 pub use alloc_crate::vec::Vec;
50061 pub use alloc_crate::alloc;
50062 pub use alloc_crate::string::String;
50063 pub fn as_i32<T: AsI32>(t: T) -> i32 {
50064 t.as_i32()
50065 }
50066 pub trait AsI32 {
50067 fn as_i32(self) -> i32;
50068 }
50069 impl<'a, T: Copy + AsI32> AsI32 for &'a T {
50070 fn as_i32(self) -> i32 {
50071 (*self).as_i32()
50072 }
50073 }
50074 impl AsI32 for i32 {
50075 #[inline]
50076 fn as_i32(self) -> i32 {
50077 self as i32
50078 }
50079 }
50080 impl AsI32 for u32 {
50081 #[inline]
50082 fn as_i32(self) -> i32 {
50083 self as i32
50084 }
50085 }
50086 impl AsI32 for i16 {
50087 #[inline]
50088 fn as_i32(self) -> i32 {
50089 self as i32
50090 }
50091 }
50092 impl AsI32 for u16 {
50093 #[inline]
50094 fn as_i32(self) -> i32 {
50095 self as i32
50096 }
50097 }
50098 impl AsI32 for i8 {
50099 #[inline]
50100 fn as_i32(self) -> i32 {
50101 self as i32
50102 }
50103 }
50104 impl AsI32 for u8 {
50105 #[inline]
50106 fn as_i32(self) -> i32 {
50107 self as i32
50108 }
50109 }
50110 impl AsI32 for char {
50111 #[inline]
50112 fn as_i32(self) -> i32 {
50113 self as i32
50114 }
50115 }
50116 impl AsI32 for usize {
50117 #[inline]
50118 fn as_i32(self) -> i32 {
50119 self as i32
50120 }
50121 }
50122 pub fn as_i64<T: AsI64>(t: T) -> i64 {
50123 t.as_i64()
50124 }
50125 pub trait AsI64 {
50126 fn as_i64(self) -> i64;
50127 }
50128 impl<'a, T: Copy + AsI64> AsI64 for &'a T {
50129 fn as_i64(self) -> i64 {
50130 (*self).as_i64()
50131 }
50132 }
50133 impl AsI64 for i64 {
50134 #[inline]
50135 fn as_i64(self) -> i64 {
50136 self as i64
50137 }
50138 }
50139 impl AsI64 for u64 {
50140 #[inline]
50141 fn as_i64(self) -> i64 {
50142 self as i64
50143 }
50144 }
50145 pub fn as_f32<T: AsF32>(t: T) -> f32 {
50146 t.as_f32()
50147 }
50148 pub trait AsF32 {
50149 fn as_f32(self) -> f32;
50150 }
50151 impl<'a, T: Copy + AsF32> AsF32 for &'a T {
50152 fn as_f32(self) -> f32 {
50153 (*self).as_f32()
50154 }
50155 }
50156 impl AsF32 for f32 {
50157 #[inline]
50158 fn as_f32(self) -> f32 {
50159 self as f32
50160 }
50161 }
50162 pub fn as_f64<T: AsF64>(t: T) -> f64 {
50163 t.as_f64()
50164 }
50165 pub trait AsF64 {
50166 fn as_f64(self) -> f64;
50167 }
50168 impl<'a, T: Copy + AsF64> AsF64 for &'a T {
50169 fn as_f64(self) -> f64 {
50170 (*self).as_f64()
50171 }
50172 }
50173 impl AsF64 for f64 {
50174 #[inline]
50175 fn as_f64(self) -> f64 {
50176 self as f64
50177 }
50178 }
50179 pub unsafe fn invalid_enum_discriminant<T>() -> T {
50180 if cfg!(debug_assertions) {
50181 panic!("invalid enum discriminant")
50182 } else {
50183 core::hint::unreachable_unchecked()
50184 }
50185 }
50186 pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) {
50187 if size == 0 {
50188 return;
50189 }
50190 let layout = alloc::Layout::from_size_align_unchecked(size, align);
50191 alloc::dealloc(ptr, layout);
50192 }
50193 pub unsafe fn char_lift(val: u32) -> char {
50194 if cfg!(debug_assertions) {
50195 core::char::from_u32(val).unwrap()
50196 } else {
50197 core::char::from_u32_unchecked(val)
50198 }
50199 }
50200 pub unsafe fn string_lift(bytes: Vec<u8>) -> String {
50201 if cfg!(debug_assertions) {
50202 String::from_utf8(bytes).unwrap()
50203 } else {
50204 String::from_utf8_unchecked(bytes)
50205 }
50206 }
50207 extern crate alloc as alloc_crate;
50208}
50209#[cfg(target_arch = "wasm32")]
50210#[link_section = "component-type:wit-bindgen:0.36.0:golem:rust:golem-rust:encoded world"]
50211#[doc(hidden)]
50212pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 30633] = *b"\
50213\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xa7\xee\x01\x01A\x02\
50214\x01An\x01B\x05\x01r\x02\x07secondsw\x0bnanosecondsy\x04\0\x08datetime\x03\0\0\x01\
50215@\0\0\x01\x04\0\x03now\x01\x02\x04\0\x0aresolution\x01\x02\x03\0\x1cwasi:clocks/\
50216wall-clock@0.2.0\x05\0\x01B\x0a\x04\0\x08pollable\x03\x01\x01h\0\x01@\x01\x04sel\
50217f\x01\0\x7f\x04\0\x16[method]pollable.ready\x01\x02\x01@\x01\x04self\x01\x01\0\x04\
50218\0\x16[method]pollable.block\x01\x03\x01p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\
50219\0\x04poll\x01\x06\x03\0\x12wasi:io/poll@0.2.0\x05\x01\x02\x03\0\0\x08datetime\x02\
50220\x03\0\x01\x08pollable\x01BK\x02\x03\x02\x01\x02\x04\0\x08datetime\x03\0\0\x02\x03\
50221\x02\x01\x03\x04\0\x08pollable\x03\0\x02\x01z\x04\0\x0anode-index\x03\0\x04\x01w\
50222\x04\0\x0bresource-id\x03\0\x06\x01m\x02\x05owned\x08borrowed\x04\0\x0dresource-\
50223mode\x03\0\x08\x01o\x02s\x05\x01p\x0a\x01k\x05\x01o\x02s\x0c\x01p\x0d\x01ps\x01p\
50224\x05\x01o\x02\x0c\x0c\x01o\x02\x07\x09\x01q\x16\x0brecord-type\x01\x0b\0\x0cvari\
50225ant-type\x01\x0e\0\x09enum-type\x01\x0f\0\x0aflags-type\x01\x0f\0\x0atuple-type\x01\
50226\x10\0\x09list-type\x01\x05\0\x0boption-type\x01\x05\0\x0bresult-type\x01\x11\0\x0c\
50227prim-u8-type\0\0\x0dprim-u16-type\0\0\x0dprim-u32-type\0\0\x0dprim-u64-type\0\0\x0c\
50228prim-s8-type\0\0\x0dprim-s16-type\0\0\x0dprim-s32-type\0\0\x0dprim-s64-type\0\0\x0d\
50229prim-f32-type\0\0\x0dprim-f64-type\0\0\x0eprim-char-type\0\0\x0eprim-bool-type\0\
50230\0\x10prim-string-type\0\0\x0bhandle-type\x01\x12\0\x04\0\x0dwit-type-node\x03\0\
50231\x13\x01p\x14\x01r\x01\x05nodes\x15\x04\0\x08wit-type\x03\0\x16\x01r\x01\x05valu\
50232es\x04\0\x03uri\x03\0\x18\x01o\x02y\x0c\x01p\x7f\x01j\x01\x0c\x01\x0c\x01o\x02\x19\
50233w\x01q\x16\x0crecord-value\x01\x10\0\x0dvariant-value\x01\x1a\0\x0aenum-value\x01\
50234y\0\x0bflags-value\x01\x1b\0\x0btuple-value\x01\x10\0\x0alist-value\x01\x10\0\x0c\
50235option-value\x01\x0c\0\x0cresult-value\x01\x1c\0\x07prim-u8\x01}\0\x08prim-u16\x01\
50236{\0\x08prim-u32\x01y\0\x08prim-u64\x01w\0\x07prim-s8\x01~\0\x08prim-s16\x01|\0\x08\
50237prim-s32\x01z\0\x08prim-s64\x01x\0\x0cprim-float32\x01v\0\x0cprim-float64\x01u\0\
50238\x09prim-char\x01t\0\x09prim-bool\x01\x7f\0\x0bprim-string\x01s\0\x06handle\x01\x1d\
50239\0\x04\0\x08wit-node\x03\0\x1e\x01p\x1f\x01r\x01\x05nodes\x20\x04\0\x09wit-value\
50240\x03\0!\x01r\x02\x05value\"\x03typ\x17\x04\0\x0evalue-and-type\x03\0#\x01q\x04\x0e\
50241protocol-error\x01s\0\x06denied\x01s\0\x09not-found\x01s\0\x15remote-internal-er\
50242ror\x01s\0\x04\0\x09rpc-error\x03\0%\x04\0\x08wasm-rpc\x03\x01\x04\0\x14future-i\
50243nvoke-result\x03\x01\x04\0\x12cancellation-token\x03\x01\x01i'\x01@\x01\x08locat\
50244ion\x19\0*\x04\0\x15[constructor]wasm-rpc\x01+\x01h'\x01p\"\x01j\x01\"\x01&\x01@\
50245\x03\x04self,\x0dfunction-names\x0ffunction-params-\0.\x04\0![method]wasm-rpc.in\
50246voke-and-await\x01/\x01j\0\x01&\x01@\x03\x04self,\x0dfunction-names\x0ffunction-\
50247params-\00\x04\0\x17[method]wasm-rpc.invoke\x011\x01i(\x01@\x03\x04self,\x0dfunc\
50248tion-names\x0ffunction-params-\02\x04\0'[method]wasm-rpc.async-invoke-and-await\x01\
502493\x01@\x04\x04self,\x0escheduled-time\x01\x0dfunction-names\x0ffunction-params-\x01\
50250\0\x04\0$[method]wasm-rpc.schedule-invocation\x014\x01i)\x01@\x04\x04self,\x0esc\
50251heduled-time\x01\x0dfunction-names\x0ffunction-params-\05\x04\0/[method]wasm-rpc\
50252.schedule-cancelable-invocation\x016\x01h(\x01i\x03\x01@\x01\x04self7\08\x04\0&[\
50253method]future-invoke-result.subscribe\x019\x01k.\x01@\x01\x04self7\0:\x04\0\x20[\
50254method]future-invoke-result.get\x01;\x01h)\x01@\x01\x04self<\x01\0\x04\0![method\
50255]cancellation-token.cancel\x01=\x01@\x01\x03vnt$\0\"\x04\0\x0dextract-value\x01>\
50256\x01@\x01\x03vnt$\0\x17\x04\0\x0cextract-type\x01?\x03\0\x15golem:rpc/types@0.1.\
502573\x05\x04\x01B\x0f\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\0\0\x01w\x04\0\x07i\
50258nstant\x03\0\x02\x01w\x04\0\x08duration\x03\0\x04\x01@\0\0\x03\x04\0\x03now\x01\x06\
50259\x01@\0\0\x05\x04\0\x0aresolution\x01\x07\x01i\x01\x01@\x01\x04when\x03\0\x08\x04\
50260\0\x11subscribe-instant\x01\x09\x01@\x01\x04when\x05\0\x08\x04\0\x12subscribe-du\
50261ration\x01\x0a\x03\0!wasi:clocks/monotonic-clock@0.2.0\x05\x05\x02\x03\0\x02\x03\
50262uri\x02\x03\0\x02\x09wit-value\x02\x03\0\x03\x08duration\x01B{\x02\x03\x02\x01\x06\
50263\x04\0\x03uri\x03\0\0\x02\x03\x02\x01\x07\x04\0\x09wit-value\x03\0\x02\x02\x03\x02\
50264\x01\x08\x04\0\x08duration\x03\0\x04\x01w\x04\0\x0boplog-index\x03\0\x06\x01w\x04\
50265\0\x11component-version\x03\0\x08\x01r\x02\x09high-bitsw\x08low-bitsw\x04\0\x04u\
50266uid\x03\0\x0a\x01r\x01\x04uuid\x0b\x04\0\x0ccomponent-id\x03\0\x0c\x01r\x02\x0cc\
50267omponent-id\x0d\x0bworker-names\x04\0\x09worker-id\x03\0\x0e\x01r\x02\x09worker-\
50268id\x0f\x09oplog-idx\x07\x04\0\x0apromise-id\x03\0\x10\x01r\x01\x05values\x04\0\x0a\
50269account-id\x03\0\x12\x01ku\x01r\x05\x0cmax-attemptsy\x09min-delay\x05\x09max-del\
50270ay\x05\x0amultiplieru\x11max-jitter-factor\x14\x04\0\x0cretry-policy\x03\0\x15\x01\
50271q\x03\x0fpersist-nothing\0\0\x1bpersist-remote-side-effects\0\0\x05smart\0\0\x04\
50272\0\x11persistence-level\x03\0\x17\x01m\x02\x09automatic\x0esnapshot-based\x04\0\x0b\
50273update-mode\x03\0\x19\x01m\x06\x05equal\x09not-equal\x0dgreater-equal\x07greater\
50274\x0aless-equal\x04less\x04\0\x11filter-comparator\x03\0\x1b\x01m\x04\x05equal\x09\
50275not-equal\x04like\x08not-like\x04\0\x18string-filter-comparator\x03\0\x1d\x01m\x07\
50276\x07running\x04idle\x09suspended\x0binterrupted\x08retrying\x06failed\x06exited\x04\
50277\0\x0dworker-status\x03\0\x1f\x01r\x02\x0acomparator\x1e\x05values\x04\0\x12work\
50278er-name-filter\x03\0!\x01r\x02\x0acomparator\x1c\x05value\x20\x04\0\x14worker-st\
50279atus-filter\x03\0#\x01r\x02\x0acomparator\x1c\x05valuew\x04\0\x15worker-version-\
50280filter\x03\0%\x01r\x02\x0acomparator\x1c\x05valuew\x04\0\x18worker-created-at-fi\
50281lter\x03\0'\x01r\x03\x04names\x0acomparator\x1e\x05values\x04\0\x11worker-env-fi\
50282lter\x03\0)\x01q\x05\x04name\x01\"\0\x06status\x01$\0\x07version\x01&\0\x0acreat\
50283ed-at\x01(\0\x03env\x01*\0\x04\0\x16worker-property-filter\x03\0+\x01p,\x01r\x01\
50284\x07filters-\x04\0\x11worker-all-filter\x03\0.\x01p/\x01r\x01\x07filters0\x04\0\x11\
50285worker-any-filter\x03\01\x01ps\x01o\x02ss\x01p4\x01r\x06\x09worker-id\x0f\x04arg\
50286s3\x03env5\x06status\x20\x11component-versionw\x0bretry-countw\x04\0\x0fworker-m\
50287etadata\x03\06\x04\0\x0bget-workers\x03\x01\x01q\x02\x15revert-to-oplog-index\x01\
50288\x07\0\x17revert-last-invocations\x01w\0\x04\0\x14revert-worker-target\x03\09\x01\
50289k2\x01i8\x01@\x03\x0ccomponent-id\x0d\x06filter;\x07precise\x7f\0<\x04\0\x18[con\
50290structor]get-workers\x01=\x01h8\x01p7\x01k?\x01@\x01\x04self>\0\xc0\0\x04\0\x1c[\
50291method]get-workers.get-next\x01A\x01@\0\0\x11\x04\0\x0ecreate-promise\x01B\x01p}\
50292\x01@\x01\x0apromise-id\x11\0\xc3\0\x04\0\x0dawait-promise\x01D\x01k\xc3\0\x01@\x01\
50293\x0apromise-id\x11\0\xc5\0\x04\0\x0cpoll-promise\x01F\x01@\x02\x0apromise-id\x11\
50294\x04data\xc3\0\0\x7f\x04\0\x10complete-promise\x01G\x01@\x01\x0apromise-id\x11\x01\
50295\0\x04\0\x0edelete-promise\x01H\x01@\0\0\x07\x04\0\x0fget-oplog-index\x01I\x01@\x01\
50296\x09oplog-idx\x07\x01\0\x04\0\x0fset-oplog-index\x01J\x01@\x01\x08replicas}\x01\0\
50297\x04\0\x0coplog-commit\x01K\x04\0\x14mark-begin-operation\x01I\x01@\x01\x05begin\
50298\x07\x01\0\x04\0\x12mark-end-operation\x01L\x01@\0\0\x16\x04\0\x10get-retry-poli\
50299cy\x01M\x01@\x01\x10new-retry-policy\x16\x01\0\x04\0\x10set-retry-policy\x01N\x01\
50300@\0\0\x18\x04\0\x1bget-oplog-persistence-level\x01O\x01@\x01\x15new-persistence-\
50301level\x18\x01\0\x04\0\x1bset-oplog-persistence-level\x01P\x01@\0\0\x7f\x04\0\x14\
50302get-idempotence-mode\x01Q\x01@\x01\x0aidempotent\x7f\x01\0\x04\0\x14set-idempote\
50303nce-mode\x01R\x01@\0\0\x0b\x04\0\x18generate-idempotency-key\x01S\x01@\x03\x09wo\
50304rker-id\x0f\x0etarget-version\x09\x04mode\x1a\x01\0\x04\0\x0dupdate-worker\x01T\x01\
50305@\0\07\x04\0\x11get-self-metadata\x01U\x01k7\x01@\x01\x09worker-id\x0f\0\xd6\0\x04\
50306\0\x13get-worker-metadata\x01W\x01@\x03\x10source-worker-id\x0f\x10target-worker\
50307-id\x0f\x11oplog-idx-cut-off\x07\x01\0\x04\0\x0bfork-worker\x01X\x01@\x02\x09wor\
50308ker-id\x0f\x0drevert-target:\x01\0\x04\0\x0drevert-worker\x01Y\x01k\x0d\x01@\x01\
50309\x13component-references\0\xda\0\x04\0\x14resolve-component-id\x01[\x01k\x0f\x01\
50310@\x02\x13component-references\x0bworker-names\0\xdc\0\x04\0\x11resolve-worker-id\
50311\x01]\x04\0\x18resolve-worker-id-strict\x01]\x01@\x01\x09worker-id\x0f\0\x01\x04\
50312\0\x0aworker-uri\x01^\x03\0\x14golem:api/host@1.1.5\x05\x09\x01B7\x02\x03\x02\x01\
50313\x02\x04\0\x08datetime\x03\0\0\x04\0\x04span\x03\x01\x04\0\x12invocation-context\
50314\x03\x01\x01q\x01\x06string\x01s\0\x04\0\x0fattribute-value\x03\0\x04\x01r\x02\x03\
50315keys\x05value\x05\x04\0\x09attribute\x03\0\x06\x01p\x05\x01r\x02\x03keys\x06valu\
50316es\x08\x04\0\x0fattribute-chain\x03\0\x09\x01s\x04\0\x08trace-id\x03\0\x0b\x01s\x04\
50317\0\x07span-id\x03\0\x0d\x01h\x02\x01@\x01\x04self\x0f\0\x01\x04\0\x17[method]spa\
50318n.started-at\x01\x10\x01@\x03\x04self\x0f\x04names\x05value\x05\x01\0\x04\0\x1a[\
50319method]span.set-attribute\x01\x11\x01p\x07\x01@\x02\x04self\x0f\x0aattributes\x12\
50320\x01\0\x04\0\x1b[method]span.set-attributes\x01\x13\x01@\x01\x04self\x0f\x01\0\x04\
50321\0\x13[method]span.finish\x01\x14\x01h\x03\x01@\x01\x04self\x15\0\x0c\x04\0#[met\
50322hod]invocation-context.trace-id\x01\x16\x01@\x01\x04self\x15\0\x0e\x04\0\"[metho\
50323d]invocation-context.span-id\x01\x17\x01i\x03\x01k\x18\x01@\x01\x04self\x15\0\x19\
50324\x04\0![method]invocation-context.parent\x01\x1a\x01k\x05\x01@\x03\x04self\x15\x03\
50325keys\x09inherited\x7f\0\x1b\x04\0([method]invocation-context.get-attribute\x01\x1c\
50326\x01@\x02\x04self\x15\x09inherited\x7f\0\x12\x04\0)[method]invocation-context.ge\
50327t-attributes\x01\x1d\x01@\x02\x04self\x15\x03keys\0\x08\x04\0.[method]invocation\
50328-context.get-attribute-chain\x01\x1e\x01p\x0a\x01@\x01\x04self\x15\0\x1f\x04\0/[\
50329method]invocation-context.get-attribute-chains\x01\x20\x01o\x02ss\x01p!\x01@\x01\
50330\x04self\x15\0\"\x04\00[method]invocation-context.trace-context-headers\x01#\x01\
50331i\x02\x01@\x01\x04names\0$\x04\0\x0astart-span\x01%\x01@\0\0\x18\x04\0\x0fcurren\
50332t-context\x01&\x01@\x01\x05allow\x7f\0\x7f\x04\0&allow-forwarding-trace-context-\
50333headers\x01'\x03\0\x17golem:api/context@1.1.5\x05\x0a\x02\x03\0\x04\x0aaccount-i\
50334d\x02\x03\0\x04\x11component-version\x02\x03\0\x04\x0boplog-index\x02\x03\0\x04\x0c\
50335retry-policy\x02\x03\0\x04\x04uuid\x02\x03\0\x04\x09worker-id\x02\x03\0\x05\x09a\
50336ttribute\x02\x03\0\x05\x0fattribute-value\x02\x03\0\x05\x07span-id\x02\x03\0\x05\
50337\x08trace-id\x01B\x82\x01\x02\x03\x02\x01\x02\x04\0\x08datetime\x03\0\0\x02\x03\x02\
50338\x01\x07\x04\0\x09wit-value\x03\0\x02\x02\x03\x02\x01\x0b\x04\0\x0aaccount-id\x03\
50339\0\x04\x02\x03\x02\x01\x0c\x04\0\x11component-version\x03\0\x06\x02\x03\x02\x01\x0d\
50340\x04\0\x0boplog-index\x03\0\x08\x02\x03\x02\x01\x0e\x04\0\x0cretry-policy\x03\0\x0a\
50341\x02\x03\x02\x01\x0f\x04\0\x04uuid\x03\0\x0c\x02\x03\x02\x01\x10\x04\0\x09worker\
50342-id\x03\0\x0e\x02\x03\x02\x01\x11\x04\0\x09attribute\x03\0\x10\x02\x03\x02\x01\x12\
50343\x04\0\x0fattribute-value\x03\0\x12\x02\x03\x02\x01\x13\x04\0\x07span-id\x03\0\x14\
50344\x02\x03\x02\x01\x14\x04\0\x08trace-id\x03\0\x16\x01k\x09\x01q\x05\x0aread-local\
50345\0\0\x0bwrite-local\0\0\x0bread-remote\0\0\x0cwrite-remote\0\0\x14write-remote-b\
50346atched\x01\x18\0\x04\0\x15wrapped-function-type\x03\0\x19\x01o\x02ss\x01p\x1b\x01\
50347r\x04\x0finstallation-id\x0d\x04names\x07versions\x0aparameters\x1c\x04\0\x1fplu\
50348gin-installation-description\x03\0\x1d\x01ps\x01k\x0f\x01p\x1e\x01r\x0a\x09times\
50349tamp\x01\x09worker-id\x0f\x11component-version\x07\x04args\x1f\x03env\x1c\x0aacc\
50350ount-id\x05\x06parent\x20\x0ecomponent-sizew\x20initial-total-linear-memory-size\
50351w\x16initial-active-plugins!\x04\0\x11create-parameters\x03\0\"\x01r\x05\x09time\
50352stamp\x01\x0dfunction-names\x07request\x03\x08response\x03\x15wrapped-function-t\
50353ype\x1a\x04\0$imported-function-invoked-parameters\x03\0$\x01k\x15\x01kw\x01p\x11\
50354\x01r\x06\x07span-id\x15\x05start\x01\x06parent&\x0elinked-context'\x0aattribute\
50355s(\x09inherited\x7f\x04\0\x0flocal-span-data\x03\0)\x01r\x01\x07span-id\x15\x04\0\
50356\x12external-span-data\x03\0+\x01q\x02\x0alocal-span\x01*\0\x0dexternal-span\x01\
50357,\0\x04\0\x09span-data\x03\0-\x01p\x03\x01p.\x01p0\x01r\x07\x09timestamp\x01\x0d\
50358function-names\x07request/\x0fidempotency-keys\x08trace-id\x17\x0ctrace-states\x1f\
50359\x12invocation-context1\x04\0$exported-function-invoked-parameters\x03\02\x01r\x03\
50360\x09timestamp\x01\x08response\x03\x0dconsumed-fuelx\x04\0&exported-function-comp\
50361leted-parameters\x03\04\x01r\x02\x09timestamp\x01\x05errors\x04\0\x10error-param\
50362eters\x03\06\x01r\x03\x09timestamp\x01\x05start\x09\x03end\x09\x04\0\x0fjump-par\
50363ameters\x03\08\x01r\x02\x09timestamp\x01\x0cretry-policy\x0b\x04\0\x1echange-ret\
50364ry-policy-parameters\x03\0:\x01r\x02\x09timestamp\x01\x0bbegin-index\x09\x04\0\x1c\
50365end-atomic-region-parameters\x03\0<\x01r\x02\x09timestamp\x01\x0bbegin-index\x09\
50366\x04\0\x1bend-remote-write-parameters\x03\0>\x01k/\x01r\x03\x0fidempotency-keys\x0d\
50367function-names\x05input\xc0\0\x04\0'exported-function-invocation-parameters\x03\0\
50368A\x01q\x02\x11exported-function\x01\xc2\0\0\x0dmanual-update\x01\x07\0\x04\0\x11\
50369worker-invocation\x03\0C\x01r\x02\x09timestamp\x01\x0ainvocation\xc4\0\x04\0$pen\
50370ding-worker-invocation-parameters\x03\0E\x01p}\x01q\x02\x0bauto-update\0\0\x0esn\
50371apshot-based\x01\xc7\0\0\x04\0\x12update-description\x03\0H\x01r\x03\x09timestam\
50372p\x01\x0etarget-version\x07\x12update-description\xc9\0\x04\0\x19pending-update-\
50373parameters\x03\0J\x01r\x04\x09timestamp\x01\x0etarget-version\x07\x12new-compone\
50374nt-sizew\x12new-active-plugins!\x04\0\x1csuccessful-update-parameters\x03\0L\x01\
50375ks\x01r\x03\x09timestamp\x01\x0etarget-version\x07\x07details\xce\0\x04\0\x18fai\
50376led-update-parameters\x03\0O\x01r\x02\x09timestamp\x01\x05deltaw\x04\0\x16grow-m\
50377emory-parameters\x03\0Q\x01w\x04\0\x12worker-resource-id\x03\0S\x01r\x02\x09time\
50378stamp\x01\x0bresource-id\xd4\0\x04\0\x1acreate-resource-parameters\x03\0U\x01r\x02\
50379\x09timestamp\x01\x0bresource-id\xd4\0\x04\0\x18drop-resource-parameters\x03\0W\x01\
50380r\x04\x09timestamp\x01\x0bresource-id\xd4\0\x0dresource-names\x0fresource-params\
50381/\x04\0\x1cdescribe-resource-parameters\x03\0Y\x01m\x08\x06stdout\x06stderr\x05t\
50382race\x05debug\x04info\x04warn\x05error\x08critical\x04\0\x09log-level\x03\0[\x01\
50383r\x04\x09timestamp\x01\x05level\xdc\0\x07contexts\x07messages\x04\0\x0elog-param\
50384eters\x03\0]\x01r\x02\x09timestamp\x01\x06plugin\x1e\x04\0\x1aactivate-plugin-pa\
50385rameters\x03\0_\x01r\x02\x09timestamp\x01\x06plugin\x1e\x04\0\x1cdeactivate-plug\
50386in-parameters\x03\0a\x01r\x03\x09timestamp\x01\x05start\x09\x03end\x09\x04\0\x11\
50387revert-parameters\x03\0c\x01r\x02\x09timestamp\x01\x0fidempotency-keys\x04\0\x1c\
50388cancel-invocation-parameters\x03\0e\x01r\x05\x09timestamp\x01\x07span-id\x15\x06\
50389parent&\x0elinked-context&\x0aattributes(\x04\0\x15start-span-parameters\x03\0g\x01\
50390r\x02\x09timestamp\x01\x07span-id\x15\x04\0\x16finish-span-parameters\x03\0i\x01\
50391r\x04\x09timestamp\x01\x07span-id\x15\x03keys\x05value\x13\x04\0\x1dset-span-att\
50392ribute-parameters\x03\0k\x01q\x20\x06create\x01#\0\x19imported-function-invoked\x01\
50393%\0\x19exported-function-invoked\x013\0\x1bexported-function-completed\x015\0\x07\
50394suspend\x01\x01\0\x05error\x017\0\x05no-op\x01\x01\0\x04jump\x019\0\x0binterrupt\
50395ed\x01\x01\0\x06exited\x01\x01\0\x13change-retry-policy\x01;\0\x13begin-atomic-r\
50396egion\x01\x01\0\x11end-atomic-region\x01=\0\x12begin-remote-write\x01\x01\0\x10e\
50397nd-remote-write\x01?\0\x19pending-worker-invocation\x01\xc6\0\0\x0epending-updat\
50398e\x01\xcb\0\0\x11successful-update\x01\xcd\0\0\x0dfailed-update\x01\xd0\0\0\x0bg\
50399row-memory\x01\xd2\0\0\x0fcreate-resource\x01\xd6\0\0\x0ddrop-resource\x01\xd8\0\
50400\0\x11describe-resource\x01\xda\0\0\x03log\x01\xde\0\0\x07restart\x01\x01\0\x0fa\
50401ctivate-plugin\x01\xe0\0\0\x11deactivate-plugin\x01\xe2\0\0\x06revert\x01\xe4\0\0\
50402\x11cancel-invocation\x01\xe6\0\0\x0astart-span\x01\xe8\0\0\x0bfinish-span\x01\xea\
50403\0\0\x12set-span-attribute\x01\xec\0\0\x04\0\x0boplog-entry\x03\0m\x04\0\x09get-\
50404oplog\x03\x01\x04\0\x0csearch-oplog\x03\x01\x01io\x01@\x02\x09worker-id\x0f\x05s\
50405tart\x09\0\xf1\0\x04\0\x16[constructor]get-oplog\x01r\x01ho\x01p\xee\0\x01k\xf4\0\
50406\x01@\x01\x04self\xf3\0\0\xf5\0\x04\0\x1a[method]get-oplog.get-next\x01v\x01ip\x01\
50407@\x02\x09worker-id\x0f\x04texts\0\xf7\0\x04\0\x19[constructor]search-oplog\x01x\x01\
50408hp\x01o\x02\x09\xee\0\x01p\xfa\0\x01k\xfb\0\x01@\x01\x04self\xf9\0\0\xfc\0\x04\0\
50409\x1d[method]search-oplog.get-next\x01}\x03\0\x15golem:api/oplog@1.1.5\x05\x15\x02\
50410\x03\0\x04\x11persistence-level\x02\x03\0\x06\x0boplog-index\x02\x03\0\x06\x15wr\
50411apped-function-type\x02\x03\0\x02\x0evalue-and-type\x01B\x20\x02\x03\x02\x01\x16\
50412\x04\0\x11persistence-level\x03\0\0\x02\x03\x02\x01\x17\x04\0\x0boplog-index\x03\
50413\0\x02\x02\x03\x02\x01\x18\x04\0\x15wrapped-function-type\x03\0\x04\x02\x03\x02\x01\
50414\x02\x04\0\x08datetime\x03\0\x06\x02\x03\x02\x01\x19\x04\0\x0evalue-and-type\x03\
50415\0\x08\x04\0\x15durable-function-type\x03\0\x05\x01r\x02\x07is-live\x7f\x11persi\
50416stence-level\x01\x04\0\x17durable-execution-state\x03\0\x0b\x01m\x02\x02v1\x02v2\
50417\x04\0\x13oplog-entry-version\x03\0\x0d\x01p}\x01r\x05\x09timestamp\x07\x0dfunct\
50418ion-names\x08response\x0f\x0dfunction-type\x0a\x0dentry-version\x0e\x04\0%persis\
50419ted-durable-function-invocation\x03\0\x10\x01@\x02\x05ifaces\x08functions\x01\0\x04\
50420\0\x15observe-function-call\x01\x12\x01@\x01\x0dfunction-type\x0a\0\x03\x04\0\x16\
50421begin-durable-function\x01\x13\x01@\x03\x0dfunction-type\x0a\x0bbegin-index\x03\x0d\
50422forced-commit\x7f\x01\0\x04\0\x14end-durable-function\x01\x14\x01@\0\0\x0c\x04\0\
50423\x1fcurrent-durable-execution-state\x01\x15\x01@\x04\x0dfunction-names\x07reques\
50424t\x0f\x08response\x0f\x0dfunction-type\x0a\x01\0\x04\0#persist-durable-function-\
50425invocation\x01\x16\x01@\x04\x0dfunction-names\x07request\x09\x08response\x09\x0d\
50426function-type\x0a\x01\0\x04\0)persist-typed-durable-function-invocation\x01\x17\x01\
50427@\0\0\x11\x04\0*read-persisted-durable-function-invocation\x01\x18\x03\0!golem:d\
50428urability/durability@1.2.0\x05\x1a\x01B\x13\x01r\x02\x09high-bitsw\x08low-bitsw\x04\
50429\0\x04uuid\x03\0\0\x01o\x04}}}}\x01o\x08{{{{{{{{\x01q\x02\x04ipv4\x01\x02\0\x04i\
50430pv6\x01\x03\0\x04\0\x0aip-address\x03\0\x04\x01o\x06}}}}}}\x01r\x01\x06octets\x06\
50431\x04\0\x0bmac-address\x03\0\x07\x01r\x03\x04yearz\x05month}\x03day}\x04\0\x04dat\
50432e\x03\0\x09\x01r\x04\x04hour}\x06minute}\x06second}\x0ananosecondy\x04\0\x04time\
50433\x03\0\x0b\x01r\x02\x04date\x0a\x04time\x0c\x04\0\x09timestamp\x03\0\x0d\x01r\x02\
50434\x09timestamp\x0e\x06offsetz\x04\0\x0btimestamptz\x03\0\x0f\x01r\x02\x04time\x0c\
50435\x06offsetz\x04\0\x06timetz\x03\0\x11\x03\0\x17golem:rdbms/types@0.0.1\x05\x1b\x02\
50436\x03\0\x08\x04date\x02\x03\0\x08\x04time\x02\x03\0\x08\x09timestamp\x01B>\x02\x03\
50437\x02\x01\x1c\x04\0\x04date\x03\0\0\x02\x03\x02\x01\x1d\x04\0\x04time\x03\0\x02\x02\
50438\x03\x02\x01\x1e\x04\0\x09timestamp\x03\0\x04\x01q\x05\x12connection-failure\x01\
50439s\0\x17query-parameter-failure\x01s\0\x17query-execution-failure\x01s\0\x16query\
50440-response-failure\x01s\0\x05other\x01s\0\x04\0\x05error\x03\0\x06\x01q#\x07boole\
50441an\0\0\x07tinyint\0\0\x08smallint\0\0\x09mediumint\0\0\x03int\0\0\x06bigint\0\0\x10\
50442tinyint-unsigned\0\0\x11smallint-unsigned\0\0\x12mediumint-unsigned\0\0\x0cint-u\
50443nsigned\0\0\x0fbigint-unsigned\0\0\x05float\0\0\x06double\0\0\x07decimal\0\0\x04\
50444date\0\0\x08datetime\0\0\x09timestamp\0\0\x04time\0\0\x04year\0\0\x07fixchar\0\0\
50445\x07varchar\0\0\x08tinytext\0\0\x04text\0\0\x0amediumtext\0\0\x08longtext\0\0\x06\
50446binary\0\0\x09varbinary\0\0\x08tinyblob\0\0\x04blob\0\0\x0amediumblob\0\0\x08lon\
50447gblob\0\0\x0benumeration\0\0\x03set\0\0\x03bit\0\0\x04json\0\0\x04\0\x0edb-colum\
50448n-type\x03\0\x08\x01r\x04\x07ordinalw\x04names\x07db-type\x09\x0cdb-type-names\x04\
50449\0\x09db-column\x03\0\x0a\x01p}\x01p\x7f\x01q$\x07boolean\x01\x7f\0\x07tinyint\x01\
50450~\0\x08smallint\x01|\0\x09mediumint\x01z\0\x03int\x01z\0\x06bigint\x01x\0\x10tin\
50451yint-unsigned\x01}\0\x11smallint-unsigned\x01{\0\x12mediumint-unsigned\x01y\0\x0c\
50452int-unsigned\x01y\0\x0fbigint-unsigned\x01w\0\x05float\x01v\0\x06double\x01u\0\x07\
50453decimal\x01s\0\x04date\x01\x01\0\x08datetime\x01\x05\0\x09timestamp\x01\x05\0\x04\
50454time\x01\x03\0\x04year\x01{\0\x07fixchar\x01s\0\x07varchar\x01s\0\x08tinytext\x01\
50455s\0\x04text\x01s\0\x0amediumtext\x01s\0\x08longtext\x01s\0\x06binary\x01\x0c\0\x09\
50456varbinary\x01\x0c\0\x08tinyblob\x01\x0c\0\x04blob\x01\x0c\0\x0amediumblob\x01\x0c\
50457\0\x08longblob\x01\x0c\0\x0benumeration\x01s\0\x03set\x01s\0\x03bit\x01\x0d\0\x04\
50458json\x01s\0\x04null\0\0\x04\0\x08db-value\x03\0\x0e\x01p\x0f\x01r\x01\x06values\x10\
50459\x04\0\x06db-row\x03\0\x11\x01p\x0b\x01p\x12\x01r\x02\x07columns\x13\x04rows\x14\
50460\x04\0\x09db-result\x03\0\x15\x04\0\x10db-result-stream\x03\x01\x04\0\x0ddb-conn\
50461ection\x03\x01\x04\0\x0edb-transaction\x03\x01\x01h\x17\x01@\x01\x04self\x1a\0\x13\
50462\x04\0$[method]db-result-stream.get-columns\x01\x1b\x01k\x14\x01@\x01\x04self\x1a\
50463\0\x1c\x04\0![method]db-result-stream.get-next\x01\x1d\x01i\x18\x01j\x01\x1e\x01\
50464\x07\x01@\x01\x07addresss\0\x1f\x04\0\x1a[static]db-connection.open\x01\x20\x01h\
50465\x18\x01j\x01\x16\x01\x07\x01@\x03\x04self!\x09statements\x06params\x10\0\"\x04\0\
50466\x1b[method]db-connection.query\x01#\x01i\x17\x01j\x01$\x01\x07\x01@\x03\x04self\
50467!\x09statements\x06params\x10\0%\x04\0\"[method]db-connection.query-stream\x01&\x01\
50468j\x01w\x01\x07\x01@\x03\x04self!\x09statements\x06params\x10\0'\x04\0\x1d[method\
50469]db-connection.execute\x01(\x01i\x19\x01j\x01)\x01\x07\x01@\x01\x04self!\0*\x04\0\
50470'[method]db-connection.begin-transaction\x01+\x01h\x19\x01@\x03\x04self,\x09stat\
50471ements\x06params\x10\0\"\x04\0\x1c[method]db-transaction.query\x01-\x01@\x03\x04\
50472self,\x09statements\x06params\x10\0%\x04\0#[method]db-transaction.query-stream\x01\
50473.\x01@\x03\x04self,\x09statements\x06params\x10\0'\x04\0\x1e[method]db-transacti\
50474on.execute\x01/\x01j\0\x01\x07\x01@\x01\x04self,\00\x04\0\x1d[method]db-transact\
50475ion.commit\x011\x04\0\x1f[method]db-transaction.rollback\x011\x03\0\x17golem:rdb\
50476ms/mysql@0.0.1\x05\x1f\x02\x03\0\x08\x06timetz\x02\x03\0\x08\x0btimestamptz\x02\x03\
50477\0\x08\x04uuid\x02\x03\0\x08\x0aip-address\x02\x03\0\x08\x0bmac-address\x01B\x87\
50478\x01\x02\x03\x02\x01\x1c\x04\0\x04date\x03\0\0\x02\x03\x02\x01\x1d\x04\0\x04time\
50479\x03\0\x02\x02\x03\x02\x01\x20\x04\0\x06timetz\x03\0\x04\x02\x03\x02\x01\x1e\x04\
50480\0\x09timestamp\x03\0\x06\x02\x03\x02\x01!\x04\0\x0btimestamptz\x03\0\x08\x02\x03\
50481\x02\x01\"\x04\0\x04uuid\x03\0\x0a\x02\x03\x02\x01#\x04\0\x0aip-address\x03\0\x0c\
50482\x02\x03\x02\x01$\x04\0\x0bmac-address\x03\0\x0e\x01q\x05\x12connection-failure\x01\
50483s\0\x17query-parameter-failure\x01s\0\x17query-execution-failure\x01s\0\x16query\
50484-response-failure\x01s\0\x05other\x01s\0\x04\0\x05error\x03\0\x10\x01r\x03\x06mo\
50485nthsz\x04daysz\x0cmicrosecondsx\x04\0\x08interval\x03\0\x12\x01q\x03\x08included\
50486\x01z\0\x08excluded\x01z\0\x09unbounded\0\0\x04\0\x09int4bound\x03\0\x14\x01q\x03\
50487\x08included\x01x\0\x08excluded\x01x\0\x09unbounded\0\0\x04\0\x09int8bound\x03\0\
50488\x16\x01q\x03\x08included\x01s\0\x08excluded\x01s\0\x09unbounded\0\0\x04\0\x08nu\
50489mbound\x03\0\x18\x01q\x03\x08included\x01\x07\0\x08excluded\x01\x07\0\x09unbound\
50490ed\0\0\x04\0\x07tsbound\x03\0\x1a\x01q\x03\x08included\x01\x09\0\x08excluded\x01\
50491\x09\0\x09unbounded\0\0\x04\0\x09tstzbound\x03\0\x1c\x01q\x03\x08included\x01\x01\
50492\0\x08excluded\x01\x01\0\x09unbounded\0\0\x04\0\x09datebound\x03\0\x1e\x01r\x02\x05\
50493start\x15\x03end\x15\x04\0\x09int4range\x03\0\x20\x01r\x02\x05start\x17\x03end\x17\
50494\x04\0\x09int8range\x03\0\"\x01r\x02\x05start\x19\x03end\x19\x04\0\x08numrange\x03\
50495\0$\x01r\x02\x05start\x1b\x03end\x1b\x04\0\x07tsrange\x03\0&\x01r\x02\x05start\x1d\
50496\x03end\x1d\x04\0\x09tstzrange\x03\0(\x01r\x02\x05start\x1f\x03end\x1f\x04\0\x09\
50497daterange\x03\0*\x01r\x01\x04names\x04\0\x10enumeration-type\x03\0,\x01r\x02\x04\
50498names\x05values\x04\0\x0benumeration\x03\0.\x04\0\x0dlazy-db-value\x03\x01\x01i0\
50499\x01p1\x01r\x02\x04names\x06values2\x04\0\x09composite\x03\03\x01r\x02\x04names\x05\
50500value1\x04\0\x06domain\x03\05\x01q\x03\x08included\x011\0\x08excluded\x011\0\x09\
50501unbounded\0\0\x04\0\x0bvalue-bound\x03\07\x01r\x02\x05start8\x03end8\x04\0\x0cva\
50502lues-range\x03\09\x01r\x02\x04names\x05value:\x04\0\x05range\x03\0;\x01p}\x01p\x7f\
50503\x01q*\x09character\x01~\0\x04int2\x01|\0\x04int4\x01z\0\x04int8\x01x\0\x06float\
505044\x01v\0\x06float8\x01u\0\x07numeric\x01s\0\x07boolean\x01\x7f\0\x04text\x01s\0\x07\
50505varchar\x01s\0\x06bpchar\x01s\0\x09timestamp\x01\x07\0\x0btimestamptz\x01\x09\0\x04\
50506date\x01\x01\0\x04time\x01\x03\0\x06timetz\x01\x05\0\x08interval\x01\x13\0\x05by\
50507tea\x01=\0\x04json\x01s\0\x05jsonb\x01s\0\x08jsonpath\x01s\0\x03xml\x01s\0\x04uu\
50508id\x01\x0b\0\x04inet\x01\x0d\0\x04cidr\x01\x0d\0\x07macaddr\x01\x0f\0\x03bit\x01\
50509>\0\x06varbit\x01>\0\x09int4range\x01!\0\x09int8range\x01#\0\x08numrange\x01%\0\x07\
50510tsrange\x01'\0\x09tstzrange\x01)\0\x09daterange\x01+\0\x05money\x01x\0\x03oid\x01\
50511y\0\x0benumeration\x01/\0\x09composite\x014\0\x06domain\x016\0\x05array\x012\0\x05\
50512range\x01<\0\x04null\0\0\x04\0\x08db-value\x03\0?\x04\0\x13lazy-db-column-type\x03\
50513\x01\x01iA\x01o\x02s\xc2\0\x01p\xc3\0\x01r\x02\x04names\x0aattributes\xc4\0\x04\0\
50514\x0ecomposite-type\x03\0E\x01r\x02\x04names\x09base-type\xc2\0\x04\0\x0bdomain-t\
50515ype\x03\0G\x01r\x02\x04names\x09base-type\xc2\0\x04\0\x0arange-type\x03\0I\x01q)\
50516\x09character\0\0\x04int2\0\0\x04int4\0\0\x04int8\0\0\x06float4\0\0\x06float8\0\0\
50517\x07numeric\0\0\x07boolean\0\0\x04text\0\0\x07varchar\0\0\x06bpchar\0\0\x09times\
50518tamp\0\0\x0btimestamptz\0\0\x04date\0\0\x04time\0\0\x06timetz\0\0\x08interval\0\0\
50519\x05bytea\0\0\x04uuid\0\0\x03xml\0\0\x04json\0\0\x05jsonb\0\0\x08jsonpath\0\0\x04\
50520inet\0\0\x04cidr\0\0\x07macaddr\0\0\x03bit\0\0\x06varbit\0\0\x09int4range\0\0\x09\
50521int8range\0\0\x08numrange\0\0\x07tsrange\0\0\x09tstzrange\0\0\x09daterange\0\0\x05\
50522money\0\0\x03oid\0\0\x0benumeration\x01-\0\x09composite\x01\xc6\0\0\x06domain\x01\
50523\xc8\0\0\x05array\x01\xc2\0\0\x05range\x01\xca\0\0\x04\0\x0edb-column-type\x03\0\
50524K\x01r\x04\x07ordinalw\x04names\x07db-type\xcc\0\x0cdb-type-names\x04\0\x09db-co\
50525lumn\x03\0M\x01p\xc0\0\x01r\x01\x06values\xcf\0\x04\0\x06db-row\x03\0P\x01p\xce\0\
50526\x01p\xd1\0\x01r\x02\x07columns\xd2\0\x04rows\xd3\0\x04\0\x09db-result\x03\0T\x04\
50527\0\x10db-result-stream\x03\x01\x04\0\x0ddb-connection\x03\x01\x04\0\x0edb-transa\
50528ction\x03\x01\x01@\x01\x05value\xc0\0\01\x04\0\x1a[constructor]lazy-db-value\x01\
50529Y\x01h0\x01@\x01\x04self\xda\0\0\xc0\0\x04\0\x19[method]lazy-db-value.get\x01[\x01\
50530@\x01\x05value\xcc\0\0\xc2\0\x04\0\x20[constructor]lazy-db-column-type\x01\\\x01\
50531hA\x01@\x01\x04self\xdd\0\0\xcc\0\x04\0\x1f[method]lazy-db-column-type.get\x01^\x01\
50532hV\x01@\x01\x04self\xdf\0\0\xd2\0\x04\0$[method]db-result-stream.get-columns\x01\
50533`\x01k\xd3\0\x01@\x01\x04self\xdf\0\0\xe1\0\x04\0![method]db-result-stream.get-n\
50534ext\x01b\x01iW\x01j\x01\xe3\0\x01\x11\x01@\x01\x07addresss\0\xe4\0\x04\0\x1a[sta\
50535tic]db-connection.open\x01e\x01hW\x01j\x01\xd5\0\x01\x11\x01@\x03\x04self\xe6\0\x09\
50536statements\x06params\xcf\0\0\xe7\0\x04\0\x1b[method]db-connection.query\x01h\x01\
50537iV\x01j\x01\xe9\0\x01\x11\x01@\x03\x04self\xe6\0\x09statements\x06params\xcf\0\0\
50538\xea\0\x04\0\"[method]db-connection.query-stream\x01k\x01j\x01w\x01\x11\x01@\x03\
50539\x04self\xe6\0\x09statements\x06params\xcf\0\0\xec\0\x04\0\x1d[method]db-connect\
50540ion.execute\x01m\x01iX\x01j\x01\xee\0\x01\x11\x01@\x01\x04self\xe6\0\0\xef\0\x04\
50541\0'[method]db-connection.begin-transaction\x01p\x01hX\x01@\x03\x04self\xf1\0\x09\
50542statements\x06params\xcf\0\0\xe7\0\x04\0\x1c[method]db-transaction.query\x01r\x01\
50543@\x03\x04self\xf1\0\x09statements\x06params\xcf\0\0\xea\0\x04\0#[method]db-trans\
50544action.query-stream\x01s\x01@\x03\x04self\xf1\0\x09statements\x06params\xcf\0\0\xec\
50545\0\x04\0\x1e[method]db-transaction.execute\x01t\x01j\0\x01\x11\x01@\x01\x04self\xf1\
50546\0\0\xf5\0\x04\0\x1d[method]db-transaction.commit\x01v\x04\0\x1f[method]db-trans\
50547action.rollback\x01v\x03\0\x1agolem:rdbms/postgres@0.0.1\x05%\x01B\x04\x04\0\x05\
50548error\x03\x01\x01h\0\x01@\x01\x04self\x01\0s\x04\0\x1d[method]error.to-debug-str\
50549ing\x01\x02\x03\0\x13wasi:io/error@0.2.0\x05&\x02\x03\0\x0b\x05error\x01B(\x02\x03\
50550\x02\x01'\x04\0\x05error\x03\0\0\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\0\x02\
50551\x01i\x01\x01q\x02\x15last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstr\
50552eam-error\x03\0\x05\x04\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\
50553\x01h\x07\x01p}\x01j\x01\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19\
50554[method]input-stream.read\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\
50555\x01j\x01w\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-str\
50556eam.skip\x01\x0e\x04\0\"[method]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\
50557\x01\x04self\x09\0\x0f\x04\0\x1e[method]input-stream.subscribe\x01\x10\x01h\x08\x01\
50558@\x01\x04self\x11\0\x0d\x04\0![method]output-stream.check-write\x01\x12\x01j\0\x01\
50559\x06\x01@\x02\x04self\x11\x08contents\x0a\0\x13\x04\0\x1b[method]output-stream.w\
50560rite\x01\x14\x04\0.[method]output-stream.blocking-write-and-flush\x01\x14\x01@\x01\
50561\x04self\x11\0\x13\x04\0\x1b[method]output-stream.flush\x01\x15\x04\0$[method]ou\
50562tput-stream.blocking-flush\x01\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]o\
50563utput-stream.subscribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method\
50564]output-stream.write-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-z\
50565eroes-and-flush\x01\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[\
50566method]output-stream.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\
50567\x18\x03\0\x15wasi:io/streams@0.2.0\x05(\x02\x03\0\x0c\x0cinput-stream\x02\x03\0\
50568\x0c\x0doutput-stream\x01B+\x02\x03\x02\x01)\x04\0\x0cinput-stream\x03\0\0\x02\x03\
50569\x02\x01*\x04\0\x0doutput-stream\x03\0\x02\x01s\x04\0\x0econtainer-name\x03\0\x04\
50570\x01s\x04\0\x0bobject-name\x03\0\x06\x01w\x04\0\x09timestamp\x03\0\x08\x01w\x04\0\
50571\x0bobject-size\x03\0\x0a\x01s\x04\0\x05error\x03\0\x0c\x01r\x02\x04name\x05\x0a\
50572created-at\x09\x04\0\x12container-metadata\x03\0\x0e\x01r\x04\x04name\x07\x09con\
50573tainer\x05\x0acreated-at\x09\x04size\x0b\x04\0\x0fobject-metadata\x03\0\x10\x01r\
50574\x02\x09container\x05\x06object\x07\x04\0\x09object-id\x03\0\x12\x04\0\x0eoutgoi\
50575ng-value\x03\x01\x04\0\x0eincoming-value\x03\x01\x04\0\x19incoming-value-async-b\
50576ody\x03\0\x01\x01p}\x04\0\x18incoming-value-sync-body\x03\0\x17\x01i\x14\x01@\0\0\
50577\x19\x04\0)[static]outgoing-value.new-outgoing-value\x01\x1a\x01h\x14\x01i\x03\x01\
50578j\x01\x1c\0\x01@\x01\x04self\x1b\0\x1d\x04\00[method]outgoing-value.outgoing-val\
50579ue-write-body\x01\x1e\x01h\x15\x01j\x01\x18\x01\x0d\x01@\x01\x04self\x1f\0\x20\x04\
50580\02[method]incoming-value.incoming-value-consume-sync\x01!\x01i\x16\x01j\x01\"\x01\
50581\x0d\x01@\x01\x04self\x1f\0#\x04\03[method]incoming-value.incoming-value-consume\
50582-async\x01$\x01@\x01\x04self\x1f\0w\x04\0\x1b[method]incoming-value.size\x01%\x03\
50583\0\x14wasi:blobstore/types\x05+\x02\x03\0\x0d\x12container-metadata\x02\x03\0\x0d\
50584\x05error\x02\x03\0\x0d\x0eincoming-value\x02\x03\0\x0d\x0fobject-metadata\x02\x03\
50585\0\x0d\x0bobject-name\x02\x03\0\x0d\x0eoutgoing-value\x01B;\x02\x03\x02\x01)\x04\
50586\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01*\x04\0\x0doutput-stream\x03\0\x02\x02\
50587\x03\x02\x01,\x04\0\x12container-metadata\x03\0\x04\x02\x03\x02\x01-\x04\0\x05er\
50588ror\x03\0\x06\x02\x03\x02\x01.\x04\0\x0eincoming-value\x03\0\x08\x02\x03\x02\x01\
50589/\x04\0\x0fobject-metadata\x03\0\x0a\x02\x03\x02\x010\x04\0\x0bobject-name\x03\0\
50590\x0c\x02\x03\x02\x011\x04\0\x0eoutgoing-value\x03\0\x0e\x04\0\x09container\x03\x01\
50591\x04\0\x13stream-object-names\x03\x01\x01h\x10\x01j\x01s\x01\x07\x01@\x01\x04sel\
50592f\x12\0\x13\x04\0\x16[method]container.name\x01\x14\x01j\x01\x05\x01\x07\x01@\x01\
50593\x04self\x12\0\x15\x04\0\x16[method]container.info\x01\x16\x01i\x09\x01j\x01\x17\
50594\x01\x07\x01@\x04\x04self\x12\x04name\x0d\x05startw\x03endw\0\x18\x04\0\x1a[meth\
50595od]container.get-data\x01\x19\x01h\x0f\x01j\0\x01\x07\x01@\x03\x04self\x12\x04na\
50596me\x0d\x04data\x1a\0\x1b\x04\0\x1c[method]container.write-data\x01\x1c\x01i\x11\x01\
50597j\x01\x1d\x01\x07\x01@\x01\x04self\x12\0\x1e\x04\0\x1e[method]container.list-obj\
50598ects\x01\x1f\x01@\x02\x04self\x12\x04name\x0d\0\x1b\x04\0\x1f[method]container.d\
50599elete-object\x01\x20\x01p\x0d\x01@\x02\x04self\x12\x05names!\0\x1b\x04\0\x20[met\
50600hod]container.delete-objects\x01\"\x01j\x01\x7f\x01\x07\x01@\x02\x04self\x12\x04\
50601name\x0d\0#\x04\0\x1c[method]container.has-object\x01$\x01j\x01\x0b\x01\x07\x01@\
50602\x02\x04self\x12\x04name\x0d\0%\x04\0\x1d[method]container.object-info\x01&\x01@\
50603\x01\x04self\x12\0\x1b\x04\0\x17[method]container.clear\x01'\x01h\x11\x01o\x02!\x7f\
50604\x01j\x01)\x01\x07\x01@\x02\x04self(\x03lenw\0*\x04\04[method]stream-object-name\
50605s.read-stream-object-names\x01+\x01o\x02w\x7f\x01j\x01,\x01\x07\x01@\x02\x04self\
50606(\x03numw\0-\x04\04[method]stream-object-names.skip-stream-object-names\x01.\x03\
50607\0\x18wasi:blobstore/container\x052\x02\x03\0\x0e\x09container\x02\x03\0\x0d\x0e\
50608container-name\x02\x03\0\x0d\x09object-id\x01B\x16\x02\x03\x02\x013\x04\0\x09con\
50609tainer\x03\0\0\x02\x03\x02\x01-\x04\0\x05error\x03\0\x02\x02\x03\x02\x014\x04\0\x0e\
50610container-name\x03\0\x04\x02\x03\x02\x015\x04\0\x09object-id\x03\0\x06\x01i\x01\x01\
50611j\x01\x08\x01\x03\x01@\x01\x04name\x05\0\x09\x04\0\x10create-container\x01\x0a\x04\
50612\0\x0dget-container\x01\x0a\x01j\0\x01\x03\x01@\x01\x04name\x05\0\x0b\x04\0\x10d\
50613elete-container\x01\x0c\x01j\x01\x7f\x01\x03\x01@\x01\x04name\x05\0\x0d\x04\0\x10\
50614container-exists\x01\x0e\x01@\x02\x03src\x07\x04dest\x07\0\x0b\x04\0\x0bcopy-obj\
50615ect\x01\x0f\x04\0\x0bmove-object\x01\x0f\x03\0\x18wasi:blobstore/blobstore\x056\x02\
50616\x03\0\x0c\x05error\x01Br\x02\x03\x02\x01)\x04\0\x0cinput-stream\x03\0\0\x02\x03\
50617\x02\x01*\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x017\x04\0\x05error\x03\0\
50618\x04\x02\x03\x02\x01\x02\x04\0\x08datetime\x03\0\x06\x01w\x04\0\x08filesize\x03\0\
50619\x08\x01m\x08\x07unknown\x0cblock-device\x10character-device\x09directory\x04fif\
50620o\x0dsymbolic-link\x0cregular-file\x06socket\x04\0\x0fdescriptor-type\x03\0\x0a\x01\
50621n\x06\x04read\x05write\x13file-integrity-sync\x13data-integrity-sync\x14requeste\
50622d-write-sync\x10mutate-directory\x04\0\x10descriptor-flags\x03\0\x0c\x01n\x01\x0e\
50623symlink-follow\x04\0\x0apath-flags\x03\0\x0e\x01n\x04\x06create\x09directory\x09\
50624exclusive\x08truncate\x04\0\x0aopen-flags\x03\0\x10\x01w\x04\0\x0alink-count\x03\
50625\0\x12\x01k\x07\x01r\x06\x04type\x0b\x0alink-count\x13\x04size\x09\x15data-acces\
50626s-timestamp\x14\x1bdata-modification-timestamp\x14\x17status-change-timestamp\x14\
50627\x04\0\x0fdescriptor-stat\x03\0\x15\x01q\x03\x09no-change\0\0\x03now\0\0\x09time\
50628stamp\x01\x07\0\x04\0\x0dnew-timestamp\x03\0\x17\x01r\x02\x04type\x0b\x04names\x04\
50629\0\x0fdirectory-entry\x03\0\x19\x01m%\x06access\x0bwould-block\x07already\x0ebad\
50630-descriptor\x04busy\x08deadlock\x05quota\x05exist\x0efile-too-large\x15illegal-b\
50631yte-sequence\x0bin-progress\x0binterrupted\x07invalid\x02io\x0cis-directory\x04l\
50632oop\x0etoo-many-links\x0cmessage-size\x0dname-too-long\x09no-device\x08no-entry\x07\
50633no-lock\x13insufficient-memory\x12insufficient-space\x0dnot-directory\x09not-emp\
50634ty\x0fnot-recoverable\x0bunsupported\x06no-tty\x0eno-such-device\x08overflow\x0d\
50635not-permitted\x04pipe\x09read-only\x0cinvalid-seek\x0etext-file-busy\x0ccross-de\
50636vice\x04\0\x0aerror-code\x03\0\x1b\x01m\x06\x06normal\x0asequential\x06random\x09\
50637will-need\x09dont-need\x08no-reuse\x04\0\x06advice\x03\0\x1d\x01r\x02\x05lowerw\x05\
50638upperw\x04\0\x13metadata-hash-value\x03\0\x1f\x04\0\x0adescriptor\x03\x01\x04\0\x16\
50639directory-entry-stream\x03\x01\x01h!\x01i\x01\x01j\x01$\x01\x1c\x01@\x02\x04self\
50640#\x06offset\x09\0%\x04\0\"[method]descriptor.read-via-stream\x01&\x01i\x03\x01j\x01\
50641'\x01\x1c\x01@\x02\x04self#\x06offset\x09\0(\x04\0#[method]descriptor.write-via-\
50642stream\x01)\x01@\x01\x04self#\0(\x04\0$[method]descriptor.append-via-stream\x01*\
50643\x01j\0\x01\x1c\x01@\x04\x04self#\x06offset\x09\x06length\x09\x06advice\x1e\0+\x04\
50644\0\x19[method]descriptor.advise\x01,\x01@\x01\x04self#\0+\x04\0\x1c[method]descr\
50645iptor.sync-data\x01-\x01j\x01\x0d\x01\x1c\x01@\x01\x04self#\0.\x04\0\x1c[method]\
50646descriptor.get-flags\x01/\x01j\x01\x0b\x01\x1c\x01@\x01\x04self#\00\x04\0\x1b[me\
50647thod]descriptor.get-type\x011\x01@\x02\x04self#\x04size\x09\0+\x04\0\x1b[method]\
50648descriptor.set-size\x012\x01@\x03\x04self#\x15data-access-timestamp\x18\x1bdata-\
50649modification-timestamp\x18\0+\x04\0\x1c[method]descriptor.set-times\x013\x01p}\x01\
50650o\x024\x7f\x01j\x015\x01\x1c\x01@\x03\x04self#\x06length\x09\x06offset\x09\06\x04\
50651\0\x17[method]descriptor.read\x017\x01j\x01\x09\x01\x1c\x01@\x03\x04self#\x06buf\
50652fer4\x06offset\x09\08\x04\0\x18[method]descriptor.write\x019\x01i\"\x01j\x01:\x01\
50653\x1c\x01@\x01\x04self#\0;\x04\0![method]descriptor.read-directory\x01<\x04\0\x17\
50654[method]descriptor.sync\x01-\x01@\x02\x04self#\x04paths\0+\x04\0&[method]descrip\
50655tor.create-directory-at\x01=\x01j\x01\x16\x01\x1c\x01@\x01\x04self#\0>\x04\0\x17\
50656[method]descriptor.stat\x01?\x01@\x03\x04self#\x0apath-flags\x0f\x04paths\0>\x04\
50657\0\x1a[method]descriptor.stat-at\x01@\x01@\x05\x04self#\x0apath-flags\x0f\x04pat\
50658hs\x15data-access-timestamp\x18\x1bdata-modification-timestamp\x18\0+\x04\0\x1f[\
50659method]descriptor.set-times-at\x01A\x01@\x05\x04self#\x0eold-path-flags\x0f\x08o\
50660ld-paths\x0enew-descriptor#\x08new-paths\0+\x04\0\x1a[method]descriptor.link-at\x01\
50661B\x01i!\x01j\x01\xc3\0\x01\x1c\x01@\x05\x04self#\x0apath-flags\x0f\x04paths\x0ao\
50662pen-flags\x11\x05flags\x0d\0\xc4\0\x04\0\x1a[method]descriptor.open-at\x01E\x01j\
50663\x01s\x01\x1c\x01@\x02\x04self#\x04paths\0\xc6\0\x04\0\x1e[method]descriptor.rea\
50664dlink-at\x01G\x04\0&[method]descriptor.remove-directory-at\x01=\x01@\x04\x04self\
50665#\x08old-paths\x0enew-descriptor#\x08new-paths\0+\x04\0\x1c[method]descriptor.re\
50666name-at\x01H\x01@\x03\x04self#\x08old-paths\x08new-paths\0+\x04\0\x1d[method]des\
50667criptor.symlink-at\x01I\x04\0![method]descriptor.unlink-file-at\x01=\x01@\x02\x04\
50668self#\x05other#\0\x7f\x04\0![method]descriptor.is-same-object\x01J\x01j\x01\x20\x01\
50669\x1c\x01@\x01\x04self#\0\xcb\0\x04\0\x20[method]descriptor.metadata-hash\x01L\x01\
50670@\x03\x04self#\x0apath-flags\x0f\x04paths\0\xcb\0\x04\0#[method]descriptor.metad\
50671ata-hash-at\x01M\x01h\"\x01k\x1a\x01j\x01\xcf\0\x01\x1c\x01@\x01\x04self\xce\0\0\
50672\xd0\0\x04\03[method]directory-entry-stream.read-directory-entry\x01Q\x01h\x05\x01\
50673k\x1c\x01@\x01\x03err\xd2\0\0\xd3\0\x04\0\x15filesystem-error-code\x01T\x03\0\x1b\
50674wasi:filesystem/types@0.2.0\x058\x02\x03\0\x10\x0adescriptor\x01B\x07\x02\x03\x02\
50675\x019\x04\0\x0adescriptor\x03\0\0\x01i\x01\x01o\x02\x02s\x01p\x03\x01@\0\0\x04\x04\
50676\0\x0fget-directories\x01\x05\x03\0\x1ewasi:filesystem/preopens@0.2.0\x05:\x01B\xc0\
50677\x01\x02\x03\x02\x01\x08\x04\0\x08duration\x03\0\0\x02\x03\x02\x01)\x04\0\x0cinp\
50678ut-stream\x03\0\x02\x02\x03\x02\x01*\x04\0\x0doutput-stream\x03\0\x04\x02\x03\x02\
50679\x01'\x04\0\x08io-error\x03\0\x06\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\0\x08\
50680\x01q\x0a\x03get\0\0\x04head\0\0\x04post\0\0\x03put\0\0\x06delete\0\0\x07connect\
50681\0\0\x07options\0\0\x05trace\0\0\x05patch\0\0\x05other\x01s\0\x04\0\x06method\x03\
50682\0\x0a\x01q\x03\x04HTTP\0\0\x05HTTPS\0\0\x05other\x01s\0\x04\0\x06scheme\x03\0\x0c\
50683\x01ks\x01k{\x01r\x02\x05rcode\x0e\x09info-code\x0f\x04\0\x11DNS-error-payload\x03\
50684\0\x10\x01k}\x01r\x02\x08alert-id\x12\x0dalert-message\x0e\x04\0\x1aTLS-alert-re\
50685ceived-payload\x03\0\x13\x01ky\x01r\x02\x0afield-name\x0e\x0afield-size\x15\x04\0\
50686\x12field-size-payload\x03\0\x16\x01kw\x01k\x17\x01q'\x0bDNS-timeout\0\0\x09DNS-\
50687error\x01\x11\0\x15destination-not-found\0\0\x17destination-unavailable\0\0\x19d\
50688estination-IP-prohibited\0\0\x19destination-IP-unroutable\0\0\x12connection-refu\
50689sed\0\0\x15connection-terminated\0\0\x12connection-timeout\0\0\x17connection-rea\
50690d-timeout\0\0\x18connection-write-timeout\0\0\x18connection-limit-reached\0\0\x12\
50691TLS-protocol-error\0\0\x15TLS-certificate-error\0\0\x12TLS-alert-received\x01\x14\
50692\0\x13HTTP-request-denied\0\0\x1cHTTP-request-length-required\0\0\x16HTTP-reques\
50693t-body-size\x01\x18\0\x1bHTTP-request-method-invalid\0\0\x18HTTP-request-URI-inv\
50694alid\0\0\x19HTTP-request-URI-too-long\0\0\x20HTTP-request-header-section-size\x01\
50695\x15\0\x18HTTP-request-header-size\x01\x19\0!HTTP-request-trailer-section-size\x01\
50696\x15\0\x19HTTP-request-trailer-size\x01\x17\0\x18HTTP-response-incomplete\0\0!HT\
50697TP-response-header-section-size\x01\x15\0\x19HTTP-response-header-size\x01\x17\0\
50698\x17HTTP-response-body-size\x01\x18\0\"HTTP-response-trailer-section-size\x01\x15\
50699\0\x1aHTTP-response-trailer-size\x01\x17\0\x1dHTTP-response-transfer-coding\x01\x0e\
50700\0\x1cHTTP-response-content-coding\x01\x0e\0\x15HTTP-response-timeout\0\0\x13HTT\
50701P-upgrade-failed\0\0\x13HTTP-protocol-error\0\0\x0dloop-detected\0\0\x13configur\
50702ation-error\0\0\x0einternal-error\x01\x0e\0\x04\0\x0aerror-code\x03\0\x1a\x01q\x03\
50703\x0einvalid-syntax\0\0\x09forbidden\0\0\x09immutable\0\0\x04\0\x0cheader-error\x03\
50704\0\x1c\x01s\x04\0\x09field-key\x03\0\x1e\x01p}\x04\0\x0bfield-value\x03\0\x20\x04\
50705\0\x06fields\x03\x01\x04\0\x07headers\x03\0\"\x04\0\x08trailers\x03\0\"\x04\0\x10\
50706incoming-request\x03\x01\x04\0\x10outgoing-request\x03\x01\x04\0\x0frequest-opti\
50707ons\x03\x01\x04\0\x11response-outparam\x03\x01\x01{\x04\0\x0bstatus-code\x03\0)\x04\
50708\0\x11incoming-response\x03\x01\x04\0\x0dincoming-body\x03\x01\x04\0\x0ffuture-t\
50709railers\x03\x01\x04\0\x11outgoing-response\x03\x01\x04\0\x0doutgoing-body\x03\x01\
50710\x04\0\x18future-incoming-response\x03\x01\x01i\"\x01@\0\01\x04\0\x13[constructo\
50711r]fields\x012\x01o\x02\x1f!\x01p3\x01j\x011\x01\x1d\x01@\x01\x07entries4\05\x04\0\
50712\x18[static]fields.from-list\x016\x01h\"\x01p!\x01@\x02\x04self7\x04name\x1f\08\x04\
50713\0\x12[method]fields.get\x019\x01@\x02\x04self7\x04name\x1f\0\x7f\x04\0\x12[meth\
50714od]fields.has\x01:\x01j\0\x01\x1d\x01@\x03\x04self7\x04name\x1f\x05value8\0;\x04\
50715\0\x12[method]fields.set\x01<\x01@\x02\x04self7\x04name\x1f\0;\x04\0\x15[method]\
50716fields.delete\x01=\x01@\x03\x04self7\x04name\x1f\x05value!\0;\x04\0\x15[method]f\
50717ields.append\x01>\x01@\x01\x04self7\04\x04\0\x16[method]fields.entries\x01?\x01@\
50718\x01\x04self7\01\x04\0\x14[method]fields.clone\x01@\x01h%\x01@\x01\x04self\xc1\0\
50719\0\x0b\x04\0\x1f[method]incoming-request.method\x01B\x01@\x01\x04self\xc1\0\0\x0e\
50720\x04\0([method]incoming-request.path-with-query\x01C\x01k\x0d\x01@\x01\x04self\xc1\
50721\0\0\xc4\0\x04\0\x1f[method]incoming-request.scheme\x01E\x04\0\"[method]incoming\
50722-request.authority\x01C\x01i#\x01@\x01\x04self\xc1\0\0\xc6\0\x04\0\x20[method]in\
50723coming-request.headers\x01G\x01i,\x01j\x01\xc8\0\0\x01@\x01\x04self\xc1\0\0\xc9\0\
50724\x04\0\x20[method]incoming-request.consume\x01J\x01i&\x01@\x01\x07headers\xc6\0\0\
50725\xcb\0\x04\0\x1d[constructor]outgoing-request\x01L\x01h&\x01i/\x01j\x01\xce\0\0\x01\
50726@\x01\x04self\xcd\0\0\xcf\0\x04\0\x1d[method]outgoing-request.body\x01P\x01@\x01\
50727\x04self\xcd\0\0\x0b\x04\0\x1f[method]outgoing-request.method\x01Q\x01j\0\0\x01@\
50728\x02\x04self\xcd\0\x06method\x0b\0\xd2\0\x04\0#[method]outgoing-request.set-meth\
50729od\x01S\x01@\x01\x04self\xcd\0\0\x0e\x04\0([method]outgoing-request.path-with-qu\
50730ery\x01T\x01@\x02\x04self\xcd\0\x0fpath-with-query\x0e\0\xd2\0\x04\0,[method]out\
50731going-request.set-path-with-query\x01U\x01@\x01\x04self\xcd\0\0\xc4\0\x04\0\x1f[\
50732method]outgoing-request.scheme\x01V\x01@\x02\x04self\xcd\0\x06scheme\xc4\0\0\xd2\
50733\0\x04\0#[method]outgoing-request.set-scheme\x01W\x04\0\"[method]outgoing-reques\
50734t.authority\x01T\x01@\x02\x04self\xcd\0\x09authority\x0e\0\xd2\0\x04\0&[method]o\
50735utgoing-request.set-authority\x01X\x01@\x01\x04self\xcd\0\0\xc6\0\x04\0\x20[meth\
50736od]outgoing-request.headers\x01Y\x01i'\x01@\0\0\xda\0\x04\0\x1c[constructor]requ\
50737est-options\x01[\x01h'\x01k\x01\x01@\x01\x04self\xdc\0\0\xdd\0\x04\0'[method]req\
50738uest-options.connect-timeout\x01^\x01@\x02\x04self\xdc\0\x08duration\xdd\0\0\xd2\
50739\0\x04\0+[method]request-options.set-connect-timeout\x01_\x04\0*[method]request-\
50740options.first-byte-timeout\x01^\x04\0.[method]request-options.set-first-byte-tim\
50741eout\x01_\x04\0-[method]request-options.between-bytes-timeout\x01^\x04\01[method\
50742]request-options.set-between-bytes-timeout\x01_\x01i(\x01i.\x01j\x01\xe1\0\x01\x1b\
50743\x01@\x02\x05param\xe0\0\x08response\xe2\0\x01\0\x04\0\x1d[static]response-outpa\
50744ram.set\x01c\x01h+\x01@\x01\x04self\xe4\0\0*\x04\0\x20[method]incoming-response.\
50745status\x01e\x01@\x01\x04self\xe4\0\0\xc6\0\x04\0![method]incoming-response.heade\
50746rs\x01f\x01@\x01\x04self\xe4\0\0\xc9\0\x04\0![method]incoming-response.consume\x01\
50747g\x01h,\x01i\x03\x01j\x01\xe9\0\0\x01@\x01\x04self\xe8\0\0\xea\0\x04\0\x1c[metho\
50748d]incoming-body.stream\x01k\x01i-\x01@\x01\x04this\xc8\0\0\xec\0\x04\0\x1c[stati\
50749c]incoming-body.finish\x01m\x01h-\x01i\x09\x01@\x01\x04self\xee\0\0\xef\0\x04\0!\
50750[method]future-trailers.subscribe\x01p\x01i$\x01k\xf1\0\x01j\x01\xf2\0\x01\x1b\x01\
50751j\x01\xf3\0\0\x01k\xf4\0\x01@\x01\x04self\xee\0\0\xf5\0\x04\0\x1b[method]future-\
50752trailers.get\x01v\x01@\x01\x07headers\xc6\0\0\xe1\0\x04\0\x1e[constructor]outgoi\
50753ng-response\x01w\x01h.\x01@\x01\x04self\xf8\0\0*\x04\0%[method]outgoing-response\
50754.status-code\x01y\x01@\x02\x04self\xf8\0\x0bstatus-code*\0\xd2\0\x04\0)[method]o\
50755utgoing-response.set-status-code\x01z\x01@\x01\x04self\xf8\0\0\xc6\0\x04\0![meth\
50756od]outgoing-response.headers\x01{\x01@\x01\x04self\xf8\0\0\xcf\0\x04\0\x1e[metho\
50757d]outgoing-response.body\x01|\x01h/\x01i\x05\x01j\x01\xfe\0\0\x01@\x01\x04self\xfd\
50758\0\0\xff\0\x04\0\x1b[method]outgoing-body.write\x01\x80\x01\x01j\0\x01\x1b\x01@\x02\
50759\x04this\xce\0\x08trailers\xf2\0\0\x81\x01\x04\0\x1c[static]outgoing-body.finish\
50760\x01\x82\x01\x01h0\x01@\x01\x04self\x83\x01\0\xef\0\x04\0*[method]future-incomin\
50761g-response.subscribe\x01\x84\x01\x01i+\x01j\x01\x85\x01\x01\x1b\x01j\x01\x86\x01\
50762\0\x01k\x87\x01\x01@\x01\x04self\x83\x01\0\x88\x01\x04\0$[method]future-incoming\
50763-response.get\x01\x89\x01\x01h\x07\x01k\x1b\x01@\x01\x03err\x8a\x01\0\x8b\x01\x04\
50764\0\x0fhttp-error-code\x01\x8c\x01\x03\0\x15wasi:http/types@0.2.0\x05;\x02\x03\0\x12\
50765\x10outgoing-request\x02\x03\0\x12\x0frequest-options\x02\x03\0\x12\x18future-in\
50766coming-response\x02\x03\0\x12\x0aerror-code\x01B\x0f\x02\x03\x02\x01<\x04\0\x10o\
50767utgoing-request\x03\0\0\x02\x03\x02\x01=\x04\0\x0frequest-options\x03\0\x02\x02\x03\
50768\x02\x01>\x04\0\x18future-incoming-response\x03\0\x04\x02\x03\x02\x01?\x04\0\x0a\
50769error-code\x03\0\x06\x01i\x01\x01i\x03\x01k\x09\x01i\x05\x01j\x01\x0b\x01\x07\x01\
50770@\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x06handle\x01\x0d\x03\0\x20wasi:\
50771http/outgoing-handler@0.2.0\x05@\x01B\x04\x04\0\x05error\x03\x01\x01h\0\x01@\x01\
50772\x04self\x01\0s\x04\0\x13[method]error.trace\x01\x02\x03\0'wasi:keyvalue/wasi-ke\
50773yvalue-error@0.1.0\x05A\x02\x03\0\x14\x05error\x01B,\x02\x03\x02\x01)\x04\0\x0ci\
50774nput-stream\x03\0\0\x02\x03\x02\x01*\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\
50775\x01B\x04\0\x05error\x03\0\x04\x04\0\x06bucket\x03\x01\x01s\x04\0\x03key\x03\0\x07\
50776\x04\0\x0eoutgoing-value\x03\x01\x04\0\x19outgoing-value-body-async\x03\0\x03\x01\
50777p}\x04\0\x18outgoing-value-body-sync\x03\0\x0b\x04\0\x0eincoming-value\x03\x01\x04\
50778\0\x19incoming-value-async-body\x03\0\x01\x01p}\x04\0\x18incoming-value-sync-bod\
50779y\x03\0\x0f\x01i\x06\x01i\x05\x01j\x01\x11\x01\x12\x01@\x01\x04names\0\x13\x04\0\
50780\x1a[static]bucket.open-bucket\x01\x14\x01i\x09\x01@\0\0\x15\x04\0)[static]outgo\
50781ing-value.new-outgoing-value\x01\x16\x01h\x09\x01i\x0a\x01j\x01\x18\x01\x12\x01@\
50782\x01\x04self\x17\0\x19\x04\06[method]outgoing-value.outgoing-value-write-body-as\
50783ync\x01\x1a\x01j\0\x01\x12\x01@\x02\x04self\x17\x05value\x0c\0\x1b\x04\05[method\
50784]outgoing-value.outgoing-value-write-body-sync\x01\x1c\x01h\x0d\x01j\x01\x10\x01\
50785\x12\x01@\x01\x04self\x1d\0\x1e\x04\02[method]incoming-value.incoming-value-cons\
50786ume-sync\x01\x1f\x01i\x0e\x01j\x01\x20\x01\x12\x01@\x01\x04self\x1d\0!\x04\03[me\
50787thod]incoming-value.incoming-value-consume-async\x01\"\x01j\x01w\x01\x12\x01@\x01\
50788\x04self\x1d\0#\x04\0*[method]incoming-value.incoming-value-size\x01$\x03\0\x19w\
50789asi:keyvalue/types@0.1.0\x05C\x02\x03\0\x15\x06bucket\x02\x03\0\x15\x05error\x02\
50790\x03\0\x15\x03key\x02\x03\0\x15\x0eincoming-value\x02\x03\0\x15\x0eoutgoing-valu\
50791e\x01B\x1e\x02\x03\x02\x01D\x04\0\x06bucket\x03\0\0\x02\x03\x02\x01E\x04\0\x05er\
50792ror\x03\0\x02\x02\x03\x02\x01F\x04\0\x03key\x03\0\x04\x02\x03\x02\x01G\x04\0\x0e\
50793incoming-value\x03\0\x06\x02\x03\x02\x01H\x04\0\x0eoutgoing-value\x03\0\x08\x01h\
50794\x01\x01p\x05\x01i\x07\x01k\x0c\x01p\x0d\x01i\x03\x01j\x01\x0e\x01\x0f\x01@\x02\x06\
50795bucket\x0a\x04keys\x0b\0\x10\x04\0\x08get-many\x01\x11\x01j\x01\x0b\x01\x0f\x01@\
50796\x01\x06bucket\x0a\0\x12\x04\0\x04keys\x01\x13\x01h\x09\x01o\x02\x05\x14\x01p\x15\
50797\x01j\0\x01\x0f\x01@\x02\x06bucket\x0a\x0akey-values\x16\0\x17\x04\0\x08set-many\
50798\x01\x18\x01@\x02\x06bucket\x0a\x04keys\x0b\0\x17\x04\0\x0bdelete-many\x01\x19\x03\
50799\0\"wasi:keyvalue/eventual-batch@0.1.0\x05I\x01B\x1a\x02\x03\x02\x01D\x04\0\x06b\
50800ucket\x03\0\0\x02\x03\x02\x01E\x04\0\x05error\x03\0\x02\x02\x03\x02\x01G\x04\0\x0e\
50801incoming-value\x03\0\x04\x02\x03\x02\x01F\x04\0\x03key\x03\0\x06\x02\x03\x02\x01\
50802H\x04\0\x0eoutgoing-value\x03\0\x08\x01h\x01\x01i\x05\x01k\x0b\x01i\x03\x01j\x01\
50803\x0c\x01\x0d\x01@\x02\x06bucket\x0a\x03key\x07\0\x0e\x04\0\x03get\x01\x0f\x01h\x09\
50804\x01j\0\x01\x0d\x01@\x03\x06bucket\x0a\x03key\x07\x0eoutgoing-value\x10\0\x11\x04\
50805\0\x03set\x01\x12\x01@\x02\x06bucket\x0a\x03key\x07\0\x11\x04\0\x06delete\x01\x13\
50806\x01j\x01\x7f\x01\x0d\x01@\x02\x06bucket\x0a\x03key\x07\0\x14\x04\0\x06exists\x01\
50807\x15\x03\0\x1cwasi:keyvalue/eventual@0.1.0\x05J\x01B\x04\x01m\x06\x05trace\x05de\
50808bug\x04info\x04warn\x05error\x08critical\x04\0\x05level\x03\0\0\x01@\x03\x05leve\
50809l\x01\x07contexts\x07messages\x01\0\x04\0\x03log\x01\x02\x03\0\x14wasi:logging/l\
50810ogging\x05K\x01B\x11\x04\0\x07network\x03\x01\x01m\x15\x07unknown\x0daccess-deni\
50811ed\x0dnot-supported\x10invalid-argument\x0dout-of-memory\x07timeout\x14concurren\
50812cy-conflict\x0fnot-in-progress\x0bwould-block\x0dinvalid-state\x10new-socket-lim\
50813it\x14address-not-bindable\x0eaddress-in-use\x12remote-unreachable\x12connection\
50814-refused\x10connection-reset\x12connection-aborted\x12datagram-too-large\x11name\
50815-unresolvable\x1atemporary-resolver-failure\x1apermanent-resolver-failure\x04\0\x0a\
50816error-code\x03\0\x01\x01m\x02\x04ipv4\x04ipv6\x04\0\x11ip-address-family\x03\0\x03\
50817\x01o\x04}}}}\x04\0\x0cipv4-address\x03\0\x05\x01o\x08{{{{{{{{\x04\0\x0cipv6-add\
50818ress\x03\0\x07\x01q\x02\x04ipv4\x01\x06\0\x04ipv6\x01\x08\0\x04\0\x0aip-address\x03\
50819\0\x09\x01r\x02\x04port{\x07address\x06\x04\0\x13ipv4-socket-address\x03\0\x0b\x01\
50820r\x04\x04port{\x09flow-infoy\x07address\x08\x08scope-idy\x04\0\x13ipv6-socket-ad\
50821dress\x03\0\x0d\x01q\x02\x04ipv4\x01\x0c\0\x04ipv6\x01\x0e\0\x04\0\x11ip-socket-\
50822address\x03\0\x0f\x03\0\x1awasi:sockets/network@0.2.0\x05L\x02\x03\0\x19\x07netw\
50823ork\x02\x03\0\x19\x0aerror-code\x02\x03\0\x19\x0aip-address\x01B\x16\x02\x03\x02\
50824\x01\x03\x04\0\x08pollable\x03\0\0\x02\x03\x02\x01M\x04\0\x07network\x03\0\x02\x02\
50825\x03\x02\x01N\x04\0\x0aerror-code\x03\0\x04\x02\x03\x02\x01O\x04\0\x0aip-address\
50826\x03\0\x06\x04\0\x16resolve-address-stream\x03\x01\x01h\x08\x01k\x07\x01j\x01\x0a\
50827\x01\x05\x01@\x01\x04self\x09\0\x0b\x04\03[method]resolve-address-stream.resolve\
50828-next-address\x01\x0c\x01i\x01\x01@\x01\x04self\x09\0\x0d\x04\0([method]resolve-\
50829address-stream.subscribe\x01\x0e\x01h\x03\x01i\x08\x01j\x01\x10\x01\x05\x01@\x02\
50830\x07network\x0f\x04names\0\x11\x04\0\x11resolve-addresses\x01\x12\x03\0!wasi:soc\
50831kets/ip-name-lookup@0.2.0\x05P\x01B\x05\x02\x03\x02\x01M\x04\0\x07network\x03\0\0\
50832\x01i\x01\x01@\0\0\x02\x04\0\x10instance-network\x01\x03\x03\0#wasi:sockets/inst\
50833ance-network@0.2.0\x05Q\x04\0\x15golem:rust/golem-rust\x04\0\x0b\x10\x01\0\x0ago\
50834lem-rust\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.2\
5083520.0\x10wit-bindgen-rust\x060.36.0";
50836#[inline(never)]
50837#[doc(hidden)]
50838pub fn __link_custom_section_describing_imports() {
50839 wit_bindgen_rt::maybe_link_cabi_realloc();
50840}