|
| 1 | +//! Hermes bindings generated with [`::wit_bindgen`]. |
| 2 | +//! They can be reused when using `share` keyword of [`bindings_generate`] macro. |
| 3 | +
|
| 4 | +/// Re-exported [`::wit-bindgen`] crate, so that [`bindings_generate`] is self-reliant. |
| 5 | +#[doc(hidden)] |
| 6 | +pub use wit_bindgen; |
| 7 | + |
| 8 | +wit_bindgen::generate!({ |
| 9 | + world: "hermes", |
| 10 | + path: "../../../../wasm/wasi/wit", |
| 11 | + disable_custom_section_link_helpers: true, |
| 12 | + generate_all, |
| 13 | +}); |
| 14 | + |
| 15 | +/// See [crate-level](crate) documentation. |
| 16 | +#[macro_export] |
| 17 | +macro_rules! bindings_generate { |
| 18 | + ({ |
| 19 | + world: $world:literal, |
| 20 | + path: $path:literal, |
| 21 | + inline: $inline:literal, |
| 22 | + $(with: {$($with_wit:literal: $with_path:path),* $(,)? },)? |
| 23 | + share: [] $(,)? |
| 24 | + }) => { |
| 25 | + ::shared::bindings::wit_bindgen::generate!({ |
| 26 | + runtime_path: "::shared::bindings::wit_bindgen::rt", |
| 27 | + world: $world, |
| 28 | + path: $path, |
| 29 | + inline: $inline, |
| 30 | + $(with: { $($with_wit: $with_path,)* },)? |
| 31 | + generate_all, |
| 32 | + }); |
| 33 | + }; |
| 34 | + ({ |
| 35 | + world: $world:literal, |
| 36 | + path: $path:literal, |
| 37 | + inline: $inline:literal, |
| 38 | + $(with: {$($with_wit:literal: $with_path:path),* $(,)? },)? |
| 39 | + share: ["hermes:cardano" $(, $share:tt)* $(,)?] $(,)? |
| 40 | + }) => { |
| 41 | + $crate::bindings_generate!({ |
| 42 | + world: $world, |
| 43 | + path: $path, |
| 44 | + inline: $inline, |
| 45 | + with: { |
| 46 | + $($($with_wit: $with_path,)*)? |
| 47 | + "hermes:binary/api": ::shared::bindings::hermes::binary::api, |
| 48 | + "hermes:cbor/api": ::shared::bindings::hermes::cbor::api, |
| 49 | + "hermes:hash/api": ::shared::bindings::hermes::hash::api, |
| 50 | + "hermes:cardano/api": ::shared::bindings::hermes::cardano::api, |
| 51 | + }, |
| 52 | + share: [$($share),*], |
| 53 | + }); |
| 54 | + }; |
| 55 | + ({ |
| 56 | + world: $world:literal, |
| 57 | + path: $path:literal, |
| 58 | + inline: $inline:literal, |
| 59 | + $(with: {$($with_wit:literal: $with_path:path),* $(,)? },)? |
| 60 | + share: ["hermes:logging" $(, $share:tt)* $(,)?] $(,)? |
| 61 | + }) => { |
| 62 | + $crate::bindings_generate!({ |
| 63 | + world: $world, |
| 64 | + path: $path, |
| 65 | + inline: $inline, |
| 66 | + with: { |
| 67 | + $($($with_wit: $with_path,)*)? |
| 68 | + "hermes:logging/api": ::shared::bindings::hermes::logging::api, |
| 69 | + "hermes:json/api": ::shared::bindings::hermes::json::api, |
| 70 | + }, |
| 71 | + share: [$($share),*], |
| 72 | + }); |
| 73 | + }; |
| 74 | + ({ |
| 75 | + world: $world:literal, |
| 76 | + path: $path:literal, |
| 77 | + inline: $inline:literal, |
| 78 | + $(with: {$($with_wit:literal: $with_path:path),* $(,)? },)? |
| 79 | + share: ["hermes:sqlite" $(, $share:tt)* $(,)?] $(,)? |
| 80 | + }) => { |
| 81 | + $crate::bindings_generate!({ |
| 82 | + world: $world, |
| 83 | + path: $path, |
| 84 | + inline: $inline, |
| 85 | + with: { |
| 86 | + $($($with_wit: $with_path,)*)? |
| 87 | + "hermes:sqlite/api": ::shared::bindings::hermes::sqlite::api, |
| 88 | + }, |
| 89 | + share: [$($share),*] |
| 90 | + }); |
| 91 | + }; |
| 92 | +} |
0 commit comments