#![allow(
non_camel_case_types,
unused,
clippy::redundant_closure,
clippy::useless_conversion,
clippy::unit_arg,
clippy::double_parens,
non_snake_case,
clippy::too_many_arguments
)]
use crate::mobile::*;
use core::panic::UnwindSafe;
use flutter_rust_bridge::*;
use std::ffi::c_void;
use std::sync::Arc;
fn wire_greet_impl(port_: MessagePort) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap(
WrapInfo {
debug_name: "greet",
port: Some(port_),
mode: FfiCallMode::Normal,
},
move || move |task_callback| Ok(greet()),
)
}
fn wire_did_resolve_impl(
port_: MessagePort,
did: impl Wire2Api<String> + UnwindSafe,
opts: impl Wire2Api<String> + UnwindSafe,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap(
WrapInfo {
debug_name: "did_resolve",
port: Some(port_),
mode: FfiCallMode::Normal,
},
move || {
let api_did = did.wire2api();
let api_opts = opts.wire2api();
move |task_callback| did_resolve(api_did, api_opts)
},
)
}
fn wire_did_verify_impl(
port_: MessagePort,
did: impl Wire2Api<String> + UnwindSafe,
opts: impl Wire2Api<String> + UnwindSafe,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap(
WrapInfo {
debug_name: "did_verify",
port: Some(port_),
mode: FfiCallMode::Normal,
},
move || {
let api_did = did.wire2api();
let api_opts = opts.wire2api();
move |task_callback| did_verify(api_did, api_opts)
},
)
}
fn wire_vc_verify_credential_impl(
port_: MessagePort,
credential: impl Wire2Api<String> + UnwindSafe,
opts: impl Wire2Api<String> + UnwindSafe,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap(
WrapInfo {
debug_name: "vc_verify_credential",
port: Some(port_),
mode: FfiCallMode::Normal,
},
move || {
let api_credential = credential.wire2api();
let api_opts = opts.wire2api();
move |task_callback| vc_verify_credential(api_credential, api_opts)
},
)
}
fn wire_vp_issue_presentation_impl(
port_: MessagePort,
presentation: impl Wire2Api<String> + UnwindSafe,
opts: impl Wire2Api<String> + UnwindSafe,
jwk_json: impl Wire2Api<String> + UnwindSafe,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap(
WrapInfo {
debug_name: "vp_issue_presentation",
port: Some(port_),
mode: FfiCallMode::Normal,
},
move || {
let api_presentation = presentation.wire2api();
let api_opts = opts.wire2api();
let api_jwk_json = jwk_json.wire2api();
move |task_callback| vp_issue_presentation(api_presentation, api_opts, api_jwk_json)
},
)
}
fn wire_vp_verify_presentation_impl(
port_: MessagePort,
presentation: impl Wire2Api<String> + UnwindSafe,
opts: impl Wire2Api<String> + UnwindSafe,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap(
WrapInfo {
debug_name: "vp_verify_presentation",
port: Some(port_),
mode: FfiCallMode::Normal,
},
move || {
let api_presentation = presentation.wire2api();
let api_opts = opts.wire2api();
move |task_callback| vp_verify_presentation(api_presentation, api_opts)
},
)
}
fn wire_create_operation_mnemonic_impl(
port_: MessagePort,
mnemonic: impl Wire2Api<String> + UnwindSafe,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap(
WrapInfo {
debug_name: "create_operation_mnemonic",
port: Some(port_),
mode: FfiCallMode::Normal,
},
move || {
let api_mnemonic = mnemonic.wire2api();
move |task_callback| create_operation_mnemonic(api_mnemonic)
},
)
}
pub trait Wire2Api<T> {
fn wire2api(self) -> T;
}
impl<T, S> Wire2Api<Option<T>> for *mut S
where
*mut S: Wire2Api<T>,
{
fn wire2api(self) -> Option<T> {
(!self.is_null()).then(|| self.wire2api())
}
}
impl Wire2Api<u8> for u8 {
fn wire2api(self) -> u8 {
self
}
}
support::lazy_static! {
pub static ref FLUTTER_RUST_BRIDGE_HANDLER: support::DefaultHandler = Default::default();
}
#[cfg(not(target_family = "wasm"))]
#[path = "mobile_bridge.io.rs"]
mod io;
#[cfg(not(target_family = "wasm"))]
pub use io::*;