From a0ef34dceda6a5efbb02bb384cfa991ce72354d5 Mon Sep 17 00:00:00 2001 From: Doug Anderson444 Date: Tue, 12 Mar 2024 22:52:43 -0300 Subject: [PATCH] bump cargo-component to v0.10.0 --- Cargo.lock | 72 +- Cargo.toml | 11 +- README.md | 15 +- crates/seed-keeper-wallet/Cargo.toml | 3 +- crates/seed-keeper-wallet/src/bindings.rs | 573 +-- crates/seed-keeper-wallet/src/lib.rs | 2 + crates/seed-keeper-wit-ui/Cargo.toml | 5 +- crates/seed-keeper-wit-ui/src/bindings.rs | 1247 ++++--- crates/seed-keeper-wit-ui/src/lib.rs | 2 + .../wit/deps/wallet/world.wit | 1 + examples/crates/aggregate-wit-ui/Cargo.toml | 5 +- .../crates/aggregate-wit-ui/src/bindings.rs | 3091 +++++++++-------- examples/crates/aggregate-wit-ui/src/lib.rs | 10 +- examples/crates/aggregate-wit-ui/tests/mod.rs | 7 + examples/crates/calculator/Cargo.toml | 3 +- examples/crates/calculator/src/bindings.rs | 260 +- examples/crates/calculator/src/lib.rs | 2 + examples/crates/edwards-ui/Cargo.toml | 3 +- examples/crates/edwards-ui/src/bindings.rs | 1162 ++++--- examples/crates/edwards-ui/src/lib.rs | 2 + examples/crates/edwards-ui/src/output.rs | 1 - examples/crates/edwards-ui/wit/world.wit | 8 +- examples/crates/edwards-wit/Cargo.toml | 3 +- examples/crates/edwards-wit/src/bindings.rs | 780 +++-- examples/crates/edwards-wit/src/lib.rs | 2 + examples/crates/math/Cargo.toml | 3 +- examples/crates/math/src/bindings.rs | 188 +- examples/crates/math/src/lib.rs | 2 + justfile | 13 +- 29 files changed, 4217 insertions(+), 3259 deletions(-) create mode 120000 crates/seed-keeper-wit-ui/wit/deps/wallet/world.wit diff --git a/Cargo.lock b/Cargo.lock index 9eabab1..b2f9b4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,12 +41,13 @@ dependencies = [ name = "aggregate-wit-ui" version = "0.1.0" dependencies = [ + "bitflags 2.4.2", "minijinja", "thiserror", "wasmtime", "wasmtime-wasi", - "wit-bindgen", - "wurbo", + "wit-bindgen-rt", + "wurbo 0.3.0", ] [[package]] @@ -211,7 +212,8 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" name = "calculator" version = "0.1.0" dependencies = [ - "wit-bindgen", + "bitflags 2.4.2", + "wit-bindgen-rt", ] [[package]] @@ -694,21 +696,23 @@ dependencies = [ name = "edwards-ui" version = "0.1.0" dependencies = [ - "wit-bindgen", - "wurbo", + "bitflags 2.4.2", + "wit-bindgen-rt", + "wurbo 0.3.0", ] [[package]] name = "edwards-wit" version = "0.1.0" dependencies = [ + "bitflags 2.4.2", "ed25519-dalek", "serde", "serde_json", "thiserror", "wasmtime", "wasmtime-wasi", - "wit-bindgen", + "wit-bindgen-rt", ] [[package]] @@ -1153,7 +1157,8 @@ dependencies = [ name = "math" version = "0.1.0" dependencies = [ - "wit-bindgen", + "bitflags 2.4.2", + "wit-bindgen-rt", ] [[package]] @@ -1177,6 +1182,12 @@ dependencies = [ "rustix", ] +[[package]] +name = "memo-map" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374c335b2df19e62d4cb323103473cbc6510980253119180de862d89184f6a83" + [[package]] name = "memoffset" version = "0.9.0" @@ -1192,6 +1203,8 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe0ff215195a22884d867b547c70a0c4815cbbcc70991f281dca604b20d10ce" dependencies = [ + "memo-map", + "self_cell", "serde", "serde_json", ] @@ -1569,20 +1582,21 @@ version = "0.1.0" dependencies = [ "serde", "serde_with", - "wurbo", + "wurbo 0.2.0", ] [[package]] name = "seed-keeper-wallet" version = "0.1.0" dependencies = [ + "bitflags 2.4.2", "seed-keeper-core", "serde", "serde_json", "thiserror", "wasmtime", "wasmtime-wasi", - "wit-bindgen", + "wit-bindgen-rt", ] [[package]] @@ -1590,13 +1604,20 @@ name = "seed-keeper-wit-ui" version = "0.1.0" dependencies = [ "base64ct", + "bitflags 2.4.2", "seed-keeper-events", "serde", "serde_json", - "wit-bindgen", - "wurbo", + "wit-bindgen-rt", + "wurbo 0.2.0", ] +[[package]] +name = "self_cell" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58bf37232d3bb9a2c4e641ca2a11d83b5062066f88df7fed36c28772046d65ba" + [[package]] name = "semver" version = "1.0.21" @@ -2736,13 +2757,9 @@ dependencies = [ ] [[package]] -name = "wit-bindgen" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b76f1d099678b4f69402a421e888bbe71bf20320c2f3f3565d0e7484dbe5bc20" -dependencies = [ - "bitflags 2.4.2", -] +name = "wit-bindgen-rt" +version = "0.22.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen.git?rev=9c913f6#9c913f6d119739a09b521deed89743b4a001aae1" [[package]] name = "wit-parser" @@ -2792,6 +2809,25 @@ dependencies = [ "wit-parser", ] +[[package]] +name = "wurbo" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acddc882b3d7f202fd2e6c15f455a9ca584f41d388905b4de2160e0bc639395d" +dependencies = [ + "base64ct", + "convert_case", + "lazy_static", + "minijinja", + "nanoid", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", + "wit-parser", +] + [[package]] name = "zerocopy" version = "0.7.32" diff --git a/Cargo.toml b/Cargo.toml index e12ccb1..440fb7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,13 @@ [workspace] -members = [".", "crates/*", "examples/crates/*"] +members = ["crates/*", "examples/crates/*"] resolver = "2" [workspace.dependencies] seed-keeper-core = { path = "crates/seed-keeper-core" } seed-keeper-events = { path = "crates/seed-keeper-events" } -wit-bindgen = { version = "0.16.0", default-features = false, features = ["realloc"] } -wurbo = "0.2.0" +bitflags = "2.4.2" +wit-bindgen-rt = "0.22.0" +wurbo = "0.3.0" [package] name = "seed-keeper" @@ -30,3 +31,7 @@ overflow-checks = false panic = 'abort' # Abort on panic rpath = false strip = true # Automatically strip symbols from the binary. + +[patch.crates-io] +# patch with https://github.com/bytecodealliance/wit-bindgen/commit/9c913f6d119739a09b521deed89743b4a001aae1 +wit-bindgen-rt = { git = "https://github.com/bytecodealliance/wit-bindgen.git", rev = "9c913f6" } diff --git a/README.md b/README.md index 18db782..8949c26 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,16 @@ The Seed Keeper is a tool for generating, encrypting and managing Seeds. It is u ## Build +A [Justfile](https://just.systems) contains all the build scripts, just run it: + ```bash -cargo component build --workspace --release +just build +``` + +Or build using [`cargo-component`](https://github.com/bytecodealliance/cargo-component) directly: + +```bash +cargo component build ``` ## Compose @@ -74,12 +82,9 @@ world root { Run all tests: ```bash -cargo test --workspace --all-targets --exclude seed-keeper-wit-ui +cargo test --workspace --all-targets ``` -We need to `--exclude` the `seed-keeper-wit-ui` from tests because it's `crate-type` is both `cdylib` (for `cargo component build` step) and `lib` (so that `events` can be exported), however this setup breaks `cargo test`. - - # Extensibility: Buidl your own wallet ## Plugins diff --git a/crates/seed-keeper-wallet/Cargo.toml b/crates/seed-keeper-wallet/Cargo.toml index a9499da..fd9cae5 100644 --- a/crates/seed-keeper-wallet/Cargo.toml +++ b/crates/seed-keeper-wallet/Cargo.toml @@ -6,7 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wit-bindgen = { workspace = true } +bitflags = { workspace = true } +wit-bindgen-rt = { workspace = true } seed-keeper-core = { workspace = true } [dev-dependencies] diff --git a/crates/seed-keeper-wallet/src/bindings.rs b/crates/seed-keeper-wallet/src/bindings.rs index a8ca6b9..219aad8 100644 --- a/crates/seed-keeper-wallet/src/bindings.rs +++ b/crates/seed-keeper-wallet/src/bindings.rs @@ -1,289 +1,318 @@ -// Generated by `wit-bindgen` 0.16.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Options used: pub mod seed_keeper { - pub mod wallet { - - #[allow(clippy::all)] - pub mod types { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - /// The confuration of the seed keeper - #[derive(Clone)] - pub struct Credentials { - /// The username to use for the seed keeper - pub username: wit_bindgen::rt::vec::Vec::, - /// The password to use for the seed keeper - pub password: wit_bindgen::rt::vec::Vec::, - /// Optional prevously generated encrypted seed to use for the seed keeper - pub encrypted: Option>, - } - impl ::core::fmt::Debug for Credentials { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Credentials").field("username", &self.username).field("password", &self.password).field("encrypted", &self.encrypted).finish() + pub mod wallet { + #[allow(clippy::all)] + pub mod types { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + /// The confuration of the seed keeper + #[derive(Clone)] + pub struct Credentials { + /// The username to use for the seed keeper + pub username: _rt::Vec, + /// The password to use for the seed keeper + pub password: _rt::Vec, + /// Optional prevously generated encrypted seed to use for the seed keeper + pub encrypted: Option<_rt::Vec>, + } + impl ::core::fmt::Debug for Credentials { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Credentials") + .field("username", &self.username) + .field("password", &self.password) + .field("encrypted", &self.encrypted) + .finish() + } + } } - } - } - - } } pub mod exports { - pub mod seed_keeper { - pub mod wallet { - - #[allow(clippy::all)] - pub mod config { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_section; - pub type Credentials = super::super::super::super::seed_keeper::wallet::types::Credentials; - const _: () = { - - #[doc(hidden)] - #[export_name = "seed-keeper:wallet/config@0.1.0#set-config"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_set_config(arg0: i32,arg1: i32,arg2: i32,arg3: i32,arg4: i32,arg5: i32,arg6: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let len1 = arg3 as usize; - let result3 = <_GuestImpl as Guest>::set_config(super::super::super::super::seed_keeper::wallet::types::Credentials{ - username: Vec::from_raw_parts(arg0 as *mut _, len0, len0), - password: Vec::from_raw_parts(arg2 as *mut _, len1, len1), - encrypted: match arg4 { - 0 => None, - 1 => { - let e = { - let len2 = arg6 as usize; - - Vec::from_raw_parts(arg5 as *mut _, len2, len2) - }; - Some(e) + pub mod seed_keeper { + pub mod wallet { + #[allow(clippy::all)] + pub mod config { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type Credentials = + super::super::super::super::seed_keeper::wallet::types::Credentials; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_set_config_cabi( + arg0: *mut u8, + arg1: usize, + arg2: *mut u8, + arg3: usize, + arg4: i32, + arg5: *mut u8, + arg6: usize, + ) -> *mut u8 { + let len0 = arg1; + let len1 = arg3; + let result3 = T::set_config( + super::super::super::super::seed_keeper::wallet::types::Credentials { + username: _rt::Vec::from_raw_parts(arg0.cast(), len0, len0), + password: _rt::Vec::from_raw_parts(arg2.cast(), len1, len1), + encrypted: match arg4 { + 0 => None, + 1 => { + let e = { + let len2 = arg6; + + _rt::Vec::from_raw_parts(arg5.cast(), len2, len2) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + }, + ); + let ptr4 = _RET_AREA.0.as_mut_ptr().cast::(); + match result3 { + Ok(_) => { + *ptr4.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr4.add(0).cast::() = (1i32) as u8; + let vec5 = (e.into_bytes()).into_boxed_slice(); + let ptr5 = vec5.as_ptr().cast::(); + let len5 = vec5.len(); + ::core::mem::forget(vec5); + *ptr4.add(8).cast::() = len5; + *ptr4.add(4).cast::<*mut u8>() = ptr5.cast_mut(); + } + }; + ptr4 } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - }); - let ptr4 = _RET_AREA.0.as_mut_ptr() as i32; - match result3 { - Ok(_) => { { - *((ptr4 + 0) as *mut u8) = (0i32) as u8; - } }, - Err(e) => { { - *((ptr4 + 0) as *mut u8) = (1i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr() as i32; - let len5 = vec5.len() as i32; - ::core::mem::forget(vec5); - *((ptr4 + 8) as *mut i32) = len5; - *((ptr4 + 4) as *mut i32) = ptr5; - } }, - };ptr4 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_seed-keeper:wallet/config@0.1.0#set-config"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_set_config(arg0: i32,) { - let l0 = i32::from(*((arg0 + 0) as *const u8)); - match l0 { - 0 => (), - _ => { - let l1 = *((arg0 + 4) as *const i32); - let l2 = *((arg0 + 8) as *const i32); - wit_bindgen::rt::dealloc(l1, (l2) as usize, 1); - }, - } - } - }; - }; - const _: () = { - - #[doc(hidden)] - #[export_name = "seed-keeper:wallet/config@0.1.0#get-encrypted"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_get_encrypted() -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::get_encrypted(); - let ptr1 = _RET_AREA.0.as_mut_ptr() as i32; - match result0 { - Ok(e) => { { - *((ptr1 + 0) as *mut u8) = (0i32) as u8; - let vec2 = (e).into_boxed_slice(); - let ptr2 = vec2.as_ptr() as i32; - let len2 = vec2.len() as i32; - ::core::mem::forget(vec2); - *((ptr1 + 8) as *mut i32) = len2; - *((ptr1 + 4) as *mut i32) = ptr2; - } }, - Err(e) => { { - *((ptr1 + 0) as *mut u8) = (1i32) as u8; - let vec3 = (e.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; - ::core::mem::forget(vec3); - *((ptr1 + 8) as *mut i32) = len3; - *((ptr1 + 4) as *mut i32) = ptr3; - } }, - };ptr1 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_seed-keeper:wallet/config@0.1.0#get-encrypted"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_get_encrypted(arg0: i32,) { - let l0 = i32::from(*((arg0 + 0) as *const u8)); - match l0 { - 0 => { - let l1 = *((arg0 + 4) as *const i32); - let l2 = *((arg0 + 8) as *const i32); - let base3 = l1; - let len3 = l2; - wit_bindgen::rt::dealloc(base3, (len3 as usize) * 1, 1); - }, - _ => { - let l4 = *((arg0 + 4) as *const i32); - let l5 = *((arg0 + 8) as *const i32); - wit_bindgen::rt::dealloc(l4, (l5) as usize, 1); - }, - } - } - }; - }; - const _: () = { - - #[doc(hidden)] - #[export_name = "seed-keeper:wallet/config@0.1.0#get-seed"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_get_seed() -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::get_seed(); - let ptr1 = _RET_AREA.0.as_mut_ptr() as i32; - match result0 { - Ok(e) => { { - *((ptr1 + 0) as *mut u8) = (0i32) as u8; - let vec2 = (e).into_boxed_slice(); - let ptr2 = vec2.as_ptr() as i32; - let len2 = vec2.len() as i32; - ::core::mem::forget(vec2); - *((ptr1 + 8) as *mut i32) = len2; - *((ptr1 + 4) as *mut i32) = ptr2; - } }, - Err(e) => { { - *((ptr1 + 0) as *mut u8) = (1i32) as u8; - let vec3 = (e.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; - ::core::mem::forget(vec3); - *((ptr1 + 8) as *mut i32) = len3; - *((ptr1 + 4) as *mut i32) = ptr3; - } }, - };ptr1 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_seed-keeper:wallet/config@0.1.0#get-seed"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_get_seed(arg0: i32,) { - let l0 = i32::from(*((arg0 + 0) as *const u8)); - match l0 { - 0 => { - let l1 = *((arg0 + 4) as *const i32); - let l2 = *((arg0 + 8) as *const i32); - let base3 = l1; - let len3 = l2; - wit_bindgen::rt::dealloc(base3, (len3 as usize) * 1, 1); - }, - _ => { - let l4 = *((arg0 + 4) as *const i32); - let l5 = *((arg0 + 8) as *const i32); - wit_bindgen::rt::dealloc(l4, (l5) as usize, 1); - }, - } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_set_config(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l1, l2, 1); + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_get_encrypted_cabi() -> *mut u8 { + let result0 = T::get_encrypted(); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + let vec2 = (e).into_boxed_slice(); + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + ::core::mem::forget(vec2); + *ptr1.add(8).cast::() = len2; + *ptr1.add(4).cast::<*mut u8>() = ptr2.cast_mut(); + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + let vec3 = (e.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr1.add(8).cast::() = len3; + *ptr1.add(4).cast::<*mut u8>() = ptr3.cast_mut(); + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_get_encrypted(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + let base3 = l1; + let len3 = l2; + _rt::cabi_dealloc(base3, len3 * 1, 1); + } + _ => { + let l4 = *arg0.add(4).cast::<*mut u8>(); + let l5 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l4, l5, 1); + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_get_seed_cabi() -> *mut u8 { + let result0 = T::get_seed(); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + let vec2 = (e).into_boxed_slice(); + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + ::core::mem::forget(vec2); + *ptr1.add(8).cast::() = len2; + *ptr1.add(4).cast::<*mut u8>() = ptr2.cast_mut(); + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + let vec3 = (e.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr1.add(8).cast::() = len3; + *ptr1.add(4).cast::<*mut u8>() = ptr3.cast_mut(); + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_get_seed(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + let base3 = l1; + let len3 = l2; + _rt::cabi_dealloc(base3, len3 * 1, 1); + } + _ => { + let l4 = *arg0.add(4).cast::<*mut u8>(); + let l5 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l4, l5, 1); + } + } + } + pub trait Guest { + /// Load into the component from an encrypted seed, password, and salt (username) + /// Returns the encrypted seed or an error + fn set_config(config: Credentials) -> Result<(), _rt::String>; + /// Returns the encrypted seed or None if it doesn't exist + fn get_encrypted() -> Result<_rt::Vec, _rt::String>; + /// Get the plaintext seed + fn get_seed() -> Result<_rt::Vec, _rt::String>; + } + #[doc(hidden)] + + macro_rules! __export_seed_keeper_wallet_config_0_1_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "seed-keeper:wallet/config@0.1.0#set-config"] + unsafe extern "C" fn export_set_config(arg0: *mut u8,arg1: usize,arg2: *mut u8,arg3: usize,arg4: i32,arg5: *mut u8,arg6: usize,) -> *mut u8 { + $($path_to_types)*::_export_set_config_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4, arg5, arg6) + } + #[export_name = "cabi_post_seed-keeper:wallet/config@0.1.0#set-config"] + unsafe extern "C" fn _post_return_set_config(arg0: *mut u8,) { + $($path_to_types)*::__post_return_set_config::<$ty>(arg0) + } + #[export_name = "seed-keeper:wallet/config@0.1.0#get-encrypted"] + unsafe extern "C" fn export_get_encrypted() -> *mut u8 { + $($path_to_types)*::_export_get_encrypted_cabi::<$ty>() + } + #[export_name = "cabi_post_seed-keeper:wallet/config@0.1.0#get-encrypted"] + unsafe extern "C" fn _post_return_get_encrypted(arg0: *mut u8,) { + $($path_to_types)*::__post_return_get_encrypted::<$ty>(arg0) + } + #[export_name = "seed-keeper:wallet/config@0.1.0#get-seed"] + unsafe extern "C" fn export_get_seed() -> *mut u8 { + $($path_to_types)*::_export_get_seed_cabi::<$ty>() + } + #[export_name = "cabi_post_seed-keeper:wallet/config@0.1.0#get-seed"] + unsafe extern "C" fn _post_return_get_seed(arg0: *mut u8,) { + $($path_to_types)*::__post_return_get_seed::<$ty>(arg0) + } + };); + } + #[doc(hidden)] + pub(crate) use __export_seed_keeper_wallet_config_0_1_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 12]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 12]); } - }; - }; - use super::super::super::super::super::Component as _GuestImpl; - pub trait Guest { - /// Load into the component from an encrypted seed, password, and salt (username) - /// Returns the encrypted seed or an error - fn set_config(config: Credentials,) -> Result<(),wit_bindgen::rt::string::String>; - /// Returns the encrypted seed or None if it doesn't exist - fn get_encrypted() -> Result,wit_bindgen::rt::string::String>; - /// Get the plaintext seed - fn get_seed() -> Result,wit_bindgen::rt::string::String>; } - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - #[repr(align(4))] - struct _RetArea([u8; 12]); - static mut _RET_AREA: _RetArea = _RetArea([0; 12]); - - } - } - } +} +mod _rt { + pub use alloc_crate::vec::Vec; + pub unsafe fn invalid_enum_discriminant() -> T { + if cfg!(debug_assertions) { + panic!("invalid enum discriminant") + } else { + core::hint::unreachable_unchecked() + } + } + pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) { + if size == 0 { + return; + } + let layout = alloc::Layout::from_size_align_unchecked(size, align); + alloc::dealloc(ptr as *mut u8, layout); + } + pub use alloc_crate::string::String; + extern crate alloc as alloc_crate; + pub use alloc_crate::alloc; } +/// Generates `#[no_mangle]` functions to export the specified type as the +/// root implementation of all generated traits. +/// +/// For more information see the documentation of `wit_bindgen::generate!`. +/// +/// ```rust +/// # macro_rules! export{ ($($t:tt)*) => (); } +/// # trait Guest {} +/// struct MyType; +/// +/// impl Guest for MyType { +/// // ... +/// } +/// +/// export!(MyType); +/// ``` +#[allow(unused_macros)] +#[doc(hidden)] + +macro_rules! __export_keeper_impl { + ($ty:ident) => (self::export!($ty with_types_in self);); + ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( + $($path_to_types_root)*::exports::seed_keeper::wallet::config::__export_seed_keeper_wallet_config_0_1_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::seed_keeper::wallet::config); + ) +} +#[doc(inline)] +pub(crate) use __export_keeper_impl as export; + #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:keeper"] +#[link_section = "component-type:wit-bindgen:0.21.0:keeper:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1358] = [3, 0, 6, 107, 101, 101, 112, 101, 114, 0, 97, 115, 109, 13, 0, 1, 0, 7, 98, 1, 65, 2, 1, 66, 4, 1, 112, 125, 1, 107, 0, 1, 114, 3, 8, 117, 115, 101, 114, 110, 97, 109, 101, 0, 8, 112, 97, 115, 115, 119, 111, 114, 100, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 4, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 3, 0, 2, 4, 1, 30, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 97, 108, 108, 101, 116, 47, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 11, 11, 1, 0, 5, 116, 121, 112, 101, 115, 3, 0, 0, 7, 253, 1, 1, 65, 5, 1, 66, 4, 1, 112, 125, 1, 107, 0, 1, 114, 3, 8, 117, 115, 101, 114, 110, 97, 109, 101, 0, 8, 112, 97, 115, 115, 119, 111, 114, 100, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 4, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 3, 0, 2, 3, 1, 30, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 97, 108, 108, 101, 116, 47, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 2, 3, 0, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 1, 66, 10, 2, 3, 2, 1, 1, 4, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 3, 0, 0, 1, 106, 0, 1, 115, 1, 64, 1, 6, 99, 111, 110, 102, 105, 103, 1, 0, 2, 4, 0, 10, 115, 101, 116, 45, 99, 111, 110, 102, 105, 103, 1, 3, 1, 112, 125, 1, 106, 1, 4, 1, 115, 1, 64, 0, 0, 5, 4, 0, 13, 103, 101, 116, 45, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 6, 4, 0, 8, 103, 101, 116, 45, 115, 101, 101, 100, 1, 6, 4, 1, 31, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 97, 108, 108, 101, 116, 47, 99, 111, 110, 102, 105, 103, 64, 48, 46, 49, 46, 48, 5, 2, 11, 12, 1, 0, 6, 99, 111, 110, 102, 105, 103, 3, 2, 0, 7, 164, 2, 1, 65, 2, 1, 65, 5, 1, 66, 4, 1, 112, 125, 1, 107, 0, 1, 114, 3, 8, 117, 115, 101, 114, 110, 97, 109, 101, 0, 8, 112, 97, 115, 115, 119, 111, 114, 100, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 4, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 3, 0, 2, 3, 1, 30, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 97, 108, 108, 101, 116, 47, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 2, 3, 0, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 1, 66, 10, 2, 3, 2, 1, 1, 4, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 3, 0, 0, 1, 106, 0, 1, 115, 1, 64, 1, 6, 99, 111, 110, 102, 105, 103, 1, 0, 2, 4, 0, 10, 115, 101, 116, 45, 99, 111, 110, 102, 105, 103, 1, 3, 1, 112, 125, 1, 106, 1, 4, 1, 115, 1, 64, 0, 0, 5, 4, 0, 13, 103, 101, 116, 45, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 6, 4, 0, 8, 103, 101, 116, 45, 115, 101, 101, 100, 1, 6, 4, 1, 31, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 97, 108, 108, 101, 116, 47, 99, 111, 110, 102, 105, 103, 64, 48, 46, 49, 46, 48, 5, 2, 4, 1, 31, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 97, 108, 108, 101, 116, 47, 107, 101, 101, 112, 101, 114, 64, 48, 46, 49, 46, 48, 4, 0, 11, 12, 1, 0, 6, 107, 101, 101, 112, 101, 114, 3, 4, 0, 0, 190, 4, 12, 112, 97, 99, 107, 97, 103, 101, 45, 100, 111, 99, 115, 0, 123, 34, 105, 110, 116, 101, 114, 102, 97, 99, 101, 115, 34, 58, 123, 34, 116, 121, 112, 101, 115, 34, 58, 123, 34, 116, 121, 112, 101, 115, 34, 58, 123, 34, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 84, 104, 101, 32, 99, 111, 110, 102, 117, 114, 97, 116, 105, 111, 110, 32, 111, 102, 32, 116, 104, 101, 32, 115, 101, 101, 100, 32, 107, 101, 101, 112, 101, 114, 34, 44, 34, 105, 116, 101, 109, 115, 34, 58, 123, 34, 117, 115, 101, 114, 110, 97, 109, 101, 34, 58, 34, 84, 104, 101, 32, 117, 115, 101, 114, 110, 97, 109, 101, 32, 116, 111, 32, 117, 115, 101, 32, 102, 111, 114, 32, 116, 104, 101, 32, 115, 101, 101, 100, 32, 107, 101, 101, 112, 101, 114, 34, 44, 34, 112, 97, 115, 115, 119, 111, 114, 100, 34, 58, 34, 84, 104, 101, 32, 112, 97, 115, 115, 119, 111, 114, 100, 32, 116, 111, 32, 117, 115, 101, 32, 102, 111, 114, 32, 116, 104, 101, 32, 115, 101, 101, 100, 32, 107, 101, 101, 112, 101, 114, 34, 44, 34, 101, 110, 99, 114, 121, 112, 116, 101, 100, 34, 58, 34, 79, 112, 116, 105, 111, 110, 97, 108, 32, 112, 114, 101, 118, 111, 117, 115, 108, 121, 32, 103, 101, 110, 101, 114, 97, 116, 101, 100, 32, 101, 110, 99, 114, 121, 112, 116, 101, 100, 32, 115, 101, 101, 100, 32, 116, 111, 32, 117, 115, 101, 32, 102, 111, 114, 32, 116, 104, 101, 32, 115, 101, 101, 100, 32, 107, 101, 101, 112, 101, 114, 34, 125, 125, 125, 125, 44, 34, 99, 111, 110, 102, 105, 103, 34, 58, 123, 34, 102, 117, 110, 99, 115, 34, 58, 123, 34, 115, 101, 116, 45, 99, 111, 110, 102, 105, 103, 34, 58, 34, 76, 111, 97, 100, 32, 105, 110, 116, 111, 32, 116, 104, 101, 32, 99, 111, 109, 112, 111, 110, 101, 110, 116, 32, 102, 114, 111, 109, 32, 97, 110, 32, 101, 110, 99, 114, 121, 112, 116, 101, 100, 32, 115, 101, 101, 100, 44, 32, 112, 97, 115, 115, 119, 111, 114, 100, 44, 32, 97, 110, 100, 32, 115, 97, 108, 116, 32, 40, 117, 115, 101, 114, 110, 97, 109, 101, 41, 92, 110, 82, 101, 116, 117, 114, 110, 115, 32, 116, 104, 101, 32, 101, 110, 99, 114, 121, 112, 116, 101, 100, 32, 115, 101, 101, 100, 32, 111, 114, 32, 97, 110, 32, 101, 114, 114, 111, 114, 34, 44, 34, 103, 101, 116, 45, 101, 110, 99, 114, 121, 112, 116, 101, 100, 34, 58, 34, 82, 101, 116, 117, 114, 110, 115, 32, 116, 104, 101, 32, 101, 110, 99, 114, 121, 112, 116, 101, 100, 32, 115, 101, 101, 100, 32, 111, 114, 32, 78, 111, 110, 101, 32, 105, 102, 32, 105, 116, 32, 100, 111, 101, 115, 110, 39, 116, 32, 101, 120, 105, 115, 116, 34, 44, 34, 103, 101, 116, 45, 115, 101, 101, 100, 34, 58, 34, 71, 101, 116, 32, 116, 104, 101, 32, 112, 108, 97, 105, 110, 116, 101, 120, 116, 32, 115, 101, 101, 100, 34, 125, 125, 125, 125, 0, 70, 9, 112, 114, 111, 100, 117, 99, 101, 114, 115, 1, 12, 112, 114, 111, 99, 101, 115, 115, 101, 100, 45, 98, 121, 2, 13, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 6, 48, 46, 49, 56, 46, 50, 16, 119, 105, 116, 45, 98, 105, 110, 100, 103, 101, 110, 45, 114, 117, 115, 116, 6, 48, 46, 49, 54, 46, 48]; +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 417] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xa4\x02\x01A\x02\x01\ +A\x05\x01B\x04\x01p}\x01k\0\x01r\x03\x08username\0\x08password\0\x09encrypted\x01\ +\x04\0\x0bcredentials\x03\0\x02\x03\x01\x1eseed-keeper:wallet/types@0.1.0\x05\0\x02\ +\x03\0\0\x0bcredentials\x01B\x0a\x02\x03\x02\x01\x01\x04\0\x0bcredentials\x03\0\0\ +\x01j\0\x01s\x01@\x01\x06config\x01\0\x02\x04\0\x0aset-config\x01\x03\x01p}\x01j\ +\x01\x04\x01s\x01@\0\0\x05\x04\0\x0dget-encrypted\x01\x06\x04\0\x08get-seed\x01\x06\ +\x04\x01\x1fseed-keeper:wallet/config@0.1.0\x05\x02\x04\x01\x1fseed-keeper:walle\ +t/keeper@0.1.0\x04\0\x0b\x0c\x01\0\x06keeper\x03\0\0\0G\x09producers\x01\x0cproc\ +essed-by\x02\x0dwit-component\x070.201.0\x10wit-bindgen-rust\x060.21.0"; #[inline(never)] #[doc(hidden)] #[cfg(target_arch = "wasm32")] -pub fn __link_section() {} +pub fn __link_custom_section_describing_imports() { + wit_bindgen_rt::maybe_link_cabi_realloc(); +} diff --git a/crates/seed-keeper-wallet/src/lib.rs b/crates/seed-keeper-wallet/src/lib.rs index d1dd78b..f37917c 100644 --- a/crates/seed-keeper-wallet/src/lib.rs +++ b/crates/seed-keeper-wallet/src/lib.rs @@ -19,6 +19,8 @@ static CONFIG: LazyLock>> = LazyLock::new(|| Mutex::ne struct Component; +bindings::export!(Component with_types_in bindings); + /// Sets the Config of the Seed-Keeper (username, password, and optionally encrypted seed) impl ConfigGuest for Component { fn set_config(config: Credentials) -> Result<(), String> { diff --git a/crates/seed-keeper-wit-ui/Cargo.toml b/crates/seed-keeper-wit-ui/Cargo.toml index e7f395c..c27ef64 100644 --- a/crates/seed-keeper-wit-ui/Cargo.toml +++ b/crates/seed-keeper-wit-ui/Cargo.toml @@ -7,7 +7,8 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -wit-bindgen = { workspace = true } +bitflags = { workspace = true } +wit-bindgen-rt = { workspace = true } wurbo = "0.2.0" base64ct = { version = "1.6.0", features = ["alloc"] } seed-keeper-events = { path = "../seed-keeper-events" } @@ -26,4 +27,4 @@ package = "seed-keeper:wit-ui" [package.metadata.component.dependencies] [package.metadata.component.target.dependencies] -"seed-keeper:wallet" = { path = "../seed-keeper-wallet/wit" } +"seed-keeper:wallet" = { path = "wit/deps/wallet" } diff --git a/crates/seed-keeper-wit-ui/src/bindings.rs b/crates/seed-keeper-wit-ui/src/bindings.rs index 15de4d6..53decde 100644 --- a/crates/seed-keeper-wit-ui/src/bindings.rs +++ b/crates/seed-keeper-wit-ui/src/bindings.rs @@ -1,605 +1,710 @@ -// Generated by `wit-bindgen` 0.16.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Options used: pub mod seed_keeper { - pub mod wallet { - - #[allow(clippy::all)] - pub mod types { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - /// The confuration of the seed keeper - #[derive(Clone)] - pub struct Credentials { - /// The username to use for the seed keeper - pub username: wit_bindgen::rt::vec::Vec::, - /// The password to use for the seed keeper - pub password: wit_bindgen::rt::vec::Vec::, - /// Optional prevously generated encrypted seed to use for the seed keeper - pub encrypted: Option>, - } - impl ::core::fmt::Debug for Credentials { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Credentials").field("username", &self.username).field("password", &self.password).field("encrypted", &self.encrypted).finish() - } - } - - } - - - #[allow(clippy::all)] - pub mod config { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - pub type Credentials = super::super::super::seed_keeper::wallet::types::Credentials; - #[allow(unused_unsafe, clippy::all)] - /// Load into the component from an encrypted seed, password, and salt (username) - /// Returns the encrypted seed or an error - pub fn set_config(config: &Credentials,) -> Result<(),wit_bindgen::rt::string::String>{ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - - #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let super::super::super::seed_keeper::wallet::types::Credentials{ username:username0, password:password0, encrypted:encrypted0, } = config; - let vec1 = username0; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - let vec2 = password0; - let ptr2 = vec2.as_ptr() as i32; - let len2 = vec2.len() as i32; - let (result4_0,result4_1,result4_2,) = match encrypted0 { - Some(e) => { - let vec3 = e; - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; - - (1i32, ptr3, len3) - }, - None => { - (0i32, 0i32, 0i32) - }, - };let ptr5 = ret_area.as_mut_ptr() as i32; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "seed-keeper:wallet/config@0.1.0")] - extern "C" { - #[link_name = "set-config"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, ){ unreachable!() } - wit_import(ptr1, len1, ptr2, len2, result4_0, result4_1, result4_2, ptr5); - let l6 = i32::from(*((ptr5 + 0) as *const u8)); - match l6 { - 0 => { - let e = (); - Ok(e) + pub mod wallet { + #[allow(clippy::all)] + pub mod types { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + /// The confuration of the seed keeper + #[derive(Clone)] + pub struct Credentials { + /// The username to use for the seed keeper + pub username: _rt::Vec, + /// The password to use for the seed keeper + pub password: _rt::Vec, + /// Optional prevously generated encrypted seed to use for the seed keeper + pub encrypted: Option<_rt::Vec>, } - 1 => { - let e = { - let l7 = *((ptr5 + 4) as *const i32); - let l8 = *((ptr5 + 8) as *const i32); - let len9 = l8 as usize; - let bytes9 = Vec::from_raw_parts(l7 as *mut _, len9, len9); - - wit_bindgen::rt::string_lift(bytes9) - }; - Err(e) + impl ::core::fmt::Debug for Credentials { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Credentials") + .field("username", &self.username) + .field("password", &self.password) + .field("encrypted", &self.encrypted) + .finish() + } } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } } - } - #[allow(unused_unsafe, clippy::all)] - /// Returns the encrypted seed or None if it doesn't exist - pub fn get_encrypted() -> Result,wit_bindgen::rt::string::String>{ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - - #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "seed-keeper:wallet/config@0.1.0")] - extern "C" { - #[link_name = "get-encrypted"] - fn wit_import(_: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, ){ unreachable!() } - wit_import(ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); - match l1 { - 0 => { - let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; - - Vec::from_raw_parts(l2 as *mut _, len4, len4) - }; - Ok(e) - } - 1 => { - let e = { - let l5 = *((ptr0 + 4) as *const i32); - let l6 = *((ptr0 + 8) as *const i32); - let len7 = l6 as usize; - let bytes7 = Vec::from_raw_parts(l5 as *mut _, len7, len7); - - wit_bindgen::rt::string_lift(bytes7) - }; - Err(e) + + #[allow(clippy::all)] + pub mod config { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + pub type Credentials = super::super::super::seed_keeper::wallet::types::Credentials; + #[allow(unused_unsafe, clippy::all)] + /// Load into the component from an encrypted seed, password, and salt (username) + /// Returns the encrypted seed or an error + pub fn set_config(config: &Credentials) -> Result<(), _rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let super::super::super::seed_keeper::wallet::types::Credentials { + username: username0, + password: password0, + encrypted: encrypted0, + } = config; + let vec1 = username0; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + let vec2 = password0; + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + let (result4_0, result4_1, result4_2) = match encrypted0 { + Some(e) => { + let vec3 = e; + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + + (1i32, ptr3.cast_mut(), len3) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + let ptr5 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "seed-keeper:wallet/config@0.1.0")] + extern "C" { + #[link_name = "set-config"] + fn wit_import( + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import( + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { + unreachable!() + } + wit_import( + ptr1.cast_mut(), + len1, + ptr2.cast_mut(), + len2, + result4_0, + result4_1, + result4_2, + ptr5, + ); + let l6 = i32::from(*ptr5.add(0).cast::()); + match l6 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l7 = *ptr5.add(4).cast::<*mut u8>(); + let l8 = *ptr5.add(8).cast::(); + let len9 = l8; + let bytes9 = _rt::Vec::from_raw_parts(l7.cast(), len9, len9); + + _rt::string_lift(bytes9) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } - } - } - #[allow(unused_unsafe, clippy::all)] - /// Get the plaintext seed - pub fn get_seed() -> Result,wit_bindgen::rt::string::String>{ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - - #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "seed-keeper:wallet/config@0.1.0")] - extern "C" { - #[link_name = "get-seed"] - fn wit_import(_: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, ){ unreachable!() } - wit_import(ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); - match l1 { - 0 => { - let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; - - Vec::from_raw_parts(l2 as *mut _, len4, len4) - }; - Ok(e) + #[allow(unused_unsafe, clippy::all)] + /// Returns the encrypted seed or None if it doesn't exist + pub fn get_encrypted() -> Result<_rt::Vec, _rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "seed-keeper:wallet/config@0.1.0")] + extern "C" { + #[link_name = "get-encrypted"] + fn wit_import(_: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8) { + unreachable!() + } + wit_import(ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; + + _rt::Vec::from_raw_parts(l2.cast(), len4, len4) + }; + Ok(e) + } + 1 => { + let e = { + let l5 = *ptr0.add(4).cast::<*mut u8>(); + let l6 = *ptr0.add(8).cast::(); + let len7 = l6; + let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7); + + _rt::string_lift(bytes7) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } } - 1 => { - let e = { - let l5 = *((ptr0 + 4) as *const i32); - let l6 = *((ptr0 + 8) as *const i32); - let len7 = l6 as usize; - let bytes7 = Vec::from_raw_parts(l5 as *mut _, len7, len7); - - wit_bindgen::rt::string_lift(bytes7) - }; - Err(e) + #[allow(unused_unsafe, clippy::all)] + /// Get the plaintext seed + pub fn get_seed() -> Result<_rt::Vec, _rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "seed-keeper:wallet/config@0.1.0")] + extern "C" { + #[link_name = "get-seed"] + fn wit_import(_: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8) { + unreachable!() + } + wit_import(ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; + + _rt::Vec::from_raw_parts(l2.cast(), len4, len4) + }; + Ok(e) + } + 1 => { + let e = { + let l5 = *ptr0.add(4).cast::<*mut u8>(); + let l6 = *ptr0.add(8).cast::(); + let len7 = l6; + let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7); + + _rt::string_lift(bytes7) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } } - } - } - - } - pub mod wit_ui { - - #[allow(clippy::all)] - pub mod wurbo_types { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - pub type Encrypted = wit_bindgen::rt::string::String; - /// Details required in order to add an event listener to an element - #[derive(Clone)] - pub struct ListenDetails { - pub selector: wit_bindgen::rt::string::String, - pub ty: wit_bindgen::rt::string::String, - } - impl ::core::fmt::Debug for ListenDetails { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ListenDetails").field("selector", &self.selector).field("ty", &self.ty).finish() - } - } - /// Context for the minijinja rendering - #[derive(Clone)] - pub struct Page { - pub title: wit_bindgen::rt::string::String, - } - impl ::core::fmt::Debug for Page { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Page").field("title", &self.title).finish() - } - } - #[derive(Clone)] - pub struct Input { - pub placeholder: wit_bindgen::rt::string::String, - pub encrypted_seed: Option, - } - impl ::core::fmt::Debug for Input { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Input").field("placeholder", &self.placeholder).field("encrypted-seed", &self.encrypted_seed).finish() - } - } - /// Content for the entire page - #[derive(Clone)] - pub struct Content { - pub page: Option, - pub input: Option, - pub load: Option, - } - impl ::core::fmt::Debug for Content { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Content").field("page", &self.page).field("input", &self.input).field("load", &self.load).finish() - } - } - /// Context variants - #[derive(Clone)] - pub enum Context{ - AllContent(Content), - Username(wit_bindgen::rt::string::String), - Password(wit_bindgen::rt::string::String), - Encrypted(Encrypted), - Submit, - } - impl ::core::fmt::Debug for Context { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - match self { - Context::AllContent(e) => { - f.debug_tuple("Context::AllContent").field(e).finish() + pub mod wit_ui { + #[allow(clippy::all)] + pub mod wurbo_types { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + pub type Encrypted = _rt::String; + /// Details required in order to add an event listener to an element + #[derive(Clone)] + pub struct ListenDetails { + pub selector: _rt::String, + pub ty: _rt::String, } - Context::Username(e) => { - f.debug_tuple("Context::Username").field(e).finish() + impl ::core::fmt::Debug for ListenDetails { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("ListenDetails") + .field("selector", &self.selector) + .field("ty", &self.ty) + .finish() + } } - Context::Password(e) => { - f.debug_tuple("Context::Password").field(e).finish() + /// Context for the minijinja rendering + #[derive(Clone)] + pub struct Page { + pub title: _rt::String, } - Context::Encrypted(e) => { - f.debug_tuple("Context::Encrypted").field(e).finish() + impl ::core::fmt::Debug for Page { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Page").field("title", &self.title).finish() + } } - Context::Submit => { - f.debug_tuple("Context::Submit").finish() + #[derive(Clone)] + pub struct Input { + pub placeholder: _rt::String, + pub encrypted_seed: Option<_rt::String>, + } + impl ::core::fmt::Debug for Input { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Input") + .field("placeholder", &self.placeholder) + .field("encrypted-seed", &self.encrypted_seed) + .finish() + } + } + /// Content for the entire page + #[derive(Clone)] + pub struct Content { + pub page: Option, + pub input: Option, + pub load: Option<_rt::String>, + } + impl ::core::fmt::Debug for Content { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Content") + .field("page", &self.page) + .field("input", &self.input) + .field("load", &self.load) + .finish() + } + } + /// Context variants + #[derive(Clone)] + pub enum Context { + AllContent(Content), + Username(_rt::String), + Password(_rt::String), + Encrypted(Encrypted), + Submit, + } + impl ::core::fmt::Debug for Context { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Context::AllContent(e) => { + f.debug_tuple("Context::AllContent").field(e).finish() + } + Context::Username(e) => { + f.debug_tuple("Context::Username").field(e).finish() + } + Context::Password(e) => { + f.debug_tuple("Context::Password").field(e).finish() + } + Context::Encrypted(e) => { + f.debug_tuple("Context::Encrypted").field(e).finish() + } + Context::Submit => f.debug_tuple("Context::Submit").finish(), + } + } } - } - } - } - - } - - - #[allow(clippy::all)] - pub mod wurbo_in { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - pub type ListenDetails = super::super::super::seed_keeper::wit_ui::wurbo_types::ListenDetails; - #[allow(unused_unsafe, clippy::all)] - /// Add an event listener to the given element - pub fn addeventlistener(details: &ListenDetails,){ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - let super::super::super::seed_keeper::wit_ui::wurbo_types::ListenDetails{ selector:selector0, ty:ty0, } = details; - let vec1 = selector0; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - let vec2 = ty0; - let ptr2 = vec2.as_ptr() as i32; - let len2 = vec2.len() as i32; - - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "seed-keeper:wit-ui/wurbo-in@0.1.0")] - extern "C" { - #[link_name = "addeventlistener"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, ){ unreachable!() } - wit_import(ptr1, len1, ptr2, len2); } - } - #[allow(unused_unsafe, clippy::all)] - /// Emit events from this component. Messages should be serialized JSON strings of Event type. - pub fn emit(message: &str,){ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - let vec0 = message; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "seed-keeper:wit-ui/wurbo-in@0.1.0")] - extern "C" { - #[link_name = "emit"] - fn wit_import(_: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, ){ unreachable!() } - wit_import(ptr0, len0); + + #[allow(clippy::all)] + pub mod wurbo_in { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + pub type ListenDetails = + super::super::super::seed_keeper::wit_ui::wurbo_types::ListenDetails; + #[allow(unused_unsafe, clippy::all)] + /// Add an event listener to the given element + pub fn addeventlistener(details: &ListenDetails) { + unsafe { + let super::super::super::seed_keeper::wit_ui::wurbo_types::ListenDetails { + selector: selector0, + ty: ty0, + } = details; + let vec1 = selector0; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + let vec2 = ty0; + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "seed-keeper:wit-ui/wurbo-in@0.1.0")] + extern "C" { + #[link_name = "addeventlistener"] + fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize) { + unreachable!() + } + wit_import(ptr1.cast_mut(), len1, ptr2.cast_mut(), len2); + } + } + #[allow(unused_unsafe, clippy::all)] + /// Emit events from this component. Messages should be serialized JSON strings of Event type. + pub fn emit(message: &str) { + unsafe { + let vec0 = message; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "seed-keeper:wit-ui/wurbo-in@0.1.0")] + extern "C" { + #[link_name = "emit"] + fn wit_import(_: *mut u8, _: usize); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8, _: usize) { + unreachable!() + } + wit_import(ptr0.cast_mut(), len0); + } + } } - } - } - - } } pub mod exports { - pub mod seed_keeper { - pub mod wit_ui { - - #[allow(clippy::all)] - pub mod wurbo_out { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_section; - pub type Context = super::super::super::super::seed_keeper::wit_ui::wurbo_types::Context; - const _: () = { - - #[doc(hidden)] - #[export_name = "seed-keeper:wit-ui/wurbo-out@0.1.0#render"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_render(arg0: i32,arg1: i32,arg2: i32,arg3: i32,arg4: i32,arg5: i32,arg6: i32,arg7: i32,arg8: i32,arg9: i32,arg10: i32,arg11: i32,arg12: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - use super::super::super::super::seed_keeper::wit_ui::wurbo_types::Context as V7; - let v7 = match arg0 { - 0 => { - let e7 = super::super::super::super::seed_keeper::wit_ui::wurbo_types::Content{ - page: match arg1 { - 0 => None, - 1 => { - let e = { - let len0 = arg3 as usize; - let bytes0 = Vec::from_raw_parts(arg2 as *mut _, len0, len0); - - super::super::super::super::seed_keeper::wit_ui::wurbo_types::Page{ - title: wit_bindgen::rt::string_lift(bytes0), - } - }; - Some(e) + pub mod seed_keeper { + pub mod wit_ui { + #[allow(clippy::all)] + pub mod wurbo_out { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type Context = + super::super::super::super::seed_keeper::wit_ui::wurbo_types::Context; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_render_cabi( + arg0: i32, + arg1: *mut u8, + arg2: *mut u8, + arg3: usize, + arg4: i32, + arg5: *mut u8, + arg6: usize, + arg7: i32, + arg8: *mut u8, + arg9: usize, + arg10: i32, + arg11: *mut u8, + arg12: usize, + ) -> *mut u8 { + use super::super::super::super::seed_keeper::wit_ui::wurbo_types::Context as V7; + let v7 = match arg0 { + 0 => { + let e7 = super::super::super::super::seed_keeper::wit_ui::wurbo_types::Content{ + page: match arg1 as i32 { + 0 => None, + 1 => { + let e = { + let len0 = arg3; + let bytes0 = _rt::Vec::from_raw_parts(arg2.cast(), len0, len0); + + super::super::super::super::seed_keeper::wit_ui::wurbo_types::Page{ + title: _rt::string_lift(bytes0), } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - input: match arg4 { - 0 => None, - 1 => { - let e = { - let len1 = arg6 as usize; - let bytes1 = Vec::from_raw_parts(arg5 as *mut _, len1, len1); - - super::super::super::super::seed_keeper::wit_ui::wurbo_types::Input{ - placeholder: wit_bindgen::rt::string_lift(bytes1), - encrypted_seed: match arg7 { - 0 => None, - 1 => { - let e = { - let len2 = arg9 as usize; - let bytes2 = Vec::from_raw_parts(arg8 as *mut _, len2, len2); - - wit_bindgen::rt::string_lift(bytes2) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + input: match arg4 { + 0 => None, + 1 => { + let e = { + let len1 = arg6; + let bytes1 = _rt::Vec::from_raw_parts(arg5.cast(), len1, len1); + + super::super::super::super::seed_keeper::wit_ui::wurbo_types::Input{ + placeholder: _rt::string_lift(bytes1), + encrypted_seed: match arg7 { + 0 => None, + 1 => { + let e = { + let len2 = arg9; + let bytes2 = _rt::Vec::from_raw_parts(arg8.cast(), len2, len2); + + _rt::string_lift(bytes2) + }; + Some(e) } - }; - Some(e) + _ => _rt::invalid_enum_discriminant(), + }, } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - load: match arg10 { - 0 => None, - 1 => { - let e = { - let len3 = arg12 as usize; - let bytes3 = Vec::from_raw_parts(arg11 as *mut _, len3, len3); - - wit_bindgen::rt::string_lift(bytes3) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - }; - V7::AllContent(e7) - } - 1 => { - let e7 = { - let len4 = arg2 as usize; - let bytes4 = Vec::from_raw_parts(arg1 as *mut _, len4, len4); - - wit_bindgen::rt::string_lift(bytes4) - }; - V7::Username(e7) - } - 2 => { - let e7 = { - let len5 = arg2 as usize; - let bytes5 = Vec::from_raw_parts(arg1 as *mut _, len5, len5); - - wit_bindgen::rt::string_lift(bytes5) - }; - V7::Password(e7) - } - 3 => { - let e7 = { - let len6 = arg2 as usize; - let bytes6 = Vec::from_raw_parts(arg1 as *mut _, len6, len6); - - wit_bindgen::rt::string_lift(bytes6) - }; - V7::Encrypted(e7) - } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - V7::Submit - } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + load: match arg10 { + 0 => None, + 1 => { + let e = { + let len3 = arg12; + let bytes3 = _rt::Vec::from_raw_parts(arg11.cast(), len3, len3); + + _rt::string_lift(bytes3) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, }; - let result8 = <_GuestImpl as Guest>::render(v7); - let ptr9 = _RET_AREA.0.as_mut_ptr() as i32; - match result8 { - Ok(e) => { { - *((ptr9 + 0) as *mut u8) = (0i32) as u8; - let vec10 = (e.into_bytes()).into_boxed_slice(); - let ptr10 = vec10.as_ptr() as i32; - let len10 = vec10.len() as i32; - ::core::mem::forget(vec10); - *((ptr9 + 8) as *mut i32) = len10; - *((ptr9 + 4) as *mut i32) = ptr10; - } }, - Err(e) => { { - *((ptr9 + 0) as *mut u8) = (1i32) as u8; - let vec11 = (e.into_bytes()).into_boxed_slice(); - let ptr11 = vec11.as_ptr() as i32; - let len11 = vec11.len() as i32; - ::core::mem::forget(vec11); - *((ptr9 + 8) as *mut i32) = len11; - *((ptr9 + 4) as *mut i32) = ptr11; - } }, - };ptr9 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_seed-keeper:wit-ui/wurbo-out@0.1.0#render"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_render(arg0: i32,) { - let l0 = i32::from(*((arg0 + 0) as *const u8)); - match l0 { - 0 => { - let l1 = *((arg0 + 4) as *const i32); - let l2 = *((arg0 + 8) as *const i32); - wit_bindgen::rt::dealloc(l1, (l2) as usize, 1); - }, - _ => { - let l3 = *((arg0 + 4) as *const i32); - let l4 = *((arg0 + 8) as *const i32); - wit_bindgen::rt::dealloc(l3, (l4) as usize, 1); - }, - } - } - }; - }; - const _: () = { - - #[doc(hidden)] - #[export_name = "seed-keeper:wit-ui/wurbo-out@0.1.0#activate"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_activate(arg0: i32,arg1: i32,arg2: i32,) { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - <_GuestImpl as Guest>::activate(match arg0 { - 0 => None, - 1 => { - let e = { - let base3 = arg1; - let len3 = arg2; - let mut result3 = Vec::with_capacity(len3 as usize); - for i in 0..len3 { - let base = base3 + i * 8; - let e3 = { - let l0 = *((base + 0) as *const i32); - let l1 = *((base + 4) as *const i32); - let len2 = l1 as usize; - let bytes2 = Vec::from_raw_parts(l0 as *mut _, len2, len2); - - wit_bindgen::rt::string_lift(bytes2) + V7::AllContent(e7) + } + 1 => { + let e7 = { + let len4 = arg2 as usize; + let bytes4 = _rt::Vec::from_raw_parts(arg1.cast(), len4, len4); + + _rt::string_lift(bytes4) + }; + V7::Username(e7) + } + 2 => { + let e7 = { + let len5 = arg2 as usize; + let bytes5 = _rt::Vec::from_raw_parts(arg1.cast(), len5, len5); + + _rt::string_lift(bytes5) + }; + V7::Password(e7) + } + 3 => { + let e7 = { + let len6 = arg2 as usize; + let bytes6 = _rt::Vec::from_raw_parts(arg1.cast(), len6, len6); + + _rt::string_lift(bytes6) + }; + V7::Encrypted(e7) + } + n => { + debug_assert_eq!(n, 4, "invalid enum discriminant"); + V7::Submit + } + }; + let result8 = T::render(v7); + let ptr9 = _RET_AREA.0.as_mut_ptr().cast::(); + match result8 { + Ok(e) => { + *ptr9.add(0).cast::() = (0i32) as u8; + let vec10 = (e.into_bytes()).into_boxed_slice(); + let ptr10 = vec10.as_ptr().cast::(); + let len10 = vec10.len(); + ::core::mem::forget(vec10); + *ptr9.add(8).cast::() = len10; + *ptr9.add(4).cast::<*mut u8>() = ptr10.cast_mut(); + } + Err(e) => { + *ptr9.add(0).cast::() = (1i32) as u8; + let vec11 = (e.into_bytes()).into_boxed_slice(); + let ptr11 = vec11.as_ptr().cast::(); + let len11 = vec11.len(); + ::core::mem::forget(vec11); + *ptr9.add(8).cast::() = len11; + *ptr9.add(4).cast::<*mut u8>() = ptr11.cast_mut(); + } }; - result3.push(e3); - } - wit_bindgen::rt::dealloc(base3, (len3 as usize) * 8, 4); - - result3 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }); - } - }; - use super::super::super::super::super::Component as _GuestImpl; - pub trait Guest { - /// renders the initial Web component with the given data - /// and the target template to use as top level entry point - fn render(ctx: Context,) -> Result; - /// listen on all or given selectors - fn activate(selectors: Option>,); + ptr9 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_render(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l1, l2, 1); + } + _ => { + let l3 = *arg0.add(4).cast::<*mut u8>(); + let l4 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l3, l4, 1); + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_activate_cabi( + arg0: i32, + arg1: *mut u8, + arg2: usize, + ) { + T::activate(match arg0 { + 0 => None, + 1 => { + let e = { + let base3 = arg1; + let len3 = arg2; + let mut result3 = _rt::Vec::with_capacity(len3); + for i in 0..len3 { + let base = base3.add(i * 8); + let e3 = { + let l0 = *base.add(0).cast::<*mut u8>(); + let l1 = *base.add(4).cast::(); + let len2 = l1; + let bytes2 = + _rt::Vec::from_raw_parts(l0.cast(), len2, len2); + + _rt::string_lift(bytes2) + }; + result3.push(e3); + } + _rt::cabi_dealloc(base3, len3 * 8, 4); + + result3 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }); + } + pub trait Guest { + /// renders the initial Web component with the given data + /// and the target template to use as top level entry point + fn render(ctx: Context) -> Result<_rt::String, _rt::String>; + /// listen on all or given selectors + fn activate(selectors: Option<_rt::Vec<_rt::String>>); + } + #[doc(hidden)] + + macro_rules! __export_seed_keeper_wit_ui_wurbo_out_0_1_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "seed-keeper:wit-ui/wurbo-out@0.1.0#render"] + unsafe extern "C" fn export_render(arg0: i32,arg1: *mut u8,arg2: *mut u8,arg3: usize,arg4: i32,arg5: *mut u8,arg6: usize,arg7: i32,arg8: *mut u8,arg9: usize,arg10: i32,arg11: *mut u8,arg12: usize,) -> *mut u8 { + $($path_to_types)*::_export_render_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12) + } + #[export_name = "cabi_post_seed-keeper:wit-ui/wurbo-out@0.1.0#render"] + unsafe extern "C" fn _post_return_render(arg0: *mut u8,) { + $($path_to_types)*::__post_return_render::<$ty>(arg0) + } + #[export_name = "seed-keeper:wit-ui/wurbo-out@0.1.0#activate"] + unsafe extern "C" fn export_activate(arg0: i32,arg1: *mut u8,arg2: usize,) { + $($path_to_types)*::_export_activate_cabi::<$ty>(arg0, arg1, arg2) + } + };); + } + #[doc(hidden)] + pub(crate) use __export_seed_keeper_wit_ui_wurbo_out_0_1_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 12]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 12]); + } } - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - #[repr(align(4))] - struct _RetArea([u8; 12]); - static mut _RET_AREA: _RetArea = _RetArea([0; 12]); - - } - } - } } +mod _rt { + pub use alloc_crate::string::String; + pub use alloc_crate::vec::Vec; + pub unsafe fn string_lift(bytes: Vec) -> String { + if cfg!(debug_assertions) { + String::from_utf8(bytes).unwrap() + } else { + String::from_utf8_unchecked(bytes) + } + } + pub unsafe fn invalid_enum_discriminant() -> T { + if cfg!(debug_assertions) { + panic!("invalid enum discriminant") + } else { + core::hint::unreachable_unchecked() + } + } + pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) { + if size == 0 { + return; + } + let layout = alloc::Layout::from_size_align_unchecked(size, align); + alloc::dealloc(ptr as *mut u8, layout); + } + extern crate alloc as alloc_crate; + pub use alloc_crate::alloc; +} + +/// Generates `#[no_mangle]` functions to export the specified type as the +/// root implementation of all generated traits. +/// +/// For more information see the documentation of `wit_bindgen::generate!`. +/// +/// ```rust +/// # macro_rules! export{ ($($t:tt)*) => (); } +/// # trait Guest {} +/// struct MyType; +/// +/// impl Guest for MyType { +/// // ... +/// } +/// +/// export!(MyType); +/// ``` +#[allow(unused_macros)] +#[doc(hidden)] + +macro_rules! __export_seedworld_impl { + ($ty:ident) => (self::export!($ty with_types_in self);); + ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( + $($path_to_types_root)*::exports::seed_keeper::wit_ui::wurbo_out::__export_seed_keeper_wit_ui_wurbo_out_0_1_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::seed_keeper::wit_ui::wurbo_out); + ) +} +#[doc(inline)] +pub(crate) use __export_seedworld_impl as export; #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:seedworld"] +#[link_section = "component-type:wit-bindgen:0.21.0:seedworld:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 2911] = [3, 0, 9, 115, 101, 101, 100, 119, 111, 114, 108, 100, 0, 97, 115, 109, 13, 0, 1, 0, 7, 157, 2, 1, 65, 2, 1, 66, 15, 1, 115, 4, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 3, 0, 0, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 2, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 4, 1, 107, 115, 1, 114, 2, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 14, 101, 110, 99, 114, 121, 112, 116, 101, 100, 45, 115, 101, 101, 100, 6, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 7, 1, 107, 5, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 9, 5, 105, 110, 112, 117, 116, 10, 4, 108, 111, 97, 100, 6, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 11, 1, 113, 5, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 12, 0, 8, 117, 115, 101, 114, 110, 97, 109, 101, 1, 115, 0, 8, 112, 97, 115, 115, 119, 111, 114, 100, 1, 115, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 1, 0, 6, 115, 117, 98, 109, 105, 116, 0, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 13, 4, 1, 36, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 11, 17, 1, 0, 11, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 3, 0, 0, 7, 172, 3, 1, 65, 5, 1, 66, 15, 1, 115, 4, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 3, 0, 0, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 2, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 4, 1, 107, 115, 1, 114, 2, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 14, 101, 110, 99, 114, 121, 112, 116, 101, 100, 45, 115, 101, 101, 100, 6, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 7, 1, 107, 5, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 9, 5, 105, 110, 112, 117, 116, 10, 4, 108, 111, 97, 100, 6, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 11, 1, 113, 5, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 12, 0, 8, 117, 115, 101, 114, 110, 97, 109, 101, 1, 115, 0, 8, 112, 97, 115, 115, 119, 111, 114, 100, 1, 115, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 1, 0, 6, 115, 117, 98, 109, 105, 116, 0, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 13, 3, 1, 36, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 2, 3, 0, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 1, 66, 6, 2, 3, 2, 1, 1, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 64, 1, 7, 100, 101, 116, 97, 105, 108, 115, 1, 1, 0, 4, 0, 16, 97, 100, 100, 101, 118, 101, 110, 116, 108, 105, 115, 116, 101, 110, 101, 114, 1, 2, 1, 64, 1, 7, 109, 101, 115, 115, 97, 103, 101, 115, 1, 0, 4, 0, 4, 101, 109, 105, 116, 1, 3, 4, 1, 33, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 105, 110, 64, 48, 46, 49, 46, 48, 5, 2, 11, 14, 1, 0, 8, 119, 117, 114, 98, 111, 45, 105, 110, 3, 2, 0, 7, 163, 3, 1, 65, 5, 1, 66, 15, 1, 115, 4, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 3, 0, 0, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 2, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 4, 1, 107, 115, 1, 114, 2, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 14, 101, 110, 99, 114, 121, 112, 116, 101, 100, 45, 115, 101, 101, 100, 6, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 7, 1, 107, 5, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 9, 5, 105, 110, 112, 117, 116, 10, 4, 108, 111, 97, 100, 6, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 11, 1, 113, 5, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 12, 0, 8, 117, 115, 101, 114, 110, 97, 109, 101, 1, 115, 0, 8, 112, 97, 115, 115, 119, 111, 114, 100, 1, 115, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 1, 0, 6, 115, 117, 98, 109, 105, 116, 0, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 13, 3, 1, 36, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 2, 3, 0, 0, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 9, 2, 3, 2, 1, 1, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 1, 106, 1, 115, 1, 115, 1, 64, 1, 3, 99, 116, 120, 1, 0, 2, 4, 0, 6, 114, 101, 110, 100, 101, 114, 1, 3, 1, 112, 115, 1, 107, 4, 1, 64, 1, 9, 115, 101, 108, 101, 99, 116, 111, 114, 115, 5, 1, 0, 4, 0, 8, 97, 99, 116, 105, 118, 97, 116, 101, 1, 6, 4, 1, 34, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 2, 11, 15, 1, 0, 9, 119, 117, 114, 98, 111, 45, 111, 117, 116, 3, 4, 0, 7, 214, 6, 1, 65, 2, 1, 65, 13, 1, 66, 4, 1, 112, 125, 1, 107, 0, 1, 114, 3, 8, 117, 115, 101, 114, 110, 97, 109, 101, 0, 8, 112, 97, 115, 115, 119, 111, 114, 100, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 4, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 3, 0, 2, 3, 1, 30, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 97, 108, 108, 101, 116, 47, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 2, 3, 0, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 1, 66, 10, 2, 3, 2, 1, 1, 4, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 3, 0, 0, 1, 106, 0, 1, 115, 1, 64, 1, 6, 99, 111, 110, 102, 105, 103, 1, 0, 2, 4, 0, 10, 115, 101, 116, 45, 99, 111, 110, 102, 105, 103, 1, 3, 1, 112, 125, 1, 106, 1, 4, 1, 115, 1, 64, 0, 0, 5, 4, 0, 13, 103, 101, 116, 45, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 6, 4, 0, 8, 103, 101, 116, 45, 115, 101, 101, 100, 1, 6, 3, 1, 31, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 97, 108, 108, 101, 116, 47, 99, 111, 110, 102, 105, 103, 64, 48, 46, 49, 46, 48, 5, 2, 1, 66, 15, 1, 115, 4, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 3, 0, 0, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 2, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 4, 1, 107, 115, 1, 114, 2, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 14, 101, 110, 99, 114, 121, 112, 116, 101, 100, 45, 115, 101, 101, 100, 6, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 7, 1, 107, 5, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 9, 5, 105, 110, 112, 117, 116, 10, 4, 108, 111, 97, 100, 6, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 11, 1, 113, 5, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 12, 0, 8, 117, 115, 101, 114, 110, 97, 109, 101, 1, 115, 0, 8, 112, 97, 115, 115, 119, 111, 114, 100, 1, 115, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 1, 0, 6, 115, 117, 98, 109, 105, 116, 0, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 13, 3, 1, 36, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 3, 2, 3, 0, 2, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 1, 66, 6, 2, 3, 2, 1, 4, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 64, 1, 7, 100, 101, 116, 97, 105, 108, 115, 1, 1, 0, 4, 0, 16, 97, 100, 100, 101, 118, 101, 110, 116, 108, 105, 115, 116, 101, 110, 101, 114, 1, 2, 1, 64, 1, 7, 109, 101, 115, 115, 97, 103, 101, 115, 1, 0, 4, 0, 4, 101, 109, 105, 116, 1, 3, 3, 1, 33, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 105, 110, 64, 48, 46, 49, 46, 48, 5, 5, 2, 3, 0, 2, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 9, 2, 3, 2, 1, 6, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 1, 106, 1, 115, 1, 115, 1, 64, 1, 3, 99, 116, 120, 1, 0, 2, 4, 0, 6, 114, 101, 110, 100, 101, 114, 1, 3, 1, 112, 115, 1, 107, 4, 1, 64, 1, 9, 115, 101, 108, 101, 99, 116, 111, 114, 115, 5, 1, 0, 4, 0, 8, 97, 99, 116, 105, 118, 97, 116, 101, 1, 6, 4, 1, 34, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 7, 4, 1, 34, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 115, 101, 101, 100, 119, 111, 114, 108, 100, 64, 48, 46, 49, 46, 48, 4, 0, 11, 15, 1, 0, 9, 115, 101, 101, 100, 119, 111, 114, 108, 100, 3, 6, 0, 0, 237, 5, 12, 112, 97, 99, 107, 97, 103, 101, 45, 100, 111, 99, 115, 0, 123, 34, 119, 111, 114, 108, 100, 115, 34, 58, 123, 34, 115, 101, 101, 100, 119, 111, 114, 108, 100, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 65, 110, 32, 101, 120, 97, 109, 112, 108, 101, 32, 119, 111, 114, 108, 100, 32, 102, 111, 114, 32, 116, 104, 101, 32, 99, 111, 109, 112, 111, 110, 101, 110, 116, 32, 116, 111, 32, 116, 97, 114, 103, 101, 116, 46, 34, 125, 125, 44, 34, 105, 110, 116, 101, 114, 102, 97, 99, 101, 115, 34, 58, 123, 34, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 34, 58, 123, 34, 116, 121, 112, 101, 115, 34, 58, 123, 34, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 68, 101, 116, 97, 105, 108, 115, 32, 114, 101, 113, 117, 105, 114, 101, 100, 32, 105, 110, 32, 111, 114, 100, 101, 114, 32, 116, 111, 32, 97, 100, 100, 32, 97, 110, 32, 101, 118, 101, 110, 116, 32, 108, 105, 115, 116, 101, 110, 101, 114, 32, 116, 111, 32, 97, 110, 32, 101, 108, 101, 109, 101, 110, 116, 34, 125, 44, 34, 112, 97, 103, 101, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 67, 111, 110, 116, 101, 120, 116, 32, 102, 111, 114, 32, 116, 104, 101, 32, 109, 105, 110, 105, 106, 105, 110, 106, 97, 32, 114, 101, 110, 100, 101, 114, 105, 110, 103, 34, 125, 44, 34, 99, 111, 110, 116, 101, 110, 116, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 67, 111, 110, 116, 101, 110, 116, 32, 102, 111, 114, 32, 116, 104, 101, 32, 101, 110, 116, 105, 114, 101, 32, 112, 97, 103, 101, 34, 125, 44, 34, 99, 111, 110, 116, 101, 120, 116, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 67, 111, 110, 116, 101, 120, 116, 32, 118, 97, 114, 105, 97, 110, 116, 115, 34, 125, 125, 125, 44, 34, 119, 117, 114, 98, 111, 45, 105, 110, 34, 58, 123, 34, 102, 117, 110, 99, 115, 34, 58, 123, 34, 97, 100, 100, 101, 118, 101, 110, 116, 108, 105, 115, 116, 101, 110, 101, 114, 34, 58, 34, 65, 100, 100, 32, 97, 110, 32, 101, 118, 101, 110, 116, 32, 108, 105, 115, 116, 101, 110, 101, 114, 32, 116, 111, 32, 116, 104, 101, 32, 103, 105, 118, 101, 110, 32, 101, 108, 101, 109, 101, 110, 116, 34, 44, 34, 101, 109, 105, 116, 34, 58, 34, 69, 109, 105, 116, 32, 101, 118, 101, 110, 116, 115, 32, 102, 114, 111, 109, 32, 116, 104, 105, 115, 32, 99, 111, 109, 112, 111, 110, 101, 110, 116, 46, 32, 77, 101, 115, 115, 97, 103, 101, 115, 32, 115, 104, 111, 117, 108, 100, 32, 98, 101, 32, 115, 101, 114, 105, 97, 108, 105, 122, 101, 100, 32, 74, 83, 79, 78, 32, 115, 116, 114, 105, 110, 103, 115, 32, 111, 102, 32, 69, 118, 101, 110, 116, 32, 116, 121, 112, 101, 46, 34, 125, 125, 44, 34, 119, 117, 114, 98, 111, 45, 111, 117, 116, 34, 58, 123, 34, 102, 117, 110, 99, 115, 34, 58, 123, 34, 114, 101, 110, 100, 101, 114, 34, 58, 34, 114, 101, 110, 100, 101, 114, 115, 32, 116, 104, 101, 32, 105, 110, 105, 116, 105, 97, 108, 32, 87, 101, 98, 32, 99, 111, 109, 112, 111, 110, 101, 110, 116, 32, 119, 105, 116, 104, 32, 116, 104, 101, 32, 103, 105, 118, 101, 110, 32, 100, 97, 116, 97, 92, 110, 97, 110, 100, 32, 116, 104, 101, 32, 116, 97, 114, 103, 101, 116, 32, 116, 101, 109, 112, 108, 97, 116, 101, 32, 116, 111, 32, 117, 115, 101, 32, 97, 115, 32, 116, 111, 112, 32, 108, 101, 118, 101, 108, 32, 101, 110, 116, 114, 121, 32, 112, 111, 105, 110, 116, 34, 44, 34, 97, 99, 116, 105, 118, 97, 116, 101, 34, 58, 34, 108, 105, 115, 116, 101, 110, 32, 111, 110, 32, 97, 108, 108, 32, 111, 114, 32, 103, 105, 118, 101, 110, 32, 115, 101, 108, 101, 99, 116, 111, 114, 115, 34, 125, 125, 125, 125, 0, 70, 9, 112, 114, 111, 100, 117, 99, 101, 114, 115, 1, 12, 112, 114, 111, 99, 101, 115, 115, 101, 100, 45, 98, 121, 2, 13, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 6, 48, 46, 49, 56, 46, 50, 16, 119, 105, 116, 45, 98, 105, 110, 100, 103, 101, 110, 45, 114, 117, 115, 116, 6, 48, 46, 49, 54, 46, 48]; +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 982] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xd6\x06\x01A\x02\x01\ +A\x0d\x01B\x04\x01p}\x01k\0\x01r\x03\x08username\0\x08password\0\x09encrypted\x01\ +\x04\0\x0bcredentials\x03\0\x02\x03\x01\x1eseed-keeper:wallet/types@0.1.0\x05\0\x02\ +\x03\0\0\x0bcredentials\x01B\x0a\x02\x03\x02\x01\x01\x04\0\x0bcredentials\x03\0\0\ +\x01j\0\x01s\x01@\x01\x06config\x01\0\x02\x04\0\x0aset-config\x01\x03\x01p}\x01j\ +\x01\x04\x01s\x01@\0\0\x05\x04\0\x0dget-encrypted\x01\x06\x04\0\x08get-seed\x01\x06\ +\x03\x01\x1fseed-keeper:wallet/config@0.1.0\x05\x02\x01B\x0f\x01s\x04\0\x09encry\ +pted\x03\0\0\x01r\x02\x08selectors\x02tys\x04\0\x0elisten-details\x03\0\x02\x01r\ +\x01\x05titles\x04\0\x04page\x03\0\x04\x01ks\x01r\x02\x0bplaceholders\x0eencrypt\ +ed-seed\x06\x04\0\x05input\x03\0\x07\x01k\x05\x01k\x08\x01r\x03\x04page\x09\x05i\ +nput\x0a\x04load\x06\x04\0\x07content\x03\0\x0b\x01q\x05\x0ball-content\x01\x0c\0\ +\x08username\x01s\0\x08password\x01s\0\x09encrypted\x01\x01\0\x06submit\0\0\x04\0\ +\x07context\x03\0\x0d\x03\x01$seed-keeper:wit-ui/wurbo-types@0.1.0\x05\x03\x02\x03\ +\0\x02\x0elisten-details\x01B\x06\x02\x03\x02\x01\x04\x04\0\x0elisten-details\x03\ +\0\0\x01@\x01\x07details\x01\x01\0\x04\0\x10addeventlistener\x01\x02\x01@\x01\x07\ +messages\x01\0\x04\0\x04emit\x01\x03\x03\x01!seed-keeper:wit-ui/wurbo-in@0.1.0\x05\ +\x05\x02\x03\0\x02\x07context\x01B\x09\x02\x03\x02\x01\x06\x04\0\x07context\x03\0\ +\0\x01j\x01s\x01s\x01@\x01\x03ctx\x01\0\x02\x04\0\x06render\x01\x03\x01ps\x01k\x04\ +\x01@\x01\x09selectors\x05\x01\0\x04\0\x08activate\x01\x06\x04\x01\"seed-keeper:\ +wit-ui/wurbo-out@0.1.0\x05\x07\x04\x01\"seed-keeper:wit-ui/seedworld@0.1.0\x04\0\ +\x0b\x0f\x01\0\x09seedworld\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dw\ +it-component\x070.201.0\x10wit-bindgen-rust\x060.21.0"; #[inline(never)] #[doc(hidden)] #[cfg(target_arch = "wasm32")] -pub fn __link_section() {} +pub fn __link_custom_section_describing_imports() { + wit_bindgen_rt::maybe_link_cabi_realloc(); +} diff --git a/crates/seed-keeper-wit-ui/src/lib.rs b/crates/seed-keeper-wit-ui/src/lib.rs index a1b451b..92ae8ce 100644 --- a/crates/seed-keeper-wit-ui/src/lib.rs +++ b/crates/seed-keeper-wit-ui/src/lib.rs @@ -30,6 +30,8 @@ const OUTPUT_HTML: &str = "output.html"; struct Component; +bindings::export!(Component with_types_in bindings); + /// We need to provide the templates for the macro to pull in fn get_templates() -> Templates { Templates::new( diff --git a/crates/seed-keeper-wit-ui/wit/deps/wallet/world.wit b/crates/seed-keeper-wit-ui/wit/deps/wallet/world.wit new file mode 120000 index 0000000..926ee36 --- /dev/null +++ b/crates/seed-keeper-wit-ui/wit/deps/wallet/world.wit @@ -0,0 +1 @@ +../../../../seed-keeper-wallet/wit/world.wit \ No newline at end of file diff --git a/examples/crates/aggregate-wit-ui/Cargo.toml b/examples/crates/aggregate-wit-ui/Cargo.toml index b9891fa..d4b6aac 100644 --- a/examples/crates/aggregate-wit-ui/Cargo.toml +++ b/examples/crates/aggregate-wit-ui/Cargo.toml @@ -6,9 +6,10 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wit-bindgen = { workspace = true } +bitflags = { workspace = true } +wit-bindgen-rt = { workspace = true } wurbo = { workspace = true } -minijinja = { version = "1.0.10" } +minijinja = { version = "1.0.12", features = ["json", "loader"] } [dev-dependencies] wasmtime = { version = "17", features = ['component-model'] } diff --git a/examples/crates/aggregate-wit-ui/src/bindings.rs b/examples/crates/aggregate-wit-ui/src/bindings.rs index 6d2fb26..243e5d7 100644 --- a/examples/crates/aggregate-wit-ui/src/bindings.rs +++ b/examples/crates/aggregate-wit-ui/src/bindings.rs @@ -1,1476 +1,1787 @@ -// Generated by `wit-bindgen` 0.16.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Options used: pub mod example { - pub mod edwards_ui { - - #[allow(clippy::all)] - pub mod wurbo_types { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - /// Details required in order to add an event listener to an element - #[derive(Clone)] - pub struct ListenDetails { - pub selector: wit_bindgen::rt::string::String, - pub ty: wit_bindgen::rt::string::String, - } - impl ::core::fmt::Debug for ListenDetails { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ListenDetails").field("selector", &self.selector).field("ty", &self.ty).finish() - } - } - /// Context for the minijinja rendering - #[derive(Clone)] - pub struct Page { - pub title: wit_bindgen::rt::string::String, - } - impl ::core::fmt::Debug for Page { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Page").field("title", &self.title).finish() - } - } - #[derive(Clone)] - pub struct Input { - pub placeholder: wit_bindgen::rt::string::String, - } - impl ::core::fmt::Debug for Input { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Input").field("placeholder", &self.placeholder).finish() - } - } - #[derive(Clone)] - pub struct Output { - /// the resulting value of the total outputs combined - pub value: Option, - /// optional id string: None is intial render, Some for update value - pub id: Option, - /// the output dest for the message changes - pub message: Option, - /// the output dest for the signature changes - pub signature: Option, - } - impl ::core::fmt::Debug for Output { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Output").field("value", &self.value).field("id", &self.id).field("message", &self.message).field("signature", &self.signature).finish() - } - } - /// COntent for the entire page - #[derive(Clone)] - pub struct Content { - pub page: Page, - pub input: Input, - pub output: Option, - } - impl ::core::fmt::Debug for Content { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Content").field("page", &self.page).field("input", &self.input).field("output", &self.output).finish() - } - } - /// Context variants - #[derive(Clone)] - pub enum Context{ - AllContent(Content), - Message(wit_bindgen::rt::string::String), - Submit(wit_bindgen::rt::string::String), - } - impl ::core::fmt::Debug for Context { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - match self { - Context::AllContent(e) => { - f.debug_tuple("Context::AllContent").field(e).finish() + pub mod edwards_ui { + #[allow(clippy::all)] + pub mod wurbo_types { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + /// Details required in order to add an event listener to an element + #[derive(Clone)] + pub struct ListenDetails { + pub selector: _rt::String, + pub ty: _rt::String, } - Context::Message(e) => { - f.debug_tuple("Context::Message").field(e).finish() + impl ::core::fmt::Debug for ListenDetails { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("ListenDetails") + .field("selector", &self.selector) + .field("ty", &self.ty) + .finish() + } } - Context::Submit(e) => { - f.debug_tuple("Context::Submit").field(e).finish() + /// Context for the minijinja rendering + #[derive(Clone)] + pub struct Page { + pub title: _rt::String, + } + impl ::core::fmt::Debug for Page { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Page").field("title", &self.title).finish() + } + } + #[derive(Clone)] + pub struct Input { + pub placeholder: _rt::String, + } + impl ::core::fmt::Debug for Input { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Input") + .field("placeholder", &self.placeholder) + .finish() + } + } + #[derive(Clone)] + pub struct Output { + /// the resulting value of the total outputs combined + pub value: Option<_rt::String>, + /// optional id string: None is intial render, Some for update value + pub id: Option<_rt::String>, + /// the output dest for the message changes + pub message: Option<_rt::String>, + /// the output dest for the signature changes + pub signature: Option<_rt::String>, + } + impl ::core::fmt::Debug for Output { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Output") + .field("value", &self.value) + .field("id", &self.id) + .field("message", &self.message) + .field("signature", &self.signature) + .finish() + } + } + /// COntent for the entire page + #[derive(Clone)] + pub struct Content { + pub page: Page, + pub input: Input, + pub output: Option, + } + impl ::core::fmt::Debug for Content { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Content") + .field("page", &self.page) + .field("input", &self.input) + .field("output", &self.output) + .finish() + } + } + /// Context variants + #[derive(Clone)] + pub enum Context { + AllContent(Content), + Message(_rt::String), + Submit(_rt::String), + } + impl ::core::fmt::Debug for Context { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Context::AllContent(e) => { + f.debug_tuple("Context::AllContent").field(e).finish() + } + Context::Message(e) => f.debug_tuple("Context::Message").field(e).finish(), + Context::Submit(e) => f.debug_tuple("Context::Submit").field(e).finish(), + } + } } - } } - } - - } - - - #[allow(clippy::all)] - pub mod wurbo_out { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - pub type Context = super::super::super::example::edwards_ui::wurbo_types::Context; - #[allow(unused_unsafe, clippy::all)] - /// renders the initial Web component with the given data - /// and the target template to use as top level entry point - pub fn render(ctx: &Context,) -> Result{ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - - #[repr(align(4))] - struct RetArea([u8; 72]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32;use super::super::super::example::edwards_ui::wurbo_types::Context as V13; - match ctx { - V13::AllContent(e) => { - *((ptr0 + 0) as *mut u8) = (0i32) as u8; - let super::super::super::example::edwards_ui::wurbo_types::Content{ page:page1, input:input1, output:output1, } = e; - let super::super::super::example::edwards_ui::wurbo_types::Page{ title:title2, } = page1; - let vec3 = title2; - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; - *((ptr0 + 8) as *mut i32) = len3; - *((ptr0 + 4) as *mut i32) = ptr3; - let super::super::super::example::edwards_ui::wurbo_types::Input{ placeholder:placeholder4, } = input1; - let vec5 = placeholder4; - let ptr5 = vec5.as_ptr() as i32; - let len5 = vec5.len() as i32; - *((ptr0 + 16) as *mut i32) = len5; - *((ptr0 + 12) as *mut i32) = ptr5; - match output1 { - Some(e) => { - *((ptr0 + 20) as *mut u8) = (1i32) as u8; - let super::super::super::example::edwards_ui::wurbo_types::Output{ value:value6, id:id6, message:message6, signature:signature6, } = e; - match value6 { - Some(e) => { - *((ptr0 + 24) as *mut u8) = (1i32) as u8; - let vec7 = e; - let ptr7 = vec7.as_ptr() as i32; - let len7 = vec7.len() as i32; - *((ptr0 + 32) as *mut i32) = len7; - *((ptr0 + 28) as *mut i32) = ptr7; - }, - None => { - { - *((ptr0 + 24) as *mut u8) = (0i32) as u8; - } - }, - };match id6 { - Some(e) => { - *((ptr0 + 36) as *mut u8) = (1i32) as u8; - let vec8 = e; - let ptr8 = vec8.as_ptr() as i32; - let len8 = vec8.len() as i32; - *((ptr0 + 44) as *mut i32) = len8; - *((ptr0 + 40) as *mut i32) = ptr8; - }, - None => { - { - *((ptr0 + 36) as *mut u8) = (0i32) as u8; - } - }, - };match message6 { - Some(e) => { - *((ptr0 + 48) as *mut u8) = (1i32) as u8; - let vec9 = e; - let ptr9 = vec9.as_ptr() as i32; - let len9 = vec9.len() as i32; - *((ptr0 + 56) as *mut i32) = len9; - *((ptr0 + 52) as *mut i32) = ptr9; - }, - None => { - { - *((ptr0 + 48) as *mut u8) = (0i32) as u8; - } - }, - };match signature6 { - Some(e) => { - *((ptr0 + 60) as *mut u8) = (1i32) as u8; - let vec10 = e; - let ptr10 = vec10.as_ptr() as i32; - let len10 = vec10.len() as i32; - *((ptr0 + 68) as *mut i32) = len10; - *((ptr0 + 64) as *mut i32) = ptr10; - }, - None => { - { - *((ptr0 + 60) as *mut u8) = (0i32) as u8; - } - }, - };}, - None => { - { - *((ptr0 + 20) as *mut u8) = (0i32) as u8; + + #[allow(clippy::all)] + pub mod wurbo_out { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + pub type Context = super::super::super::example::edwards_ui::wurbo_types::Context; + #[allow(unused_unsafe, clippy::all)] + /// listen on all or given selectors + pub fn activate(selectors: Option<&[_rt::String]>) { + unsafe { + let mut cleanup_list = _rt::Vec::new(); + let (result2_0, result2_1, result2_2) = match selectors { + Some(e) => { + let vec1 = e; + let len1 = vec1.len(); + let layout1 = + _rt::alloc::Layout::from_size_align_unchecked(vec1.len() * 8, 4); + let result1 = if layout1.size() != 0 { + let ptr = _rt::alloc::alloc(layout1).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout1); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec1.into_iter().enumerate() { + let base = result1.add(i * 8); + { + let vec0 = e; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + *base.add(4).cast::() = len0; + *base.add(0).cast::<*mut u8>() = ptr0.cast_mut(); + } + } + cleanup_list.extend_from_slice(&[(result1, layout1)]); + + (1i32, result1, len1) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "example:edwards-ui/wurbo-out@0.1.0")] + extern "C" { + #[link_name = "activate"] + fn wit_import(_: i32, _: *mut u8, _: usize); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8, _: usize) { + unreachable!() + } + wit_import(result2_0, result2_1, result2_2); + for (ptr, layout) in cleanup_list { + if layout.size() != 0 { + _rt::alloc::dealloc(ptr.cast(), layout); + } } - }, - };}, - V13::Message(e) => { - *((ptr0 + 0) as *mut u8) = (1i32) as u8; - let vec11 = e; - let ptr11 = vec11.as_ptr() as i32; - let len11 = vec11.len() as i32; - *((ptr0 + 8) as *mut i32) = len11; - *((ptr0 + 4) as *mut i32) = ptr11; - }, - V13::Submit(e) => { - *((ptr0 + 0) as *mut u8) = (2i32) as u8; - let vec12 = e; - let ptr12 = vec12.as_ptr() as i32; - let len12 = vec12.len() as i32; - *((ptr0 + 8) as *mut i32) = len12; - *((ptr0 + 4) as *mut i32) = ptr12; - }, - } - let ptr14 = ret_area.as_mut_ptr() as i32; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "example:edwards-ui/wurbo-out@0.1.0")] - extern "C" { - #[link_name = "render"] - fn wit_import(_: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, ){ unreachable!() } - wit_import(ptr0, ptr14); - let l15 = i32::from(*((ptr14 + 0) as *const u8)); - match l15 { - 0 => { - let e = { - let l16 = *((ptr14 + 4) as *const i32); - let l17 = *((ptr14 + 8) as *const i32); - let len18 = l17 as usize; - let bytes18 = Vec::from_raw_parts(l16 as *mut _, len18, len18); - - wit_bindgen::rt::string_lift(bytes18) - }; - Ok(e) } - 1 => { - let e = { - let l19 = *((ptr14 + 4) as *const i32); - let l20 = *((ptr14 + 8) as *const i32); - let len21 = l20 as usize; - let bytes21 = Vec::from_raw_parts(l19 as *mut _, len21, len21); - - wit_bindgen::rt::string_lift(bytes21) - }; - Err(e) + } + #[allow(unused_unsafe, clippy::all)] + /// renders the initial Web component with the given data + /// and the target template to use as top level entry point + pub fn render(ctx: &Context) -> Result<_rt::String, _rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 72]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 72]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + use super::super::super::example::edwards_ui::wurbo_types::Context as V13; + match ctx { + V13::AllContent(e) => { + *ptr0.add(0).cast::() = (0i32) as u8; + let super::super::super::example::edwards_ui::wurbo_types::Content { + page: page1, + input: input1, + output: output1, + } = e; + let super::super::super::example::edwards_ui::wurbo_types::Page { + title: title2, + } = page1; + let vec3 = title2; + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + *ptr0.add(8).cast::() = len3; + *ptr0.add(4).cast::<*mut u8>() = ptr3.cast_mut(); + let super::super::super::example::edwards_ui::wurbo_types::Input { + placeholder: placeholder4, + } = input1; + let vec5 = placeholder4; + let ptr5 = vec5.as_ptr().cast::(); + let len5 = vec5.len(); + *ptr0.add(16).cast::() = len5; + *ptr0.add(12).cast::<*mut u8>() = ptr5.cast_mut(); + match output1 { + Some(e) => { + *ptr0.add(20).cast::() = (1i32) as u8; + let super::super::super::example::edwards_ui::wurbo_types::Output{ value:value6, id:id6, message:message6, signature:signature6, } = e; + match value6 { + Some(e) => { + *ptr0.add(24).cast::() = (1i32) as u8; + let vec7 = e; + let ptr7 = vec7.as_ptr().cast::(); + let len7 = vec7.len(); + *ptr0.add(32).cast::() = len7; + *ptr0.add(28).cast::<*mut u8>() = ptr7.cast_mut(); + } + None => { + *ptr0.add(24).cast::() = (0i32) as u8; + } + }; + match id6 { + Some(e) => { + *ptr0.add(36).cast::() = (1i32) as u8; + let vec8 = e; + let ptr8 = vec8.as_ptr().cast::(); + let len8 = vec8.len(); + *ptr0.add(44).cast::() = len8; + *ptr0.add(40).cast::<*mut u8>() = ptr8.cast_mut(); + } + None => { + *ptr0.add(36).cast::() = (0i32) as u8; + } + }; + match message6 { + Some(e) => { + *ptr0.add(48).cast::() = (1i32) as u8; + let vec9 = e; + let ptr9 = vec9.as_ptr().cast::(); + let len9 = vec9.len(); + *ptr0.add(56).cast::() = len9; + *ptr0.add(52).cast::<*mut u8>() = ptr9.cast_mut(); + } + None => { + *ptr0.add(48).cast::() = (0i32) as u8; + } + }; + match signature6 { + Some(e) => { + *ptr0.add(60).cast::() = (1i32) as u8; + let vec10 = e; + let ptr10 = vec10.as_ptr().cast::(); + let len10 = vec10.len(); + *ptr0.add(68).cast::() = len10; + *ptr0.add(64).cast::<*mut u8>() = ptr10.cast_mut(); + } + None => { + *ptr0.add(60).cast::() = (0i32) as u8; + } + }; + } + None => { + *ptr0.add(20).cast::() = (0i32) as u8; + } + }; + } + V13::Message(e) => { + *ptr0.add(0).cast::() = (1i32) as u8; + let vec11 = e; + let ptr11 = vec11.as_ptr().cast::(); + let len11 = vec11.len(); + *ptr0.add(8).cast::() = len11; + *ptr0.add(4).cast::<*mut u8>() = ptr11.cast_mut(); + } + V13::Submit(e) => { + *ptr0.add(0).cast::() = (2i32) as u8; + let vec12 = e; + let ptr12 = vec12.as_ptr().cast::(); + let len12 = vec12.len(); + *ptr0.add(8).cast::() = len12; + *ptr0.add(4).cast::<*mut u8>() = ptr12.cast_mut(); + } + } + let ptr14 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "example:edwards-ui/wurbo-out@0.1.0")] + extern "C" { + #[link_name = "render"] + fn wit_import(_: *mut u8, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8, _: *mut u8) { + unreachable!() + } + wit_import(ptr0, ptr14); + let l15 = i32::from(*ptr14.add(0).cast::()); + match l15 { + 0 => { + let e = { + let l16 = *ptr14.add(4).cast::<*mut u8>(); + let l17 = *ptr14.add(8).cast::(); + let len18 = l17; + let bytes18 = _rt::Vec::from_raw_parts(l16.cast(), len18, len18); + + _rt::string_lift(bytes18) + }; + Ok(e) + } + 1 => { + let e = { + let l19 = *ptr14.add(4).cast::<*mut u8>(); + let l20 = *ptr14.add(8).cast::(); + let len21 = l20; + let bytes21 = _rt::Vec::from_raw_parts(l19.cast(), len21, len21); + + _rt::string_lift(bytes21) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } } - } - #[allow(unused_unsafe, clippy::all)] - /// listen on all or given selectors - pub fn activate(selectors: Option<&[wit_bindgen::rt::string::String]>,){ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - let mut cleanup_list = Vec::new(); - let (result2_0,result2_1,result2_2,) = match selectors { - Some(e) => { - let vec1 = e; - let len1 = vec1.len() as i32; - let layout1 = alloc::Layout::from_size_align_unchecked(vec1.len() * 8, 4); - let result1 = if layout1.size() != 0 - { - let ptr = alloc::alloc(layout1); - if ptr.is_null() - { - alloc::handle_alloc_error(layout1); + #[allow(unused_unsafe, clippy::all)] + /// Optionally customize the configuration of the templates used to render the component + pub fn customize(templates: &[(_rt::String, _rt::String)]) -> Result<(), _rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let vec3 = templates; + let len3 = vec3.len(); + let layout3 = _rt::alloc::Layout::from_size_align_unchecked(vec3.len() * 16, 4); + let result3 = if layout3.size() != 0 { + let ptr = _rt::alloc::alloc(layout3).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout3); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec3.into_iter().enumerate() { + let base = result3.add(i * 16); + { + let (t0_0, t0_1) = e; + let vec1 = t0_0; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + *base.add(4).cast::() = len1; + *base.add(0).cast::<*mut u8>() = ptr1.cast_mut(); + let vec2 = t0_1; + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + *base.add(12).cast::() = len2; + *base.add(8).cast::<*mut u8>() = ptr2.cast_mut(); + } } - ptr - }else {{ - ::core::ptr::null_mut() - }}; - for (i, e) in vec1.into_iter().enumerate() { - let base = result1 as i32 + (i as i32) * 8; - { - let vec0 = e; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - *((base + 4) as *mut i32) = len0; - *((base + 0) as *mut i32) = ptr0; + let ptr4 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "example:edwards-ui/wurbo-out@0.1.0")] + extern "C" { + #[link_name = "customize"] + fn wit_import(_: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import(result3, len3, ptr4); + let l5 = i32::from(*ptr4.add(0).cast::()); + if layout3.size() != 0 { + _rt::alloc::dealloc(result3.cast(), layout3); + } + match l5 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l6 = *ptr4.add(4).cast::<*mut u8>(); + let l7 = *ptr4.add(8).cast::(); + let len8 = l7; + let bytes8 = _rt::Vec::from_raw_parts(l6.cast(), len8, len8); + + _rt::string_lift(bytes8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), } - } - cleanup_list.extend_from_slice(&[(result1, layout1),]); - - (1i32, result1 as i32, len1) - }, - None => { - (0i32, 0i32, 0i32) - }, - }; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "example:edwards-ui/wurbo-out@0.1.0")] - extern "C" { - #[link_name = "activate"] - fn wit_import(_: i32, _: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, ){ unreachable!() } - wit_import(result2_0, result2_1, result2_2); - for (ptr, layout) in cleanup_list { - - if layout.size() != 0 { - - alloc::dealloc(ptr, layout); - } - - } } - } - } - - } } - pub mod seed_keeper { - pub mod wit_ui { - +} +pub mod seed_keeper { + pub mod wit_ui { #[allow(clippy::all)] pub mod wurbo_types { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - pub type Encrypted = wit_bindgen::rt::string::String; - /// Details required in order to add an event listener to an element - #[derive(Clone)] - pub struct ListenDetails { - pub selector: wit_bindgen::rt::string::String, - pub ty: wit_bindgen::rt::string::String, - } - impl ::core::fmt::Debug for ListenDetails { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ListenDetails").field("selector", &self.selector).field("ty", &self.ty).finish() - } - } - /// Context for the minijinja rendering - #[derive(Clone)] - pub struct Page { - pub title: wit_bindgen::rt::string::String, - } - impl ::core::fmt::Debug for Page { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Page").field("title", &self.title).finish() + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + pub type Encrypted = _rt::String; + /// Details required in order to add an event listener to an element + #[derive(Clone)] + pub struct ListenDetails { + pub selector: _rt::String, + pub ty: _rt::String, } - } - #[derive(Clone)] - pub struct Input { - pub placeholder: wit_bindgen::rt::string::String, - pub encrypted_seed: Option, - } - impl ::core::fmt::Debug for Input { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Input").field("placeholder", &self.placeholder).field("encrypted-seed", &self.encrypted_seed).finish() + impl ::core::fmt::Debug for ListenDetails { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("ListenDetails") + .field("selector", &self.selector) + .field("ty", &self.ty) + .finish() + } } - } - /// Content for the entire page - #[derive(Clone)] - pub struct Content { - pub page: Option, - pub input: Option, - pub load: Option, - } - impl ::core::fmt::Debug for Content { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Content").field("page", &self.page).field("input", &self.input).field("load", &self.load).finish() + /// Context for the minijinja rendering + #[derive(Clone)] + pub struct Page { + pub title: _rt::String, } - } - /// Context variants - #[derive(Clone)] - pub enum Context{ - AllContent(Content), - Username(wit_bindgen::rt::string::String), - Password(wit_bindgen::rt::string::String), - Encrypted(Encrypted), - Submit, - } - impl ::core::fmt::Debug for Context { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - match self { - Context::AllContent(e) => { - f.debug_tuple("Context::AllContent").field(e).finish() - } - Context::Username(e) => { - f.debug_tuple("Context::Username").field(e).finish() + impl ::core::fmt::Debug for Page { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Page").field("title", &self.title).finish() } - Context::Password(e) => { - f.debug_tuple("Context::Password").field(e).finish() + } + #[derive(Clone)] + pub struct Input { + pub placeholder: _rt::String, + pub encrypted_seed: Option<_rt::String>, + } + impl ::core::fmt::Debug for Input { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Input") + .field("placeholder", &self.placeholder) + .field("encrypted-seed", &self.encrypted_seed) + .finish() } - Context::Encrypted(e) => { - f.debug_tuple("Context::Encrypted").field(e).finish() + } + /// Content for the entire page + #[derive(Clone)] + pub struct Content { + pub page: Option, + pub input: Option, + pub load: Option<_rt::String>, + } + impl ::core::fmt::Debug for Content { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Content") + .field("page", &self.page) + .field("input", &self.input) + .field("load", &self.load) + .finish() } - Context::Submit => { - f.debug_tuple("Context::Submit").finish() + } + /// Context variants + #[derive(Clone)] + pub enum Context { + AllContent(Content), + Username(_rt::String), + Password(_rt::String), + Encrypted(Encrypted), + Submit, + } + impl ::core::fmt::Debug for Context { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Context::AllContent(e) => { + f.debug_tuple("Context::AllContent").field(e).finish() + } + Context::Username(e) => { + f.debug_tuple("Context::Username").field(e).finish() + } + Context::Password(e) => { + f.debug_tuple("Context::Password").field(e).finish() + } + Context::Encrypted(e) => { + f.debug_tuple("Context::Encrypted").field(e).finish() + } + Context::Submit => f.debug_tuple("Context::Submit").finish(), + } } - } } - } - } - - + #[allow(clippy::all)] pub mod wurbo_out { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - pub type Context = super::super::super::seed_keeper::wit_ui::wurbo_types::Context; - #[allow(unused_unsafe, clippy::all)] - /// renders the initial Web component with the given data - /// and the target template to use as top level entry point - pub fn render(ctx: &Context,) -> Result{ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - - #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - use super::super::super::seed_keeper::wit_ui::wurbo_types::Context as V14; - let (result15_0,result15_1,result15_2,result15_3,result15_4,result15_5,result15_6,result15_7,result15_8,result15_9,result15_10,result15_11,result15_12,) = match ctx { - V14::AllContent(e) => { - let super::super::super::seed_keeper::wit_ui::wurbo_types::Content{ page:page0, input:input0, load:load0, } = e; - let (result3_0,result3_1,result3_2,) = match page0 { - Some(e) => { - let super::super::super::seed_keeper::wit_ui::wurbo_types::Page{ title:title1, } = e; - let vec2 = title1; - let ptr2 = vec2.as_ptr() as i32; - let len2 = vec2.len() as i32; - - (1i32, ptr2, len2) - }, - None => { - (0i32, 0i32, 0i32) - }, - };let (result8_0,result8_1,result8_2,result8_3,result8_4,result8_5,) = match input0 { - Some(e) => { - let super::super::super::seed_keeper::wit_ui::wurbo_types::Input{ placeholder:placeholder4, encrypted_seed:encrypted_seed4, } = e; - let vec5 = placeholder4; - let ptr5 = vec5.as_ptr() as i32; - let len5 = vec5.len() as i32; - let (result7_0,result7_1,result7_2,) = match encrypted_seed4 { - Some(e) => { - let vec6 = e; - let ptr6 = vec6.as_ptr() as i32; - let len6 = vec6.len() as i32; - - (1i32, ptr6, len6) - }, - None => { - (0i32, 0i32, 0i32) - }, - }; - (1i32, ptr5, len5, result7_0, result7_1, result7_2) - }, - None => { - (0i32, 0i32, 0i32, 0i32, 0i32, 0i32) - }, - };let (result10_0,result10_1,result10_2,) = match load0 { - Some(e) => { - let vec9 = e; - let ptr9 = vec9.as_ptr() as i32; - let len9 = vec9.len() as i32; - - (1i32, ptr9, len9) - }, - None => { - (0i32, 0i32, 0i32) - }, - }; - (0i32, result3_0, result3_1, result3_2, result8_0, result8_1, result8_2, result8_3, result8_4, result8_5, result10_0, result10_1, result10_2) - }, - V14::Username(e) => { - let vec11 = e; - let ptr11 = vec11.as_ptr() as i32; - let len11 = vec11.len() as i32; - - (1i32, ptr11, len11, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32) - }, - V14::Password(e) => { - let vec12 = e; - let ptr12 = vec12.as_ptr() as i32; - let len12 = vec12.len() as i32; - - (2i32, ptr12, len12, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32) - }, - V14::Encrypted(e) => { - let vec13 = e; - let ptr13 = vec13.as_ptr() as i32; - let len13 = vec13.len() as i32; - - (3i32, ptr13, len13, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32) - }, - V14::Submit=> { - (4i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32) - } - }; - let ptr16 = ret_area.as_mut_ptr() as i32; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "seed-keeper:wit-ui/wurbo-out@0.1.0")] - extern "C" { - #[link_name = "render"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, ){ unreachable!() } - wit_import(result15_0, result15_1, result15_2, result15_3, result15_4, result15_5, result15_6, result15_7, result15_8, result15_9, result15_10, result15_11, result15_12, ptr16); - let l17 = i32::from(*((ptr16 + 0) as *const u8)); - match l17 { - 0 => { - let e = { - let l18 = *((ptr16 + 4) as *const i32); - let l19 = *((ptr16 + 8) as *const i32); - let len20 = l19 as usize; - let bytes20 = Vec::from_raw_parts(l18 as *mut _, len20, len20); - - wit_bindgen::rt::string_lift(bytes20) - }; - Ok(e) - } - 1 => { - let e = { - let l21 = *((ptr16 + 4) as *const i32); - let l22 = *((ptr16 + 8) as *const i32); - let len23 = l22 as usize; - let bytes23 = Vec::from_raw_parts(l21 as *mut _, len23, len23); - - wit_bindgen::rt::string_lift(bytes23) - }; - Err(e) + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + pub type Context = super::super::super::seed_keeper::wit_ui::wurbo_types::Context; + #[allow(unused_unsafe, clippy::all)] + /// renders the initial Web component with the given data + /// and the target template to use as top level entry point + pub fn render(ctx: &Context) -> Result<_rt::String, _rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + use super::super::super::seed_keeper::wit_ui::wurbo_types::Context as V14; + let ( + result15_0, + result15_1, + result15_2, + result15_3, + result15_4, + result15_5, + result15_6, + result15_7, + result15_8, + result15_9, + result15_10, + result15_11, + result15_12, + ) = match ctx { + V14::AllContent(e) => { + let super::super::super::seed_keeper::wit_ui::wurbo_types::Content { + page: page0, + input: input0, + load: load0, + } = e; + let (result3_0, result3_1, result3_2) = match page0 { + Some(e) => { + let super::super::super::seed_keeper::wit_ui::wurbo_types::Page{ title:title1, } = e; + let vec2 = title1; + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + + (1i32, ptr2.cast_mut(), len2) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + let (result8_0, result8_1, result8_2, result8_3, result8_4, result8_5) = + match input0 { + Some(e) => { + let super::super::super::seed_keeper::wit_ui::wurbo_types::Input{ placeholder:placeholder4, encrypted_seed:encrypted_seed4, } = e; + let vec5 = placeholder4; + let ptr5 = vec5.as_ptr().cast::(); + let len5 = vec5.len(); + let (result7_0, result7_1, result7_2) = + match encrypted_seed4 { + Some(e) => { + let vec6 = e; + let ptr6 = vec6.as_ptr().cast::(); + let len6 = vec6.len(); + + (1i32, ptr6.cast_mut(), len6) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + ( + 1i32, + ptr5.cast_mut(), + len5, + result7_0, + result7_1, + result7_2, + ) + } + None => ( + 0i32, + ::core::ptr::null_mut(), + 0usize, + 0i32, + ::core::ptr::null_mut(), + 0usize, + ), + }; + let (result10_0, result10_1, result10_2) = match load0 { + Some(e) => { + let vec9 = e; + let ptr9 = vec9.as_ptr().cast::(); + let len9 = vec9.len(); + + (1i32, ptr9.cast_mut(), len9) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + ( + 0i32, + result3_0 as *mut u8, + result3_1, + result3_2, + result8_0, + result8_1, + result8_2, + result8_3, + result8_4, + result8_5, + result10_0, + result10_1, + result10_2, + ) + } + V14::Username(e) => { + let vec11 = e; + let ptr11 = vec11.as_ptr().cast::(); + let len11 = vec11.len(); + + ( + 1i32, + ptr11.cast_mut(), + len11 as *mut u8, + 0usize, + 0i32, + ::core::ptr::null_mut(), + 0usize, + 0i32, + ::core::ptr::null_mut(), + 0usize, + 0i32, + ::core::ptr::null_mut(), + 0usize, + ) + } + V14::Password(e) => { + let vec12 = e; + let ptr12 = vec12.as_ptr().cast::(); + let len12 = vec12.len(); + + ( + 2i32, + ptr12.cast_mut(), + len12 as *mut u8, + 0usize, + 0i32, + ::core::ptr::null_mut(), + 0usize, + 0i32, + ::core::ptr::null_mut(), + 0usize, + 0i32, + ::core::ptr::null_mut(), + 0usize, + ) + } + V14::Encrypted(e) => { + let vec13 = e; + let ptr13 = vec13.as_ptr().cast::(); + let len13 = vec13.len(); + + ( + 3i32, + ptr13.cast_mut(), + len13 as *mut u8, + 0usize, + 0i32, + ::core::ptr::null_mut(), + 0usize, + 0i32, + ::core::ptr::null_mut(), + 0usize, + 0i32, + ::core::ptr::null_mut(), + 0usize, + ) + } + V14::Submit => ( + 4i32, + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ::core::ptr::null_mut(), + 0usize, + 0i32, + ::core::ptr::null_mut(), + 0usize, + 0i32, + ::core::ptr::null_mut(), + 0usize, + ), + }; + let ptr16 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "seed-keeper:wit-ui/wurbo-out@0.1.0")] + extern "C" { + #[link_name = "render"] + fn wit_import( + _: i32, + _: *mut u8, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import( + _: i32, + _: *mut u8, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { + unreachable!() + } + wit_import( + result15_0, + result15_1, + result15_2, + result15_3, + result15_4, + result15_5, + result15_6, + result15_7, + result15_8, + result15_9, + result15_10, + result15_11, + result15_12, + ptr16, + ); + let l17 = i32::from(*ptr16.add(0).cast::()); + match l17 { + 0 => { + let e = { + let l18 = *ptr16.add(4).cast::<*mut u8>(); + let l19 = *ptr16.add(8).cast::(); + let len20 = l19; + let bytes20 = _rt::Vec::from_raw_parts(l18.cast(), len20, len20); + + _rt::string_lift(bytes20) + }; + Ok(e) + } + 1 => { + let e = { + let l21 = *ptr16.add(4).cast::<*mut u8>(); + let l22 = *ptr16.add(8).cast::(); + let len23 = l22; + let bytes23 = _rt::Vec::from_raw_parts(l21.cast(), len23, len23); + + _rt::string_lift(bytes23) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } } - } - #[allow(unused_unsafe, clippy::all)] - /// listen on all or given selectors - pub fn activate(selectors: Option<&[wit_bindgen::rt::string::String]>,){ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - let mut cleanup_list = Vec::new(); - let (result2_0,result2_1,result2_2,) = match selectors { - Some(e) => { - let vec1 = e; - let len1 = vec1.len() as i32; - let layout1 = alloc::Layout::from_size_align_unchecked(vec1.len() * 8, 4); - let result1 = if layout1.size() != 0 - { - let ptr = alloc::alloc(layout1); - if ptr.is_null() - { - alloc::handle_alloc_error(layout1); + #[allow(unused_unsafe, clippy::all)] + /// listen on all or given selectors + pub fn activate(selectors: Option<&[_rt::String]>) { + unsafe { + let mut cleanup_list = _rt::Vec::new(); + let (result2_0, result2_1, result2_2) = match selectors { + Some(e) => { + let vec1 = e; + let len1 = vec1.len(); + let layout1 = + _rt::alloc::Layout::from_size_align_unchecked(vec1.len() * 8, 4); + let result1 = if layout1.size() != 0 { + let ptr = _rt::alloc::alloc(layout1).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout1); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec1.into_iter().enumerate() { + let base = result1.add(i * 8); + { + let vec0 = e; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + *base.add(4).cast::() = len0; + *base.add(0).cast::<*mut u8>() = ptr0.cast_mut(); + } + } + cleanup_list.extend_from_slice(&[(result1, layout1)]); + + (1i32, result1, len1) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "seed-keeper:wit-ui/wurbo-out@0.1.0")] + extern "C" { + #[link_name = "activate"] + fn wit_import(_: i32, _: *mut u8, _: usize); } - ptr - }else {{ - ::core::ptr::null_mut() - }}; - for (i, e) in vec1.into_iter().enumerate() { - let base = result1 as i32 + (i as i32) * 8; - { - let vec0 = e; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - *((base + 4) as *mut i32) = len0; - *((base + 0) as *mut i32) = ptr0; + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8, _: usize) { + unreachable!() + } + wit_import(result2_0, result2_1, result2_2); + for (ptr, layout) in cleanup_list { + if layout.size() != 0 { + _rt::alloc::dealloc(ptr.cast(), layout); + } } - } - cleanup_list.extend_from_slice(&[(result1, layout1),]); - - (1i32, result1 as i32, len1) - }, - None => { - (0i32, 0i32, 0i32) - }, - }; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "seed-keeper:wit-ui/wurbo-out@0.1.0")] - extern "C" { - #[link_name = "activate"] - fn wit_import(_: i32, _: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, ){ unreachable!() } - wit_import(result2_0, result2_1, result2_2); - for (ptr, layout) in cleanup_list { - - if layout.size() != 0 { - - alloc::dealloc(ptr, layout); - } - - } } - } - } - - } } - pub mod wallet { - pub mod aggregate_wit_ui { - +} +pub mod wallet { + pub mod aggregate_wit_ui { #[allow(clippy::all)] pub mod wurbo_types { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - pub type EdwardsContext = super::super::super::example::edwards_ui::wurbo_out::Context; - pub type SeedContext = super::super::super::seed_keeper::wit_ui::wurbo_out::Context; - /// Details required in order to add an event listener to an element - #[derive(Clone)] - pub struct ListenDetails { - pub selector: wit_bindgen::rt::string::String, - pub ty: wit_bindgen::rt::string::String, - } - impl ::core::fmt::Debug for ListenDetails { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ListenDetails").field("selector", &self.selector).field("ty", &self.ty).finish() + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + pub type EdwardsContext = super::super::super::example::edwards_ui::wurbo_out::Context; + pub type SeedContext = super::super::super::seed_keeper::wit_ui::wurbo_out::Context; + /// Details required in order to add an event listener to an element + #[derive(Clone)] + pub struct ListenDetails { + pub selector: _rt::String, + pub ty: _rt::String, } - } - /// Context for the minijinja rendering - #[derive(Clone)] - pub struct App { - pub title: wit_bindgen::rt::string::String, - } - impl ::core::fmt::Debug for App { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("App").field("title", &self.title).finish() + impl ::core::fmt::Debug for ListenDetails { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("ListenDetails") + .field("selector", &self.selector) + .field("ty", &self.ty) + .finish() + } } - } - /// Content record for the initial content of the entire app - #[derive(Clone)] - pub struct Content { - /// pass in props like title, etc. - pub app: App, - /// optionally pass in an encrypted seed to load - pub seed_ui: SeedContext, - /// optionally pass in a message to sign or verify - pub edwards_ui: EdwardsContext, - } - impl ::core::fmt::Debug for Content { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Content").field("app", &self.app).field("seed-ui", &self.seed_ui).field("edwards-ui", &self.edwards_ui).finish() + /// Context for the minijinja rendering + #[derive(Clone)] + pub struct App { + pub title: _rt::String, } - } - /// Context variants - #[derive(Clone)] - pub enum Context{ - AllContent(Content), - Seed(SeedContext), - Edwards(EdwardsContext), - } - impl ::core::fmt::Debug for Context { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - match self { - Context::AllContent(e) => { - f.debug_tuple("Context::AllContent").field(e).finish() + impl ::core::fmt::Debug for App { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("App").field("title", &self.title).finish() } - Context::Seed(e) => { - f.debug_tuple("Context::Seed").field(e).finish() + } + /// Content record for the initial content of the entire app + #[derive(Clone)] + pub struct Content { + /// pass in props like title, etc. + pub app: App, + /// optionally pass in an encrypted seed to load + pub seed_ui: SeedContext, + /// optionally pass in a message to sign or verify + pub edwards_ui: EdwardsContext, + } + impl ::core::fmt::Debug for Content { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Content") + .field("app", &self.app) + .field("seed-ui", &self.seed_ui) + .field("edwards-ui", &self.edwards_ui) + .finish() } - Context::Edwards(e) => { - f.debug_tuple("Context::Edwards").field(e).finish() + } + /// Context variants + #[derive(Clone)] + pub enum Context { + AllContent(Content), + Seed(SeedContext), + Edwards(EdwardsContext), + } + impl ::core::fmt::Debug for Context { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Context::AllContent(e) => { + f.debug_tuple("Context::AllContent").field(e).finish() + } + Context::Seed(e) => f.debug_tuple("Context::Seed").field(e).finish(), + Context::Edwards(e) => f.debug_tuple("Context::Edwards").field(e).finish(), + } } - } } - } - } - - + #[allow(clippy::all)] pub mod wurbo_in { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - pub type ListenDetails = super::super::super::wallet::aggregate_wit_ui::wurbo_types::ListenDetails; - #[allow(unused_unsafe, clippy::all)] - /// Add an event listener to the given element - pub fn addeventlistener(details: &ListenDetails,){ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - let super::super::super::wallet::aggregate_wit_ui::wurbo_types::ListenDetails{ selector:selector0, ty:ty0, } = details; - let vec1 = selector0; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - let vec2 = ty0; - let ptr2 = vec2.as_ptr() as i32; - let len2 = vec2.len() as i32; - - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wallet:aggregate-wit-ui/wurbo-in@0.1.0")] - extern "C" { - #[link_name = "addeventlistener"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, ){ unreachable!() } - wit_import(ptr1, len1, ptr2, len2); + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + pub type ListenDetails = + super::super::super::wallet::aggregate_wit_ui::wurbo_types::ListenDetails; + #[allow(unused_unsafe, clippy::all)] + /// Add an event listener to the given element + pub fn addeventlistener(details: &ListenDetails) { + unsafe { + let super::super::super::wallet::aggregate_wit_ui::wurbo_types::ListenDetails { + selector: selector0, + ty: ty0, + } = details; + let vec1 = selector0; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + let vec2 = ty0; + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wallet:aggregate-wit-ui/wurbo-in@0.1.0")] + extern "C" { + #[link_name = "addeventlistener"] + fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize) { + unreachable!() + } + wit_import(ptr1.cast_mut(), len1, ptr2.cast_mut(), len2); + } } - } - } - - } } - pub mod exports { - pub mod wallet { +} +pub mod exports { + pub mod wallet { pub mod aggregate_wit_ui { - - #[allow(clippy::all)] - pub mod wurbo_out { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_section; - pub type Context = super::super::super::super::wallet::aggregate_wit_ui::wurbo_types::Context; - const _: () = { - - #[doc(hidden)] - #[export_name = "wallet:aggregate-wit-ui/wurbo-out@0.1.0#render"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_render(arg0: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let l0 = i32::from(*((arg0 + 0) as *const u8)); - use super::super::super::super::wallet::aggregate_wit_ui::wurbo_types::Context as V120; - let v120 = match l0 { - 0 => { - let e120 = { - let l1 = *((arg0 + 4) as *const i32); - let l2 = *((arg0 + 8) as *const i32); - let len3 = l2 as usize; - let bytes3 = Vec::from_raw_parts(l1 as *mut _, len3, len3); - let l4 = i32::from(*((arg0 + 12) as *const u8)); - use super::super::super::super::seed_keeper::wit_ui::wurbo_types::Context as V30; - let v30 = match l4 { + #[allow(clippy::all)] + pub mod wurbo_out { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type Context = + super::super::super::super::wallet::aggregate_wit_ui::wurbo_types::Context; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_render_cabi(arg0: *mut u8) -> *mut u8 { + let l0 = i32::from(*arg0.add(0).cast::()); + use super::super::super::super::wallet::aggregate_wit_ui::wurbo_types::Context as V120; + let v120 = match l0 { 0 => { - let e30 = { - let l5 = i32::from(*((arg0 + 16) as *const u8)); - let l9 = i32::from(*((arg0 + 28) as *const u8)); - let l17 = i32::from(*((arg0 + 52) as *const u8)); - - super::super::super::super::seed_keeper::wit_ui::wurbo_types::Content{ - page: match l5 { - 0 => None, - 1 => { - let e = { - let l6 = *((arg0 + 20) as *const i32); - let l7 = *((arg0 + 24) as *const i32); - let len8 = l7 as usize; - let bytes8 = Vec::from_raw_parts(l6 as *mut _, len8, len8); - - super::super::super::super::seed_keeper::wit_ui::wurbo_types::Page{ - title: wit_bindgen::rt::string_lift(bytes8), - } - }; - Some(e) + let e120 = { + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + let len3 = l2; + let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); + let l4 = i32::from(*arg0.add(12).cast::()); + use super::super::super::super::seed_keeper::wit_ui::wurbo_types::Context as V30; + let v30 = match l4 { + 0 => { + let e30 = { + let l5 = i32::from(*arg0.add(16).cast::()); + let l9 = i32::from(*arg0.add(28).cast::()); + let l17 = i32::from(*arg0.add(52).cast::()); + + super::super::super::super::seed_keeper::wit_ui::wurbo_types::Content{ + page: match l5 { + 0 => None, + 1 => { + let e = { + let l6 = *arg0.add(20).cast::<*mut u8>(); + let l7 = *arg0.add(24).cast::(); + let len8 = l7; + let bytes8 = _rt::Vec::from_raw_parts(l6.cast(), len8, len8); + + super::super::super::super::seed_keeper::wit_ui::wurbo_types::Page{ + title: _rt::string_lift(bytes8), } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - input: match l9 { - 0 => None, - 1 => { - let e = { - let l10 = *((arg0 + 32) as *const i32); - let l11 = *((arg0 + 36) as *const i32); - let len12 = l11 as usize; - let bytes12 = Vec::from_raw_parts(l10 as *mut _, len12, len12); - let l13 = i32::from(*((arg0 + 40) as *const u8)); - - super::super::super::super::seed_keeper::wit_ui::wurbo_types::Input{ - placeholder: wit_bindgen::rt::string_lift(bytes12), - encrypted_seed: match l13 { - 0 => None, - 1 => { - let e = { - let l14 = *((arg0 + 44) as *const i32); - let l15 = *((arg0 + 48) as *const i32); - let len16 = l15 as usize; - let bytes16 = Vec::from_raw_parts(l14 as *mut _, len16, len16); - - wit_bindgen::rt::string_lift(bytes16) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + input: match l9 { + 0 => None, + 1 => { + let e = { + let l10 = *arg0.add(32).cast::<*mut u8>(); + let l11 = *arg0.add(36).cast::(); + let len12 = l11; + let bytes12 = _rt::Vec::from_raw_parts(l10.cast(), len12, len12); + let l13 = i32::from(*arg0.add(40).cast::()); + + super::super::super::super::seed_keeper::wit_ui::wurbo_types::Input{ + placeholder: _rt::string_lift(bytes12), + encrypted_seed: match l13 { + 0 => None, + 1 => { + let e = { + let l14 = *arg0.add(44).cast::<*mut u8>(); + let l15 = *arg0.add(48).cast::(); + let len16 = l15; + let bytes16 = _rt::Vec::from_raw_parts(l14.cast(), len16, len16); + + _rt::string_lift(bytes16) + }; + Some(e) } - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - load: match l17 { - 0 => None, - 1 => { - let e = { - let l18 = *((arg0 + 56) as *const i32); - let l19 = *((arg0 + 60) as *const i32); - let len20 = l19 as usize; - let bytes20 = Vec::from_raw_parts(l18 as *mut _, len20, len20); - - wit_bindgen::rt::string_lift(bytes20) - }; - Some(e) + _ => _rt::invalid_enum_discriminant(), + }, } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, + }; + Some(e) } - }; - V30::AllContent(e30) - } - 1 => { - let e30 = { - let l21 = *((arg0 + 16) as *const i32); - let l22 = *((arg0 + 20) as *const i32); - let len23 = l22 as usize; - let bytes23 = Vec::from_raw_parts(l21 as *mut _, len23, len23); - - wit_bindgen::rt::string_lift(bytes23) - }; - V30::Username(e30) - } - 2 => { - let e30 = { - let l24 = *((arg0 + 16) as *const i32); - let l25 = *((arg0 + 20) as *const i32); - let len26 = l25 as usize; - let bytes26 = Vec::from_raw_parts(l24 as *mut _, len26, len26); - - wit_bindgen::rt::string_lift(bytes26) - }; - V30::Password(e30) + _ => _rt::invalid_enum_discriminant(), + }, + load: match l17 { + 0 => None, + 1 => { + let e = { + let l18 = *arg0.add(56).cast::<*mut u8>(); + let l19 = *arg0.add(60).cast::(); + let len20 = l19; + let bytes20 = _rt::Vec::from_raw_parts(l18.cast(), len20, len20); + + _rt::string_lift(bytes20) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, } - 3 => { - let e30 = { - let l27 = *((arg0 + 16) as *const i32); - let l28 = *((arg0 + 20) as *const i32); - let len29 = l28 as usize; - let bytes29 = Vec::from_raw_parts(l27 as *mut _, len29, len29); - - wit_bindgen::rt::string_lift(bytes29) - }; - V30::Encrypted(e30) + }; + V30::AllContent(e30) + } + 1 => { + let e30 = { + let l21 = *arg0.add(16).cast::<*mut u8>(); + let l22 = *arg0.add(20).cast::(); + let len23 = l22; + let bytes23 = + _rt::Vec::from_raw_parts(l21.cast(), len23, len23); + + _rt::string_lift(bytes23) + }; + V30::Username(e30) + } + 2 => { + let e30 = { + let l24 = *arg0.add(16).cast::<*mut u8>(); + let l25 = *arg0.add(20).cast::(); + let len26 = l25; + let bytes26 = + _rt::Vec::from_raw_parts(l24.cast(), len26, len26); + + _rt::string_lift(bytes26) + }; + V30::Password(e30) + } + 3 => { + let e30 = { + let l27 = *arg0.add(16).cast::<*mut u8>(); + let l28 = *arg0.add(20).cast::(); + let len29 = l28; + let bytes29 = + _rt::Vec::from_raw_parts(l27.cast(), len29, len29); + + _rt::string_lift(bytes29) + }; + V30::Encrypted(e30) + } + n => { + debug_assert_eq!(n, 4, "invalid enum discriminant"); + V30::Submit + } + }; + let l31 = i32::from(*arg0.add(64).cast::()); + use super::super::super::super::example::edwards_ui::wurbo_types::Context as V61; + let v61 = match l31 { + 0 => { + let e61 = { + let l32 = *arg0.add(68).cast::<*mut u8>(); + let l33 = *arg0.add(72).cast::(); + let len34 = l33; + let bytes34 = + _rt::Vec::from_raw_parts(l32.cast(), len34, len34); + let l35 = *arg0.add(76).cast::<*mut u8>(); + let l36 = *arg0.add(80).cast::(); + let len37 = l36; + let bytes37 = + _rt::Vec::from_raw_parts(l35.cast(), len37, len37); + let l38 = i32::from(*arg0.add(84).cast::()); + + super::super::super::super::example::edwards_ui::wurbo_types::Content{ + page: super::super::super::super::example::edwards_ui::wurbo_types::Page{ + title: _rt::string_lift(bytes34), + }, + input: super::super::super::super::example::edwards_ui::wurbo_types::Input{ + placeholder: _rt::string_lift(bytes37), + }, + output: match l38 { + 0 => None, + 1 => { + let e = { + let l39 = i32::from(*arg0.add(88).cast::()); + let l43 = i32::from(*arg0.add(100).cast::()); + let l47 = i32::from(*arg0.add(112).cast::()); + let l51 = i32::from(*arg0.add(124).cast::()); + + super::super::super::super::example::edwards_ui::wurbo_types::Output{ + value: match l39 { + 0 => None, + 1 => { + let e = { + let l40 = *arg0.add(92).cast::<*mut u8>(); + let l41 = *arg0.add(96).cast::(); + let len42 = l41; + let bytes42 = _rt::Vec::from_raw_parts(l40.cast(), len42, len42); + + _rt::string_lift(bytes42) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + id: match l43 { + 0 => None, + 1 => { + let e = { + let l44 = *arg0.add(104).cast::<*mut u8>(); + let l45 = *arg0.add(108).cast::(); + let len46 = l45; + let bytes46 = _rt::Vec::from_raw_parts(l44.cast(), len46, len46); + + _rt::string_lift(bytes46) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + message: match l47 { + 0 => None, + 1 => { + let e = { + let l48 = *arg0.add(116).cast::<*mut u8>(); + let l49 = *arg0.add(120).cast::(); + let len50 = l49; + let bytes50 = _rt::Vec::from_raw_parts(l48.cast(), len50, len50); + + _rt::string_lift(bytes50) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + signature: match l51 { + 0 => None, + 1 => { + let e = { + let l52 = *arg0.add(128).cast::<*mut u8>(); + let l53 = *arg0.add(132).cast::(); + let len54 = l53; + let bytes54 = _rt::Vec::from_raw_parts(l52.cast(), len54, len54); + + _rt::string_lift(bytes54) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - V30::Submit + }; + V61::AllContent(e61) + } + 1 => { + let e61 = { + let l55 = *arg0.add(68).cast::<*mut u8>(); + let l56 = *arg0.add(72).cast::(); + let len57 = l56; + let bytes57 = + _rt::Vec::from_raw_parts(l55.cast(), len57, len57); + + _rt::string_lift(bytes57) + }; + V61::Message(e61) + } + n => { + debug_assert_eq!(n, 2, "invalid enum discriminant"); + let e61 = { + let l58 = *arg0.add(68).cast::<*mut u8>(); + let l59 = *arg0.add(72).cast::(); + let len60 = l59; + let bytes60 = + _rt::Vec::from_raw_parts(l58.cast(), len60, len60); + + _rt::string_lift(bytes60) + }; + V61::Submit(e61) + } + }; + + super::super::super::super::wallet::aggregate_wit_ui::wurbo_types::Content{ + app: super::super::super::super::wallet::aggregate_wit_ui::wurbo_types::App{ + title: _rt::string_lift(bytes3), + }, + seed_ui: v30, + edwards_ui: v61, + } + }; + V120::AllContent(e120) } - }; - let l31 = i32::from(*((arg0 + 64) as *const u8)); - use super::super::super::super::example::edwards_ui::wurbo_types::Context as V61; - let v61 = match l31 { - 0 => { - let e61 = { - let l32 = *((arg0 + 68) as *const i32); - let l33 = *((arg0 + 72) as *const i32); - let len34 = l33 as usize; - let bytes34 = Vec::from_raw_parts(l32 as *mut _, len34, len34); - let l35 = *((arg0 + 76) as *const i32); - let l36 = *((arg0 + 80) as *const i32); - let len37 = l36 as usize; - let bytes37 = Vec::from_raw_parts(l35 as *mut _, len37, len37); - let l38 = i32::from(*((arg0 + 84) as *const u8)); - - super::super::super::super::example::edwards_ui::wurbo_types::Content{ - page: super::super::super::super::example::edwards_ui::wurbo_types::Page{ - title: wit_bindgen::rt::string_lift(bytes34), - }, - input: super::super::super::super::example::edwards_ui::wurbo_types::Input{ - placeholder: wit_bindgen::rt::string_lift(bytes37), - }, - output: match l38 { - 0 => None, - 1 => { - let e = { - let l39 = i32::from(*((arg0 + 88) as *const u8)); - let l43 = i32::from(*((arg0 + 100) as *const u8)); - let l47 = i32::from(*((arg0 + 112) as *const u8)); - let l51 = i32::from(*((arg0 + 124) as *const u8)); - - super::super::super::super::example::edwards_ui::wurbo_types::Output{ - value: match l39 { - 0 => None, - 1 => { - let e = { - let l40 = *((arg0 + 92) as *const i32); - let l41 = *((arg0 + 96) as *const i32); - let len42 = l41 as usize; - let bytes42 = Vec::from_raw_parts(l40 as *mut _, len42, len42); - - wit_bindgen::rt::string_lift(bytes42) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - id: match l43 { - 0 => None, - 1 => { - let e = { - let l44 = *((arg0 + 104) as *const i32); - let l45 = *((arg0 + 108) as *const i32); - let len46 = l45 as usize; - let bytes46 = Vec::from_raw_parts(l44 as *mut _, len46, len46); - - wit_bindgen::rt::string_lift(bytes46) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - message: match l47 { - 0 => None, - 1 => { - let e = { - let l48 = *((arg0 + 116) as *const i32); - let l49 = *((arg0 + 120) as *const i32); - let len50 = l49 as usize; - let bytes50 = Vec::from_raw_parts(l48 as *mut _, len50, len50); - - wit_bindgen::rt::string_lift(bytes50) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - signature: match l51 { - 0 => None, - 1 => { - let e = { - let l52 = *((arg0 + 128) as *const i32); - let l53 = *((arg0 + 132) as *const i32); - let len54 = l53 as usize; - let bytes54 = Vec::from_raw_parts(l52 as *mut _, len54, len54); - - wit_bindgen::rt::string_lift(bytes54) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, + 1 => { + let e120 = { + let l62 = i32::from(*arg0.add(4).cast::()); + use super::super::super::super::seed_keeper::wit_ui::wurbo_types::Context as V88; + let v88 = match l62 { + 0 => { + let e88 = { + let l63 = i32::from(*arg0.add(8).cast::()); + let l67 = i32::from(*arg0.add(20).cast::()); + let l75 = i32::from(*arg0.add(44).cast::()); + + super::super::super::super::seed_keeper::wit_ui::wurbo_types::Content{ + page: match l63 { + 0 => None, + 1 => { + let e = { + let l64 = *arg0.add(12).cast::<*mut u8>(); + let l65 = *arg0.add(16).cast::(); + let len66 = l65; + let bytes66 = _rt::Vec::from_raw_parts(l64.cast(), len66, len66); + + super::super::super::super::seed_keeper::wit_ui::wurbo_types::Page{ + title: _rt::string_lift(bytes66), + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + input: match l67 { + 0 => None, + 1 => { + let e = { + let l68 = *arg0.add(24).cast::<*mut u8>(); + let l69 = *arg0.add(28).cast::(); + let len70 = l69; + let bytes70 = _rt::Vec::from_raw_parts(l68.cast(), len70, len70); + let l71 = i32::from(*arg0.add(32).cast::()); + + super::super::super::super::seed_keeper::wit_ui::wurbo_types::Input{ + placeholder: _rt::string_lift(bytes70), + encrypted_seed: match l71 { + 0 => None, + 1 => { + let e = { + let l72 = *arg0.add(36).cast::<*mut u8>(); + let l73 = *arg0.add(40).cast::(); + let len74 = l73; + let bytes74 = _rt::Vec::from_raw_parts(l72.cast(), len74, len74); + + _rt::string_lift(bytes74) + }; + Some(e) } - }; - Some(e) + _ => _rt::invalid_enum_discriminant(), + }, } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, + }; + Some(e) } - }; - V61::AllContent(e61) + _ => _rt::invalid_enum_discriminant(), + }, + load: match l75 { + 0 => None, + 1 => { + let e = { + let l76 = *arg0.add(48).cast::<*mut u8>(); + let l77 = *arg0.add(52).cast::(); + let len78 = l77; + let bytes78 = _rt::Vec::from_raw_parts(l76.cast(), len78, len78); + + _rt::string_lift(bytes78) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, } - 1 => { - let e61 = { - let l55 = *((arg0 + 68) as *const i32); - let l56 = *((arg0 + 72) as *const i32); - let len57 = l56 as usize; - let bytes57 = Vec::from_raw_parts(l55 as *mut _, len57, len57); - - wit_bindgen::rt::string_lift(bytes57) - }; - V61::Message(e61) + }; + V88::AllContent(e88) + } + 1 => { + let e88 = { + let l79 = *arg0.add(8).cast::<*mut u8>(); + let l80 = *arg0.add(12).cast::(); + let len81 = l80; + let bytes81 = + _rt::Vec::from_raw_parts(l79.cast(), len81, len81); + + _rt::string_lift(bytes81) + }; + V88::Username(e88) + } + 2 => { + let e88 = { + let l82 = *arg0.add(8).cast::<*mut u8>(); + let l83 = *arg0.add(12).cast::(); + let len84 = l83; + let bytes84 = + _rt::Vec::from_raw_parts(l82.cast(), len84, len84); + + _rt::string_lift(bytes84) + }; + V88::Password(e88) + } + 3 => { + let e88 = { + let l85 = *arg0.add(8).cast::<*mut u8>(); + let l86 = *arg0.add(12).cast::(); + let len87 = l86; + let bytes87 = + _rt::Vec::from_raw_parts(l85.cast(), len87, len87); + + _rt::string_lift(bytes87) + }; + V88::Encrypted(e88) + } + n => { + debug_assert_eq!(n, 4, "invalid enum discriminant"); + V88::Submit + } + }; + + v88 + }; + V120::Seed(e120) } n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e61 = { - let l58 = *((arg0 + 68) as *const i32); - let l59 = *((arg0 + 72) as *const i32); - let len60 = l59 as usize; - let bytes60 = Vec::from_raw_parts(l58 as *mut _, len60, len60); - - wit_bindgen::rt::string_lift(bytes60) - }; - V61::Submit(e61) - } - }; - - super::super::super::super::wallet::aggregate_wit_ui::wurbo_types::Content{ - app: super::super::super::super::wallet::aggregate_wit_ui::wurbo_types::App{ - title: wit_bindgen::rt::string_lift(bytes3), - }, - seed_ui: v30, - edwards_ui: v61, - } - }; - V120::AllContent(e120) - } - 1 => { - let e120 = { - let l62 = i32::from(*((arg0 + 4) as *const u8)); - use super::super::super::super::seed_keeper::wit_ui::wurbo_types::Context as V88; - let v88 = match l62 { - 0 => { - let e88 = { - let l63 = i32::from(*((arg0 + 8) as *const u8)); - let l67 = i32::from(*((arg0 + 20) as *const u8)); - let l75 = i32::from(*((arg0 + 44) as *const u8)); - - super::super::super::super::seed_keeper::wit_ui::wurbo_types::Content{ - page: match l63 { - 0 => None, - 1 => { - let e = { - let l64 = *((arg0 + 12) as *const i32); - let l65 = *((arg0 + 16) as *const i32); - let len66 = l65 as usize; - let bytes66 = Vec::from_raw_parts(l64 as *mut _, len66, len66); - - super::super::super::super::seed_keeper::wit_ui::wurbo_types::Page{ - title: wit_bindgen::rt::string_lift(bytes66), + debug_assert_eq!(n, 2, "invalid enum discriminant"); + let e120 = { + let l89 = i32::from(*arg0.add(4).cast::()); + use super::super::super::super::example::edwards_ui::wurbo_types::Context as V119; + let v119 = match l89 { + 0 => { + let e119 = { + let l90 = *arg0.add(8).cast::<*mut u8>(); + let l91 = *arg0.add(12).cast::(); + let len92 = l91; + let bytes92 = + _rt::Vec::from_raw_parts(l90.cast(), len92, len92); + let l93 = *arg0.add(16).cast::<*mut u8>(); + let l94 = *arg0.add(20).cast::(); + let len95 = l94; + let bytes95 = + _rt::Vec::from_raw_parts(l93.cast(), len95, len95); + let l96 = i32::from(*arg0.add(24).cast::()); + + super::super::super::super::example::edwards_ui::wurbo_types::Content{ + page: super::super::super::super::example::edwards_ui::wurbo_types::Page{ + title: _rt::string_lift(bytes92), + }, + input: super::super::super::super::example::edwards_ui::wurbo_types::Input{ + placeholder: _rt::string_lift(bytes95), + }, + output: match l96 { + 0 => None, + 1 => { + let e = { + let l97 = i32::from(*arg0.add(28).cast::()); + let l101 = i32::from(*arg0.add(40).cast::()); + let l105 = i32::from(*arg0.add(52).cast::()); + let l109 = i32::from(*arg0.add(64).cast::()); + + super::super::super::super::example::edwards_ui::wurbo_types::Output{ + value: match l97 { + 0 => None, + 1 => { + let e = { + let l98 = *arg0.add(32).cast::<*mut u8>(); + let l99 = *arg0.add(36).cast::(); + let len100 = l99; + let bytes100 = _rt::Vec::from_raw_parts(l98.cast(), len100, len100); + + _rt::string_lift(bytes100) + }; + Some(e) } - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - input: match l67 { - 0 => None, - 1 => { - let e = { - let l68 = *((arg0 + 24) as *const i32); - let l69 = *((arg0 + 28) as *const i32); - let len70 = l69 as usize; - let bytes70 = Vec::from_raw_parts(l68 as *mut _, len70, len70); - let l71 = i32::from(*((arg0 + 32) as *const u8)); - - super::super::super::super::seed_keeper::wit_ui::wurbo_types::Input{ - placeholder: wit_bindgen::rt::string_lift(bytes70), - encrypted_seed: match l71 { - 0 => None, - 1 => { - let e = { - let l72 = *((arg0 + 36) as *const i32); - let l73 = *((arg0 + 40) as *const i32); - let len74 = l73 as usize; - let bytes74 = Vec::from_raw_parts(l72 as *mut _, len74, len74); - - wit_bindgen::rt::string_lift(bytes74) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, + _ => _rt::invalid_enum_discriminant(), + }, + id: match l101 { + 0 => None, + 1 => { + let e = { + let l102 = *arg0.add(44).cast::<*mut u8>(); + let l103 = *arg0.add(48).cast::(); + let len104 = l103; + let bytes104 = _rt::Vec::from_raw_parts(l102.cast(), len104, len104); + + _rt::string_lift(bytes104) + }; + Some(e) } - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - load: match l75 { - 0 => None, - 1 => { - let e = { - let l76 = *((arg0 + 48) as *const i32); - let l77 = *((arg0 + 52) as *const i32); - let len78 = l77 as usize; - let bytes78 = Vec::from_raw_parts(l76 as *mut _, len78, len78); - - wit_bindgen::rt::string_lift(bytes78) - }; - Some(e) + _ => _rt::invalid_enum_discriminant(), + }, + message: match l105 { + 0 => None, + 1 => { + let e = { + let l106 = *arg0.add(56).cast::<*mut u8>(); + let l107 = *arg0.add(60).cast::(); + let len108 = l107; + let bytes108 = _rt::Vec::from_raw_parts(l106.cast(), len108, len108); + + _rt::string_lift(bytes108) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + signature: match l109 { + 0 => None, + 1 => { + let e = { + let l110 = *arg0.add(68).cast::<*mut u8>(); + let l111 = *arg0.add(72).cast::(); + let len112 = l111; + let bytes112 = _rt::Vec::from_raw_parts(l110.cast(), len112, len112); + + _rt::string_lift(bytes112) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, + }; + Some(e) } - }; - V88::AllContent(e88) + _ => _rt::invalid_enum_discriminant(), + }, } - 1 => { - let e88 = { - let l79 = *((arg0 + 8) as *const i32); - let l80 = *((arg0 + 12) as *const i32); - let len81 = l80 as usize; - let bytes81 = Vec::from_raw_parts(l79 as *mut _, len81, len81); - - wit_bindgen::rt::string_lift(bytes81) - }; - V88::Username(e88) + }; + V119::AllContent(e119) + } + 1 => { + let e119 = { + let l113 = *arg0.add(8).cast::<*mut u8>(); + let l114 = *arg0.add(12).cast::(); + let len115 = l114; + let bytes115 = _rt::Vec::from_raw_parts( + l113.cast(), + len115, + len115, + ); + + _rt::string_lift(bytes115) + }; + V119::Message(e119) + } + n => { + debug_assert_eq!(n, 2, "invalid enum discriminant"); + let e119 = { + let l116 = *arg0.add(8).cast::<*mut u8>(); + let l117 = *arg0.add(12).cast::(); + let len118 = l117; + let bytes118 = _rt::Vec::from_raw_parts( + l116.cast(), + len118, + len118, + ); + + _rt::string_lift(bytes118) + }; + V119::Submit(e119) + } + }; + + v119 + }; + V120::Edwards(e120) } - 2 => { - let e88 = { - let l82 = *((arg0 + 8) as *const i32); - let l83 = *((arg0 + 12) as *const i32); - let len84 = l83 as usize; - let bytes84 = Vec::from_raw_parts(l82 as *mut _, len84, len84); - - wit_bindgen::rt::string_lift(bytes84) - }; - V88::Password(e88) + }; + let result121 = T::render(v120); + _rt::cabi_dealloc(arg0, 136, 4); + let ptr122 = _RET_AREA.0.as_mut_ptr().cast::(); + match result121 { + Ok(e) => { + *ptr122.add(0).cast::() = (0i32) as u8; + let vec123 = (e.into_bytes()).into_boxed_slice(); + let ptr123 = vec123.as_ptr().cast::(); + let len123 = vec123.len(); + ::core::mem::forget(vec123); + *ptr122.add(8).cast::() = len123; + *ptr122.add(4).cast::<*mut u8>() = ptr123.cast_mut(); } - 3 => { - let e88 = { - let l85 = *((arg0 + 8) as *const i32); - let l86 = *((arg0 + 12) as *const i32); - let len87 = l86 as usize; - let bytes87 = Vec::from_raw_parts(l85 as *mut _, len87, len87); - - wit_bindgen::rt::string_lift(bytes87) - }; - V88::Encrypted(e88) + Err(e) => { + *ptr122.add(0).cast::() = (1i32) as u8; + let vec124 = (e.into_bytes()).into_boxed_slice(); + let ptr124 = vec124.as_ptr().cast::(); + let len124 = vec124.len(); + ::core::mem::forget(vec124); + *ptr122.add(8).cast::() = len124; + *ptr122.add(4).cast::<*mut u8>() = ptr124.cast_mut(); } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - V88::Submit - } - }; - - v88 }; - V120::Seed(e120) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e120 = { - let l89 = i32::from(*((arg0 + 4) as *const u8)); - use super::super::super::super::example::edwards_ui::wurbo_types::Context as V119; - let v119 = match l89 { + ptr122 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_render(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { 0 => { - let e119 = { - let l90 = *((arg0 + 8) as *const i32); - let l91 = *((arg0 + 12) as *const i32); - let len92 = l91 as usize; - let bytes92 = Vec::from_raw_parts(l90 as *mut _, len92, len92); - let l93 = *((arg0 + 16) as *const i32); - let l94 = *((arg0 + 20) as *const i32); - let len95 = l94 as usize; - let bytes95 = Vec::from_raw_parts(l93 as *mut _, len95, len95); - let l96 = i32::from(*((arg0 + 24) as *const u8)); - - super::super::super::super::example::edwards_ui::wurbo_types::Content{ - page: super::super::super::super::example::edwards_ui::wurbo_types::Page{ - title: wit_bindgen::rt::string_lift(bytes92), - }, - input: super::super::super::super::example::edwards_ui::wurbo_types::Input{ - placeholder: wit_bindgen::rt::string_lift(bytes95), - }, - output: match l96 { - 0 => None, - 1 => { - let e = { - let l97 = i32::from(*((arg0 + 28) as *const u8)); - let l101 = i32::from(*((arg0 + 40) as *const u8)); - let l105 = i32::from(*((arg0 + 52) as *const u8)); - let l109 = i32::from(*((arg0 + 64) as *const u8)); - - super::super::super::super::example::edwards_ui::wurbo_types::Output{ - value: match l97 { - 0 => None, - 1 => { - let e = { - let l98 = *((arg0 + 32) as *const i32); - let l99 = *((arg0 + 36) as *const i32); - let len100 = l99 as usize; - let bytes100 = Vec::from_raw_parts(l98 as *mut _, len100, len100); - - wit_bindgen::rt::string_lift(bytes100) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - id: match l101 { - 0 => None, - 1 => { - let e = { - let l102 = *((arg0 + 44) as *const i32); - let l103 = *((arg0 + 48) as *const i32); - let len104 = l103 as usize; - let bytes104 = Vec::from_raw_parts(l102 as *mut _, len104, len104); - - wit_bindgen::rt::string_lift(bytes104) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - message: match l105 { - 0 => None, - 1 => { - let e = { - let l106 = *((arg0 + 56) as *const i32); - let l107 = *((arg0 + 60) as *const i32); - let len108 = l107 as usize; - let bytes108 = Vec::from_raw_parts(l106 as *mut _, len108, len108); - - wit_bindgen::rt::string_lift(bytes108) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - signature: match l109 { - 0 => None, - 1 => { - let e = { - let l110 = *((arg0 + 68) as *const i32); - let l111 = *((arg0 + 72) as *const i32); - let len112 = l111 as usize; - let bytes112 = Vec::from_raw_parts(l110 as *mut _, len112, len112); - - wit_bindgen::rt::string_lift(bytes112) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } - }; - V119::AllContent(e119) + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l1, l2, 1); } - 1 => { - let e119 = { - let l113 = *((arg0 + 8) as *const i32); - let l114 = *((arg0 + 12) as *const i32); - let len115 = l114 as usize; - let bytes115 = Vec::from_raw_parts(l113 as *mut _, len115, len115); - - wit_bindgen::rt::string_lift(bytes115) - }; - V119::Message(e119) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e119 = { - let l116 = *((arg0 + 8) as *const i32); - let l117 = *((arg0 + 12) as *const i32); - let len118 = l117 as usize; - let bytes118 = Vec::from_raw_parts(l116 as *mut _, len118, len118); - - wit_bindgen::rt::string_lift(bytes118) - }; - V119::Submit(e119) + _ => { + let l3 = *arg0.add(4).cast::<*mut u8>(); + let l4 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l3, l4, 1); } - }; - - v119 - }; - V120::Edwards(e120) - } - }; - let result121 = <_GuestImpl as Guest>::render(v120); - wit_bindgen::rt::dealloc(arg0, 136, 4); - let ptr122 = _RET_AREA.0.as_mut_ptr() as i32; - match result121 { - Ok(e) => { { - *((ptr122 + 0) as *mut u8) = (0i32) as u8; - let vec123 = (e.into_bytes()).into_boxed_slice(); - let ptr123 = vec123.as_ptr() as i32; - let len123 = vec123.len() as i32; - ::core::mem::forget(vec123); - *((ptr122 + 8) as *mut i32) = len123; - *((ptr122 + 4) as *mut i32) = ptr123; - } }, - Err(e) => { { - *((ptr122 + 0) as *mut u8) = (1i32) as u8; - let vec124 = (e.into_bytes()).into_boxed_slice(); - let ptr124 = vec124.as_ptr() as i32; - let len124 = vec124.len() as i32; - ::core::mem::forget(vec124); - *((ptr122 + 8) as *mut i32) = len124; - *((ptr122 + 4) as *mut i32) = ptr124; - } }, - };ptr122 - } - - const _: () = { + } + } #[doc(hidden)] - #[export_name = "cabi_post_wallet:aggregate-wit-ui/wurbo-out@0.1.0#render"] #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_render(arg0: i32,) { - let l0 = i32::from(*((arg0 + 0) as *const u8)); - match l0 { - 0 => { - let l1 = *((arg0 + 4) as *const i32); - let l2 = *((arg0 + 8) as *const i32); - wit_bindgen::rt::dealloc(l1, (l2) as usize, 1); - }, - _ => { - let l3 = *((arg0 + 4) as *const i32); - let l4 = *((arg0 + 8) as *const i32); - wit_bindgen::rt::dealloc(l3, (l4) as usize, 1); - }, - } + pub unsafe fn _export_activate_cabi( + arg0: i32, + arg1: *mut u8, + arg2: usize, + ) { + T::activate(match arg0 { + 0 => None, + 1 => { + let e = { + let base3 = arg1; + let len3 = arg2; + let mut result3 = _rt::Vec::with_capacity(len3); + for i in 0..len3 { + let base = base3.add(i * 8); + let e3 = { + let l0 = *base.add(0).cast::<*mut u8>(); + let l1 = *base.add(4).cast::(); + let len2 = l1; + let bytes2 = + _rt::Vec::from_raw_parts(l0.cast(), len2, len2); + + _rt::string_lift(bytes2) + }; + result3.push(e3); + } + _rt::cabi_dealloc(base3, len3 * 8, 4); + + result3 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }); } - }; - }; - const _: () = { - - #[doc(hidden)] - #[export_name = "wallet:aggregate-wit-ui/wurbo-out@0.1.0#activate"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_activate(arg0: i32,arg1: i32,arg2: i32,) { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - <_GuestImpl as Guest>::activate(match arg0 { - 0 => None, - 1 => { - let e = { - let base3 = arg1; - let len3 = arg2; - let mut result3 = Vec::with_capacity(len3 as usize); - for i in 0..len3 { - let base = base3 + i * 8; - let e3 = { - let l0 = *((base + 0) as *const i32); - let l1 = *((base + 4) as *const i32); - let len2 = l1 as usize; - let bytes2 = Vec::from_raw_parts(l0 as *mut _, len2, len2); - - wit_bindgen::rt::string_lift(bytes2) - }; - result3.push(e3); - } - wit_bindgen::rt::dealloc(base3, (len3 as usize) * 8, 4); - - result3 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }); - } - }; - use super::super::super::super::super::Component as _GuestImpl; - pub trait Guest { - /// renders the initial Web component with the given data - fn render(ctx: Context,) -> Result; - /// listen on all or given selectors - fn activate(selectors: Option>,); + pub trait Guest { + /// renders the initial Web component with the given data + fn render(ctx: Context) -> Result<_rt::String, _rt::String>; + /// listen on all or given selectors + fn activate(selectors: Option<_rt::Vec<_rt::String>>); + } + #[doc(hidden)] + + macro_rules! __export_wallet_aggregate_wit_ui_wurbo_out_0_1_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "wallet:aggregate-wit-ui/wurbo-out@0.1.0#render"] + unsafe extern "C" fn export_render(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_render_cabi::<$ty>(arg0) } - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - #[repr(align(4))] - struct _RetArea([u8; 12]); - static mut _RET_AREA: _RetArea = _RetArea([0; 12]); - - } - - - #[allow(clippy::all)] - pub mod aggregation { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_section; - const _: () = { - - #[doc(hidden)] - #[export_name = "wallet:aggregate-wit-ui/aggregation@0.1.0#activates"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_activates(arg0: i32,arg1: i32,arg2: i32,) { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - <_GuestImpl as Guest>::activates(match arg0 { - 0 => None, - 1 => { - let e = { - let base3 = arg1; - let len3 = arg2; - let mut result3 = Vec::with_capacity(len3 as usize); - for i in 0..len3 { - let base = base3 + i * 8; - let e3 = { - let l0 = *((base + 0) as *const i32); - let l1 = *((base + 4) as *const i32); - let len2 = l1 as usize; - let bytes2 = Vec::from_raw_parts(l0 as *mut _, len2, len2); - - wit_bindgen::rt::string_lift(bytes2) - }; - result3.push(e3); - } - wit_bindgen::rt::dealloc(base3, (len3 as usize) * 8, 4); - - result3 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }); - } - }; - use super::super::super::super::super::Component as _GuestImpl; - pub trait Guest { - /// calls activate on on the child components - fn activates(selectors: Option>,); + #[export_name = "cabi_post_wallet:aggregate-wit-ui/wurbo-out@0.1.0#render"] + unsafe extern "C" fn _post_return_render(arg0: *mut u8,) { + $($path_to_types)*::__post_return_render::<$ty>(arg0) } - - } - + #[export_name = "wallet:aggregate-wit-ui/wurbo-out@0.1.0#activate"] + unsafe extern "C" fn export_activate(arg0: i32,arg1: *mut u8,arg2: usize,) { + $($path_to_types)*::_export_activate_cabi::<$ty>(arg0, arg1, arg2) + } + };); } + #[doc(hidden)] + pub(crate) use __export_wallet_aggregate_wit_ui_wurbo_out_0_1_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 12]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 12]); + } + + #[allow(clippy::all)] + pub mod aggregation { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_activates_cabi( + arg0: i32, + arg1: *mut u8, + arg2: usize, + ) { + T::activates(match arg0 { + 0 => None, + 1 => { + let e = { + let base3 = arg1; + let len3 = arg2; + let mut result3 = _rt::Vec::with_capacity(len3); + for i in 0..len3 { + let base = base3.add(i * 8); + let e3 = { + let l0 = *base.add(0).cast::<*mut u8>(); + let l1 = *base.add(4).cast::(); + let len2 = l1; + let bytes2 = + _rt::Vec::from_raw_parts(l0.cast(), len2, len2); + + _rt::string_lift(bytes2) + }; + result3.push(e3); + } + _rt::cabi_dealloc(base3, len3 * 8, 4); + + result3 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }); + } + pub trait Guest { + /// calls activate on on the child components + fn activates(selectors: Option<_rt::Vec<_rt::String>>); + } + #[doc(hidden)] + + macro_rules! __export_wallet_aggregate_wit_ui_aggregation_0_1_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "wallet:aggregate-wit-ui/aggregation@0.1.0#activates"] + unsafe extern "C" fn export_activates(arg0: i32,arg1: *mut u8,arg2: usize,) { + $($path_to_types)*::_export_activates_cabi::<$ty>(arg0, arg1, arg2) + } + };); } + #[doc(hidden)] + pub(crate) use __export_wallet_aggregate_wit_ui_aggregation_0_1_0_cabi; + } + } + } +} +mod _rt { + pub use alloc_crate::alloc; + pub use alloc_crate::string::String; + pub use alloc_crate::vec::Vec; + pub unsafe fn string_lift(bytes: Vec) -> String { + if cfg!(debug_assertions) { + String::from_utf8(bytes).unwrap() + } else { + String::from_utf8_unchecked(bytes) + } + } + pub unsafe fn invalid_enum_discriminant() -> T { + if cfg!(debug_assertions) { + panic!("invalid enum discriminant") + } else { + core::hint::unreachable_unchecked() + } + } + pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) { + if size == 0 { + return; + } + let layout = alloc::Layout::from_size_align_unchecked(size, align); + alloc::dealloc(ptr as *mut u8, layout); } - - #[cfg(target_arch = "wasm32")] - #[link_section = "component-type:agg"] - #[doc(hidden)] - pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 5915] = [3, 0, 3, 97, 103, 103, 0, 97, 115, 109, 13, 0, 1, 0, 7, 200, 7, 1, 65, 14, 1, 66, 14, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 2, 1, 114, 1, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 4, 1, 107, 115, 1, 114, 4, 5, 118, 97, 108, 117, 101, 6, 2, 105, 100, 6, 7, 109, 101, 115, 115, 97, 103, 101, 6, 9, 115, 105, 103, 110, 97, 116, 117, 114, 101, 6, 4, 0, 6, 111, 117, 116, 112, 117, 116, 3, 0, 7, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 3, 5, 105, 110, 112, 117, 116, 5, 6, 111, 117, 116, 112, 117, 116, 9, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 10, 1, 113, 3, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 11, 0, 7, 109, 101, 115, 115, 97, 103, 101, 1, 115, 0, 6, 115, 117, 98, 109, 105, 116, 1, 115, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 12, 3, 1, 36, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 2, 3, 0, 0, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 2, 2, 3, 2, 1, 1, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 3, 1, 34, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 2, 1, 66, 15, 1, 115, 4, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 3, 0, 0, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 2, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 4, 1, 107, 115, 1, 114, 2, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 14, 101, 110, 99, 114, 121, 112, 116, 101, 100, 45, 115, 101, 101, 100, 6, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 7, 1, 107, 5, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 9, 5, 105, 110, 112, 117, 116, 10, 4, 108, 111, 97, 100, 6, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 11, 1, 113, 5, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 12, 0, 8, 117, 115, 101, 114, 110, 97, 109, 101, 1, 115, 0, 8, 112, 97, 115, 115, 119, 111, 114, 100, 1, 115, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 1, 0, 6, 115, 117, 98, 109, 105, 116, 0, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 13, 3, 1, 36, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 3, 2, 3, 0, 2, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 2, 2, 3, 2, 1, 4, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 3, 1, 34, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 5, 2, 3, 0, 1, 7, 99, 111, 110, 116, 101, 120, 116, 2, 3, 0, 3, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 12, 2, 3, 2, 1, 6, 4, 0, 15, 101, 100, 119, 97, 114, 100, 115, 45, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 2, 3, 2, 1, 7, 4, 0, 12, 115, 101, 101, 100, 45, 99, 111, 110, 116, 101, 120, 116, 3, 0, 2, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 4, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 3, 97, 112, 112, 3, 0, 6, 1, 114, 3, 3, 97, 112, 112, 7, 7, 115, 101, 101, 100, 45, 117, 105, 3, 10, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 1, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 8, 1, 113, 3, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 9, 0, 4, 115, 101, 101, 100, 1, 3, 0, 7, 101, 100, 119, 97, 114, 100, 115, 1, 1, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 10, 4, 1, 41, 119, 97, 108, 108, 101, 116, 58, 97, 103, 103, 114, 101, 103, 97, 116, 101, 45, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 8, 11, 17, 1, 0, 11, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 3, 0, 0, 7, 88, 1, 65, 2, 1, 66, 4, 1, 112, 115, 1, 107, 0, 1, 64, 1, 9, 115, 101, 108, 101, 99, 116, 111, 114, 115, 1, 1, 0, 4, 0, 9, 97, 99, 116, 105, 118, 97, 116, 101, 115, 1, 2, 4, 1, 41, 119, 97, 108, 108, 101, 116, 58, 97, 103, 103, 114, 101, 103, 97, 116, 101, 45, 119, 105, 116, 45, 117, 105, 47, 97, 103, 103, 114, 101, 103, 97, 116, 105, 111, 110, 64, 48, 46, 49, 46, 48, 5, 0, 11, 17, 1, 0, 11, 97, 103, 103, 114, 101, 103, 97, 116, 105, 111, 110, 3, 2, 0, 7, 197, 8, 1, 65, 17, 1, 66, 14, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 2, 1, 114, 1, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 4, 1, 107, 115, 1, 114, 4, 5, 118, 97, 108, 117, 101, 6, 2, 105, 100, 6, 7, 109, 101, 115, 115, 97, 103, 101, 6, 9, 115, 105, 103, 110, 97, 116, 117, 114, 101, 6, 4, 0, 6, 111, 117, 116, 112, 117, 116, 3, 0, 7, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 3, 5, 105, 110, 112, 117, 116, 5, 6, 111, 117, 116, 112, 117, 116, 9, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 10, 1, 113, 3, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 11, 0, 7, 109, 101, 115, 115, 97, 103, 101, 1, 115, 0, 6, 115, 117, 98, 109, 105, 116, 1, 115, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 12, 3, 1, 36, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 2, 3, 0, 0, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 2, 2, 3, 2, 1, 1, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 3, 1, 34, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 2, 1, 66, 15, 1, 115, 4, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 3, 0, 0, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 2, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 4, 1, 107, 115, 1, 114, 2, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 14, 101, 110, 99, 114, 121, 112, 116, 101, 100, 45, 115, 101, 101, 100, 6, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 7, 1, 107, 5, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 9, 5, 105, 110, 112, 117, 116, 10, 4, 108, 111, 97, 100, 6, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 11, 1, 113, 5, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 12, 0, 8, 117, 115, 101, 114, 110, 97, 109, 101, 1, 115, 0, 8, 112, 97, 115, 115, 119, 111, 114, 100, 1, 115, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 1, 0, 6, 115, 117, 98, 109, 105, 116, 0, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 13, 3, 1, 36, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 3, 2, 3, 0, 2, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 2, 2, 3, 2, 1, 4, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 3, 1, 34, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 5, 2, 3, 0, 1, 7, 99, 111, 110, 116, 101, 120, 116, 2, 3, 0, 3, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 12, 2, 3, 2, 1, 6, 4, 0, 15, 101, 100, 119, 97, 114, 100, 115, 45, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 2, 3, 2, 1, 7, 4, 0, 12, 115, 101, 101, 100, 45, 99, 111, 110, 116, 101, 120, 116, 3, 0, 2, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 4, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 3, 97, 112, 112, 3, 0, 6, 1, 114, 3, 3, 97, 112, 112, 7, 7, 115, 101, 101, 100, 45, 117, 105, 3, 10, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 1, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 8, 1, 113, 3, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 9, 0, 4, 115, 101, 101, 100, 1, 3, 0, 7, 101, 100, 119, 97, 114, 100, 115, 1, 1, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 10, 3, 1, 41, 119, 97, 108, 108, 101, 116, 58, 97, 103, 103, 114, 101, 103, 97, 116, 101, 45, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 8, 2, 3, 0, 4, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 1, 66, 4, 2, 3, 2, 1, 9, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 64, 1, 7, 100, 101, 116, 97, 105, 108, 115, 1, 1, 0, 4, 0, 16, 97, 100, 100, 101, 118, 101, 110, 116, 108, 105, 115, 116, 101, 110, 101, 114, 1, 2, 4, 1, 38, 119, 97, 108, 108, 101, 116, 58, 97, 103, 103, 114, 101, 103, 97, 116, 101, 45, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 105, 110, 64, 48, 46, 49, 46, 48, 5, 10, 11, 14, 1, 0, 8, 119, 117, 114, 98, 111, 45, 105, 110, 3, 4, 0, 7, 211, 8, 1, 65, 17, 1, 66, 14, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 2, 1, 114, 1, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 4, 1, 107, 115, 1, 114, 4, 5, 118, 97, 108, 117, 101, 6, 2, 105, 100, 6, 7, 109, 101, 115, 115, 97, 103, 101, 6, 9, 115, 105, 103, 110, 97, 116, 117, 114, 101, 6, 4, 0, 6, 111, 117, 116, 112, 117, 116, 3, 0, 7, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 3, 5, 105, 110, 112, 117, 116, 5, 6, 111, 117, 116, 112, 117, 116, 9, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 10, 1, 113, 3, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 11, 0, 7, 109, 101, 115, 115, 97, 103, 101, 1, 115, 0, 6, 115, 117, 98, 109, 105, 116, 1, 115, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 12, 3, 1, 36, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 2, 3, 0, 0, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 2, 2, 3, 2, 1, 1, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 3, 1, 34, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 2, 1, 66, 15, 1, 115, 4, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 3, 0, 0, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 2, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 4, 1, 107, 115, 1, 114, 2, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 14, 101, 110, 99, 114, 121, 112, 116, 101, 100, 45, 115, 101, 101, 100, 6, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 7, 1, 107, 5, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 9, 5, 105, 110, 112, 117, 116, 10, 4, 108, 111, 97, 100, 6, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 11, 1, 113, 5, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 12, 0, 8, 117, 115, 101, 114, 110, 97, 109, 101, 1, 115, 0, 8, 112, 97, 115, 115, 119, 111, 114, 100, 1, 115, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 1, 0, 6, 115, 117, 98, 109, 105, 116, 0, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 13, 3, 1, 36, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 3, 2, 3, 0, 2, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 2, 2, 3, 2, 1, 4, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 3, 1, 34, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 5, 2, 3, 0, 1, 7, 99, 111, 110, 116, 101, 120, 116, 2, 3, 0, 3, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 12, 2, 3, 2, 1, 6, 4, 0, 15, 101, 100, 119, 97, 114, 100, 115, 45, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 2, 3, 2, 1, 7, 4, 0, 12, 115, 101, 101, 100, 45, 99, 111, 110, 116, 101, 120, 116, 3, 0, 2, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 4, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 3, 97, 112, 112, 3, 0, 6, 1, 114, 3, 3, 97, 112, 112, 7, 7, 115, 101, 101, 100, 45, 117, 105, 3, 10, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 1, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 8, 1, 113, 3, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 9, 0, 4, 115, 101, 101, 100, 1, 3, 0, 7, 101, 100, 119, 97, 114, 100, 115, 1, 1, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 10, 3, 1, 41, 119, 97, 108, 108, 101, 116, 58, 97, 103, 103, 114, 101, 103, 97, 116, 101, 45, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 8, 2, 3, 0, 4, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 9, 2, 3, 2, 1, 9, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 1, 106, 1, 115, 1, 115, 1, 64, 1, 3, 99, 116, 120, 1, 0, 2, 4, 0, 6, 114, 101, 110, 100, 101, 114, 1, 3, 1, 112, 115, 1, 107, 4, 1, 64, 1, 9, 115, 101, 108, 101, 99, 116, 111, 114, 115, 5, 1, 0, 4, 0, 8, 97, 99, 116, 105, 118, 97, 116, 101, 1, 6, 4, 1, 39, 119, 97, 108, 108, 101, 116, 58, 97, 103, 103, 114, 101, 103, 97, 116, 101, 45, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 10, 11, 15, 1, 0, 9, 119, 117, 114, 98, 111, 45, 111, 117, 116, 3, 6, 0, 7, 202, 11, 1, 65, 2, 1, 65, 22, 1, 66, 14, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 2, 1, 114, 1, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 4, 1, 107, 115, 1, 114, 4, 5, 118, 97, 108, 117, 101, 6, 2, 105, 100, 6, 7, 109, 101, 115, 115, 97, 103, 101, 6, 9, 115, 105, 103, 110, 97, 116, 117, 114, 101, 6, 4, 0, 6, 111, 117, 116, 112, 117, 116, 3, 0, 7, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 3, 5, 105, 110, 112, 117, 116, 5, 6, 111, 117, 116, 112, 117, 116, 9, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 10, 1, 113, 3, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 11, 0, 7, 109, 101, 115, 115, 97, 103, 101, 1, 115, 0, 6, 115, 117, 98, 109, 105, 116, 1, 115, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 12, 3, 1, 36, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 2, 3, 0, 0, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 9, 2, 3, 2, 1, 1, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 1, 106, 1, 115, 1, 115, 1, 64, 1, 3, 99, 116, 120, 1, 0, 2, 4, 0, 6, 114, 101, 110, 100, 101, 114, 1, 3, 1, 112, 115, 1, 107, 4, 1, 64, 1, 9, 115, 101, 108, 101, 99, 116, 111, 114, 115, 5, 1, 0, 4, 0, 8, 97, 99, 116, 105, 118, 97, 116, 101, 1, 6, 3, 1, 34, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 2, 1, 66, 15, 1, 115, 4, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 3, 0, 0, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 2, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 4, 1, 107, 115, 1, 114, 2, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 14, 101, 110, 99, 114, 121, 112, 116, 101, 100, 45, 115, 101, 101, 100, 6, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 7, 1, 107, 5, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 9, 5, 105, 110, 112, 117, 116, 10, 4, 108, 111, 97, 100, 6, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 11, 1, 113, 5, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 12, 0, 8, 117, 115, 101, 114, 110, 97, 109, 101, 1, 115, 0, 8, 112, 97, 115, 115, 119, 111, 114, 100, 1, 115, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 1, 0, 6, 115, 117, 98, 109, 105, 116, 0, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 13, 3, 1, 36, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 3, 2, 3, 0, 2, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 9, 2, 3, 2, 1, 4, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 1, 106, 1, 115, 1, 115, 1, 64, 1, 3, 99, 116, 120, 1, 0, 2, 4, 0, 6, 114, 101, 110, 100, 101, 114, 1, 3, 1, 112, 115, 1, 107, 4, 1, 64, 1, 9, 115, 101, 108, 101, 99, 116, 111, 114, 115, 5, 1, 0, 4, 0, 8, 97, 99, 116, 105, 118, 97, 116, 101, 1, 6, 3, 1, 34, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 5, 2, 3, 0, 1, 7, 99, 111, 110, 116, 101, 120, 116, 2, 3, 0, 3, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 12, 2, 3, 2, 1, 6, 4, 0, 15, 101, 100, 119, 97, 114, 100, 115, 45, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 2, 3, 2, 1, 7, 4, 0, 12, 115, 101, 101, 100, 45, 99, 111, 110, 116, 101, 120, 116, 3, 0, 2, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 4, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 3, 97, 112, 112, 3, 0, 6, 1, 114, 3, 3, 97, 112, 112, 7, 7, 115, 101, 101, 100, 45, 117, 105, 3, 10, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 1, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 8, 1, 113, 3, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 9, 0, 4, 115, 101, 101, 100, 1, 3, 0, 7, 101, 100, 119, 97, 114, 100, 115, 1, 1, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 10, 3, 1, 41, 119, 97, 108, 108, 101, 116, 58, 97, 103, 103, 114, 101, 103, 97, 116, 101, 45, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 8, 2, 3, 0, 4, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 1, 66, 4, 2, 3, 2, 1, 9, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 64, 1, 7, 100, 101, 116, 97, 105, 108, 115, 1, 1, 0, 4, 0, 16, 97, 100, 100, 101, 118, 101, 110, 116, 108, 105, 115, 116, 101, 110, 101, 114, 1, 2, 3, 1, 38, 119, 97, 108, 108, 101, 116, 58, 97, 103, 103, 114, 101, 103, 97, 116, 101, 45, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 105, 110, 64, 48, 46, 49, 46, 48, 5, 10, 2, 3, 0, 4, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 9, 2, 3, 2, 1, 11, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 1, 106, 1, 115, 1, 115, 1, 64, 1, 3, 99, 116, 120, 1, 0, 2, 4, 0, 6, 114, 101, 110, 100, 101, 114, 1, 3, 1, 112, 115, 1, 107, 4, 1, 64, 1, 9, 115, 101, 108, 101, 99, 116, 111, 114, 115, 5, 1, 0, 4, 0, 8, 97, 99, 116, 105, 118, 97, 116, 101, 1, 6, 4, 1, 39, 119, 97, 108, 108, 101, 116, 58, 97, 103, 103, 114, 101, 103, 97, 116, 101, 45, 119, 105, 116, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 12, 1, 66, 4, 1, 112, 115, 1, 107, 0, 1, 64, 1, 9, 115, 101, 108, 101, 99, 116, 111, 114, 115, 1, 1, 0, 4, 0, 9, 97, 99, 116, 105, 118, 97, 116, 101, 115, 1, 2, 4, 1, 41, 119, 97, 108, 108, 101, 116, 58, 97, 103, 103, 114, 101, 103, 97, 116, 101, 45, 119, 105, 116, 45, 117, 105, 47, 97, 103, 103, 114, 101, 103, 97, 116, 105, 111, 110, 64, 48, 46, 49, 46, 48, 5, 13, 4, 1, 33, 119, 97, 108, 108, 101, 116, 58, 97, 103, 103, 114, 101, 103, 97, 116, 101, 45, 119, 105, 116, 45, 117, 105, 47, 97, 103, 103, 64, 48, 46, 49, 46, 48, 4, 0, 11, 9, 1, 0, 3, 97, 103, 103, 3, 8, 0, 0, 224, 7, 12, 112, 97, 99, 107, 97, 103, 101, 45, 100, 111, 99, 115, 0, 123, 34, 100, 111, 99, 115, 34, 58, 34, 78, 111, 110, 101, 32, 111, 102, 32, 116, 104, 101, 32, 100, 101, 112, 115, 32, 99, 97, 110, 32, 104, 97, 118, 101, 32, 116, 104, 101, 32, 115, 97, 109, 101, 32, 112, 97, 99, 107, 97, 103, 101, 32, 110, 97, 109, 101, 32, 97, 115, 32, 116, 104, 105, 115, 32, 112, 97, 99, 107, 97, 103, 101, 44, 32, 105, 116, 32, 99, 111, 110, 102, 108, 105, 99, 116, 115, 46, 32, 83, 111, 32, 119, 101, 32, 110, 101, 101, 100, 32, 116, 111, 32, 107, 101, 101, 112, 32, 99, 104, 97, 110, 103, 105, 110, 103, 32, 110, 97, 109, 101, 115, 112, 97, 99, 101, 115, 46, 34, 44, 34, 119, 111, 114, 108, 100, 115, 34, 58, 123, 34, 97, 103, 103, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 65, 110, 32, 101, 120, 97, 109, 112, 108, 101, 32, 119, 111, 114, 108, 100, 32, 102, 111, 114, 32, 116, 104, 101, 32, 99, 111, 109, 112, 111, 110, 101, 110, 116, 32, 116, 111, 32, 116, 97, 114, 103, 101, 116, 46, 34, 125, 125, 44, 34, 105, 110, 116, 101, 114, 102, 97, 99, 101, 115, 34, 58, 123, 34, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 34, 58, 123, 34, 116, 121, 112, 101, 115, 34, 58, 123, 34, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 68, 101, 116, 97, 105, 108, 115, 32, 114, 101, 113, 117, 105, 114, 101, 100, 32, 105, 110, 32, 111, 114, 100, 101, 114, 32, 116, 111, 32, 97, 100, 100, 32, 97, 110, 32, 101, 118, 101, 110, 116, 32, 108, 105, 115, 116, 101, 110, 101, 114, 32, 116, 111, 32, 97, 110, 32, 101, 108, 101, 109, 101, 110, 116, 34, 125, 44, 34, 97, 112, 112, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 67, 111, 110, 116, 101, 120, 116, 32, 102, 111, 114, 32, 116, 104, 101, 32, 109, 105, 110, 105, 106, 105, 110, 106, 97, 32, 114, 101, 110, 100, 101, 114, 105, 110, 103, 34, 125, 44, 34, 99, 111, 110, 116, 101, 110, 116, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 67, 111, 110, 116, 101, 110, 116, 32, 114, 101, 99, 111, 114, 100, 32, 102, 111, 114, 32, 116, 104, 101, 32, 105, 110, 105, 116, 105, 97, 108, 32, 99, 111, 110, 116, 101, 110, 116, 32, 111, 102, 32, 116, 104, 101, 32, 101, 110, 116, 105, 114, 101, 32, 97, 112, 112, 34, 44, 34, 105, 116, 101, 109, 115, 34, 58, 123, 34, 97, 112, 112, 34, 58, 34, 112, 97, 115, 115, 32, 105, 110, 32, 112, 114, 111, 112, 115, 32, 108, 105, 107, 101, 32, 116, 105, 116, 108, 101, 44, 32, 101, 116, 99, 46, 34, 44, 34, 115, 101, 101, 100, 45, 117, 105, 34, 58, 34, 111, 112, 116, 105, 111, 110, 97, 108, 108, 121, 32, 112, 97, 115, 115, 32, 105, 110, 32, 97, 110, 32, 101, 110, 99, 114, 121, 112, 116, 101, 100, 32, 115, 101, 101, 100, 32, 116, 111, 32, 108, 111, 97, 100, 34, 44, 34, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 34, 58, 34, 111, 112, 116, 105, 111, 110, 97, 108, 108, 121, 32, 112, 97, 115, 115, 32, 105, 110, 32, 97, 32, 109, 101, 115, 115, 97, 103, 101, 32, 116, 111, 32, 115, 105, 103, 110, 32, 111, 114, 32, 118, 101, 114, 105, 102, 121, 34, 125, 125, 44, 34, 99, 111, 110, 116, 101, 120, 116, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 67, 111, 110, 116, 101, 120, 116, 32, 118, 97, 114, 105, 97, 110, 116, 115, 34, 125, 125, 125, 44, 34, 97, 103, 103, 114, 101, 103, 97, 116, 105, 111, 110, 34, 58, 123, 34, 102, 117, 110, 99, 115, 34, 58, 123, 34, 97, 99, 116, 105, 118, 97, 116, 101, 115, 34, 58, 34, 99, 97, 108, 108, 115, 32, 97, 99, 116, 105, 118, 97, 116, 101, 32, 111, 110, 32, 111, 110, 32, 116, 104, 101, 32, 99, 104, 105, 108, 100, 32, 99, 111, 109, 112, 111, 110, 101, 110, 116, 115, 34, 125, 125, 44, 34, 119, 117, 114, 98, 111, 45, 105, 110, 34, 58, 123, 34, 102, 117, 110, 99, 115, 34, 58, 123, 34, 97, 100, 100, 101, 118, 101, 110, 116, 108, 105, 115, 116, 101, 110, 101, 114, 34, 58, 34, 65, 100, 100, 32, 97, 110, 32, 101, 118, 101, 110, 116, 32, 108, 105, 115, 116, 101, 110, 101, 114, 32, 116, 111, 32, 116, 104, 101, 32, 103, 105, 118, 101, 110, 32, 101, 108, 101, 109, 101, 110, 116, 34, 125, 125, 44, 34, 119, 117, 114, 98, 111, 45, 111, 117, 116, 34, 58, 123, 34, 102, 117, 110, 99, 115, 34, 58, 123, 34, 114, 101, 110, 100, 101, 114, 34, 58, 34, 114, 101, 110, 100, 101, 114, 115, 32, 116, 104, 101, 32, 105, 110, 105, 116, 105, 97, 108, 32, 87, 101, 98, 32, 99, 111, 109, 112, 111, 110, 101, 110, 116, 32, 119, 105, 116, 104, 32, 116, 104, 101, 32, 103, 105, 118, 101, 110, 32, 100, 97, 116, 97, 34, 44, 34, 97, 99, 116, 105, 118, 97, 116, 101, 34, 58, 34, 108, 105, 115, 116, 101, 110, 32, 111, 110, 32, 97, 108, 108, 32, 111, 114, 32, 103, 105, 118, 101, 110, 32, 115, 101, 108, 101, 99, 116, 111, 114, 115, 34, 125, 125, 125, 125, 0, 70, 9, 112, 114, 111, 100, 117, 99, 101, 114, 115, 1, 12, 112, 114, 111, 99, 101, 115, 115, 101, 100, 45, 98, 121, 2, 13, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 6, 48, 46, 49, 56, 46, 50, 16, 119, 105, 116, 45, 98, 105, 110, 100, 103, 101, 110, 45, 114, 117, 115, 116, 6, 48, 46, 49, 54, 46, 48]; - - #[inline(never)] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - pub fn __link_section() {} - \ No newline at end of file + extern crate alloc as alloc_crate; +} + +/// Generates `#[no_mangle]` functions to export the specified type as the +/// root implementation of all generated traits. +/// +/// For more information see the documentation of `wit_bindgen::generate!`. +/// +/// ```rust +/// # macro_rules! export{ ($($t:tt)*) => (); } +/// # trait Guest {} +/// struct MyType; +/// +/// impl Guest for MyType { +/// // ... +/// } +/// +/// export!(MyType); +/// ``` +#[allow(unused_macros)] +#[doc(hidden)] + +macro_rules! __export_agg_impl { + ($ty:ident) => (self::export!($ty with_types_in self);); + ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( + $($path_to_types_root)*::exports::wallet::aggregate_wit_ui::wurbo_out::__export_wallet_aggregate_wit_ui_wurbo_out_0_1_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wallet::aggregate_wit_ui::wurbo_out); + $($path_to_types_root)*::exports::wallet::aggregate_wit_ui::aggregation::__export_wallet_aggregate_wit_ui_aggregation_0_1_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wallet::aggregate_wit_ui::aggregation); + ) +} +#[doc(inline)] +pub(crate) use __export_agg_impl as export; + +#[cfg(target_arch = "wasm32")] +#[link_section = "component-type:wit-bindgen:0.21.0:agg:encoded world"] +#[doc(hidden)] +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1647] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xf5\x0b\x01A\x02\x01\ +A\x16\x01B\x0e\x01r\x02\x08selectors\x02tys\x04\0\x0elisten-details\x03\0\0\x01r\ +\x01\x05titles\x04\0\x04page\x03\0\x02\x01r\x01\x0bplaceholders\x04\0\x05input\x03\ +\0\x04\x01ks\x01r\x04\x05value\x06\x02id\x06\x07message\x06\x09signature\x06\x04\ +\0\x06output\x03\0\x07\x01k\x08\x01r\x03\x04page\x03\x05input\x05\x06output\x09\x04\ +\0\x07content\x03\0\x0a\x01q\x03\x0ball-content\x01\x0b\0\x07message\x01s\0\x06s\ +ubmit\x01s\0\x04\0\x07context\x03\0\x0c\x03\x01$example:edwards-ui/wurbo-types@0\ +.1.0\x05\0\x02\x03\0\0\x07context\x01B\x0e\x02\x03\x02\x01\x01\x04\0\x07context\x03\ +\0\0\x01ps\x01k\x02\x01@\x01\x09selectors\x03\x01\0\x04\0\x08activate\x01\x04\x01\ +j\x01s\x01s\x01@\x01\x03ctx\x01\0\x05\x04\0\x06render\x01\x06\x01o\x02ss\x01p\x07\ +\x01j\0\x01s\x01@\x01\x09templates\x08\0\x09\x04\0\x09customize\x01\x0a\x03\x01\"\ +example:edwards-ui/wurbo-out@0.1.0\x05\x02\x01B\x0f\x01s\x04\0\x09encrypted\x03\0\ +\0\x01r\x02\x08selectors\x02tys\x04\0\x0elisten-details\x03\0\x02\x01r\x01\x05ti\ +tles\x04\0\x04page\x03\0\x04\x01ks\x01r\x02\x0bplaceholders\x0eencrypted-seed\x06\ +\x04\0\x05input\x03\0\x07\x01k\x05\x01k\x08\x01r\x03\x04page\x09\x05input\x0a\x04\ +load\x06\x04\0\x07content\x03\0\x0b\x01q\x05\x0ball-content\x01\x0c\0\x08usernam\ +e\x01s\0\x08password\x01s\0\x09encrypted\x01\x01\0\x06submit\0\0\x04\0\x07contex\ +t\x03\0\x0d\x03\x01$seed-keeper:wit-ui/wurbo-types@0.1.0\x05\x03\x02\x03\0\x02\x07\ +context\x01B\x09\x02\x03\x02\x01\x04\x04\0\x07context\x03\0\0\x01j\x01s\x01s\x01\ +@\x01\x03ctx\x01\0\x02\x04\0\x06render\x01\x03\x01ps\x01k\x04\x01@\x01\x09select\ +ors\x05\x01\0\x04\0\x08activate\x01\x06\x03\x01\"seed-keeper:wit-ui/wurbo-out@0.\ +1.0\x05\x05\x02\x03\0\x01\x07context\x02\x03\0\x03\x07context\x01B\x0c\x02\x03\x02\ +\x01\x06\x04\0\x0fedwards-context\x03\0\0\x02\x03\x02\x01\x07\x04\0\x0cseed-cont\ +ext\x03\0\x02\x01r\x02\x08selectors\x02tys\x04\0\x0elisten-details\x03\0\x04\x01\ +r\x01\x05titles\x04\0\x03app\x03\0\x06\x01r\x03\x03app\x07\x07seed-ui\x03\x0aedw\ +ards-ui\x01\x04\0\x07content\x03\0\x08\x01q\x03\x0ball-content\x01\x09\0\x04seed\ +\x01\x03\0\x07edwards\x01\x01\0\x04\0\x07context\x03\0\x0a\x03\x01)wallet:aggreg\ +ate-wit-ui/wurbo-types@0.1.0\x05\x08\x02\x03\0\x04\x0elisten-details\x01B\x04\x02\ +\x03\x02\x01\x09\x04\0\x0elisten-details\x03\0\0\x01@\x01\x07details\x01\x01\0\x04\ +\0\x10addeventlistener\x01\x02\x03\x01&wallet:aggregate-wit-ui/wurbo-in@0.1.0\x05\ +\x0a\x02\x03\0\x04\x07context\x01B\x09\x02\x03\x02\x01\x0b\x04\0\x07context\x03\0\ +\0\x01j\x01s\x01s\x01@\x01\x03ctx\x01\0\x02\x04\0\x06render\x01\x03\x01ps\x01k\x04\ +\x01@\x01\x09selectors\x05\x01\0\x04\0\x08activate\x01\x06\x04\x01'wallet:aggreg\ +ate-wit-ui/wurbo-out@0.1.0\x05\x0c\x01B\x04\x01ps\x01k\0\x01@\x01\x09selectors\x01\ +\x01\0\x04\0\x09activates\x01\x02\x04\x01)wallet:aggregate-wit-ui/aggregation@0.\ +1.0\x05\x0d\x04\x01!wallet:aggregate-wit-ui/agg@0.1.0\x04\0\x0b\x09\x01\0\x03agg\ +\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.201.0\x10\ +wit-bindgen-rust\x060.21.0"; + +#[inline(never)] +#[doc(hidden)] +#[cfg(target_arch = "wasm32")] +pub fn __link_custom_section_describing_imports() { + wit_bindgen_rt::maybe_link_cabi_realloc(); +} diff --git a/examples/crates/aggregate-wit-ui/src/lib.rs b/examples/crates/aggregate-wit-ui/src/lib.rs index f9b3cdc..4f5a938 100644 --- a/examples/crates/aggregate-wit-ui/src/lib.rs +++ b/examples/crates/aggregate-wit-ui/src/lib.rs @@ -16,6 +16,7 @@ //! Each child component takes care of its own inputs/output, so the Router doesn't //! need to worry about it. //! +#[allow(warnings)] mod bindings; use crate::bindings::exports::wallet::aggregate_wit_ui::wurbo_out::Guest as WurboGuest; @@ -24,7 +25,6 @@ use bindings::example::edwards_ui; use bindings::exports::wallet::aggregate_wit_ui::aggregation::Guest as AggregationGuest; use bindings::seed_keeper::wit_ui; -use minijinja::Environment; use wurbo::jinja::{error::RenderError, Entry, Index, Rest, Templates}; use wurbo::prelude::*; @@ -32,6 +32,8 @@ use std::ops::Deref; struct Component; +bindings::export!(Component with_types_in bindings); + /// We need to provide the templates for the macro to pull in fn get_templates() -> Templates { Templates::new( @@ -48,11 +50,11 @@ impl WurboGuest for Component { let html = match context { Context::AllContent(ctx) => { let templates = get_templates(); - let entry = templates.entry.name; + let entry = templates.entry.name.clone(); let mut env = Environment::new(); for (name, template) in templates.into_iter() { - env.add_template(name, template) + env.add_template_owned(name.clone(), template.clone()) .expect("template should be added"); } @@ -68,7 +70,7 @@ impl WurboGuest for Component { RenderError::from(e) }; - let tmpl = env.get_template(entry).map_err(prnt_err)?; + let tmpl = env.get_template(&entry).map_err(prnt_err)?; let rendered = tmpl.render(&struct_ctx).map_err(prnt_err)?; rendered } diff --git a/examples/crates/aggregate-wit-ui/tests/mod.rs b/examples/crates/aggregate-wit-ui/tests/mod.rs index ac11627..40541e1 100644 --- a/examples/crates/aggregate-wit-ui/tests/mod.rs +++ b/examples/crates/aggregate-wit-ui/tests/mod.rs @@ -61,6 +61,13 @@ impl bindgen::example::edwards_ui::wurbo_out::Host for MyCtx { fn activate(&mut self, _selectors: Option>) -> wasmtime::Result<()> { Ok(()) } + + fn customize( + &mut self, + _templates: Vec<(String, String)>, + ) -> wasmtime::Result> { + Ok(Ok(())) + } } impl bindgen::seed_keeper::wit_ui::wurbo_types::Host for MyCtx {} diff --git a/examples/crates/calculator/Cargo.toml b/examples/crates/calculator/Cargo.toml index 8b3e7b6..0bdfc69 100644 --- a/examples/crates/calculator/Cargo.toml +++ b/examples/crates/calculator/Cargo.toml @@ -6,7 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wit-bindgen = { workspace = true } +bitflags = { workspace = true } +wit-bindgen-rt = { workspace = true } [lib] crate-type = ["cdylib"] diff --git a/examples/crates/calculator/src/bindings.rs b/examples/crates/calculator/src/bindings.rs index 18480d9..c87dda5 100644 --- a/examples/crates/calculator/src/bindings.rs +++ b/examples/crates/calculator/src/bindings.rs @@ -1,94 +1,200 @@ -// Generated by `wit-bindgen` 0.16.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Options used: pub mod component { - pub mod math { - - #[allow(clippy::all)] - pub mod addition { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - #[allow(unused_unsafe, clippy::all)] - pub fn add(x: i32,y: i32,) -> i32{ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "component:math/addition@0.1.0")] - extern "C" { - #[link_name = "add"] - fn wit_import(_: i32, _: i32, ) -> i32; - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, ) -> i32{ unreachable!() } - let ret = wit_import(wit_bindgen::rt::as_i32(x), wit_bindgen::rt::as_i32(y)); - ret + pub mod math { + #[allow(clippy::all)] + pub mod addition { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + #[allow(unused_unsafe, clippy::all)] + pub fn add(x: i32, y: i32) -> i32 { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "component:math/addition@0.1.0")] + extern "C" { + #[link_name = "add"] + fn wit_import(_: i32, _: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32) -> i32 { + unreachable!() + } + let ret = wit_import(_rt::as_i32(&x), _rt::as_i32(&y)); + ret + } + } } - } - } - - } } pub mod exports { - pub mod example { - pub mod calculator { - - #[allow(clippy::all)] - pub mod calculate { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_section; - const _: () = { - - #[doc(hidden)] + pub mod example { + pub mod calculator { + #[allow(clippy::all)] + pub mod calculate { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_evaluate_cabi(arg0: *mut u8, arg1: usize) -> i32 { + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let result1 = T::evaluate(_rt::string_lift(bytes0)); + _rt::as_i32(result1) + } + pub trait Guest { + fn evaluate(expr: _rt::String) -> i32; + } + #[doc(hidden)] + + macro_rules! __export_example_calculator_calculate_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + #[export_name = "example:calculator/calculate#evaluate"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_evaluate(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let bytes0 = Vec::from_raw_parts(arg0 as *mut _, len0, len0); - let result1 = <_GuestImpl as Guest>::evaluate(wit_bindgen::rt::string_lift(bytes0)); - wit_bindgen::rt::as_i32(result1) + unsafe extern "C" fn export_evaluate(arg0: *mut u8,arg1: usize,) -> i32 { + $($path_to_types)*::_export_evaluate_cabi::<$ty>(arg0, arg1) } - }; - use super::super::super::super::super::Component as _GuestImpl; - pub trait Guest { - fn evaluate(expr: wit_bindgen::rt::string::String,) -> i32; - } - + };); } - + #[doc(hidden)] + pub(crate) use __export_example_calculator_calculate_cabi; + } + } + } +} +mod _rt { + + pub fn as_i32(t: T) -> i32 { + t.as_i32() + } + + pub trait AsI32 { + fn as_i32(self) -> i32; + } + + impl<'a, T: Copy + AsI32> AsI32 for &'a T { + fn as_i32(self) -> i32 { + (*self).as_i32() + } + } + + impl AsI32 for i32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } } - } + + impl AsI32 for char { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for usize { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + pub use alloc_crate::vec::Vec; + pub unsafe fn string_lift(bytes: Vec) -> String { + if cfg!(debug_assertions) { + String::from_utf8(bytes).unwrap() + } else { + String::from_utf8_unchecked(bytes) + } + } + pub use alloc_crate::string::String; + extern crate alloc as alloc_crate; } +/// Generates `#[no_mangle]` functions to export the specified type as the +/// root implementation of all generated traits. +/// +/// For more information see the documentation of `wit_bindgen::generate!`. +/// +/// ```rust +/// # macro_rules! export{ ($($t:tt)*) => (); } +/// # trait Guest {} +/// struct MyType; +/// +/// impl Guest for MyType { +/// // ... +/// } +/// +/// export!(MyType); +/// ``` +#[allow(unused_macros)] +#[doc(hidden)] + +macro_rules! __export_calculator_impl { + ($ty:ident) => (self::export!($ty with_types_in self);); + ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( + $($path_to_types_root)*::exports::example::calculator::calculate::__export_example_calculator_calculate_cabi!($ty with_types_in $($path_to_types_root)*::exports::example::calculator::calculate); + ) +} +#[doc(inline)] +pub(crate) use __export_calculator_impl as export; + #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:calculator"] +#[link_section = "component-type:wit-bindgen:0.21.0:calculator:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 370] = [3, 0, 10, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 0, 97, 115, 109, 13, 0, 1, 0, 7, 63, 1, 65, 2, 1, 66, 2, 1, 64, 1, 4, 101, 120, 112, 114, 115, 0, 122, 4, 0, 8, 101, 118, 97, 108, 117, 97, 116, 101, 1, 0, 4, 1, 28, 101, 120, 97, 109, 112, 108, 101, 58, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 47, 99, 97, 108, 99, 117, 108, 97, 116, 101, 5, 0, 11, 15, 1, 0, 9, 99, 97, 108, 99, 117, 108, 97, 116, 101, 3, 0, 0, 7, 156, 1, 1, 65, 2, 1, 65, 4, 1, 66, 2, 1, 64, 2, 1, 120, 122, 1, 121, 122, 0, 122, 4, 0, 3, 97, 100, 100, 1, 0, 3, 1, 29, 99, 111, 109, 112, 111, 110, 101, 110, 116, 58, 109, 97, 116, 104, 47, 97, 100, 100, 105, 116, 105, 111, 110, 64, 48, 46, 49, 46, 48, 5, 0, 1, 66, 2, 1, 64, 1, 4, 101, 120, 112, 114, 115, 0, 122, 4, 0, 8, 101, 118, 97, 108, 117, 97, 116, 101, 1, 0, 4, 1, 28, 101, 120, 97, 109, 112, 108, 101, 58, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 47, 99, 97, 108, 99, 117, 108, 97, 116, 101, 5, 1, 4, 1, 29, 101, 120, 97, 109, 112, 108, 101, 58, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 47, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 4, 0, 11, 16, 1, 0, 10, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 3, 2, 0, 0, 16, 12, 112, 97, 99, 107, 97, 103, 101, 45, 100, 111, 99, 115, 0, 123, 125, 0, 70, 9, 112, 114, 111, 100, 117, 99, 101, 114, 115, 1, 12, 112, 114, 111, 99, 101, 115, 115, 101, 100, 45, 98, 121, 2, 13, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 6, 48, 46, 49, 56, 46, 50, 16, 119, 105, 116, 45, 98, 105, 110, 100, 103, 101, 110, 45, 114, 117, 115, 116, 6, 48, 46, 49, 54, 46, 48]; +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 285] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\x9c\x01\x01A\x02\x01\ +A\x04\x01B\x02\x01@\x02\x01xz\x01yz\0z\x04\0\x03add\x01\0\x03\x01\x1dcomponent:m\ +ath/addition@0.1.0\x05\0\x01B\x02\x01@\x01\x04exprs\0z\x04\0\x08evaluate\x01\0\x04\ +\x01\x1cexample:calculator/calculate\x05\x01\x04\x01\x1dexample:calculator/calcu\ +lator\x04\0\x0b\x10\x01\0\x0acalculator\x03\0\0\0G\x09producers\x01\x0cprocessed\ +-by\x02\x0dwit-component\x070.201.0\x10wit-bindgen-rust\x060.21.0"; #[inline(never)] #[doc(hidden)] #[cfg(target_arch = "wasm32")] -pub fn __link_section() {} +pub fn __link_custom_section_describing_imports() { + wit_bindgen_rt::maybe_link_cabi_realloc(); +} diff --git a/examples/crates/calculator/src/lib.rs b/examples/crates/calculator/src/lib.rs index c6c0959..3db95b1 100644 --- a/examples/crates/calculator/src/lib.rs +++ b/examples/crates/calculator/src/lib.rs @@ -7,6 +7,8 @@ use bindings::component::math::addition::add; struct Component; +bindings::export!(Component with_types_in bindings); + impl Guest for Component { fn evaluate(_expr: String) -> i32 { // Cleverly parse `expr` into values and operations, and evaluate diff --git a/examples/crates/edwards-ui/Cargo.toml b/examples/crates/edwards-ui/Cargo.toml index 324b88a..166814e 100644 --- a/examples/crates/edwards-ui/Cargo.toml +++ b/examples/crates/edwards-ui/Cargo.toml @@ -6,7 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wit-bindgen = { workspace = true } +bitflags = { workspace = true } +wit-bindgen-rt = { workspace = true } wurbo = { workspace = true } [lib] diff --git a/examples/crates/edwards-ui/src/bindings.rs b/examples/crates/edwards-ui/src/bindings.rs index 427d4bc..e48468f 100644 --- a/examples/crates/edwards-ui/src/bindings.rs +++ b/examples/crates/edwards-ui/src/bindings.rs @@ -1,539 +1,679 @@ -// Generated by `wit-bindgen` 0.16.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Options used: pub mod example { - pub mod edwards_ui { - - #[allow(clippy::all)] - pub mod wurbo_types { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - /// Details required in order to add an event listener to an element - #[derive(Clone)] - pub struct ListenDetails { - pub selector: wit_bindgen::rt::string::String, - pub ty: wit_bindgen::rt::string::String, - } - impl ::core::fmt::Debug for ListenDetails { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ListenDetails").field("selector", &self.selector).field("ty", &self.ty).finish() - } - } - /// Context for the minijinja rendering - #[derive(Clone)] - pub struct Page { - pub title: wit_bindgen::rt::string::String, - } - impl ::core::fmt::Debug for Page { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Page").field("title", &self.title).finish() - } - } - #[derive(Clone)] - pub struct Input { - pub placeholder: wit_bindgen::rt::string::String, - } - impl ::core::fmt::Debug for Input { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Input").field("placeholder", &self.placeholder).finish() - } - } - #[derive(Clone)] - pub struct Output { - /// the resulting value of the total outputs combined - pub value: Option, - /// optional id string: None is intial render, Some for update value - pub id: Option, - /// the output dest for the message changes - pub message: Option, - /// the output dest for the signature changes - pub signature: Option, - } - impl ::core::fmt::Debug for Output { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Output").field("value", &self.value).field("id", &self.id).field("message", &self.message).field("signature", &self.signature).finish() - } - } - /// COntent for the entire page - #[derive(Clone)] - pub struct Content { - pub page: Page, - pub input: Input, - pub output: Option, - } - impl ::core::fmt::Debug for Content { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Content").field("page", &self.page).field("input", &self.input).field("output", &self.output).finish() - } - } - /// Context variants - #[derive(Clone)] - pub enum Context{ - AllContent(Content), - Message(wit_bindgen::rt::string::String), - Submit(wit_bindgen::rt::string::String), - } - impl ::core::fmt::Debug for Context { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - match self { - Context::AllContent(e) => { - f.debug_tuple("Context::AllContent").field(e).finish() + pub mod edwards_ui { + #[allow(clippy::all)] + pub mod wurbo_types { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + /// Details required in order to add an event listener to an element + #[derive(Clone)] + pub struct ListenDetails { + pub selector: _rt::String, + pub ty: _rt::String, + } + impl ::core::fmt::Debug for ListenDetails { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("ListenDetails") + .field("selector", &self.selector) + .field("ty", &self.ty) + .finish() + } + } + /// Context for the minijinja rendering + #[derive(Clone)] + pub struct Page { + pub title: _rt::String, + } + impl ::core::fmt::Debug for Page { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Page").field("title", &self.title).finish() + } + } + #[derive(Clone)] + pub struct Input { + pub placeholder: _rt::String, + } + impl ::core::fmt::Debug for Input { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Input") + .field("placeholder", &self.placeholder) + .finish() + } } - Context::Message(e) => { - f.debug_tuple("Context::Message").field(e).finish() + #[derive(Clone)] + pub struct Output { + /// the resulting value of the total outputs combined + pub value: Option<_rt::String>, + /// optional id string: None is intial render, Some for update value + pub id: Option<_rt::String>, + /// the output dest for the message changes + pub message: Option<_rt::String>, + /// the output dest for the signature changes + pub signature: Option<_rt::String>, } - Context::Submit(e) => { - f.debug_tuple("Context::Submit").field(e).finish() + impl ::core::fmt::Debug for Output { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Output") + .field("value", &self.value) + .field("id", &self.id) + .field("message", &self.message) + .field("signature", &self.signature) + .finish() + } + } + /// COntent for the entire page + #[derive(Clone)] + pub struct Content { + pub page: Page, + pub input: Input, + pub output: Option, + } + impl ::core::fmt::Debug for Content { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Content") + .field("page", &self.page) + .field("input", &self.input) + .field("output", &self.output) + .finish() + } + } + /// Context variants + #[derive(Clone)] + pub enum Context { + AllContent(Content), + Message(_rt::String), + Submit(_rt::String), + } + impl ::core::fmt::Debug for Context { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Context::AllContent(e) => { + f.debug_tuple("Context::AllContent").field(e).finish() + } + Context::Message(e) => f.debug_tuple("Context::Message").field(e).finish(), + Context::Submit(e) => f.debug_tuple("Context::Submit").field(e).finish(), + } + } } - } } - } - - } - - - #[allow(clippy::all)] - pub mod wurbo_in { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - pub type ListenDetails = super::super::super::example::edwards_ui::wurbo_types::ListenDetails; - #[allow(unused_unsafe, clippy::all)] - /// Add an event listener to the given element - pub fn addeventlistener(details: &ListenDetails,){ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - let super::super::super::example::edwards_ui::wurbo_types::ListenDetails{ selector:selector0, ty:ty0, } = details; - let vec1 = selector0; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - let vec2 = ty0; - let ptr2 = vec2.as_ptr() as i32; - let len2 = vec2.len() as i32; - - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "example:edwards-ui/wurbo-in@0.1.0")] - extern "C" { - #[link_name = "addeventlistener"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, ){ unreachable!() } - wit_import(ptr1, len1, ptr2, len2); + + #[allow(clippy::all)] + pub mod wurbo_in { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + pub type ListenDetails = + super::super::super::example::edwards_ui::wurbo_types::ListenDetails; + #[allow(unused_unsafe, clippy::all)] + /// Add an event listener to the given element + pub fn addeventlistener(details: &ListenDetails) { + unsafe { + let super::super::super::example::edwards_ui::wurbo_types::ListenDetails { + selector: selector0, + ty: ty0, + } = details; + let vec1 = selector0; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + let vec2 = ty0; + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "example:edwards-ui/wurbo-in@0.1.0")] + extern "C" { + #[link_name = "addeventlistener"] + fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize) { + unreachable!() + } + wit_import(ptr1.cast_mut(), len1, ptr2.cast_mut(), len2); + } + } } - } - } - - } } pub mod seed_keeper { - pub mod edwards_wit { - - #[allow(clippy::all)] - pub mod operations { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - #[allow(unused_unsafe, clippy::all)] - pub fn sign(message: &[u8],) -> Result,wit_bindgen::rt::string::String>{ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - - #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let vec0 = message; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - let ptr1 = ret_area.as_mut_ptr() as i32; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "seed-keeper:edwards-wit/operations@0.1.0")] - extern "C" { - #[link_name = "sign"] - fn wit_import(_: i32, _: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, ){ unreachable!() } - wit_import(ptr0, len0, ptr1); - let l2 = i32::from(*((ptr1 + 0) as *const u8)); - match l2 { - 0 => { - let e = { - let l3 = *((ptr1 + 4) as *const i32); - let l4 = *((ptr1 + 8) as *const i32); - let len5 = l4 as usize; - - Vec::from_raw_parts(l3 as *mut _, len5, len5) - }; - Ok(e) + pub mod edwards_wit { + #[allow(clippy::all)] + pub mod operations { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + #[allow(unused_unsafe, clippy::all)] + pub fn sign(message: &[u8]) -> Result<_rt::Vec, _rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let vec0 = message; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let ptr1 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "seed-keeper:edwards-wit/operations@0.1.0")] + extern "C" { + #[link_name = "sign"] + fn wit_import(_: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import(ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); + match l2 { + 0 => { + let e = { + let l3 = *ptr1.add(4).cast::<*mut u8>(); + let l4 = *ptr1.add(8).cast::(); + let len5 = l4; + + _rt::Vec::from_raw_parts(l3.cast(), len5, len5) + }; + Ok(e) + } + 1 => { + let e = { + let l6 = *ptr1.add(4).cast::<*mut u8>(); + let l7 = *ptr1.add(8).cast::(); + let len8 = l7; + let bytes8 = _rt::Vec::from_raw_parts(l6.cast(), len8, len8); + + _rt::string_lift(bytes8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } } - 1 => { - let e = { - let l6 = *((ptr1 + 4) as *const i32); - let l7 = *((ptr1 + 8) as *const i32); - let len8 = l7 as usize; - let bytes8 = Vec::from_raw_parts(l6 as *mut _, len8, len8); - - wit_bindgen::rt::string_lift(bytes8) - }; - Err(e) + #[allow(unused_unsafe, clippy::all)] + pub fn verify(message: &[u8], signature: &[u8]) -> Result { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let vec0 = message; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let vec1 = signature; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + let ptr2 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "seed-keeper:edwards-wit/operations@0.1.0")] + extern "C" { + #[link_name = "verify"] + fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import(ptr0.cast_mut(), len0, ptr1.cast_mut(), len1, ptr2); + let l3 = i32::from(*ptr2.add(0).cast::()); + match l3 { + 0 => { + let e = { + let l4 = i32::from(*ptr2.add(4).cast::()); + + _rt::bool_lift(l4 as u8) + }; + Ok(e) + } + 1 => { + let e = { + let l5 = *ptr2.add(4).cast::<*mut u8>(); + let l6 = *ptr2.add(8).cast::(); + let len7 = l6; + let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7); + + _rt::string_lift(bytes7) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } } - } - #[allow(unused_unsafe, clippy::all)] - pub fn verify(message: &[u8],signature: &[u8],) -> Result{ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - - #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let vec0 = message; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - let vec1 = signature; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - let ptr2 = ret_area.as_mut_ptr() as i32; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "seed-keeper:edwards-wit/operations@0.1.0")] - extern "C" { - #[link_name = "verify"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, ){ unreachable!() } - wit_import(ptr0, len0, ptr1, len1, ptr2); - let l3 = i32::from(*((ptr2 + 0) as *const u8)); - match l3 { - 0 => { - let e = { - let l4 = i32::from(*((ptr2 + 4) as *const u8)); - - wit_bindgen::rt::bool_lift(l4 as u8) - }; - Ok(e) + } +} +pub mod exports { + pub mod example { + pub mod edwards_ui { + #[allow(clippy::all)] + pub mod wurbo_out { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type Context = + super::super::super::super::example::edwards_ui::wurbo_types::Context; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_activate_cabi( + arg0: i32, + arg1: *mut u8, + arg2: usize, + ) { + T::activate(match arg0 { + 0 => None, + 1 => { + let e = { + let base3 = arg1; + let len3 = arg2; + let mut result3 = _rt::Vec::with_capacity(len3); + for i in 0..len3 { + let base = base3.add(i * 8); + let e3 = { + let l0 = *base.add(0).cast::<*mut u8>(); + let l1 = *base.add(4).cast::(); + let len2 = l1; + let bytes2 = + _rt::Vec::from_raw_parts(l0.cast(), len2, len2); + + _rt::string_lift(bytes2) + }; + result3.push(e3); + } + _rt::cabi_dealloc(base3, len3 * 8, 4); + + result3 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }); + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_render_cabi(arg0: *mut u8) -> *mut u8 { + let l0 = i32::from(*arg0.add(0).cast::()); + use super::super::super::super::example::edwards_ui::wurbo_types::Context as V30; + let v30 = match l0 { + 0 => { + let e30 = { + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + let len3 = l2; + let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); + let l4 = *arg0.add(12).cast::<*mut u8>(); + let l5 = *arg0.add(16).cast::(); + let len6 = l5; + let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); + let l7 = i32::from(*arg0.add(20).cast::()); + + super::super::super::super::example::edwards_ui::wurbo_types::Content{ + page: super::super::super::super::example::edwards_ui::wurbo_types::Page{ + title: _rt::string_lift(bytes3), + }, + input: super::super::super::super::example::edwards_ui::wurbo_types::Input{ + placeholder: _rt::string_lift(bytes6), + }, + output: match l7 { + 0 => None, + 1 => { + let e = { + let l8 = i32::from(*arg0.add(24).cast::()); + let l12 = i32::from(*arg0.add(36).cast::()); + let l16 = i32::from(*arg0.add(48).cast::()); + let l20 = i32::from(*arg0.add(60).cast::()); + + super::super::super::super::example::edwards_ui::wurbo_types::Output{ + value: match l8 { + 0 => None, + 1 => { + let e = { + let l9 = *arg0.add(28).cast::<*mut u8>(); + let l10 = *arg0.add(32).cast::(); + let len11 = l10; + let bytes11 = _rt::Vec::from_raw_parts(l9.cast(), len11, len11); + + _rt::string_lift(bytes11) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + id: match l12 { + 0 => None, + 1 => { + let e = { + let l13 = *arg0.add(40).cast::<*mut u8>(); + let l14 = *arg0.add(44).cast::(); + let len15 = l14; + let bytes15 = _rt::Vec::from_raw_parts(l13.cast(), len15, len15); + + _rt::string_lift(bytes15) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + message: match l16 { + 0 => None, + 1 => { + let e = { + let l17 = *arg0.add(52).cast::<*mut u8>(); + let l18 = *arg0.add(56).cast::(); + let len19 = l18; + let bytes19 = _rt::Vec::from_raw_parts(l17.cast(), len19, len19); + + _rt::string_lift(bytes19) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + signature: match l20 { + 0 => None, + 1 => { + let e = { + let l21 = *arg0.add(64).cast::<*mut u8>(); + let l22 = *arg0.add(68).cast::(); + let len23 = l22; + let bytes23 = _rt::Vec::from_raw_parts(l21.cast(), len23, len23); + + _rt::string_lift(bytes23) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, } - 1 => { - let e = { - let l5 = *((ptr2 + 4) as *const i32); - let l6 = *((ptr2 + 8) as *const i32); - let len7 = l6 as usize; - let bytes7 = Vec::from_raw_parts(l5 as *mut _, len7, len7); - - wit_bindgen::rt::string_lift(bytes7) - }; - Err(e) + }; + V30::AllContent(e30) + } + 1 => { + let e30 = { + let l24 = *arg0.add(4).cast::<*mut u8>(); + let l25 = *arg0.add(8).cast::(); + let len26 = l25; + let bytes26 = _rt::Vec::from_raw_parts(l24.cast(), len26, len26); + + _rt::string_lift(bytes26) + }; + V30::Message(e30) + } + n => { + debug_assert_eq!(n, 2, "invalid enum discriminant"); + let e30 = { + let l27 = *arg0.add(4).cast::<*mut u8>(); + let l28 = *arg0.add(8).cast::(); + let len29 = l28; + let bytes29 = _rt::Vec::from_raw_parts(l27.cast(), len29, len29); + + _rt::string_lift(bytes29) + }; + V30::Submit(e30) + } + }; + let result31 = T::render(v30); + _rt::cabi_dealloc(arg0, 72, 4); + let ptr32 = _RET_AREA.0.as_mut_ptr().cast::(); + match result31 { + Ok(e) => { + *ptr32.add(0).cast::() = (0i32) as u8; + let vec33 = (e.into_bytes()).into_boxed_slice(); + let ptr33 = vec33.as_ptr().cast::(); + let len33 = vec33.len(); + ::core::mem::forget(vec33); + *ptr32.add(8).cast::() = len33; + *ptr32.add(4).cast::<*mut u8>() = ptr33.cast_mut(); + } + Err(e) => { + *ptr32.add(0).cast::() = (1i32) as u8; + let vec34 = (e.into_bytes()).into_boxed_slice(); + let ptr34 = vec34.as_ptr().cast::(); + let len34 = vec34.len(); + ::core::mem::forget(vec34); + *ptr32.add(8).cast::() = len34; + *ptr32.add(4).cast::<*mut u8>() = ptr34.cast_mut(); + } + }; + ptr32 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_render(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l1, l2, 1); + } + _ => { + let l3 = *arg0.add(4).cast::<*mut u8>(); + let l4 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l3, l4, 1); + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_customize_cabi( + arg0: *mut u8, + arg1: usize, + ) -> *mut u8 { + let base6 = arg0; + let len6 = arg1; + let mut result6 = _rt::Vec::with_capacity(len6); + for i in 0..len6 { + let base = base6.add(i * 16); + let e6 = { + let l0 = *base.add(0).cast::<*mut u8>(); + let l1 = *base.add(4).cast::(); + let len2 = l1; + let bytes2 = _rt::Vec::from_raw_parts(l0.cast(), len2, len2); + let l3 = *base.add(8).cast::<*mut u8>(); + let l4 = *base.add(12).cast::(); + let len5 = l4; + let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); + + (_rt::string_lift(bytes2), _rt::string_lift(bytes5)) + }; + result6.push(e6); + } + _rt::cabi_dealloc(base6, len6 * 16, 4); + let result7 = T::customize(result6); + let ptr8 = _RET_AREA.0.as_mut_ptr().cast::(); + match result7 { + Ok(_) => { + *ptr8.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr8.add(0).cast::() = (1i32) as u8; + let vec9 = (e.into_bytes()).into_boxed_slice(); + let ptr9 = vec9.as_ptr().cast::(); + let len9 = vec9.len(); + ::core::mem::forget(vec9); + *ptr8.add(8).cast::() = len9; + *ptr8.add(4).cast::<*mut u8>() = ptr9.cast_mut(); + } + }; + ptr8 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_customize(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l1, l2, 1); + } + } + } + pub trait Guest { + /// listen on all or given selectors + fn activate(selectors: Option<_rt::Vec<_rt::String>>); + /// renders the initial Web component with the given data + /// and the target template to use as top level entry point + fn render(ctx: Context) -> Result<_rt::String, _rt::String>; + /// Optionally customize the configuration of the templates used to render the component + fn customize( + templates: _rt::Vec<(_rt::String, _rt::String)>, + ) -> Result<(), _rt::String>; + } + #[doc(hidden)] + + macro_rules! __export_example_edwards_ui_wurbo_out_0_1_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "example:edwards-ui/wurbo-out@0.1.0#activate"] + unsafe extern "C" fn export_activate(arg0: i32,arg1: *mut u8,arg2: usize,) { + $($path_to_types)*::_export_activate_cabi::<$ty>(arg0, arg1, arg2) + } + #[export_name = "example:edwards-ui/wurbo-out@0.1.0#render"] + unsafe extern "C" fn export_render(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_render_cabi::<$ty>(arg0) + } + #[export_name = "cabi_post_example:edwards-ui/wurbo-out@0.1.0#render"] + unsafe extern "C" fn _post_return_render(arg0: *mut u8,) { + $($path_to_types)*::__post_return_render::<$ty>(arg0) + } + #[export_name = "example:edwards-ui/wurbo-out@0.1.0#customize"] + unsafe extern "C" fn export_customize(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_customize_cabi::<$ty>(arg0, arg1) + } + #[export_name = "cabi_post_example:edwards-ui/wurbo-out@0.1.0#customize"] + unsafe extern "C" fn _post_return_customize(arg0: *mut u8,) { + $($path_to_types)*::__post_return_customize::<$ty>(arg0) + } + };); + } + #[doc(hidden)] + pub(crate) use __export_example_edwards_ui_wurbo_out_0_1_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 12]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 12]); } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } } - } - } - - } } -pub mod exports { - pub mod example { - pub mod edwards_ui { - - #[allow(clippy::all)] - pub mod wurbo_out { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_section; - pub type Context = super::super::super::super::example::edwards_ui::wurbo_types::Context; - const _: () = { - - #[doc(hidden)] - #[export_name = "example:edwards-ui/wurbo-out@0.1.0#render"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_render(arg0: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let l0 = i32::from(*((arg0 + 0) as *const u8)); - use super::super::super::super::example::edwards_ui::wurbo_types::Context as V30; - let v30 = match l0 { - 0 => { - let e30 = { - let l1 = *((arg0 + 4) as *const i32); - let l2 = *((arg0 + 8) as *const i32); - let len3 = l2 as usize; - let bytes3 = Vec::from_raw_parts(l1 as *mut _, len3, len3); - let l4 = *((arg0 + 12) as *const i32); - let l5 = *((arg0 + 16) as *const i32); - let len6 = l5 as usize; - let bytes6 = Vec::from_raw_parts(l4 as *mut _, len6, len6); - let l7 = i32::from(*((arg0 + 20) as *const u8)); - - super::super::super::super::example::edwards_ui::wurbo_types::Content{ - page: super::super::super::super::example::edwards_ui::wurbo_types::Page{ - title: wit_bindgen::rt::string_lift(bytes3), - }, - input: super::super::super::super::example::edwards_ui::wurbo_types::Input{ - placeholder: wit_bindgen::rt::string_lift(bytes6), - }, - output: match l7 { - 0 => None, - 1 => { - let e = { - let l8 = i32::from(*((arg0 + 24) as *const u8)); - let l12 = i32::from(*((arg0 + 36) as *const u8)); - let l16 = i32::from(*((arg0 + 48) as *const u8)); - let l20 = i32::from(*((arg0 + 60) as *const u8)); - - super::super::super::super::example::edwards_ui::wurbo_types::Output{ - value: match l8 { - 0 => None, - 1 => { - let e = { - let l9 = *((arg0 + 28) as *const i32); - let l10 = *((arg0 + 32) as *const i32); - let len11 = l10 as usize; - let bytes11 = Vec::from_raw_parts(l9 as *mut _, len11, len11); - - wit_bindgen::rt::string_lift(bytes11) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - id: match l12 { - 0 => None, - 1 => { - let e = { - let l13 = *((arg0 + 40) as *const i32); - let l14 = *((arg0 + 44) as *const i32); - let len15 = l14 as usize; - let bytes15 = Vec::from_raw_parts(l13 as *mut _, len15, len15); - - wit_bindgen::rt::string_lift(bytes15) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - message: match l16 { - 0 => None, - 1 => { - let e = { - let l17 = *((arg0 + 52) as *const i32); - let l18 = *((arg0 + 56) as *const i32); - let len19 = l18 as usize; - let bytes19 = Vec::from_raw_parts(l17 as *mut _, len19, len19); - - wit_bindgen::rt::string_lift(bytes19) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - signature: match l20 { - 0 => None, - 1 => { - let e = { - let l21 = *((arg0 + 64) as *const i32); - let l22 = *((arg0 + 68) as *const i32); - let len23 = l22 as usize; - let bytes23 = Vec::from_raw_parts(l21 as *mut _, len23, len23); - - wit_bindgen::rt::string_lift(bytes23) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } - }; - V30::AllContent(e30) - } - 1 => { - let e30 = { - let l24 = *((arg0 + 4) as *const i32); - let l25 = *((arg0 + 8) as *const i32); - let len26 = l25 as usize; - let bytes26 = Vec::from_raw_parts(l24 as *mut _, len26, len26); - - wit_bindgen::rt::string_lift(bytes26) - }; - V30::Message(e30) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e30 = { - let l27 = *((arg0 + 4) as *const i32); - let l28 = *((arg0 + 8) as *const i32); - let len29 = l28 as usize; - let bytes29 = Vec::from_raw_parts(l27 as *mut _, len29, len29); - - wit_bindgen::rt::string_lift(bytes29) - }; - V30::Submit(e30) - } - }; - let result31 = <_GuestImpl as Guest>::render(v30); - wit_bindgen::rt::dealloc(arg0, 72, 4); - let ptr32 = _RET_AREA.0.as_mut_ptr() as i32; - match result31 { - Ok(e) => { { - *((ptr32 + 0) as *mut u8) = (0i32) as u8; - let vec33 = (e.into_bytes()).into_boxed_slice(); - let ptr33 = vec33.as_ptr() as i32; - let len33 = vec33.len() as i32; - ::core::mem::forget(vec33); - *((ptr32 + 8) as *mut i32) = len33; - *((ptr32 + 4) as *mut i32) = ptr33; - } }, - Err(e) => { { - *((ptr32 + 0) as *mut u8) = (1i32) as u8; - let vec34 = (e.into_bytes()).into_boxed_slice(); - let ptr34 = vec34.as_ptr() as i32; - let len34 = vec34.len() as i32; - ::core::mem::forget(vec34); - *((ptr32 + 8) as *mut i32) = len34; - *((ptr32 + 4) as *mut i32) = ptr34; - } }, - };ptr32 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_example:edwards-ui/wurbo-out@0.1.0#render"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_render(arg0: i32,) { - let l0 = i32::from(*((arg0 + 0) as *const u8)); - match l0 { - 0 => { - let l1 = *((arg0 + 4) as *const i32); - let l2 = *((arg0 + 8) as *const i32); - wit_bindgen::rt::dealloc(l1, (l2) as usize, 1); - }, - _ => { - let l3 = *((arg0 + 4) as *const i32); - let l4 = *((arg0 + 8) as *const i32); - wit_bindgen::rt::dealloc(l3, (l4) as usize, 1); - }, - } +mod _rt { + pub use alloc_crate::string::String; + pub use alloc_crate::vec::Vec; + pub unsafe fn string_lift(bytes: Vec) -> String { + if cfg!(debug_assertions) { + String::from_utf8(bytes).unwrap() + } else { + String::from_utf8_unchecked(bytes) + } + } + pub unsafe fn invalid_enum_discriminant() -> T { + if cfg!(debug_assertions) { + panic!("invalid enum discriminant") + } else { + core::hint::unreachable_unchecked() + } + } + pub unsafe fn bool_lift(val: u8) -> bool { + if cfg!(debug_assertions) { + match val { + 0 => false, + 1 => true, + _ => panic!("invalid bool discriminant"), } - }; - }; - const _: () = { - - #[doc(hidden)] - #[export_name = "example:edwards-ui/wurbo-out@0.1.0#activate"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_activate(arg0: i32,arg1: i32,arg2: i32,) { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - <_GuestImpl as Guest>::activate(match arg0 { - 0 => None, - 1 => { - let e = { - let base3 = arg1; - let len3 = arg2; - let mut result3 = Vec::with_capacity(len3 as usize); - for i in 0..len3 { - let base = base3 + i * 8; - let e3 = { - let l0 = *((base + 0) as *const i32); - let l1 = *((base + 4) as *const i32); - let len2 = l1 as usize; - let bytes2 = Vec::from_raw_parts(l0 as *mut _, len2, len2); - - wit_bindgen::rt::string_lift(bytes2) - }; - result3.push(e3); - } - wit_bindgen::rt::dealloc(base3, (len3 as usize) * 8, 4); - - result3 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }); - } - }; - use super::super::super::super::super::Component as _GuestImpl; - pub trait Guest { - /// renders the initial Web component with the given data - /// and the target template to use as top level entry point - fn render(ctx: Context,) -> Result; - /// listen on all or given selectors - fn activate(selectors: Option>,); + } else { + ::core::mem::transmute::(val) } - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - #[repr(align(4))] - struct _RetArea([u8; 12]); - static mut _RET_AREA: _RetArea = _RetArea([0; 12]); - - } - } - } + pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) { + if size == 0 { + return; + } + let layout = alloc::Layout::from_size_align_unchecked(size, align); + alloc::dealloc(ptr as *mut u8, layout); + } + extern crate alloc as alloc_crate; + pub use alloc_crate::alloc; } +/// Generates `#[no_mangle]` functions to export the specified type as the +/// root implementation of all generated traits. +/// +/// For more information see the documentation of `wit_bindgen::generate!`. +/// +/// ```rust +/// # macro_rules! export{ ($($t:tt)*) => (); } +/// # trait Guest {} +/// struct MyType; +/// +/// impl Guest for MyType { +/// // ... +/// } +/// +/// export!(MyType); +/// ``` +#[allow(unused_macros)] +#[doc(hidden)] + +macro_rules! __export_example_impl { + ($ty:ident) => (self::export!($ty with_types_in self);); + ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( + $($path_to_types_root)*::exports::example::edwards_ui::wurbo_out::__export_example_edwards_ui_wurbo_out_0_1_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::example::edwards_ui::wurbo_out); + ) +} +#[doc(inline)] +pub(crate) use __export_example_impl as export; + #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:example"] +#[link_section = "component-type:wit-bindgen:0.21.0:example:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 2838] = [3, 0, 7, 101, 120, 97, 109, 112, 108, 101, 0, 97, 115, 109, 13, 0, 1, 0, 7, 144, 2, 1, 65, 2, 1, 66, 14, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 2, 1, 114, 1, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 4, 1, 107, 115, 1, 114, 4, 5, 118, 97, 108, 117, 101, 6, 2, 105, 100, 6, 7, 109, 101, 115, 115, 97, 103, 101, 6, 9, 115, 105, 103, 110, 97, 116, 117, 114, 101, 6, 4, 0, 6, 111, 117, 116, 112, 117, 116, 3, 0, 7, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 3, 5, 105, 110, 112, 117, 116, 5, 6, 111, 117, 116, 112, 117, 116, 9, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 10, 1, 113, 3, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 11, 0, 7, 109, 101, 115, 115, 97, 103, 101, 1, 115, 0, 6, 115, 117, 98, 109, 105, 116, 1, 115, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 12, 4, 1, 36, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 11, 17, 1, 0, 11, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 3, 0, 0, 7, 136, 3, 1, 65, 5, 1, 66, 14, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 2, 1, 114, 1, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 4, 1, 107, 115, 1, 114, 4, 5, 118, 97, 108, 117, 101, 6, 2, 105, 100, 6, 7, 109, 101, 115, 115, 97, 103, 101, 6, 9, 115, 105, 103, 110, 97, 116, 117, 114, 101, 6, 4, 0, 6, 111, 117, 116, 112, 117, 116, 3, 0, 7, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 3, 5, 105, 110, 112, 117, 116, 5, 6, 111, 117, 116, 112, 117, 116, 9, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 10, 1, 113, 3, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 11, 0, 7, 109, 101, 115, 115, 97, 103, 101, 1, 115, 0, 6, 115, 117, 98, 109, 105, 116, 1, 115, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 12, 3, 1, 36, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 2, 3, 0, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 1, 66, 4, 2, 3, 2, 1, 1, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 64, 1, 7, 100, 101, 116, 97, 105, 108, 115, 1, 1, 0, 4, 0, 16, 97, 100, 100, 101, 118, 101, 110, 116, 108, 105, 115, 116, 101, 110, 101, 114, 1, 2, 4, 1, 33, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 105, 110, 64, 48, 46, 49, 46, 48, 5, 2, 11, 14, 1, 0, 8, 119, 117, 114, 98, 111, 45, 105, 110, 3, 2, 0, 7, 150, 3, 1, 65, 5, 1, 66, 14, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 2, 1, 114, 1, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 4, 1, 107, 115, 1, 114, 4, 5, 118, 97, 108, 117, 101, 6, 2, 105, 100, 6, 7, 109, 101, 115, 115, 97, 103, 101, 6, 9, 115, 105, 103, 110, 97, 116, 117, 114, 101, 6, 4, 0, 6, 111, 117, 116, 112, 117, 116, 3, 0, 7, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 3, 5, 105, 110, 112, 117, 116, 5, 6, 111, 117, 116, 112, 117, 116, 9, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 10, 1, 113, 3, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 11, 0, 7, 109, 101, 115, 115, 97, 103, 101, 1, 115, 0, 6, 115, 117, 98, 109, 105, 116, 1, 115, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 12, 3, 1, 36, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 2, 3, 0, 0, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 9, 2, 3, 2, 1, 1, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 1, 106, 1, 115, 1, 115, 1, 64, 1, 3, 99, 116, 120, 1, 0, 2, 4, 0, 6, 114, 101, 110, 100, 101, 114, 1, 3, 1, 112, 115, 1, 107, 4, 1, 64, 1, 9, 115, 101, 108, 101, 99, 116, 111, 114, 115, 5, 1, 0, 4, 0, 8, 97, 99, 116, 105, 118, 97, 116, 101, 1, 6, 4, 1, 34, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 2, 11, 15, 1, 0, 9, 119, 117, 114, 98, 111, 45, 111, 117, 116, 3, 4, 0, 7, 176, 5, 1, 65, 2, 1, 65, 10, 1, 66, 7, 1, 112, 125, 1, 106, 1, 0, 1, 115, 1, 64, 1, 7, 109, 101, 115, 115, 97, 103, 101, 0, 0, 1, 4, 0, 4, 115, 105, 103, 110, 1, 2, 1, 106, 1, 127, 1, 115, 1, 64, 2, 7, 109, 101, 115, 115, 97, 103, 101, 0, 9, 115, 105, 103, 110, 97, 116, 117, 114, 101, 0, 0, 3, 4, 0, 6, 118, 101, 114, 105, 102, 121, 1, 4, 3, 1, 40, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 101, 100, 119, 97, 114, 100, 115, 45, 119, 105, 116, 47, 111, 112, 101, 114, 97, 116, 105, 111, 110, 115, 64, 48, 46, 49, 46, 48, 5, 0, 1, 66, 14, 1, 114, 2, 8, 115, 101, 108, 101, 99, 116, 111, 114, 115, 2, 116, 121, 115, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 114, 1, 5, 116, 105, 116, 108, 101, 115, 4, 0, 4, 112, 97, 103, 101, 3, 0, 2, 1, 114, 1, 11, 112, 108, 97, 99, 101, 104, 111, 108, 100, 101, 114, 115, 4, 0, 5, 105, 110, 112, 117, 116, 3, 0, 4, 1, 107, 115, 1, 114, 4, 5, 118, 97, 108, 117, 101, 6, 2, 105, 100, 6, 7, 109, 101, 115, 115, 97, 103, 101, 6, 9, 115, 105, 103, 110, 97, 116, 117, 114, 101, 6, 4, 0, 6, 111, 117, 116, 112, 117, 116, 3, 0, 7, 1, 107, 8, 1, 114, 3, 4, 112, 97, 103, 101, 3, 5, 105, 110, 112, 117, 116, 5, 6, 111, 117, 116, 112, 117, 116, 9, 4, 0, 7, 99, 111, 110, 116, 101, 110, 116, 3, 0, 10, 1, 113, 3, 11, 97, 108, 108, 45, 99, 111, 110, 116, 101, 110, 116, 1, 11, 0, 7, 109, 101, 115, 115, 97, 103, 101, 1, 115, 0, 6, 115, 117, 98, 109, 105, 116, 1, 115, 0, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 12, 3, 1, 36, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 1, 2, 3, 0, 1, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 1, 66, 4, 2, 3, 2, 1, 2, 4, 0, 14, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 3, 0, 0, 1, 64, 1, 7, 100, 101, 116, 97, 105, 108, 115, 1, 1, 0, 4, 0, 16, 97, 100, 100, 101, 118, 101, 110, 116, 108, 105, 115, 116, 101, 110, 101, 114, 1, 2, 3, 1, 33, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 105, 110, 64, 48, 46, 49, 46, 48, 5, 3, 2, 3, 0, 1, 7, 99, 111, 110, 116, 101, 120, 116, 1, 66, 9, 2, 3, 2, 1, 4, 4, 0, 7, 99, 111, 110, 116, 101, 120, 116, 3, 0, 0, 1, 106, 1, 115, 1, 115, 1, 64, 1, 3, 99, 116, 120, 1, 0, 2, 4, 0, 6, 114, 101, 110, 100, 101, 114, 1, 3, 1, 112, 115, 1, 107, 4, 1, 64, 1, 9, 115, 101, 108, 101, 99, 116, 111, 114, 115, 5, 1, 0, 4, 0, 8, 97, 99, 116, 105, 118, 97, 116, 101, 1, 6, 4, 1, 34, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 119, 117, 114, 98, 111, 45, 111, 117, 116, 64, 48, 46, 49, 46, 48, 5, 5, 4, 1, 32, 101, 120, 97, 109, 112, 108, 101, 58, 101, 100, 119, 97, 114, 100, 115, 45, 117, 105, 47, 101, 120, 97, 109, 112, 108, 101, 64, 48, 46, 49, 46, 48, 4, 0, 11, 13, 1, 0, 7, 101, 120, 97, 109, 112, 108, 101, 3, 6, 0, 0, 140, 7, 12, 112, 97, 99, 107, 97, 103, 101, 45, 100, 111, 99, 115, 0, 123, 34, 119, 111, 114, 108, 100, 115, 34, 58, 123, 34, 101, 120, 97, 109, 112, 108, 101, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 65, 110, 32, 101, 120, 97, 109, 112, 108, 101, 32, 119, 111, 114, 108, 100, 32, 102, 111, 114, 32, 116, 104, 101, 32, 99, 111, 109, 112, 111, 110, 101, 110, 116, 32, 116, 111, 32, 116, 97, 114, 103, 101, 116, 46, 34, 125, 125, 44, 34, 105, 110, 116, 101, 114, 102, 97, 99, 101, 115, 34, 58, 123, 34, 119, 117, 114, 98, 111, 45, 116, 121, 112, 101, 115, 34, 58, 123, 34, 116, 121, 112, 101, 115, 34, 58, 123, 34, 108, 105, 115, 116, 101, 110, 45, 100, 101, 116, 97, 105, 108, 115, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 68, 101, 116, 97, 105, 108, 115, 32, 114, 101, 113, 117, 105, 114, 101, 100, 32, 105, 110, 32, 111, 114, 100, 101, 114, 32, 116, 111, 32, 97, 100, 100, 32, 97, 110, 32, 101, 118, 101, 110, 116, 32, 108, 105, 115, 116, 101, 110, 101, 114, 32, 116, 111, 32, 97, 110, 32, 101, 108, 101, 109, 101, 110, 116, 34, 125, 44, 34, 112, 97, 103, 101, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 67, 111, 110, 116, 101, 120, 116, 32, 102, 111, 114, 32, 116, 104, 101, 32, 109, 105, 110, 105, 106, 105, 110, 106, 97, 32, 114, 101, 110, 100, 101, 114, 105, 110, 103, 34, 125, 44, 34, 111, 117, 116, 112, 117, 116, 34, 58, 123, 34, 105, 116, 101, 109, 115, 34, 58, 123, 34, 118, 97, 108, 117, 101, 34, 58, 34, 116, 104, 101, 32, 114, 101, 115, 117, 108, 116, 105, 110, 103, 32, 118, 97, 108, 117, 101, 32, 111, 102, 32, 116, 104, 101, 32, 116, 111, 116, 97, 108, 32, 111, 117, 116, 112, 117, 116, 115, 32, 99, 111, 109, 98, 105, 110, 101, 100, 34, 44, 34, 105, 100, 34, 58, 34, 111, 112, 116, 105, 111, 110, 97, 108, 32, 105, 100, 32, 115, 116, 114, 105, 110, 103, 58, 32, 78, 111, 110, 101, 32, 105, 115, 32, 105, 110, 116, 105, 97, 108, 32, 114, 101, 110, 100, 101, 114, 44, 32, 83, 111, 109, 101, 32, 102, 111, 114, 32, 117, 112, 100, 97, 116, 101, 32, 118, 97, 108, 117, 101, 34, 44, 34, 109, 101, 115, 115, 97, 103, 101, 34, 58, 34, 116, 104, 101, 32, 111, 117, 116, 112, 117, 116, 32, 100, 101, 115, 116, 32, 102, 111, 114, 32, 116, 104, 101, 32, 109, 101, 115, 115, 97, 103, 101, 32, 99, 104, 97, 110, 103, 101, 115, 34, 44, 34, 115, 105, 103, 110, 97, 116, 117, 114, 101, 34, 58, 34, 116, 104, 101, 32, 111, 117, 116, 112, 117, 116, 32, 100, 101, 115, 116, 32, 102, 111, 114, 32, 116, 104, 101, 32, 115, 105, 103, 110, 97, 116, 117, 114, 101, 32, 99, 104, 97, 110, 103, 101, 115, 34, 125, 125, 44, 34, 99, 111, 110, 116, 101, 110, 116, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 67, 79, 110, 116, 101, 110, 116, 32, 102, 111, 114, 32, 116, 104, 101, 32, 101, 110, 116, 105, 114, 101, 32, 112, 97, 103, 101, 34, 125, 44, 34, 99, 111, 110, 116, 101, 120, 116, 34, 58, 123, 34, 100, 111, 99, 115, 34, 58, 34, 67, 111, 110, 116, 101, 120, 116, 32, 118, 97, 114, 105, 97, 110, 116, 115, 34, 125, 125, 125, 44, 34, 119, 117, 114, 98, 111, 45, 105, 110, 34, 58, 123, 34, 102, 117, 110, 99, 115, 34, 58, 123, 34, 97, 100, 100, 101, 118, 101, 110, 116, 108, 105, 115, 116, 101, 110, 101, 114, 34, 58, 34, 65, 100, 100, 32, 97, 110, 32, 101, 118, 101, 110, 116, 32, 108, 105, 115, 116, 101, 110, 101, 114, 32, 116, 111, 32, 116, 104, 101, 32, 103, 105, 118, 101, 110, 32, 101, 108, 101, 109, 101, 110, 116, 34, 125, 125, 44, 34, 119, 117, 114, 98, 111, 45, 111, 117, 116, 34, 58, 123, 34, 102, 117, 110, 99, 115, 34, 58, 123, 34, 114, 101, 110, 100, 101, 114, 34, 58, 34, 114, 101, 110, 100, 101, 114, 115, 32, 116, 104, 101, 32, 105, 110, 105, 116, 105, 97, 108, 32, 87, 101, 98, 32, 99, 111, 109, 112, 111, 110, 101, 110, 116, 32, 119, 105, 116, 104, 32, 116, 104, 101, 32, 103, 105, 118, 101, 110, 32, 100, 97, 116, 97, 92, 110, 97, 110, 100, 32, 116, 104, 101, 32, 116, 97, 114, 103, 101, 116, 32, 116, 101, 109, 112, 108, 97, 116, 101, 32, 116, 111, 32, 117, 115, 101, 32, 97, 115, 32, 116, 111, 112, 32, 108, 101, 118, 101, 108, 32, 101, 110, 116, 114, 121, 32, 112, 111, 105, 110, 116, 34, 44, 34, 97, 99, 116, 105, 118, 97, 116, 101, 34, 58, 34, 108, 105, 115, 116, 101, 110, 32, 111, 110, 32, 97, 108, 108, 32, 111, 114, 32, 103, 105, 118, 101, 110, 32, 115, 101, 108, 101, 99, 116, 111, 114, 115, 34, 125, 125, 125, 125, 0, 70, 9, 112, 114, 111, 100, 117, 99, 101, 114, 115, 1, 12, 112, 114, 111, 99, 101, 115, 115, 101, 100, 45, 98, 121, 2, 13, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 6, 48, 46, 49, 56, 46, 50, 16, 119, 105, 116, 45, 98, 105, 110, 100, 103, 101, 110, 45, 114, 117, 115, 116, 6, 48, 46, 49, 54, 46, 48]; +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 857] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xdb\x05\x01A\x02\x01\ +A\x0a\x01B\x07\x01p}\x01j\x01\0\x01s\x01@\x01\x07message\0\0\x01\x04\0\x04sign\x01\ +\x02\x01j\x01\x7f\x01s\x01@\x02\x07message\0\x09signature\0\0\x03\x04\0\x06verif\ +y\x01\x04\x03\x01(seed-keeper:edwards-wit/operations@0.1.0\x05\0\x01B\x0e\x01r\x02\ +\x08selectors\x02tys\x04\0\x0elisten-details\x03\0\0\x01r\x01\x05titles\x04\0\x04\ +page\x03\0\x02\x01r\x01\x0bplaceholders\x04\0\x05input\x03\0\x04\x01ks\x01r\x04\x05\ +value\x06\x02id\x06\x07message\x06\x09signature\x06\x04\0\x06output\x03\0\x07\x01\ +k\x08\x01r\x03\x04page\x03\x05input\x05\x06output\x09\x04\0\x07content\x03\0\x0a\ +\x01q\x03\x0ball-content\x01\x0b\0\x07message\x01s\0\x06submit\x01s\0\x04\0\x07c\ +ontext\x03\0\x0c\x03\x01$example:edwards-ui/wurbo-types@0.1.0\x05\x01\x02\x03\0\x01\ +\x0elisten-details\x01B\x04\x02\x03\x02\x01\x02\x04\0\x0elisten-details\x03\0\0\x01\ +@\x01\x07details\x01\x01\0\x04\0\x10addeventlistener\x01\x02\x03\x01!example:edw\ +ards-ui/wurbo-in@0.1.0\x05\x03\x02\x03\0\x01\x07context\x01B\x0e\x02\x03\x02\x01\ +\x04\x04\0\x07context\x03\0\0\x01ps\x01k\x02\x01@\x01\x09selectors\x03\x01\0\x04\ +\0\x08activate\x01\x04\x01j\x01s\x01s\x01@\x01\x03ctx\x01\0\x05\x04\0\x06render\x01\ +\x06\x01o\x02ss\x01p\x07\x01j\0\x01s\x01@\x01\x09templates\x08\0\x09\x04\0\x09cu\ +stomize\x01\x0a\x04\x01\"example:edwards-ui/wurbo-out@0.1.0\x05\x05\x04\x01\x20e\ +xample:edwards-ui/example@0.1.0\x04\0\x0b\x0d\x01\0\x07example\x03\0\0\0G\x09pro\ +ducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.201.0\x10wit-bindgen-rust\x06\ +0.21.0"; #[inline(never)] #[doc(hidden)] #[cfg(target_arch = "wasm32")] -pub fn __link_section() {} +pub fn __link_custom_section_describing_imports() { + wit_bindgen_rt::maybe_link_cabi_realloc(); +} diff --git a/examples/crates/edwards-ui/src/lib.rs b/examples/crates/edwards-ui/src/lib.rs index 07b947e..3bd8f80 100644 --- a/examples/crates/edwards-ui/src/lib.rs +++ b/examples/crates/edwards-ui/src/lib.rs @@ -20,6 +20,8 @@ use std::ops::Deref; struct Component; +bindings::export!(Component with_types_in bindings); + /// We need to provide the templates for the macro to pull in fn get_templates() -> Templates { let templates = Templates::new( diff --git a/examples/crates/edwards-ui/src/output.rs b/examples/crates/edwards-ui/src/output.rs index ea98569..f306801 100644 --- a/examples/crates/edwards-ui/src/output.rs +++ b/examples/crates/edwards-ui/src/output.rs @@ -1,5 +1,4 @@ use super::*; -use std::sync::OnceLock; static OUTPUT_ID: OnceLock = OnceLock::new(); diff --git a/examples/crates/edwards-ui/wit/world.wit b/examples/crates/edwards-ui/wit/world.wit index 346c534..625073c 100644 --- a/examples/crates/edwards-ui/wit/world.wit +++ b/examples/crates/edwards-ui/wit/world.wit @@ -56,13 +56,17 @@ interface wurbo-in { interface wurbo-out { use wurbo-types.{context}; + + // listen on all or given selectors + activate: func(selectors: option>); // renders the initial Web component with the given data // and the target template to use as top level entry point render: func(ctx: context) -> result; - // listen on all or given selectors - activate: func(selectors: option>); + // Optionally customize the configuration of the templates used to render the component + customize: func(templates: list>) -> result<_, string>; + } /// An example world for the component to target. diff --git a/examples/crates/edwards-wit/Cargo.toml b/examples/crates/edwards-wit/Cargo.toml index 0868abd..52bfccb 100644 --- a/examples/crates/edwards-wit/Cargo.toml +++ b/examples/crates/edwards-wit/Cargo.toml @@ -7,7 +7,8 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -wit-bindgen = { workspace = true } +bitflags = { workspace = true } +wit-bindgen-rt = { workspace = true } ed25519-dalek = "2.1" [dev-dependencies] diff --git a/examples/crates/edwards-wit/src/bindings.rs b/examples/crates/edwards-wit/src/bindings.rs index 7dc4457..df3de1b 100644 --- a/examples/crates/edwards-wit/src/bindings.rs +++ b/examples/crates/edwards-wit/src/bindings.rs @@ -1,371 +1,453 @@ -// Generated by `wit-bindgen` 0.16.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Options used: pub mod seed_keeper { - pub mod wallet { - - #[allow(clippy::all)] - pub mod types { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - /// The confuration of the seed keeper - #[derive(Clone)] - pub struct Credentials { - /// The username to use for the seed keeper - pub username: wit_bindgen::rt::vec::Vec::, - /// The password to use for the seed keeper - pub password: wit_bindgen::rt::vec::Vec::, - /// Optional prevously generated encrypted seed to use for the seed keeper - pub encrypted: Option>, - } - impl ::core::fmt::Debug for Credentials { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Credentials").field("username", &self.username).field("password", &self.password).field("encrypted", &self.encrypted).finish() - } - } - - } - - - #[allow(clippy::all)] - pub mod config { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - pub type Credentials = super::super::super::seed_keeper::wallet::types::Credentials; - #[allow(unused_unsafe, clippy::all)] - /// Load into the component from an encrypted seed, password, and salt (username) - /// Returns the encrypted seed or an error - pub fn set_config(config: &Credentials,) -> Result<(),wit_bindgen::rt::string::String>{ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - - #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let super::super::super::seed_keeper::wallet::types::Credentials{ username:username0, password:password0, encrypted:encrypted0, } = config; - let vec1 = username0; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - let vec2 = password0; - let ptr2 = vec2.as_ptr() as i32; - let len2 = vec2.len() as i32; - let (result4_0,result4_1,result4_2,) = match encrypted0 { - Some(e) => { - let vec3 = e; - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; - - (1i32, ptr3, len3) - }, - None => { - (0i32, 0i32, 0i32) - }, - };let ptr5 = ret_area.as_mut_ptr() as i32; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "seed-keeper:wallet/config@0.1.0")] - extern "C" { - #[link_name = "set-config"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32, ){ unreachable!() } - wit_import(ptr1, len1, ptr2, len2, result4_0, result4_1, result4_2, ptr5); - let l6 = i32::from(*((ptr5 + 0) as *const u8)); - match l6 { - 0 => { - let e = (); - Ok(e) + pub mod wallet { + #[allow(clippy::all)] + pub mod types { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + /// The confuration of the seed keeper + #[derive(Clone)] + pub struct Credentials { + /// The username to use for the seed keeper + pub username: _rt::Vec, + /// The password to use for the seed keeper + pub password: _rt::Vec, + /// Optional prevously generated encrypted seed to use for the seed keeper + pub encrypted: Option<_rt::Vec>, } - 1 => { - let e = { - let l7 = *((ptr5 + 4) as *const i32); - let l8 = *((ptr5 + 8) as *const i32); - let len9 = l8 as usize; - let bytes9 = Vec::from_raw_parts(l7 as *mut _, len9, len9); - - wit_bindgen::rt::string_lift(bytes9) - }; - Err(e) + impl ::core::fmt::Debug for Credentials { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Credentials") + .field("username", &self.username) + .field("password", &self.password) + .field("encrypted", &self.encrypted) + .finish() + } } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } } - } - #[allow(unused_unsafe, clippy::all)] - /// Returns the encrypted seed or None if it doesn't exist - pub fn get_encrypted() -> Result,wit_bindgen::rt::string::String>{ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - - #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "seed-keeper:wallet/config@0.1.0")] - extern "C" { - #[link_name = "get-encrypted"] - fn wit_import(_: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, ){ unreachable!() } - wit_import(ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); - match l1 { - 0 => { - let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; - - Vec::from_raw_parts(l2 as *mut _, len4, len4) - }; - Ok(e) - } - 1 => { - let e = { - let l5 = *((ptr0 + 4) as *const i32); - let l6 = *((ptr0 + 8) as *const i32); - let len7 = l6 as usize; - let bytes7 = Vec::from_raw_parts(l5 as *mut _, len7, len7); - - wit_bindgen::rt::string_lift(bytes7) - }; - Err(e) + + #[allow(clippy::all)] + pub mod config { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + pub type Credentials = super::super::super::seed_keeper::wallet::types::Credentials; + #[allow(unused_unsafe, clippy::all)] + /// Load into the component from an encrypted seed, password, and salt (username) + /// Returns the encrypted seed or an error + pub fn set_config(config: &Credentials) -> Result<(), _rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let super::super::super::seed_keeper::wallet::types::Credentials { + username: username0, + password: password0, + encrypted: encrypted0, + } = config; + let vec1 = username0; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + let vec2 = password0; + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + let (result4_0, result4_1, result4_2) = match encrypted0 { + Some(e) => { + let vec3 = e; + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + + (1i32, ptr3.cast_mut(), len3) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + let ptr5 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "seed-keeper:wallet/config@0.1.0")] + extern "C" { + #[link_name = "set-config"] + fn wit_import( + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import( + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { + unreachable!() + } + wit_import( + ptr1.cast_mut(), + len1, + ptr2.cast_mut(), + len2, + result4_0, + result4_1, + result4_2, + ptr5, + ); + let l6 = i32::from(*ptr5.add(0).cast::()); + match l6 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l7 = *ptr5.add(4).cast::<*mut u8>(); + let l8 = *ptr5.add(8).cast::(); + let len9 = l8; + let bytes9 = _rt::Vec::from_raw_parts(l7.cast(), len9, len9); + + _rt::string_lift(bytes9) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } - } - } - #[allow(unused_unsafe, clippy::all)] - /// Get the plaintext seed - pub fn get_seed() -> Result,wit_bindgen::rt::string::String>{ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - - #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "seed-keeper:wallet/config@0.1.0")] - extern "C" { - #[link_name = "get-seed"] - fn wit_import(_: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, ){ unreachable!() } - wit_import(ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); - match l1 { - 0 => { - let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; - - Vec::from_raw_parts(l2 as *mut _, len4, len4) - }; - Ok(e) + #[allow(unused_unsafe, clippy::all)] + /// Returns the encrypted seed or None if it doesn't exist + pub fn get_encrypted() -> Result<_rt::Vec, _rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "seed-keeper:wallet/config@0.1.0")] + extern "C" { + #[link_name = "get-encrypted"] + fn wit_import(_: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8) { + unreachable!() + } + wit_import(ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; + + _rt::Vec::from_raw_parts(l2.cast(), len4, len4) + }; + Ok(e) + } + 1 => { + let e = { + let l5 = *ptr0.add(4).cast::<*mut u8>(); + let l6 = *ptr0.add(8).cast::(); + let len7 = l6; + let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7); + + _rt::string_lift(bytes7) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } } - 1 => { - let e = { - let l5 = *((ptr0 + 4) as *const i32); - let l6 = *((ptr0 + 8) as *const i32); - let len7 = l6 as usize; - let bytes7 = Vec::from_raw_parts(l5 as *mut _, len7, len7); - - wit_bindgen::rt::string_lift(bytes7) - }; - Err(e) + #[allow(unused_unsafe, clippy::all)] + /// Get the plaintext seed + pub fn get_seed() -> Result<_rt::Vec, _rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "seed-keeper:wallet/config@0.1.0")] + extern "C" { + #[link_name = "get-seed"] + fn wit_import(_: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8) { + unreachable!() + } + wit_import(ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; + + _rt::Vec::from_raw_parts(l2.cast(), len4, len4) + }; + Ok(e) + } + 1 => { + let e = { + let l5 = *ptr0.add(4).cast::<*mut u8>(); + let l6 = *ptr0.add(8).cast::(); + let len7 = l6; + let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7); + + _rt::string_lift(bytes7) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } } - } - } - - } } pub mod exports { - pub mod seed_keeper { - pub mod edwards_wit { - - #[allow(clippy::all)] - pub mod operations { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_section; - const _: () = { - - #[doc(hidden)] - #[export_name = "seed-keeper:edwards-wit/operations@0.1.0#sign"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_sign(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let result1 = <_GuestImpl as Guest>::sign(Vec::from_raw_parts(arg0 as *mut _, len0, len0)); - let ptr2 = _RET_AREA.0.as_mut_ptr() as i32; - match result1 { - Ok(e) => { { - *((ptr2 + 0) as *mut u8) = (0i32) as u8; - let vec3 = (e).into_boxed_slice(); - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; - ::core::mem::forget(vec3); - *((ptr2 + 8) as *mut i32) = len3; - *((ptr2 + 4) as *mut i32) = ptr3; - } }, - Err(e) => { { - *((ptr2 + 0) as *mut u8) = (1i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr() as i32; - let len4 = vec4.len() as i32; - ::core::mem::forget(vec4); - *((ptr2 + 8) as *mut i32) = len4; - *((ptr2 + 4) as *mut i32) = ptr4; - } }, - };ptr2 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_seed-keeper:edwards-wit/operations@0.1.0#sign"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_sign(arg0: i32,) { - let l0 = i32::from(*((arg0 + 0) as *const u8)); - match l0 { - 0 => { - let l1 = *((arg0 + 4) as *const i32); - let l2 = *((arg0 + 8) as *const i32); - let base3 = l1; - let len3 = l2; - wit_bindgen::rt::dealloc(base3, (len3 as usize) * 1, 1); - }, - _ => { - let l4 = *((arg0 + 4) as *const i32); - let l5 = *((arg0 + 8) as *const i32); - wit_bindgen::rt::dealloc(l4, (l5) as usize, 1); - }, - } - } - }; - }; - const _: () = { - - #[doc(hidden)] - #[export_name = "seed-keeper:edwards-wit/operations@0.1.0#verify"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_verify(arg0: i32,arg1: i32,arg2: i32,arg3: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let len1 = arg3 as usize; - let result2 = <_GuestImpl as Guest>::verify(Vec::from_raw_parts(arg0 as *mut _, len0, len0), Vec::from_raw_parts(arg2 as *mut _, len1, len1)); - let ptr3 = _RET_AREA.0.as_mut_ptr() as i32; - match result2 { - Ok(e) => { { - *((ptr3 + 0) as *mut u8) = (0i32) as u8; - *((ptr3 + 4) as *mut u8) = (match e { true => 1, false => 0 }) as u8; - } }, - Err(e) => { { - *((ptr3 + 0) as *mut u8) = (1i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr() as i32; - let len4 = vec4.len() as i32; - ::core::mem::forget(vec4); - *((ptr3 + 8) as *mut i32) = len4; - *((ptr3 + 4) as *mut i32) = ptr4; - } }, - };ptr3 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_seed-keeper:edwards-wit/operations@0.1.0#verify"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_verify(arg0: i32,) { - let l0 = i32::from(*((arg0 + 0) as *const u8)); - match l0 { - 0 => (), - _ => { - let l1 = *((arg0 + 4) as *const i32); - let l2 = *((arg0 + 8) as *const i32); - wit_bindgen::rt::dealloc(l1, (l2) as usize, 1); - }, - } + pub mod seed_keeper { + pub mod edwards_wit { + #[allow(clippy::all)] + pub mod operations { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_sign_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { + let len0 = arg1; + let result1 = T::sign(_rt::Vec::from_raw_parts(arg0.cast(), len0, len0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + let vec3 = (e).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr2.add(8).cast::() = len3; + *ptr2.add(4).cast::<*mut u8>() = ptr3.cast_mut(); + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + let vec4 = (e.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr2.add(8).cast::() = len4; + *ptr2.add(4).cast::<*mut u8>() = ptr4.cast_mut(); + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_sign(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + let base3 = l1; + let len3 = l2; + _rt::cabi_dealloc(base3, len3 * 1, 1); + } + _ => { + let l4 = *arg0.add(4).cast::<*mut u8>(); + let l5 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l4, l5, 1); + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_verify_cabi( + arg0: *mut u8, + arg1: usize, + arg2: *mut u8, + arg3: usize, + ) -> *mut u8 { + let len0 = arg1; + let len1 = arg3; + let result2 = T::verify( + _rt::Vec::from_raw_parts(arg0.cast(), len0, len0), + _rt::Vec::from_raw_parts(arg2.cast(), len1, len1), + ); + let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); + match result2 { + Ok(e) => { + *ptr3.add(0).cast::() = (0i32) as u8; + *ptr3.add(4).cast::() = (match e { + true => 1, + false => 0, + }) as u8; + } + Err(e) => { + *ptr3.add(0).cast::() = (1i32) as u8; + let vec4 = (e.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr3.add(8).cast::() = len4; + *ptr3.add(4).cast::<*mut u8>() = ptr4.cast_mut(); + } + }; + ptr3 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_verify(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l1, l2, 1); + } + } + } + pub trait Guest { + fn sign(message: _rt::Vec) -> Result<_rt::Vec, _rt::String>; + fn verify( + message: _rt::Vec, + signature: _rt::Vec, + ) -> Result; + } + #[doc(hidden)] + + macro_rules! __export_seed_keeper_edwards_wit_operations_0_1_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "seed-keeper:edwards-wit/operations@0.1.0#sign"] + unsafe extern "C" fn export_sign(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_sign_cabi::<$ty>(arg0, arg1) + } + #[export_name = "cabi_post_seed-keeper:edwards-wit/operations@0.1.0#sign"] + unsafe extern "C" fn _post_return_sign(arg0: *mut u8,) { + $($path_to_types)*::__post_return_sign::<$ty>(arg0) + } + #[export_name = "seed-keeper:edwards-wit/operations@0.1.0#verify"] + unsafe extern "C" fn export_verify(arg0: *mut u8,arg1: usize,arg2: *mut u8,arg3: usize,) -> *mut u8 { + $($path_to_types)*::_export_verify_cabi::<$ty>(arg0, arg1, arg2, arg3) + } + #[export_name = "cabi_post_seed-keeper:edwards-wit/operations@0.1.0#verify"] + unsafe extern "C" fn _post_return_verify(arg0: *mut u8,) { + $($path_to_types)*::__post_return_verify::<$ty>(arg0) + } + };); + } + #[doc(hidden)] + pub(crate) use __export_seed_keeper_edwards_wit_operations_0_1_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 12]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 12]); } - }; - }; - use super::super::super::super::super::Component as _GuestImpl; - pub trait Guest { - fn sign(message: wit_bindgen::rt::vec::Vec::,) -> Result,wit_bindgen::rt::string::String>; - fn verify(message: wit_bindgen::rt::vec::Vec::,signature: wit_bindgen::rt::vec::Vec::,) -> Result; } - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - #[repr(align(4))] - struct _RetArea([u8; 12]); - static mut _RET_AREA: _RetArea = _RetArea([0; 12]); - - } - } - } +} +mod _rt { + pub use alloc_crate::string::String; + pub use alloc_crate::vec::Vec; + pub unsafe fn string_lift(bytes: Vec) -> String { + if cfg!(debug_assertions) { + String::from_utf8(bytes).unwrap() + } else { + String::from_utf8_unchecked(bytes) + } + } + pub unsafe fn invalid_enum_discriminant() -> T { + if cfg!(debug_assertions) { + panic!("invalid enum discriminant") + } else { + core::hint::unreachable_unchecked() + } + } + pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) { + if size == 0 { + return; + } + let layout = alloc::Layout::from_size_align_unchecked(size, align); + alloc::dealloc(ptr as *mut u8, layout); + } + extern crate alloc as alloc_crate; + pub use alloc_crate::alloc; } +/// Generates `#[no_mangle]` functions to export the specified type as the +/// root implementation of all generated traits. +/// +/// For more information see the documentation of `wit_bindgen::generate!`. +/// +/// ```rust +/// # macro_rules! export{ ($($t:tt)*) => (); } +/// # trait Guest {} +/// struct MyType; +/// +/// impl Guest for MyType { +/// // ... +/// } +/// +/// export!(MyType); +/// ``` +#[allow(unused_macros)] +#[doc(hidden)] + +macro_rules! __export_example_impl { + ($ty:ident) => (self::export!($ty with_types_in self);); + ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( + $($path_to_types_root)*::exports::seed_keeper::edwards_wit::operations::__export_seed_keeper_edwards_wit_operations_0_1_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::seed_keeper::edwards_wit::operations); + ) +} +#[doc(inline)] +pub(crate) use __export_example_impl as export; + #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:example"] +#[link_section = "component-type:wit-bindgen:0.21.0:example:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 691] = [3, 0, 7, 101, 120, 97, 109, 112, 108, 101, 0, 97, 115, 109, 13, 0, 1, 0, 7, 125, 1, 65, 2, 1, 66, 7, 1, 112, 125, 1, 106, 1, 0, 1, 115, 1, 64, 1, 7, 109, 101, 115, 115, 97, 103, 101, 0, 0, 1, 4, 0, 4, 115, 105, 103, 110, 1, 2, 1, 106, 1, 127, 1, 115, 1, 64, 2, 7, 109, 101, 115, 115, 97, 103, 101, 0, 9, 115, 105, 103, 110, 97, 116, 117, 114, 101, 0, 0, 3, 4, 0, 6, 118, 101, 114, 105, 102, 121, 1, 4, 4, 1, 40, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 101, 100, 119, 97, 114, 100, 115, 45, 119, 105, 116, 47, 111, 112, 101, 114, 97, 116, 105, 111, 110, 115, 64, 48, 46, 49, 46, 48, 5, 0, 11, 16, 1, 0, 10, 111, 112, 101, 114, 97, 116, 105, 111, 110, 115, 3, 0, 0, 7, 164, 3, 1, 65, 2, 1, 65, 7, 1, 66, 4, 1, 112, 125, 1, 107, 0, 1, 114, 3, 8, 117, 115, 101, 114, 110, 97, 109, 101, 0, 8, 112, 97, 115, 115, 119, 111, 114, 100, 0, 9, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 4, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 3, 0, 2, 3, 1, 30, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 97, 108, 108, 101, 116, 47, 116, 121, 112, 101, 115, 64, 48, 46, 49, 46, 48, 5, 0, 2, 3, 0, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 1, 66, 10, 2, 3, 2, 1, 1, 4, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 3, 0, 0, 1, 106, 0, 1, 115, 1, 64, 1, 6, 99, 111, 110, 102, 105, 103, 1, 0, 2, 4, 0, 10, 115, 101, 116, 45, 99, 111, 110, 102, 105, 103, 1, 3, 1, 112, 125, 1, 106, 1, 4, 1, 115, 1, 64, 0, 0, 5, 4, 0, 13, 103, 101, 116, 45, 101, 110, 99, 114, 121, 112, 116, 101, 100, 1, 6, 4, 0, 8, 103, 101, 116, 45, 115, 101, 101, 100, 1, 6, 3, 1, 31, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 119, 97, 108, 108, 101, 116, 47, 99, 111, 110, 102, 105, 103, 64, 48, 46, 49, 46, 48, 5, 2, 1, 66, 7, 1, 112, 125, 1, 106, 1, 0, 1, 115, 1, 64, 1, 7, 109, 101, 115, 115, 97, 103, 101, 0, 0, 1, 4, 0, 4, 115, 105, 103, 110, 1, 2, 1, 106, 1, 127, 1, 115, 1, 64, 2, 7, 109, 101, 115, 115, 97, 103, 101, 0, 9, 115, 105, 103, 110, 97, 116, 117, 114, 101, 0, 0, 3, 4, 0, 6, 118, 101, 114, 105, 102, 121, 1, 4, 4, 1, 40, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 101, 100, 119, 97, 114, 100, 115, 45, 119, 105, 116, 47, 111, 112, 101, 114, 97, 116, 105, 111, 110, 115, 64, 48, 46, 49, 46, 48, 5, 3, 4, 1, 37, 115, 101, 101, 100, 45, 107, 101, 101, 112, 101, 114, 58, 101, 100, 119, 97, 114, 100, 115, 45, 119, 105, 116, 47, 101, 120, 97, 109, 112, 108, 101, 64, 48, 46, 49, 46, 48, 4, 0, 11, 13, 1, 0, 7, 101, 120, 97, 109, 112, 108, 101, 3, 2, 0, 0, 16, 12, 112, 97, 99, 107, 97, 103, 101, 45, 100, 111, 99, 115, 0, 123, 125, 0, 70, 9, 112, 114, 111, 100, 117, 99, 101, 114, 115, 1, 12, 112, 114, 111, 99, 101, 115, 115, 101, 100, 45, 98, 121, 2, 13, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 6, 48, 46, 49, 56, 46, 50, 16, 119, 105, 116, 45, 98, 105, 110, 100, 103, 101, 110, 45, 114, 117, 115, 116, 6, 48, 46, 49, 54, 46, 48]; +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 546] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xa4\x03\x01A\x02\x01\ +A\x07\x01B\x04\x01p}\x01k\0\x01r\x03\x08username\0\x08password\0\x09encrypted\x01\ +\x04\0\x0bcredentials\x03\0\x02\x03\x01\x1eseed-keeper:wallet/types@0.1.0\x05\0\x02\ +\x03\0\0\x0bcredentials\x01B\x0a\x02\x03\x02\x01\x01\x04\0\x0bcredentials\x03\0\0\ +\x01j\0\x01s\x01@\x01\x06config\x01\0\x02\x04\0\x0aset-config\x01\x03\x01p}\x01j\ +\x01\x04\x01s\x01@\0\0\x05\x04\0\x0dget-encrypted\x01\x06\x04\0\x08get-seed\x01\x06\ +\x03\x01\x1fseed-keeper:wallet/config@0.1.0\x05\x02\x01B\x07\x01p}\x01j\x01\0\x01\ +s\x01@\x01\x07message\0\0\x01\x04\0\x04sign\x01\x02\x01j\x01\x7f\x01s\x01@\x02\x07\ +message\0\x09signature\0\0\x03\x04\0\x06verify\x01\x04\x04\x01(seed-keeper:edwar\ +ds-wit/operations@0.1.0\x05\x03\x04\x01%seed-keeper:edwards-wit/example@0.1.0\x04\ +\0\x0b\x0d\x01\0\x07example\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dw\ +it-component\x070.201.0\x10wit-bindgen-rust\x060.21.0"; #[inline(never)] #[doc(hidden)] #[cfg(target_arch = "wasm32")] -pub fn __link_section() {} +pub fn __link_custom_section_describing_imports() { + wit_bindgen_rt::maybe_link_cabi_realloc(); +} diff --git a/examples/crates/edwards-wit/src/lib.rs b/examples/crates/edwards-wit/src/lib.rs index a96cf4a..15e698a 100644 --- a/examples/crates/edwards-wit/src/lib.rs +++ b/examples/crates/edwards-wit/src/lib.rs @@ -8,6 +8,8 @@ use ed25519_dalek::{Signature, Signer, SigningKey}; struct Component; +bindings::export!(Component with_types_in bindings); + impl Guest for Component { /// Say hello! /// sign: func(message: list) -> list; diff --git a/examples/crates/math/Cargo.toml b/examples/crates/math/Cargo.toml index 6a1fd90..3dcec0b 100644 --- a/examples/crates/math/Cargo.toml +++ b/examples/crates/math/Cargo.toml @@ -6,7 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wit-bindgen = { workspace = true } +bitflags = { workspace = true } +wit-bindgen-rt = { workspace = true } [lib] crate-type = ["cdylib"] diff --git a/examples/crates/math/src/bindings.rs b/examples/crates/math/src/bindings.rs index 8bc2fbf..c42c398 100644 --- a/examples/crates/math/src/bindings.rs +++ b/examples/crates/math/src/bindings.rs @@ -1,58 +1,156 @@ -// Generated by `wit-bindgen` 0.16.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Options used: pub mod exports { - pub mod component { - pub mod math { - - #[allow(clippy::all)] - pub mod addition { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_section; - const _: () = { - - #[doc(hidden)] + pub mod component { + pub mod math { + #[allow(clippy::all)] + pub mod addition { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_add_cabi(arg0: i32, arg1: i32) -> i32 { + let result0 = T::add(arg0, arg1); + _rt::as_i32(result0) + } + pub trait Guest { + fn add(x: i32, y: i32) -> i32; + } + #[doc(hidden)] + + macro_rules! __export_component_math_addition_0_1_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + #[export_name = "component:math/addition@0.1.0#add"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_add(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::add(arg0, arg1); - wit_bindgen::rt::as_i32(result0) + unsafe extern "C" fn export_add(arg0: i32,arg1: i32,) -> i32 { + $($path_to_types)*::_export_add_cabi::<$ty>(arg0, arg1) } - }; - use super::super::super::super::super::Component as _GuestImpl; - pub trait Guest { - fn add(x: i32,y: i32,) -> i32; - } - + };); } - + #[doc(hidden)] + pub(crate) use __export_component_math_addition_0_1_0_cabi; + } + } } - } } +mod _rt { + + pub fn as_i32(t: T) -> i32 { + t.as_i32() + } + + pub trait AsI32 { + fn as_i32(self) -> i32; + } + + impl<'a, T: Copy + AsI32> AsI32 for &'a T { + fn as_i32(self) -> i32 { + (*self).as_i32() + } + } + + impl AsI32 for i32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for char { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for usize { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } +} + +/// Generates `#[no_mangle]` functions to export the specified type as the +/// root implementation of all generated traits. +/// +/// For more information see the documentation of `wit_bindgen::generate!`. +/// +/// ```rust +/// # macro_rules! export{ ($($t:tt)*) => (); } +/// # trait Guest {} +/// struct MyType; +/// +/// impl Guest for MyType { +/// // ... +/// } +/// +/// export!(MyType); +/// ``` +#[allow(unused_macros)] +#[doc(hidden)] + +macro_rules! __export_example_impl { + ($ty:ident) => (self::export!($ty with_types_in self);); + ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( + $($path_to_types_root)*::exports::component::math::addition::__export_component_math_addition_0_1_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::component::math::addition); + ) +} +#[doc(inline)] +pub(crate) use __export_example_impl as export; #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:example"] +#[link_section = "component-type:wit-bindgen:0.21.0:example:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 218] = [3, 0, 7, 101, 120, 97, 109, 112, 108, 101, 0, 97, 115, 109, 13, 0, 1, 0, 7, 93, 1, 65, 2, 1, 65, 2, 1, 66, 2, 1, 64, 2, 1, 120, 122, 1, 121, 122, 0, 122, 4, 0, 3, 97, 100, 100, 1, 0, 4, 1, 29, 99, 111, 109, 112, 111, 110, 101, 110, 116, 58, 109, 97, 116, 104, 47, 97, 100, 100, 105, 116, 105, 111, 110, 64, 48, 46, 49, 46, 48, 5, 0, 4, 1, 26, 101, 120, 97, 109, 112, 108, 101, 58, 109, 97, 116, 104, 47, 101, 120, 97, 109, 112, 108, 101, 64, 48, 46, 49, 46, 48, 4, 0, 11, 13, 1, 0, 7, 101, 120, 97, 109, 112, 108, 101, 3, 0, 0, 0, 16, 12, 112, 97, 99, 107, 97, 103, 101, 45, 100, 111, 99, 115, 0, 123, 125, 0, 70, 9, 112, 114, 111, 100, 117, 99, 101, 114, 115, 1, 12, 112, 114, 111, 99, 101, 115, 115, 101, 100, 45, 98, 121, 2, 13, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 6, 48, 46, 49, 56, 46, 50, 16, 119, 105, 116, 45, 98, 105, 110, 100, 103, 101, 110, 45, 114, 117, 115, 116, 6, 48, 46, 49, 54, 46, 48]; +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 218] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07]\x01A\x02\x01A\x02\x01\ +B\x02\x01@\x02\x01xz\x01yz\0z\x04\0\x03add\x01\0\x04\x01\x1dcomponent:math/addit\ +ion@0.1.0\x05\0\x04\x01\x1aexample:math/example@0.1.0\x04\0\x0b\x0d\x01\0\x07exa\ +mple\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.201.0\ +\x10wit-bindgen-rust\x060.21.0"; #[inline(never)] #[doc(hidden)] #[cfg(target_arch = "wasm32")] -pub fn __link_section() {} +pub fn __link_custom_section_describing_imports() { + wit_bindgen_rt::maybe_link_cabi_realloc(); +} diff --git a/examples/crates/math/src/lib.rs b/examples/crates/math/src/lib.rs index 111349a..bd94ad2 100644 --- a/examples/crates/math/src/lib.rs +++ b/examples/crates/math/src/lib.rs @@ -4,6 +4,8 @@ use crate::bindings::exports::component::math::addition::Guest; struct Component; +bindings::export!(Component with_types_in bindings); + impl Guest for Component { fn add(a: i32, b: i32) -> i32 { a + b diff --git a/justfile b/justfile index 7b288be..7697dcf 100644 --- a/justfile +++ b/justfile @@ -1,6 +1,15 @@ +build-examples: + for dir in examples/crates/*; do \ + if [ -f $dir/Cargo.toml ]; then \ + cargo component build --manifest-path=$dir/Cargo.toml --workspace; \ + fi \ + done + build: - cargo component build --workspace - cargo component build --workspace --release + cargo component build --manifest-path=crates/seed-keeper-wallet/Cargo.toml + cargo component build --manifest-path=crates/seed-keeper-wit-ui/Cargo.toml + cargo component build --manifest-path=crates/seed-keeper-wallet/Cargo.toml --release + cargo component build --manifest-path=crates/seed-keeper-wit-ui/Cargo.toml --release compose: build wasm-tools compose --config examples/crates/aggregate-wit-ui/config.yml -o examples/aggregate.wasm target/wasm32-wasi/release/aggregate_wit_ui.wasm