cuttle/mobile/native/src/bridge_generated.rs
2023-08-19 09:23:12 -07:00

124 lines
2.8 KiB
Rust

#![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
)]
// AUTO GENERATED FILE, DO NOT EDIT.
// Generated by `flutter_rust_bridge`@ 1.81.0.
use core::panic::UnwindSafe;
use std::{ffi::c_void, sync::Arc};
use flutter_rust_bridge::{rust2dart::IntoIntoDart, *};
use crate::api::*;
// Section: imports
// Section: wire functions
fn wire_get_tx_config_impl(port_: MessagePort, bytes: impl Wire2Api<Vec<u8>> + UnwindSafe) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap::<_, _, _, Option<TxConfig>>(
WrapInfo {
debug_name: "get_tx_config",
port: Some(port_),
mode: FfiCallMode::Normal,
},
move || {
let api_bytes = bytes.wire2api();
move |task_callback| Ok(get_tx_config(api_bytes))
},
)
}
fn wire_check_raptor_impl(
port_: MessagePort,
buffer: impl Wire2Api<Vec<u8>> + UnwindSafe,
txconf: impl Wire2Api<TxConfig> + UnwindSafe,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap::<_, _, _, bool>(
WrapInfo {
debug_name: "check_raptor",
port: Some(port_),
mode: FfiCallMode::Normal,
},
move || {
let api_buffer = buffer.wire2api();
let api_txconf = txconf.wire2api();
move |task_callback| Ok(check_raptor(api_buffer, api_txconf))
},
)
}
// Section: wrapper structs
// Section: static checks
// Section: allocate functions
// Section: related functions
// Section: impl Wire2Api
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<u16> for u16 {
fn wire2api(self) -> u16 {
self
}
}
impl Wire2Api<u64> for u64 {
fn wire2api(self) -> u64 {
self
}
}
impl Wire2Api<u8> for u8 {
fn wire2api(self) -> u8 {
self
}
}
// Section: impl IntoDart
impl support::IntoDart for TxConfig {
fn into_dart(self) -> support::DartAbi {
vec![
self.len.into_into_dart().into_dart(),
self.mtu.into_into_dart().into_dart(),
self.description.into_into_dart().into_dart(),
]
.into_dart()
}
}
impl support::IntoDartExceptPrimitive for TxConfig {}
impl rust2dart::IntoIntoDart<TxConfig> for TxConfig {
fn into_into_dart(self) -> Self {
self
}
}
// Section: executor
support::lazy_static! {
pub static ref FLUTTER_RUST_BRIDGE_HANDLER: support::DefaultHandler = Default::default();
}
#[cfg(not(target_family = "wasm"))]
#[path = "bridge_generated.io.rs"]
mod io;
#[cfg(not(target_family = "wasm"))]
pub use io::*;