mirror of
https://github.com/tauri-apps/tauri-bindgen.git
synced 2026-01-31 00:45:21 +01:00
Merge branch 'main' into feat/json-output2
This commit is contained in:
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@@ -34,7 +34,7 @@ jobs:
|
||||
- name: install native dependecies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y webkit2gtk-4.0 libgtk-3-dev
|
||||
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{matrix.rust}}
|
||||
@@ -44,7 +44,7 @@ jobs:
|
||||
RUSTFLAGS: ${{matrix.rustflags}} ${{env.RUSTFLAGS}}
|
||||
|
||||
msrv:
|
||||
name: Rust 1.70.0
|
||||
name: Rust MSRV
|
||||
needs: pre_ci
|
||||
if: needs.pre_ci.outputs.continue
|
||||
runs-on: ubuntu-latest
|
||||
@@ -54,8 +54,10 @@ jobs:
|
||||
- name: install native dependecies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y webkit2gtk-4.0 libgtk-3-dev
|
||||
- uses: dtolnay/rust-toolchain@1.70.0
|
||||
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: 1.70.0 # MSRV
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo check --workspace --tests
|
||||
|
||||
@@ -69,7 +71,7 @@ jobs:
|
||||
- name: install native dependecies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y webkit2gtk-4.0 libgtk-3-dev
|
||||
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: clippy
|
||||
|
||||
21
.github/workflows/spelling.yml
vendored
Normal file
21
.github/workflows/spelling.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: Spelling
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
CARGO_TERM_COLOR: always
|
||||
CLICOLOR: 1
|
||||
|
||||
jobs:
|
||||
spelling:
|
||||
name: Spell Check with Typos
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Actions Repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Spell Check Repo
|
||||
uses: crate-ci/typos@master
|
||||
@@ -3,7 +3,7 @@ name = "tauri-bindgen"
|
||||
authors.workspace = true
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
rust-version.workspace = true # MSRV
|
||||
|
||||
[workspace]
|
||||
members = ["crates/*"]
|
||||
@@ -35,6 +35,7 @@ proc-macro2 = "1.0.67"
|
||||
syn = "2.0.33"
|
||||
schemars = "0.8.12"
|
||||
serde_json = "1.0"
|
||||
tauri = "2.0.0-alpha.14"
|
||||
|
||||
[dependencies]
|
||||
clap.workspace = true
|
||||
|
||||
@@ -34,7 +34,7 @@ Here are a few reasons why that is cool:
|
||||
|
||||
- **Compile-time Checks**
|
||||
|
||||
When using strongly typed languages, such as Rust, TypeScript or ReScript the generated code will automatically ensure that you are calling the API correctly, as long as it passes the type checking youre golden. This is especially neat **when working in a team**, so your colleagues can't just change command signatures and pull the rug out from under you.
|
||||
When using strongly typed languages, such as Rust, TypeScript or ReScript the generated code will automatically ensure that you are calling the API correctly, as long as it passes the type checking your golden. This is especially neat **when working in a team**, so your colleagues can't just change command signatures and pull the rug out from under you.
|
||||
|
||||
- **Easily auditable**
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
|
||||
use heck::ToKebabCase;
|
||||
use heck::{ToSnakeCase, ToUpperCamelCase};
|
||||
use proc_macro2::TokenStream;
|
||||
use proc_macro2::{Literal, TokenStream};
|
||||
use quote::format_ident;
|
||||
use quote::quote;
|
||||
use std::collections::HashSet;
|
||||
use std::path::PathBuf;
|
||||
use tauri_bindgen_core::{Generate, GeneratorBuilder, TypeInfo, TypeInfos};
|
||||
use tauri_bindgen_gen_rust::{print_generics, BorrowMode, FnSig, RustGenerator};
|
||||
use wit_parser::{Function, FunctionResult, Interface, Type, TypeDefKind};
|
||||
use wit_parser::{Function, Interface, Type, TypeDefKind};
|
||||
|
||||
#[derive(Default, Debug, Clone)]
|
||||
#[cfg_attr(feature = "clap", derive(clap::Args))]
|
||||
@@ -252,7 +252,7 @@ impl Host {
|
||||
|
||||
let functions = functions.map(|func| {
|
||||
let sig = FnSig {
|
||||
async_: false,
|
||||
async_: self.opts.async_,
|
||||
unsafe_: false,
|
||||
private: true,
|
||||
self_arg: Some(quote!(&self)),
|
||||
@@ -266,7 +266,13 @@ impl Host {
|
||||
|
||||
let sized = sized.then_some(quote!(: Sized));
|
||||
|
||||
let async_trait = self
|
||||
.opts
|
||||
.async_
|
||||
.then_some(quote! { #[::tauri_bindgen_host::async_trait] });
|
||||
|
||||
quote! {
|
||||
#async_trait
|
||||
pub trait #ident #sized {
|
||||
#(#additional_items)*
|
||||
#(#functions)*
|
||||
@@ -304,6 +310,131 @@ impl Host {
|
||||
}
|
||||
}
|
||||
|
||||
fn print_router_fn_definition(&self, mod_name: &str, func: &Function) -> TokenStream {
|
||||
let func_name = func.ident.to_snake_case();
|
||||
let func_ident = format_ident!("{}", func_name);
|
||||
|
||||
let param_decl = match func.params.len() {
|
||||
0 => quote! { () },
|
||||
1 => {
|
||||
let ty = &func.params.first().unwrap().1;
|
||||
let ty = self.print_ty(ty, &BorrowMode::Owned);
|
||||
quote! { #ty }
|
||||
}
|
||||
_ => {
|
||||
let tys = func
|
||||
.params
|
||||
.iter()
|
||||
.map(|(_, ty)| self.print_ty(ty, &BorrowMode::Owned));
|
||||
quote! { (#(#tys),*) }
|
||||
}
|
||||
};
|
||||
|
||||
let param_acc = match func.params.len() {
|
||||
0 => quote! {},
|
||||
1 => quote! { p },
|
||||
_ => {
|
||||
let ids = func.params.iter().enumerate().map(|(i, _)| {
|
||||
let i = Literal::usize_unsuffixed(i);
|
||||
quote! { p.#i }
|
||||
});
|
||||
quote! { #(#ids),* }
|
||||
}
|
||||
};
|
||||
|
||||
if self.opts.async_ {
|
||||
quote! {
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router.define_async(
|
||||
#mod_name,
|
||||
#func_name,
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: #param_decl| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.#func_ident(#param_acc).await)
|
||||
})
|
||||
})?;
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router.define(
|
||||
#mod_name,
|
||||
#func_name,
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: #param_decl| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
|
||||
Ok(ctx.#func_ident(#param_acc))
|
||||
},
|
||||
)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn print_router_method_definition(
|
||||
&self,
|
||||
mod_name: &str,
|
||||
resource_name: &str,
|
||||
method: &Function,
|
||||
) -> TokenStream {
|
||||
let func_name = method.ident.to_snake_case();
|
||||
let func_ident = format_ident!("{}", func_name);
|
||||
|
||||
let param_decl = method
|
||||
.params
|
||||
.iter()
|
||||
.map(|(_, ty)| self.print_ty(ty, &BorrowMode::Owned));
|
||||
|
||||
let param_acc = match method.params.len() {
|
||||
0 => quote! {},
|
||||
1 => quote! { p.1 },
|
||||
_ => {
|
||||
let ids = method.params.iter().enumerate().map(|(i, _)| {
|
||||
let i = Literal::usize_unsuffixed(i + 1);
|
||||
quote! { p.#i }
|
||||
});
|
||||
quote! { #(#ids),* }
|
||||
}
|
||||
};
|
||||
|
||||
let mod_name = format!("{mod_name}::resource::{resource_name}");
|
||||
let get_r_ident = format_ident!("get_{}", resource_name.to_snake_case());
|
||||
|
||||
if self.opts.async_ {
|
||||
quote! {
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router.define_async(
|
||||
#mod_name,
|
||||
#func_name,
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: (::tauri_bindgen_host::ResourceId, #(#param_decl),*)| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.#get_r_ident(p.0)?;
|
||||
Ok(r.#func_ident(#param_acc).await)
|
||||
})
|
||||
})?;
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router.define(
|
||||
#mod_name,
|
||||
#func_name,
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (::tauri_bindgen_host::ResourceId, #(#param_decl),*)
|
||||
| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.#get_r_ident(p.0)?;
|
||||
Ok(r.#func_ident(#param_acc))
|
||||
},
|
||||
)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn print_add_to_router<'a>(
|
||||
&self,
|
||||
mod_ident: &str,
|
||||
@@ -314,104 +445,10 @@ impl Host {
|
||||
|
||||
let mod_name = mod_ident.to_snake_case();
|
||||
|
||||
let functions = functions.map(|func| {
|
||||
let func_name = func.id.to_snake_case();
|
||||
let func_ident = format_ident!("{}", func_name);
|
||||
|
||||
let params = self.print_function_params(&func.params, &BorrowMode::Owned);
|
||||
|
||||
let param_idents = func
|
||||
.params
|
||||
.iter()
|
||||
.map(|(ident, _)| { format_ident!("{}", ident) });
|
||||
|
||||
let result = match func.result.as_ref() {
|
||||
Some(FunctionResult::Anon(ty)) => {
|
||||
let ty = self.print_ty(ty, &BorrowMode::Owned);
|
||||
|
||||
quote! { #ty }
|
||||
}
|
||||
Some(FunctionResult::Named(types)) if types.len() == 1 => {
|
||||
let (_, ty) = &types[0];
|
||||
let ty = self.print_ty(ty, &BorrowMode::Owned);
|
||||
|
||||
quote! { #ty }
|
||||
}
|
||||
Some(FunctionResult::Named(types)) => {
|
||||
let types = types.iter().map(|(_, ty)| self.print_ty(ty, &BorrowMode::Owned));
|
||||
|
||||
quote! { (#(#types),*) }
|
||||
}
|
||||
_ => quote! { () },
|
||||
};
|
||||
|
||||
quote! {
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router.func_wrap(
|
||||
#mod_name,
|
||||
#func_name,
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, #params| -> ::tauri_bindgen_host::anyhow::Result<#result> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
|
||||
Ok(ctx.#func_ident(#(#param_idents),*))
|
||||
},
|
||||
)?;
|
||||
}
|
||||
});
|
||||
let functions = functions.map(|func| self.print_router_fn_definition(&mod_name, func));
|
||||
|
||||
let methods = methods.map(|(resource_name, method)| {
|
||||
let func_name = method.id.to_snake_case();
|
||||
let func_ident = format_ident!("{}", func_name);
|
||||
|
||||
let params = self.print_function_params(&method.params, &BorrowMode::Owned);
|
||||
|
||||
let param_idents = method
|
||||
.params
|
||||
.iter()
|
||||
.map(|(ident, _)| format_ident!("{}", ident));
|
||||
|
||||
let result = match method.result.as_ref() {
|
||||
Some(FunctionResult::Anon(ty)) => {
|
||||
let ty = self.print_ty(ty, &BorrowMode::Owned);
|
||||
|
||||
quote! { #ty }
|
||||
}
|
||||
Some(FunctionResult::Named(types)) if types.len() == 1 => {
|
||||
let (_, ty) = &types[0];
|
||||
let ty = self.print_ty(ty, &BorrowMode::Owned);
|
||||
|
||||
quote! { #ty }
|
||||
}
|
||||
Some(FunctionResult::Named(types)) => {
|
||||
let types = types
|
||||
.iter()
|
||||
.map(|(_, ty)| self.print_ty(ty, &BorrowMode::Owned));
|
||||
|
||||
quote! { (#(#types),*) }
|
||||
}
|
||||
_ => quote! { () },
|
||||
};
|
||||
|
||||
let mod_name = format!("{mod_name}::resource::{resource_name}");
|
||||
let get_r_ident = format_ident!("get_{}", resource_name.to_snake_case());
|
||||
|
||||
quote! {
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router.func_wrap(
|
||||
#mod_name,
|
||||
#func_name,
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
this_rid: ::tauri_bindgen_host::ResourceId,
|
||||
#params
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<#result> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.#get_r_ident(this_rid)?;
|
||||
|
||||
Ok(r.#func_ident(#(#param_idents),*))
|
||||
},
|
||||
)?;
|
||||
}
|
||||
self.print_router_method_definition(&mod_name, resource_name, method)
|
||||
});
|
||||
|
||||
quote! {
|
||||
@@ -420,6 +457,7 @@ impl Host {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: #trait_ident + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
|
||||
50
crates/gen-host/tests/async/chars.rs
Normal file
50
crates/gen-host/tests/async/chars.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod chars {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait Chars: Sized {
|
||||
///A function that accepts a character
|
||||
async fn take_char(&self, x: char);
|
||||
///A function that returns a character
|
||||
async fn return_char(&self) -> char;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Chars + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"chars",
|
||||
"take_char",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: char| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.take_char(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"chars",
|
||||
"return_char",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_char().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
197
crates/gen-host/tests/async/conventions.rs
Normal file
197
crates/gen-host/tests/async/conventions.rs
Normal file
@@ -0,0 +1,197 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod conventions {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[derive(serde::Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct LudicrousSpeed {
|
||||
pub how_fast_are_you_going: u32,
|
||||
pub i_am_going_extremely_slow: u64,
|
||||
}
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait Conventions: Sized {
|
||||
async fn kebab_case(&self);
|
||||
async fn foo(&self, x: LudicrousSpeed);
|
||||
async fn function_with_underscores(&self);
|
||||
async fn function_with_no_weird_characters(&self);
|
||||
async fn apple(&self);
|
||||
async fn apple_pear(&self);
|
||||
async fn apple_pear_grape(&self);
|
||||
async fn a0(&self);
|
||||
async fn is_xml(&self);
|
||||
async fn explicit(&self);
|
||||
async fn explicit_snake(&self);
|
||||
async fn bool(&self);
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Conventions + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"conventions",
|
||||
"kebab_case",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.kebab_case().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"conventions",
|
||||
"foo",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: LudicrousSpeed|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.foo(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"conventions",
|
||||
"function_with_underscores",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.function_with_underscores().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"conventions",
|
||||
"function_with_no_weird_characters",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.function_with_no_weird_characters().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"conventions",
|
||||
"apple",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.apple().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"conventions",
|
||||
"apple_pear",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.apple_pear().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"conventions",
|
||||
"apple_pear_grape",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.apple_pear_grape().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"conventions",
|
||||
"a0",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a0().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"conventions",
|
||||
"is_xml",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.is_xml().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"conventions",
|
||||
"explicit",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.explicit().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"conventions",
|
||||
"explicit_snake",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.explicit_snake().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"conventions",
|
||||
"bool",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.bool().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
19
crates/gen-host/tests/async/empty.rs
Normal file
19
crates/gen-host/tests/async/empty.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod empty {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait Empty: Sized {}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Empty + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
173
crates/gen-host/tests/async/flegs.rs
Normal file
173
crates/gen-host/tests/async/flegs.rs
Normal file
@@ -0,0 +1,173 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod flegs {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
bitflags::bitflags! {
|
||||
#[derive(serde::Deserialize, serde::Serialize)] pub struct Flag1 : u8 { const B0
|
||||
= 1 << 0; }
|
||||
}
|
||||
bitflags::bitflags! {
|
||||
#[derive(serde::Deserialize, serde::Serialize)] pub struct Flag2 : u8 { const B0
|
||||
= 1 << 0; const B1 = 1 << 1; }
|
||||
}
|
||||
bitflags::bitflags! {
|
||||
#[derive(serde::Deserialize, serde::Serialize)] pub struct Flag4 : u8 { const B0
|
||||
= 1 << 0; const B1 = 1 << 1; const B2 = 1 << 2; const B3 = 1 << 3; }
|
||||
}
|
||||
bitflags::bitflags! {
|
||||
#[derive(serde::Deserialize, serde::Serialize)] pub struct Flag8 : u8 { const B0
|
||||
= 1 << 0; const B1 = 1 << 1; const B2 = 1 << 2; const B3 = 1 << 3; const B4 = 1
|
||||
<< 4; const B5 = 1 << 5; const B6 = 1 << 6; const B7 = 1 << 7; }
|
||||
}
|
||||
bitflags::bitflags! {
|
||||
#[derive(serde::Deserialize, serde::Serialize)] pub struct Flag16 : u16 { const
|
||||
B0 = 1 << 0; const B1 = 1 << 1; const B2 = 1 << 2; const B3 = 1 << 3; const B4 =
|
||||
1 << 4; const B5 = 1 << 5; const B6 = 1 << 6; const B7 = 1 << 7; const B8 = 1 <<
|
||||
8; const B9 = 1 << 9; const B10 = 1 << 10; const B11 = 1 << 11; const B12 = 1 <<
|
||||
12; const B13 = 1 << 13; const B14 = 1 << 14; const B15 = 1 << 15; }
|
||||
}
|
||||
bitflags::bitflags! {
|
||||
#[derive(serde::Deserialize, serde::Serialize)] pub struct Flag32 : u32 { const
|
||||
B0 = 1 << 0; const B1 = 1 << 1; const B2 = 1 << 2; const B3 = 1 << 3; const B4 =
|
||||
1 << 4; const B5 = 1 << 5; const B6 = 1 << 6; const B7 = 1 << 7; const B8 = 1 <<
|
||||
8; const B9 = 1 << 9; const B10 = 1 << 10; const B11 = 1 << 11; const B12 = 1 <<
|
||||
12; const B13 = 1 << 13; const B14 = 1 << 14; const B15 = 1 << 15; const B16 = 1
|
||||
<< 16; const B17 = 1 << 17; const B18 = 1 << 18; const B19 = 1 << 19; const B20 =
|
||||
1 << 20; const B21 = 1 << 21; const B22 = 1 << 22; const B23 = 1 << 23; const B24
|
||||
= 1 << 24; const B25 = 1 << 25; const B26 = 1 << 26; const B27 = 1 << 27; const
|
||||
B28 = 1 << 28; const B29 = 1 << 29; const B30 = 1 << 30; const B31 = 1 << 31; }
|
||||
}
|
||||
bitflags::bitflags! {
|
||||
#[derive(serde::Deserialize, serde::Serialize)] pub struct Flag64 : u64 { const
|
||||
B0 = 1 << 0; const B1 = 1 << 1; const B2 = 1 << 2; const B3 = 1 << 3; const B4 =
|
||||
1 << 4; const B5 = 1 << 5; const B6 = 1 << 6; const B7 = 1 << 7; const B8 = 1 <<
|
||||
8; const B9 = 1 << 9; const B10 = 1 << 10; const B11 = 1 << 11; const B12 = 1 <<
|
||||
12; const B13 = 1 << 13; const B14 = 1 << 14; const B15 = 1 << 15; const B16 = 1
|
||||
<< 16; const B17 = 1 << 17; const B18 = 1 << 18; const B19 = 1 << 19; const B20 =
|
||||
1 << 20; const B21 = 1 << 21; const B22 = 1 << 22; const B23 = 1 << 23; const B24
|
||||
= 1 << 24; const B25 = 1 << 25; const B26 = 1 << 26; const B27 = 1 << 27; const
|
||||
B28 = 1 << 28; const B29 = 1 << 29; const B30 = 1 << 30; const B31 = 1 << 31;
|
||||
const B32 = 1 << 32; const B33 = 1 << 33; const B34 = 1 << 34; const B35 = 1 <<
|
||||
35; const B36 = 1 << 36; const B37 = 1 << 37; const B38 = 1 << 38; const B39 = 1
|
||||
<< 39; const B40 = 1 << 40; const B41 = 1 << 41; const B42 = 1 << 42; const B43 =
|
||||
1 << 43; const B44 = 1 << 44; const B45 = 1 << 45; const B46 = 1 << 46; const B47
|
||||
= 1 << 47; const B48 = 1 << 48; const B49 = 1 << 49; const B50 = 1 << 50; const
|
||||
B51 = 1 << 51; const B52 = 1 << 52; const B53 = 1 << 53; const B54 = 1 << 54;
|
||||
const B55 = 1 << 55; const B56 = 1 << 56; const B57 = 1 << 57; const B58 = 1 <<
|
||||
58; const B59 = 1 << 59; const B60 = 1 << 60; const B61 = 1 << 61; const B62 = 1
|
||||
<< 62; const B63 = 1 << 63; }
|
||||
}
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait Flegs: Sized {
|
||||
async fn roundtrip_flag1(&self, x: Flag1) -> Flag1;
|
||||
async fn roundtrip_flag2(&self, x: Flag2) -> Flag2;
|
||||
async fn roundtrip_flag4(&self, x: Flag4) -> Flag4;
|
||||
async fn roundtrip_flag8(&self, x: Flag8) -> Flag8;
|
||||
async fn roundtrip_flag16(&self, x: Flag16) -> Flag16;
|
||||
async fn roundtrip_flag32(&self, x: Flag32) -> Flag32;
|
||||
async fn roundtrip_flag64(&self, x: Flag64) -> Flag64;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Flegs + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"flegs",
|
||||
"roundtrip_flag1",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag1| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag1(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"flegs",
|
||||
"roundtrip_flag2",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag2| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag2(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"flegs",
|
||||
"roundtrip_flag4",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag4| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag4(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"flegs",
|
||||
"roundtrip_flag8",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag8| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag8(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"flegs",
|
||||
"roundtrip_flag16",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag16| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag16(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"flegs",
|
||||
"roundtrip_flag32",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag32| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag32(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"flegs",
|
||||
"roundtrip_flag64",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag64| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag64(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
76
crates/gen-host/tests/async/floats.rs
Normal file
76
crates/gen-host/tests/async/floats.rs
Normal file
@@ -0,0 +1,76 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod floats {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait Floats: Sized {
|
||||
async fn float32_param(&self, x: f32);
|
||||
async fn float64_param(&self, x: f64);
|
||||
async fn float32_result(&self) -> f32;
|
||||
async fn float64_result(&self) -> f64;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Floats + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"floats",
|
||||
"float32_param",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: f32| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.float32_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"floats",
|
||||
"float64_param",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: f64| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.float64_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"floats",
|
||||
"float32_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.float32_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"floats",
|
||||
"float64_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.float64_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
347
crates/gen-host/tests/async/integers.rs
Normal file
347
crates/gen-host/tests/async/integers.rs
Normal file
@@ -0,0 +1,347 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod integers {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait Integers: Sized {
|
||||
async fn a1(&self, x: u8);
|
||||
async fn a2(&self, x: i8);
|
||||
async fn a3(&self, x: u16);
|
||||
async fn a4(&self, x: i16);
|
||||
async fn a5(&self, x: u32);
|
||||
async fn a6(&self, x: i32);
|
||||
async fn a7(&self, x: u64);
|
||||
async fn a8(&self, x: i64);
|
||||
async fn a9(&self, x: u128);
|
||||
async fn a10(&self, x: i128);
|
||||
async fn a11(
|
||||
&self,
|
||||
p1: u8,
|
||||
p2: i8,
|
||||
p3: u16,
|
||||
p4: i16,
|
||||
p5: u32,
|
||||
p6: i32,
|
||||
p7: u64,
|
||||
p8: i64,
|
||||
p9: u128,
|
||||
p10: i128,
|
||||
);
|
||||
async fn r1(&self) -> u8;
|
||||
async fn r2(&self) -> i8;
|
||||
async fn r3(&self) -> u16;
|
||||
async fn r4(&self) -> i16;
|
||||
async fn r5(&self) -> u32;
|
||||
async fn r6(&self) -> i32;
|
||||
async fn r7(&self) -> u64;
|
||||
async fn r8(&self) -> i64;
|
||||
async fn r9(&self) -> u128;
|
||||
async fn r10(&self) -> i128;
|
||||
async fn pair_ret(&self) -> (i64, u8);
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Integers + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"a1",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: u8| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a1(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"a2",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: i8| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a2(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"a3",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: u16| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a3(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"a4",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: i16| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a4(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"a5",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: u32| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a5(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"a6",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: i32| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a6(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"a7",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: u64| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a7(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"a8",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: i64| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a8(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"a9",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: u128| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a9(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"a10",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: i128| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a10(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"a11",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (u8, i8, u16, i16, u32, i32, u64, i64, u128, i128)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(
|
||||
ctx
|
||||
.a11(p.0, p.1, p.2, p.3, p.4, p.5, p.6, p.7, p.8, p.9)
|
||||
.await,
|
||||
)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"r1",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r1().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"r2",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r2().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"r3",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r3().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"r4",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r4().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"r5",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r5().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"r6",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r6().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"r7",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r7().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"r8",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r8().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"r9",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r9().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"r10",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r10().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"integers",
|
||||
"pair_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.pair_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
551
crates/gen-host/tests/async/lists.rs
Normal file
551
crates/gen-host/tests/async/lists.rs
Normal file
@@ -0,0 +1,551 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod lists {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct OtherRecord {
|
||||
pub a1: u32,
|
||||
pub a2: u64,
|
||||
pub a3: i32,
|
||||
pub a4: i64,
|
||||
pub b: String,
|
||||
pub c: Vec<u8>,
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct SomeRecord {
|
||||
pub x: String,
|
||||
pub y: OtherRecord,
|
||||
pub z: Vec<OtherRecord>,
|
||||
pub c1: u32,
|
||||
pub c2: u64,
|
||||
pub c3: i32,
|
||||
pub c4: i64,
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum OtherVariant {
|
||||
A,
|
||||
B(u32),
|
||||
C(String),
|
||||
}
|
||||
#[derive(serde::Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum SomeVariant {
|
||||
A(String),
|
||||
B,
|
||||
C(u32),
|
||||
D(Vec<OtherVariant>),
|
||||
}
|
||||
pub type LoadStoreAllSizes = Vec<
|
||||
(String, u8, i8, u16, i16, u32, i32, u64, i64, f32, f64, char),
|
||||
>;
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait Lists: Sized {
|
||||
async fn list_u8_param(&self, x: Vec<u8>);
|
||||
async fn list_u16_param(&self, x: Vec<u16>);
|
||||
async fn list_u32_param(&self, x: Vec<u32>);
|
||||
async fn list_u64_param(&self, x: Vec<u64>);
|
||||
async fn list_u128_param(&self, x: Vec<u128>);
|
||||
async fn list_s8_param(&self, x: Vec<i8>);
|
||||
async fn list_s16_param(&self, x: Vec<i16>);
|
||||
async fn list_s32_param(&self, x: Vec<i32>);
|
||||
async fn list_s64_param(&self, x: Vec<i64>);
|
||||
async fn list_s128_param(&self, x: Vec<i128>);
|
||||
async fn list_float32_param(&self, x: Vec<f32>);
|
||||
async fn list_float64_param(&self, x: Vec<f64>);
|
||||
async fn list_u8_ret(&self) -> Vec<u8>;
|
||||
async fn list_u16_ret(&self) -> Vec<u16>;
|
||||
async fn list_u32_ret(&self) -> Vec<u32>;
|
||||
async fn list_u64_ret(&self) -> Vec<u64>;
|
||||
async fn list_u128_ret(&self) -> Vec<u128>;
|
||||
async fn list_s8_ret(&self) -> Vec<i8>;
|
||||
async fn list_s16_ret(&self) -> Vec<i16>;
|
||||
async fn list_s32_ret(&self) -> Vec<i32>;
|
||||
async fn list_s64_ret(&self) -> Vec<i64>;
|
||||
async fn list_s128_ret(&self) -> Vec<i128>;
|
||||
async fn list_float32_ret(&self) -> Vec<f32>;
|
||||
async fn list_float64_ret(&self) -> Vec<f64>;
|
||||
async fn tuple_list(&self, x: Vec<(u8, i8)>) -> Vec<(i64, u32)>;
|
||||
async fn string_list_arg(&self, a: Vec<String>);
|
||||
async fn string_list_ret(&self) -> Vec<String>;
|
||||
async fn tuple_string_list(&self, x: Vec<(u8, String)>) -> Vec<(String, u8)>;
|
||||
async fn string_list(&self, x: Vec<String>) -> Vec<String>;
|
||||
async fn record_list(&self, x: Vec<SomeRecord>) -> Vec<OtherRecord>;
|
||||
async fn record_list_reverse(&self, x: Vec<OtherRecord>) -> Vec<SomeRecord>;
|
||||
async fn variant_list(&self, x: Vec<SomeVariant>) -> Vec<OtherVariant>;
|
||||
async fn load_store_everything(&self, a: LoadStoreAllSizes) -> LoadStoreAllSizes;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Lists + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_u8_param",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<u8>| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u8_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_u16_param",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<u16>| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u16_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_u32_param",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<u32>| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u32_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_u64_param",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<u64>| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u64_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_u128_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: Vec<u128>|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u128_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_s8_param",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<i8>| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s8_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_s16_param",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<i16>| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s16_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_s32_param",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<i32>| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s32_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_s64_param",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<i64>| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s64_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_s128_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: Vec<i128>|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s128_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_float32_param",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<f32>| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_float32_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_float64_param",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<f64>| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_float64_param(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_u8_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u8_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_u16_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u16_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_u32_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u32_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_u64_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u64_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_u128_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u128_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_s8_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s8_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_s16_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s16_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_s32_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s32_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_s64_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s64_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_s128_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s128_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_float32_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_float32_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"list_float64_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_float64_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"tuple_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: Vec<(u8, i8)>|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.tuple_list(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"string_list_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: Vec<String>|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.string_list_arg(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"string_list_ret",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.string_list_ret().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"tuple_string_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: Vec<(u8, String)>|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.tuple_string_list(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"string_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: Vec<String>|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.string_list(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"record_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: Vec<SomeRecord>|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.record_list(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"record_list_reverse",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: Vec<OtherRecord>|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.record_list_reverse(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"variant_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: Vec<SomeVariant>|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.variant_list(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"lists",
|
||||
"load_store_everything",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: LoadStoreAllSizes|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.load_store_everything(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
134
crates/gen-host/tests/async/many-arguments.rs
Normal file
134
crates/gen-host/tests/async/many-arguments.rs
Normal file
@@ -0,0 +1,134 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod many_arguments {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[derive(serde::Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct BigStruct {
|
||||
pub a1: String,
|
||||
pub a2: String,
|
||||
pub a3: String,
|
||||
pub a4: String,
|
||||
pub a5: String,
|
||||
pub a6: String,
|
||||
pub a7: String,
|
||||
pub a8: String,
|
||||
pub a9: String,
|
||||
pub a10: String,
|
||||
pub a11: String,
|
||||
pub a12: String,
|
||||
pub a13: String,
|
||||
pub a14: String,
|
||||
pub a15: String,
|
||||
pub a16: String,
|
||||
pub a17: String,
|
||||
pub a18: String,
|
||||
pub a19: String,
|
||||
pub a20: String,
|
||||
}
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait ManyArguments: Sized {
|
||||
async fn many_args(
|
||||
&self,
|
||||
a1: u64,
|
||||
a2: u64,
|
||||
a3: u64,
|
||||
a4: u64,
|
||||
a5: u64,
|
||||
a6: u64,
|
||||
a7: u64,
|
||||
a8: u64,
|
||||
a9: u64,
|
||||
a10: u64,
|
||||
a11: u64,
|
||||
a12: u64,
|
||||
a13: u64,
|
||||
a14: u64,
|
||||
a15: u64,
|
||||
a16: u64,
|
||||
);
|
||||
async fn big_argument(&self, x: BigStruct);
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: ManyArguments + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"many_arguments",
|
||||
"many_args",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(
|
||||
ctx
|
||||
.many_args(
|
||||
p.0,
|
||||
p.1,
|
||||
p.2,
|
||||
p.3,
|
||||
p.4,
|
||||
p.5,
|
||||
p.6,
|
||||
p.7,
|
||||
p.8,
|
||||
p.9,
|
||||
p.10,
|
||||
p.11,
|
||||
p.12,
|
||||
p.13,
|
||||
p.14,
|
||||
p.15,
|
||||
)
|
||||
.await,
|
||||
)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"many_arguments",
|
||||
"big_argument",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: BigStruct|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.big_argument(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
90
crates/gen-host/tests/async/multi-return.rs
Normal file
90
crates/gen-host/tests/async/multi-return.rs
Normal file
@@ -0,0 +1,90 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod multi_return {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait MultiReturn: Sized {
|
||||
async fn mra(&self);
|
||||
async fn mrb(&self);
|
||||
async fn mrc(&self) -> u32;
|
||||
async fn mrd(&self) -> u32;
|
||||
async fn mre(&self) -> (u32, f32);
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: MultiReturn + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"multi_return",
|
||||
"mra",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mra().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"multi_return",
|
||||
"mrb",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mrb().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"multi_return",
|
||||
"mrc",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mrc().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"multi_return",
|
||||
"mrd",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mrd().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"multi_return",
|
||||
"mre",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mre().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
225
crates/gen-host/tests/async/records.rs
Normal file
225
crates/gen-host/tests/async/records.rs
Normal file
@@ -0,0 +1,225 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod records {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Empty {}
|
||||
/**A record containing two scalar fields
|
||||
that both have the same type*/
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Scalars {
|
||||
///The first field, named a
|
||||
pub a: u32,
|
||||
///The second field, named b
|
||||
pub b: u32,
|
||||
}
|
||||
/**A record that is really just flags
|
||||
All of the fields are bool*/
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct ReallyFlags {
|
||||
pub a: bool,
|
||||
pub b: bool,
|
||||
pub c: bool,
|
||||
pub d: bool,
|
||||
pub e: bool,
|
||||
pub f: bool,
|
||||
pub g: bool,
|
||||
pub h: bool,
|
||||
pub i: bool,
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Aggregates {
|
||||
pub a: Scalars,
|
||||
pub b: u32,
|
||||
pub c: Empty,
|
||||
pub d: String,
|
||||
pub e: ReallyFlags,
|
||||
}
|
||||
pub type IntTypedef = i32;
|
||||
pub type TupleTypedef2 = (IntTypedef,);
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait Records: Sized {
|
||||
async fn tuple_arg(&self, x: (char, u32));
|
||||
async fn tuple_result(&self) -> (char, u32);
|
||||
async fn empty_arg(&self, x: Empty);
|
||||
async fn empty_result(&self) -> Empty;
|
||||
async fn scalar_arg(&self, x: Scalars);
|
||||
async fn scalar_result(&self) -> Scalars;
|
||||
async fn flags_arg(&self, x: ReallyFlags);
|
||||
async fn flags_result(&self) -> ReallyFlags;
|
||||
async fn aggregate_arg(&self, x: Aggregates);
|
||||
async fn aggregate_result(&self) -> Aggregates;
|
||||
async fn typedef_inout(&self, e: TupleTypedef2) -> i32;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Records + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"records",
|
||||
"tuple_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (char, u32)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.tuple_arg(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"records",
|
||||
"tuple_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.tuple_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"records",
|
||||
"empty_arg",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Empty| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.empty_arg(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"records",
|
||||
"empty_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.empty_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"records",
|
||||
"scalar_arg",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Scalars| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.scalar_arg(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"records",
|
||||
"scalar_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.scalar_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"records",
|
||||
"flags_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: ReallyFlags|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.flags_arg(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"records",
|
||||
"flags_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.flags_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"records",
|
||||
"aggregate_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: Aggregates|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.aggregate_arg(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"records",
|
||||
"aggregate_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.aggregate_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"records",
|
||||
"typedef_inout",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: TupleTypedef2|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.typedef_inout(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
182
crates/gen-host/tests/async/resources.rs
Normal file
182
crates/gen-host/tests/async/resources.rs
Normal file
@@ -0,0 +1,182 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod resources {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait A {
|
||||
async fn f1(&self);
|
||||
async fn f2(&self, a: u32);
|
||||
async fn f3(&self, a: u32, b: u32);
|
||||
}
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait B {
|
||||
type A: A;
|
||||
async fn f1(&self) -> ::tauri_bindgen_host::ResourceId;
|
||||
async fn f2(&self, x: ::tauri_bindgen_host::ResourceId) -> Result<u32, ()>;
|
||||
async fn f3(
|
||||
&self,
|
||||
x: Option<Vec<::tauri_bindgen_host::ResourceId>>,
|
||||
) -> Result<::tauri_bindgen_host::ResourceId, ()>;
|
||||
}
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait Resources: Sized {
|
||||
type A: A + Send + Sync;
|
||||
fn get_a(
|
||||
&self,
|
||||
id: ::tauri_bindgen_host::ResourceId,
|
||||
) -> ::tauri_bindgen_host::Result<::std::sync::Arc<Self::A>>;
|
||||
type B: B + Send + Sync;
|
||||
fn get_b(
|
||||
&self,
|
||||
id: ::tauri_bindgen_host::ResourceId,
|
||||
) -> ::tauri_bindgen_host::Result<::std::sync::Arc<Self::B>>;
|
||||
async fn constructor_a(&self) -> ::tauri_bindgen_host::ResourceId;
|
||||
async fn constructor_b(&self) -> ::tauri_bindgen_host::ResourceId;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Resources + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"resources",
|
||||
"constructor_a",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.constructor_a().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"resources",
|
||||
"constructor_b",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.constructor_b().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"resources::resource::a",
|
||||
"f1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (::tauri_bindgen_host::ResourceId,)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.get_a(p.0)?;
|
||||
Ok(r.f1().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"resources::resource::a",
|
||||
"f2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (::tauri_bindgen_host::ResourceId, u32)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.get_a(p.0)?;
|
||||
Ok(r.f2(p.1).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"resources::resource::a",
|
||||
"f3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (::tauri_bindgen_host::ResourceId, u32, u32)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.get_a(p.0)?;
|
||||
Ok(r.f3(p.1, p.2).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"resources::resource::b",
|
||||
"f1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (::tauri_bindgen_host::ResourceId,)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.get_b(p.0)?;
|
||||
Ok(r.f1().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"resources::resource::b",
|
||||
"f2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (
|
||||
::tauri_bindgen_host::ResourceId,
|
||||
::tauri_bindgen_host::ResourceId,
|
||||
)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.get_b(p.0)?;
|
||||
Ok(r.f2(p.1).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"resources::resource::b",
|
||||
"f3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (
|
||||
::tauri_bindgen_host::ResourceId,
|
||||
Option<Vec<::tauri_bindgen_host::ResourceId>>,
|
||||
)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.get_b(p.0)?;
|
||||
Ok(r.f3(p.1).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
110
crates/gen-host/tests/async/simple-functions.rs
Normal file
110
crates/gen-host/tests/async/simple-functions.rs
Normal file
@@ -0,0 +1,110 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod simple_functions {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait SimpleFunctions: Sized {
|
||||
async fn f1(&self);
|
||||
async fn f2(&self, a: u32);
|
||||
async fn f3(&self, a: u32, b: u32);
|
||||
async fn f4(&self) -> u32;
|
||||
async fn f5(&self) -> (u32, u32);
|
||||
async fn f6(&self, a: u32, b: u32, c: u32) -> (u32, u32, u32);
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: SimpleFunctions + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"simple_functions",
|
||||
"f1",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f1().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"simple_functions",
|
||||
"f2",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: u32| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f2(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"simple_functions",
|
||||
"f3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (u32, u32)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f3(p.0, p.1).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"simple_functions",
|
||||
"f4",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f4().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"simple_functions",
|
||||
"f5",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f5().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"simple_functions",
|
||||
"f6",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (u32, u32, u32)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f6(p.0, p.1, p.2).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
82
crates/gen-host/tests/async/simple-lists.rs
Normal file
82
crates/gen-host/tests/async/simple-lists.rs
Normal file
@@ -0,0 +1,82 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod simple_lists {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait SimpleLists: Sized {
|
||||
async fn simple_list1(&self, l: Vec<u32>);
|
||||
async fn simple_list2(&self) -> Vec<u32>;
|
||||
async fn simple_list3(&self, a: Vec<u32>, b: Vec<u32>) -> (Vec<u32>, Vec<u32>);
|
||||
async fn simple_list4(&self, l: Vec<Vec<u32>>) -> Vec<Vec<u32>>;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: SimpleLists + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"simple_lists",
|
||||
"simple_list1",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<u32>| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.simple_list1(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"simple_lists",
|
||||
"simple_list2",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.simple_list2().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"simple_lists",
|
||||
"simple_list3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (Vec<u32>, Vec<u32>)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.simple_list3(p.0, p.1).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"simple_lists",
|
||||
"simple_list4",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: Vec<Vec<u32>>|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.simple_list4(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
40
crates/gen-host/tests/async/small-anonymous.rs
Normal file
40
crates/gen-host/tests/async/small-anonymous.rs
Normal file
@@ -0,0 +1,40 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod small_anonymous {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[derive(serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Error {
|
||||
Success,
|
||||
Failure,
|
||||
}
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait SmallAnonymous: Sized {
|
||||
async fn option_test(&self) -> Result<Option<String>, Error>;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: SmallAnonymous + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"small_anonymous",
|
||||
"option_test",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.option_test().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
65
crates/gen-host/tests/async/strings.rs
Normal file
65
crates/gen-host/tests/async/strings.rs
Normal file
@@ -0,0 +1,65 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod strings {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait Strings: Sized {
|
||||
async fn a(&self, x: String);
|
||||
async fn b(&self) -> String;
|
||||
async fn c(&self, a: String, b: String) -> String;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Strings + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"strings",
|
||||
"a",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: String| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"strings",
|
||||
"b",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.b().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"strings",
|
||||
"c",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (String, String)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.c(p.0, p.1).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
237
crates/gen-host/tests/async/unions.rs
Normal file
237
crates/gen-host/tests/async/unions.rs
Normal file
@@ -0,0 +1,237 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod unions {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
///A union of all of the integral types
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum AllIntegers {
|
||||
/**Bool is equivalent to a 1 bit integer
|
||||
and is treated that way in some languages*/
|
||||
Bool(bool),
|
||||
U8(u8),
|
||||
U16(u16),
|
||||
U32(u32),
|
||||
U64(u64),
|
||||
I8(i8),
|
||||
I16(i16),
|
||||
S32(i32),
|
||||
S64(i64),
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum AllFloats {
|
||||
F32(f32),
|
||||
F64(f64),
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum AllText {
|
||||
Char(char),
|
||||
String(String),
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum DuplicatedS32 {
|
||||
///The first s32
|
||||
S320(i32),
|
||||
///The second s32
|
||||
S321(i32),
|
||||
///The third s32
|
||||
S322(i32),
|
||||
}
|
||||
///A type containing numeric types that are distinct in most languages
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum DistinguishableNum {
|
||||
///A Floating Point Number
|
||||
F64(f64),
|
||||
///A Signed Integer
|
||||
S64(i64),
|
||||
}
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait Unions: Sized {
|
||||
async fn add_one_integer(&self, num: AllIntegers) -> AllIntegers;
|
||||
async fn add_one_float(&self, num: AllFloats) -> AllFloats;
|
||||
async fn replace_first_char(&self, text: AllText, letter: char) -> AllText;
|
||||
async fn identify_integer(&self, num: AllIntegers) -> u8;
|
||||
async fn identify_float(&self, num: AllFloats) -> u8;
|
||||
async fn identify_text(&self, text: AllText) -> u8;
|
||||
async fn add_one_duplicated(&self, num: DuplicatedS32) -> DuplicatedS32;
|
||||
async fn identify_duplicated(&self, num: DuplicatedS32) -> u8;
|
||||
async fn add_one_distinguishable_num(
|
||||
&self,
|
||||
num: DistinguishableNum,
|
||||
) -> DistinguishableNum;
|
||||
async fn identify_distinguishable_num(&self, num: DistinguishableNum) -> u8;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Unions + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"unions",
|
||||
"add_one_integer",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: AllIntegers|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.add_one_integer(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"unions",
|
||||
"add_one_float",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: AllFloats|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.add_one_float(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"unions",
|
||||
"replace_first_char",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (AllText, char)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.replace_first_char(p.0, p.1).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"unions",
|
||||
"identify_integer",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: AllIntegers|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.identify_integer(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"unions",
|
||||
"identify_float",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: AllFloats|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.identify_float(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"unions",
|
||||
"identify_text",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: AllText| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.identify_text(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"unions",
|
||||
"add_one_duplicated",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: DuplicatedS32|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.add_one_duplicated(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"unions",
|
||||
"identify_duplicated",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: DuplicatedS32|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.identify_duplicated(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"unions",
|
||||
"add_one_distinguishable_num",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: DistinguishableNum|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.add_one_distinguishable_num(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"unions",
|
||||
"identify_distinguishable_num",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: DistinguishableNum|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.identify_distinguishable_num(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
496
crates/gen-host/tests/async/variants.rs
Normal file
496
crates/gen-host/tests/async/variants.rs
Normal file
@@ -0,0 +1,496 @@
|
||||
#[allow(unused_imports, unused_variables, dead_code)]
|
||||
#[rustfmt::skip]
|
||||
pub mod variants {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum E1 {
|
||||
A,
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum U1 {
|
||||
U32(u32),
|
||||
F32(f32),
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Empty {}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum V1 {
|
||||
A,
|
||||
B(U1),
|
||||
C(E1),
|
||||
D(String),
|
||||
E(Empty),
|
||||
F,
|
||||
G(u32),
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Casts1 {
|
||||
A(i32),
|
||||
B(f32),
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Casts2 {
|
||||
A(f64),
|
||||
B(f32),
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Casts3 {
|
||||
A(f64),
|
||||
B(u64),
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Casts4 {
|
||||
A(u32),
|
||||
B(i64),
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Casts5 {
|
||||
A(f32),
|
||||
B(i64),
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Casts6 {
|
||||
A((f32, u32)),
|
||||
B((u32, u32)),
|
||||
}
|
||||
#[derive(serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum MyErrno {
|
||||
Bad1,
|
||||
Bad2,
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct IsClone {
|
||||
pub v1: V1,
|
||||
}
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
pub trait Variants: Sized {
|
||||
async fn e1_arg(&self, x: E1);
|
||||
async fn e1_result(&self) -> E1;
|
||||
async fn u1_arg(&self, x: U1);
|
||||
async fn u1_result(&self) -> U1;
|
||||
async fn v1_arg(&self, x: V1);
|
||||
async fn v1_result(&self) -> V1;
|
||||
async fn bool_arg(&self, x: bool);
|
||||
async fn bool_result(&self) -> bool;
|
||||
async fn option_arg(
|
||||
&self,
|
||||
a: Option<bool>,
|
||||
b: Option<()>,
|
||||
c: Option<u32>,
|
||||
d: Option<E1>,
|
||||
e: Option<f32>,
|
||||
f: Option<U1>,
|
||||
g: Option<Option<bool>>,
|
||||
);
|
||||
async fn option_result(
|
||||
&self,
|
||||
) -> (
|
||||
Option<bool>,
|
||||
Option<()>,
|
||||
Option<u32>,
|
||||
Option<E1>,
|
||||
Option<f32>,
|
||||
Option<U1>,
|
||||
Option<Option<bool>>,
|
||||
);
|
||||
async fn casts(
|
||||
&self,
|
||||
a: Casts1,
|
||||
b: Casts2,
|
||||
c: Casts3,
|
||||
d: Casts4,
|
||||
e: Casts5,
|
||||
f: Casts6,
|
||||
) -> (Casts1, Casts2, Casts3, Casts4, Casts5, Casts6);
|
||||
async fn result_arg(
|
||||
&self,
|
||||
a: Result<(), ()>,
|
||||
b: Result<(), E1>,
|
||||
c: Result<E1, ()>,
|
||||
d: Result<(), ()>,
|
||||
e: Result<u32, V1>,
|
||||
f: Result<String, Vec<u8>>,
|
||||
);
|
||||
async fn result_result(
|
||||
&self,
|
||||
) -> (
|
||||
Result<(), ()>,
|
||||
Result<(), E1>,
|
||||
Result<E1, ()>,
|
||||
Result<(), ()>,
|
||||
Result<u32, V1>,
|
||||
Result<String, Vec<u8>>,
|
||||
);
|
||||
async fn return_result_sugar(&self) -> Result<i32, MyErrno>;
|
||||
async fn return_result_sugar2(&self) -> Result<(), MyErrno>;
|
||||
async fn return_result_sugar3(&self) -> Result<MyErrno, MyErrno>;
|
||||
async fn return_result_sugar4(&self) -> Result<(i32, u32), MyErrno>;
|
||||
async fn return_option_sugar(&self) -> Option<i32>;
|
||||
async fn return_option_sugar2(&self) -> Option<MyErrno>;
|
||||
async fn result_simple(&self) -> Result<u32, i32>;
|
||||
async fn is_clone_arg(&self, a: IsClone);
|
||||
async fn is_clone_return(&self) -> IsClone;
|
||||
async fn return_named_option(&self) -> Option<u8>;
|
||||
async fn return_named_result(&self) -> Result<u8, MyErrno>;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Variants + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"e1_arg",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: E1| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.e1_arg(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"e1_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.e1_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"u1_arg",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: U1| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.u1_arg(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"u1_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.u1_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"v1_arg",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: V1| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.v1_arg(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"v1_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.v1_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"bool_arg",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: bool| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.bool_arg(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"bool_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.bool_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"option_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (
|
||||
Option<bool>,
|
||||
Option<()>,
|
||||
Option<u32>,
|
||||
Option<E1>,
|
||||
Option<f32>,
|
||||
Option<U1>,
|
||||
Option<Option<bool>>,
|
||||
)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.option_arg(p.0, p.1, p.2, p.3, p.4, p.5, p.6).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"option_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.option_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"casts",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (Casts1, Casts2, Casts3, Casts4, Casts5, Casts6)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.casts(p.0, p.1, p.2, p.3, p.4, p.5).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"result_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (
|
||||
Result<(), ()>,
|
||||
Result<(), E1>,
|
||||
Result<E1, ()>,
|
||||
Result<(), ()>,
|
||||
Result<u32, V1>,
|
||||
Result<String, Vec<u8>>,
|
||||
)|
|
||||
{
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.result_arg(p.0, p.1, p.2, p.3, p.4, p.5).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"result_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.result_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"return_result_sugar",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_result_sugar().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"return_result_sugar2",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_result_sugar2().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"return_result_sugar3",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_result_sugar3().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"return_result_sugar4",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_result_sugar4().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"return_option_sugar",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_option_sugar().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"return_option_sugar2",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_option_sugar2().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"result_simple",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.result_simple().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"is_clone_arg",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: IsClone| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.is_clone_arg(p).await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"is_clone_return",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.is_clone_return().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"return_named_option",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_named_option().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define_async(
|
||||
"variants",
|
||||
"return_named_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let get_cx = get_cx.clone();
|
||||
Box::pin(async move {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_named_result().await)
|
||||
})
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
272
crates/gen-host/tests/codegen-async.rs
Normal file
272
crates/gen-host/tests/codegen-async.rs
Normal file
@@ -0,0 +1,272 @@
|
||||
#![allow(clippy::all, unused)]
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::path::{Path, PathBuf};
|
||||
use tauri_bindgen_core::{Generate, GeneratorBuilder};
|
||||
use tauri_bindgen_gen_host::Builder;
|
||||
|
||||
fn gen_interface(
|
||||
opts: Builder,
|
||||
_name: impl AsRef<str>,
|
||||
input: impl AsRef<str>,
|
||||
) -> (String, String) {
|
||||
let iface = wit_parser::parse_and_resolve_str(&input, |_| false).unwrap();
|
||||
|
||||
let mut gen = opts.build(iface);
|
||||
let (filename, contents) = gen.to_file();
|
||||
|
||||
(filename.to_str().unwrap().to_string(), contents)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn chars() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) = gen_interface(opts, "chars", include_str!("../../../wit/chars.wit"));
|
||||
|
||||
assert_eq!(filename, "chars.rs");
|
||||
assert_eq!(contents, include_str!("./async/chars.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn convention() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) = gen_interface(
|
||||
opts,
|
||||
"conventions",
|
||||
include_str!("../../../wit/conventions.wit"),
|
||||
);
|
||||
|
||||
assert_eq!(filename, "conventions.rs");
|
||||
assert_eq!(contents, include_str!("./async/conventions.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) = gen_interface(opts, "empty", include_str!("../../../wit/empty.wit"));
|
||||
|
||||
assert_eq!(filename, "empty.rs");
|
||||
assert_eq!(contents, include_str!("./async/empty.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flags() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) = gen_interface(opts, "flegs", include_str!("../../../wit/flags.wit"));
|
||||
|
||||
assert_eq!(filename, "flegs.rs");
|
||||
assert_eq!(contents, include_str!("./async/flegs.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn floats() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) =
|
||||
gen_interface(opts, "floats", include_str!("../../../wit/floats.wit"));
|
||||
|
||||
assert_eq!(filename, "floats.rs");
|
||||
assert_eq!(contents, include_str!("./async/floats.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn integers() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) =
|
||||
gen_interface(opts, "integers", include_str!("../../../wit/integers.wit"));
|
||||
|
||||
assert_eq!(filename, "integers.rs");
|
||||
assert_eq!(contents, include_str!("./async/integers.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lists() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) = gen_interface(opts, "lists", include_str!("../../../wit/lists.wit"));
|
||||
|
||||
assert_eq!(filename, "lists.rs");
|
||||
assert_eq!(contents, include_str!("./async/lists.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn many_arguments() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) = gen_interface(
|
||||
opts,
|
||||
"many-arguments",
|
||||
include_str!("../../../wit/many_arguments.wit"),
|
||||
);
|
||||
|
||||
assert_eq!(filename, "many-arguments.rs");
|
||||
assert_eq!(contents, include_str!("./async/many-arguments.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multi_return() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) = gen_interface(
|
||||
opts,
|
||||
"multi-return",
|
||||
include_str!("../../../wit/multi_return.wit"),
|
||||
);
|
||||
|
||||
assert_eq!(filename, "multi-return.rs");
|
||||
assert_eq!(contents, include_str!("./async/multi-return.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn records() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) =
|
||||
gen_interface(opts, "records", include_str!("../../../wit/records.wit"));
|
||||
|
||||
assert_eq!(filename, "records.rs");
|
||||
assert_eq!(contents, include_str!("./async/records.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn simple_functions() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) = gen_interface(
|
||||
opts,
|
||||
"simple-functions",
|
||||
include_str!("../../../wit/simple_functions.wit"),
|
||||
);
|
||||
|
||||
assert_eq!(filename, "simple-functions.rs");
|
||||
assert_eq!(contents, include_str!("./async/simple-functions.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn simple_lists() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) = gen_interface(
|
||||
opts,
|
||||
"simple-lists",
|
||||
include_str!("../../../wit/simple_lists.wit"),
|
||||
);
|
||||
|
||||
assert_eq!(filename, "simple-lists.rs");
|
||||
assert_eq!(contents, include_str!("./async/simple-lists.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn small_anonymous() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) = gen_interface(
|
||||
opts,
|
||||
"small-anonymous",
|
||||
include_str!("../../../wit/small_anonymous.wit"),
|
||||
);
|
||||
|
||||
assert_eq!(filename, "small-anonymous.rs");
|
||||
assert_eq!(contents, include_str!("./async/small-anonymous.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn strings() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) =
|
||||
gen_interface(opts, "strings", include_str!("../../../wit/strings.wit"));
|
||||
|
||||
assert_eq!(filename, "strings.rs");
|
||||
assert_eq!(contents, include_str!("./async/strings.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unions() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) =
|
||||
gen_interface(opts, "unions", include_str!("../../../wit/unions.wit"));
|
||||
|
||||
assert_eq!(filename, "unions.rs");
|
||||
assert_eq!(contents, include_str!("./async/unions.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn variants() {
|
||||
let opts = Builder {
|
||||
fmt: true,
|
||||
tracing: true,
|
||||
async_: true,
|
||||
};
|
||||
|
||||
let (filename, contents) =
|
||||
gen_interface(opts, "variants", include_str!("../../../wit/variants.wit"));
|
||||
|
||||
assert_eq!(filename, "variants.rs");
|
||||
assert_eq!(contents, include_str!("./async/variants.rs"));
|
||||
}
|
||||
@@ -28,7 +28,7 @@ fn chars() {
|
||||
let (filename, contents) = gen_interface(opts, "chars", include_str!("../../../wit/chars.wit"));
|
||||
|
||||
assert_eq!(filename, "chars.rs");
|
||||
assert_eq!(contents, include_str!("./chars.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/chars.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -46,7 +46,7 @@ fn convention() {
|
||||
);
|
||||
|
||||
assert_eq!(filename, "conventions.rs");
|
||||
assert_eq!(contents, include_str!("./conventions.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/conventions.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -60,7 +60,7 @@ fn empty() {
|
||||
let (filename, contents) = gen_interface(opts, "empty", include_str!("../../../wit/empty.wit"));
|
||||
|
||||
assert_eq!(filename, "empty.rs");
|
||||
assert_eq!(contents, include_str!("./empty.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/empty.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -74,7 +74,7 @@ fn flags() {
|
||||
let (filename, contents) = gen_interface(opts, "flegs", include_str!("../../../wit/flags.wit"));
|
||||
|
||||
assert_eq!(filename, "flegs.rs");
|
||||
assert_eq!(contents, include_str!("./flegs.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/flegs.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -89,7 +89,7 @@ fn floats() {
|
||||
gen_interface(opts, "floats", include_str!("../../../wit/floats.wit"));
|
||||
|
||||
assert_eq!(filename, "floats.rs");
|
||||
assert_eq!(contents, include_str!("./floats.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/floats.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -104,7 +104,7 @@ fn integers() {
|
||||
gen_interface(opts, "integers", include_str!("../../../wit/integers.wit"));
|
||||
|
||||
assert_eq!(filename, "integers.rs");
|
||||
assert_eq!(contents, include_str!("./integers.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/integers.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -118,7 +118,7 @@ fn lists() {
|
||||
let (filename, contents) = gen_interface(opts, "lists", include_str!("../../../wit/lists.wit"));
|
||||
|
||||
assert_eq!(filename, "lists.rs");
|
||||
assert_eq!(contents, include_str!("./lists.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/lists.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -136,7 +136,7 @@ fn many_arguments() {
|
||||
);
|
||||
|
||||
assert_eq!(filename, "many-arguments.rs");
|
||||
assert_eq!(contents, include_str!("./many-arguments.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/many-arguments.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -154,7 +154,7 @@ fn multi_return() {
|
||||
);
|
||||
|
||||
assert_eq!(filename, "multi-return.rs");
|
||||
assert_eq!(contents, include_str!("./multi-return.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/multi-return.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -169,7 +169,7 @@ fn records() {
|
||||
gen_interface(opts, "records", include_str!("../../../wit/records.wit"));
|
||||
|
||||
assert_eq!(filename, "records.rs");
|
||||
assert_eq!(contents, include_str!("./records.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/records.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -187,7 +187,7 @@ fn simple_functions() {
|
||||
);
|
||||
|
||||
assert_eq!(filename, "simple-functions.rs");
|
||||
assert_eq!(contents, include_str!("./simple-functions.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/simple-functions.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -205,7 +205,7 @@ fn simple_lists() {
|
||||
);
|
||||
|
||||
assert_eq!(filename, "simple-lists.rs");
|
||||
assert_eq!(contents, include_str!("./simple-lists.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/simple-lists.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -223,7 +223,7 @@ fn small_anonymous() {
|
||||
);
|
||||
|
||||
assert_eq!(filename, "small-anonymous.rs");
|
||||
assert_eq!(contents, include_str!("./small-anonymous.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/small-anonymous.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -238,7 +238,7 @@ fn strings() {
|
||||
gen_interface(opts, "strings", include_str!("../../../wit/strings.wit"));
|
||||
|
||||
assert_eq!(filename, "strings.rs");
|
||||
assert_eq!(contents, include_str!("./strings.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/strings.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -253,7 +253,7 @@ fn unions() {
|
||||
gen_interface(opts, "unions", include_str!("../../../wit/unions.wit"));
|
||||
|
||||
assert_eq!(filename, "unions.rs");
|
||||
assert_eq!(contents, include_str!("./unions.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/unions.rs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -268,5 +268,5 @@ fn variants() {
|
||||
gen_interface(opts, "variants", include_str!("../../../wit/variants.wit"));
|
||||
|
||||
assert_eq!(filename, "variants.rs");
|
||||
assert_eq!(contents, include_str!("./variants.rs"));
|
||||
assert_eq!(contents, include_str!("./sync/variants.rs"));
|
||||
}
|
||||
@@ -14,30 +14,26 @@ pub mod chars {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Chars + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"chars",
|
||||
"take_char",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: char,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: char| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.take_char(x))
|
||||
Ok(ctx.take_char(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"chars",
|
||||
"return_char",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<char> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_char())
|
||||
},
|
||||
@@ -28,150 +28,129 @@ pub mod conventions {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Conventions + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"conventions",
|
||||
"kebab_case",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.kebab_case())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"conventions",
|
||||
"foo",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: LudicrousSpeed,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: LudicrousSpeed|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.foo(x))
|
||||
Ok(ctx.foo(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"conventions",
|
||||
"function_with_underscores",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.function_with_underscores())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"conventions",
|
||||
"function_with_no_weird_characters",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.function_with_no_weird_characters())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"conventions",
|
||||
"apple",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.apple())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"conventions",
|
||||
"apple_pear",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.apple_pear())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"conventions",
|
||||
"apple_pear_grape",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.apple_pear_grape())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"conventions",
|
||||
"a0",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a0())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"conventions",
|
||||
"is_xml",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.is_xml())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"conventions",
|
||||
"explicit",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.explicit())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"conventions",
|
||||
"explicit_snake",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.explicit_snake())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"conventions",
|
||||
"bool",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.bool())
|
||||
},
|
||||
@@ -9,6 +9,7 @@ pub mod empty {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Empty + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
@@ -72,98 +72,78 @@ pub mod flegs {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Flegs + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"flegs",
|
||||
"roundtrip_flag1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Flag1,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag1> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag1| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag1(x))
|
||||
Ok(ctx.roundtrip_flag1(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"flegs",
|
||||
"roundtrip_flag2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Flag2,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag2> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag2| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag2(x))
|
||||
Ok(ctx.roundtrip_flag2(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"flegs",
|
||||
"roundtrip_flag4",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Flag4,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag4> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag4| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag4(x))
|
||||
Ok(ctx.roundtrip_flag4(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"flegs",
|
||||
"roundtrip_flag8",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Flag8,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag8> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag8| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag8(x))
|
||||
Ok(ctx.roundtrip_flag8(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"flegs",
|
||||
"roundtrip_flag16",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Flag16,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag16> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag16| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag16(x))
|
||||
Ok(ctx.roundtrip_flag16(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"flegs",
|
||||
"roundtrip_flag32",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Flag32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag32> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag32| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag32(x))
|
||||
Ok(ctx.roundtrip_flag32(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"flegs",
|
||||
"roundtrip_flag64",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Flag64,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag64> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Flag64| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.roundtrip_flag64(x))
|
||||
Ok(ctx.roundtrip_flag64(p))
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
@@ -14,55 +14,46 @@ pub mod floats {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Floats + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"floats",
|
||||
"float32_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: f32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: f32| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.float32_param(x))
|
||||
Ok(ctx.float32_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"floats",
|
||||
"float64_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: f64,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: f64| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.float64_param(x))
|
||||
Ok(ctx.float64_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"floats",
|
||||
"float32_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<f32> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.float32_result())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"floats",
|
||||
"float64_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<f64> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.float64_result())
|
||||
},
|
||||
@@ -44,289 +44,229 @@ pub mod integers {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Integers + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"a1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: u8,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: u8| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a1(x))
|
||||
Ok(ctx.a1(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"a2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: i8,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: i8| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a2(x))
|
||||
Ok(ctx.a2(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"a3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: u16,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: u16| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a3(x))
|
||||
Ok(ctx.a3(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"a4",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: i16,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: i16| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a4(x))
|
||||
Ok(ctx.a4(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"a5",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: u32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: u32| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a5(x))
|
||||
Ok(ctx.a5(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"a6",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: i32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: i32| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a6(x))
|
||||
Ok(ctx.a6(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"a7",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: u64,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: u64| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a7(x))
|
||||
Ok(ctx.a7(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"a8",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: i64,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: i64| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a8(x))
|
||||
Ok(ctx.a8(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"a9",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: u128,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: u128| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a9(x))
|
||||
Ok(ctx.a9(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"a10",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: i128,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: i128| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a10(x))
|
||||
Ok(ctx.a10(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"a11",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p1: u8,
|
||||
p2: i8,
|
||||
p3: u16,
|
||||
p4: i16,
|
||||
p5: u32,
|
||||
p6: i32,
|
||||
p7: u64,
|
||||
p8: i64,
|
||||
p9: u128,
|
||||
p10: i128,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: (u8, i8, u16, i16, u32, i32, u64, i64, u128, i128)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a11(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10))
|
||||
Ok(ctx.a11(p.0, p.1, p.2, p.3, p.4, p.5, p.6, p.7, p.8, p.9))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"r1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u8> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r1())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"r2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<i8> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r2())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"r3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u16> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r3())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"r4",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<i16> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r4())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"r5",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u32> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r5())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"r6",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<i32> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r6())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"r7",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u64> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r7())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"r8",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<i64> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r8())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"r9",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u128> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r9())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"r10",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<i128> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r10())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"integers",
|
||||
"pair_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<(i64, u8)> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.pair_ret())
|
||||
},
|
||||
@@ -82,423 +82,368 @@ pub mod lists {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Lists + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_u8_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<u8>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<u8>| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u8_param(x))
|
||||
Ok(ctx.list_u8_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_u16_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<u16>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<u16>| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u16_param(x))
|
||||
Ok(ctx.list_u16_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_u32_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<u32>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<u32>| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u32_param(x))
|
||||
Ok(ctx.list_u32_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_u64_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<u64>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<u64>| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u64_param(x))
|
||||
Ok(ctx.list_u64_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_u128_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<u128>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: Vec<u128>|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u128_param(x))
|
||||
Ok(ctx.list_u128_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_s8_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<i8>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<i8>| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s8_param(x))
|
||||
Ok(ctx.list_s8_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_s16_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<i16>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<i16>| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s16_param(x))
|
||||
Ok(ctx.list_s16_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_s32_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<i32>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<i32>| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s32_param(x))
|
||||
Ok(ctx.list_s32_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_s64_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<i64>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<i64>| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s64_param(x))
|
||||
Ok(ctx.list_s64_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_s128_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<i128>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: Vec<i128>|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s128_param(x))
|
||||
Ok(ctx.list_s128_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_float32_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<f32>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<f32>| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_float32_param(x))
|
||||
Ok(ctx.list_float32_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_float64_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<f64>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<f64>| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_float64_param(x))
|
||||
Ok(ctx.list_float64_param(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_u8_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<u8>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u8_ret())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_u16_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<u16>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u16_ret())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_u32_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<u32>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u32_ret())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_u64_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<u64>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u64_ret())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_u128_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<u128>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u128_ret())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_s8_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<i8>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s8_ret())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_s16_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<i16>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s16_ret())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_s32_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<i32>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s32_ret())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_s64_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<i64>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s64_ret())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_s128_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<i128>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s128_ret())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_float32_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<f32>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_float32_ret())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"list_float64_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<f64>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_float64_ret())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"tuple_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<(u8, i8)>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<(i64, u32)>> {
|
||||
p: Vec<(u8, i8)>|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.tuple_list(x))
|
||||
Ok(ctx.tuple_list(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"string_list_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
a: Vec<String>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: Vec<String>|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.string_list_arg(a))
|
||||
Ok(ctx.string_list_arg(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"string_list_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<String>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.string_list_ret())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"tuple_string_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<(u8, String)>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<(String, u8)>> {
|
||||
p: Vec<(u8, String)>|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.tuple_string_list(x))
|
||||
Ok(ctx.tuple_string_list(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"string_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<String>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<String>> {
|
||||
p: Vec<String>|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.string_list(x))
|
||||
Ok(ctx.string_list(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"record_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<SomeRecord>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<OtherRecord>> {
|
||||
p: Vec<SomeRecord>|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.record_list(x))
|
||||
Ok(ctx.record_list(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"record_list_reverse",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<OtherRecord>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<SomeRecord>> {
|
||||
p: Vec<OtherRecord>|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.record_list_reverse(x))
|
||||
Ok(ctx.record_list_reverse(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"variant_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Vec<SomeVariant>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<OtherVariant>> {
|
||||
p: Vec<SomeVariant>|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.variant_list(x))
|
||||
Ok(ctx.variant_list(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"lists",
|
||||
"load_store_everything",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
a: LoadStoreAllSizes,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<LoadStoreAllSizes> {
|
||||
p: LoadStoreAllSizes|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.load_store_everything(a))
|
||||
Ok(ctx.load_store_everything(p))
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
@@ -54,68 +54,71 @@ pub mod many_arguments {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: ManyArguments + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"many_arguments",
|
||||
"many_args",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
a1: u64,
|
||||
a2: u64,
|
||||
a3: u64,
|
||||
a4: u64,
|
||||
a5: u64,
|
||||
a6: u64,
|
||||
a7: u64,
|
||||
a8: u64,
|
||||
a9: u64,
|
||||
a10: u64,
|
||||
a11: u64,
|
||||
a12: u64,
|
||||
a13: u64,
|
||||
a14: u64,
|
||||
a15: u64,
|
||||
a16: u64,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: (
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
u64,
|
||||
)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(
|
||||
ctx
|
||||
.many_args(
|
||||
a1,
|
||||
a2,
|
||||
a3,
|
||||
a4,
|
||||
a5,
|
||||
a6,
|
||||
a7,
|
||||
a8,
|
||||
a9,
|
||||
a10,
|
||||
a11,
|
||||
a12,
|
||||
a13,
|
||||
a14,
|
||||
a15,
|
||||
a16,
|
||||
p.0,
|
||||
p.1,
|
||||
p.2,
|
||||
p.3,
|
||||
p.4,
|
||||
p.5,
|
||||
p.6,
|
||||
p.7,
|
||||
p.8,
|
||||
p.9,
|
||||
p.10,
|
||||
p.11,
|
||||
p.12,
|
||||
p.13,
|
||||
p.14,
|
||||
p.15,
|
||||
),
|
||||
)
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"many_arguments",
|
||||
"big_argument",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: BigStruct,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: BigStruct|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.big_argument(x))
|
||||
Ok(ctx.big_argument(p))
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
@@ -15,65 +15,56 @@ pub mod multi_return {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: MultiReturn + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"multi_return",
|
||||
"mra",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mra())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"multi_return",
|
||||
"mrb",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mrb())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"multi_return",
|
||||
"mrc",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u32> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mrc())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"multi_return",
|
||||
"mrd",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u32> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mrd())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"multi_return",
|
||||
"mre",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<(u32, f32)> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mre())
|
||||
},
|
||||
@@ -60,145 +60,130 @@ All of the fields are bool*/
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Records + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"records",
|
||||
"tuple_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: (char, u32),
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: (char, u32)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.tuple_arg(x))
|
||||
Ok(ctx.tuple_arg(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"records",
|
||||
"tuple_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<(char, u32)> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.tuple_result())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"records",
|
||||
"empty_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Empty,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Empty| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.empty_arg(x))
|
||||
Ok(ctx.empty_arg(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"records",
|
||||
"empty_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Empty> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.empty_result())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"records",
|
||||
"scalar_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Scalars,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Scalars| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.scalar_arg(x))
|
||||
Ok(ctx.scalar_arg(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"records",
|
||||
"scalar_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Scalars> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.scalar_result())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"records",
|
||||
"flags_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: ReallyFlags,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: ReallyFlags|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.flags_arg(x))
|
||||
Ok(ctx.flags_arg(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"records",
|
||||
"flags_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<ReallyFlags> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.flags_result())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"records",
|
||||
"aggregate_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: Aggregates,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: Aggregates|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.aggregate_arg(x))
|
||||
Ok(ctx.aggregate_arg(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"records",
|
||||
"aggregate_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Aggregates> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.aggregate_result())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"records",
|
||||
"typedef_inout",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
e: TupleTypedef2,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<i32> {
|
||||
p: TupleTypedef2|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.typedef_inout(e))
|
||||
Ok(ctx.typedef_inout(p))
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
@@ -36,128 +36,118 @@ pub mod resources {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Resources + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"resources",
|
||||
"constructor_a",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<
|
||||
::tauri_bindgen_host::ResourceId,
|
||||
> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.constructor_a())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"resources",
|
||||
"constructor_b",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<
|
||||
::tauri_bindgen_host::ResourceId,
|
||||
> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.constructor_b())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"resources::resource::a",
|
||||
"f1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
this_rid: ::tauri_bindgen_host::ResourceId,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: (::tauri_bindgen_host::ResourceId,)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.get_a(this_rid)?;
|
||||
let r = ctx.get_a(p.0)?;
|
||||
Ok(r.f1())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"resources::resource::a",
|
||||
"f2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
this_rid: ::tauri_bindgen_host::ResourceId,
|
||||
a: u32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: (::tauri_bindgen_host::ResourceId, u32)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.get_a(this_rid)?;
|
||||
Ok(r.f2(a))
|
||||
let r = ctx.get_a(p.0)?;
|
||||
Ok(r.f2(p.1))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"resources::resource::a",
|
||||
"f3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
this_rid: ::tauri_bindgen_host::ResourceId,
|
||||
a: u32,
|
||||
b: u32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: (::tauri_bindgen_host::ResourceId, u32, u32)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.get_a(this_rid)?;
|
||||
Ok(r.f3(a, b))
|
||||
let r = ctx.get_a(p.0)?;
|
||||
Ok(r.f3(p.1, p.2))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"resources::resource::b",
|
||||
"f1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
this_rid: ::tauri_bindgen_host::ResourceId,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<
|
||||
p: (::tauri_bindgen_host::ResourceId,)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.get_b(p.0)?;
|
||||
Ok(r.f1())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define(
|
||||
"resources::resource::b",
|
||||
"f2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
p: (
|
||||
::tauri_bindgen_host::ResourceId,
|
||||
> {
|
||||
::tauri_bindgen_host::ResourceId,
|
||||
)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.get_b(this_rid)?;
|
||||
Ok(r.f1())
|
||||
let r = ctx.get_b(p.0)?;
|
||||
Ok(r.f2(p.1))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
"resources::resource::b",
|
||||
"f2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
this_rid: ::tauri_bindgen_host::ResourceId,
|
||||
x: ::tauri_bindgen_host::ResourceId,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<u32, ()>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.get_b(this_rid)?;
|
||||
Ok(r.f2(x))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"resources::resource::b",
|
||||
"f3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
this_rid: ::tauri_bindgen_host::ResourceId,
|
||||
x: Option<Vec<::tauri_bindgen_host::ResourceId>>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<
|
||||
Result<::tauri_bindgen_host::ResourceId, ()>,
|
||||
> {
|
||||
p: (
|
||||
::tauri_bindgen_host::ResourceId,
|
||||
Option<Vec<::tauri_bindgen_host::ResourceId>>,
|
||||
)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
let r = ctx.get_b(this_rid)?;
|
||||
Ok(r.f3(x))
|
||||
let r = ctx.get_b(p.0)?;
|
||||
Ok(r.f3(p.1))
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
@@ -16,85 +16,74 @@ pub mod simple_functions {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: SimpleFunctions + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"simple_functions",
|
||||
"f1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f1())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"simple_functions",
|
||||
"f2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
a: u32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: u32| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f2(a))
|
||||
Ok(ctx.f2(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"simple_functions",
|
||||
"f3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
a: u32,
|
||||
b: u32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
p: (u32, u32)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f3(a, b))
|
||||
Ok(ctx.f3(p.0, p.1))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"simple_functions",
|
||||
"f4",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u32> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f4())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"simple_functions",
|
||||
"f5",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<(u32, u32)> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f5())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"simple_functions",
|
||||
"f6",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
a: u32,
|
||||
b: u32,
|
||||
c: u32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<(u32, u32, u32)> {
|
||||
p: (u32, u32, u32)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f6(a, b, c))
|
||||
Ok(ctx.f6(p.0, p.1, p.2))
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
@@ -14,59 +14,54 @@ pub mod simple_lists {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: SimpleLists + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"simple_lists",
|
||||
"simple_list1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
l: Vec<u32>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: Vec<u32>| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.simple_list1(l))
|
||||
Ok(ctx.simple_list1(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"simple_lists",
|
||||
"simple_list2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<u32>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.simple_list2())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"simple_lists",
|
||||
"simple_list3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
a: Vec<u32>,
|
||||
b: Vec<u32>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<(Vec<u32>, Vec<u32>)> {
|
||||
p: (Vec<u32>, Vec<u32>)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.simple_list3(a, b))
|
||||
Ok(ctx.simple_list3(p.0, p.1))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"simple_lists",
|
||||
"simple_list4",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
l: Vec<Vec<u32>>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<Vec<u32>>> {
|
||||
p: Vec<Vec<u32>>|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.simple_list4(l))
|
||||
Ok(ctx.simple_list4(p))
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
@@ -17,17 +17,16 @@ pub mod small_anonymous {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: SmallAnonymous + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"small_anonymous",
|
||||
"option_test",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<Option<String>, Error>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.option_test())
|
||||
},
|
||||
@@ -13,46 +13,41 @@ pub mod strings {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Strings + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"strings",
|
||||
"a",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: String,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: String| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a(x))
|
||||
Ok(ctx.a(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"strings",
|
||||
"b",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<String> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.b())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"strings",
|
||||
"c",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
a: String,
|
||||
b: String,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<String> {
|
||||
p: (String, String)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.c(a, b))
|
||||
Ok(ctx.c(p.0, p.1))
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
@@ -70,138 +70,135 @@ and is treated that way in some languages*/
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Unions + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"unions",
|
||||
"add_one_integer",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
num: AllIntegers,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<AllIntegers> {
|
||||
p: AllIntegers|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.add_one_integer(num))
|
||||
Ok(ctx.add_one_integer(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"unions",
|
||||
"add_one_float",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
num: AllFloats,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<AllFloats> {
|
||||
p: AllFloats|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.add_one_float(num))
|
||||
Ok(ctx.add_one_float(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"unions",
|
||||
"replace_first_char",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
text: AllText,
|
||||
letter: char,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<AllText> {
|
||||
p: (AllText, char)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.replace_first_char(text, letter))
|
||||
Ok(ctx.replace_first_char(p.0, p.1))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"unions",
|
||||
"identify_integer",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
num: AllIntegers,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u8> {
|
||||
p: AllIntegers|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.identify_integer(num))
|
||||
Ok(ctx.identify_integer(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"unions",
|
||||
"identify_float",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
num: AllFloats,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u8> {
|
||||
p: AllFloats|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.identify_float(num))
|
||||
Ok(ctx.identify_float(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"unions",
|
||||
"identify_text",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
text: AllText,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u8> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: AllText| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.identify_text(text))
|
||||
Ok(ctx.identify_text(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"unions",
|
||||
"add_one_duplicated",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
num: DuplicatedS32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<DuplicatedS32> {
|
||||
p: DuplicatedS32|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.add_one_duplicated(num))
|
||||
Ok(ctx.add_one_duplicated(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"unions",
|
||||
"identify_duplicated",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
num: DuplicatedS32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u8> {
|
||||
p: DuplicatedS32|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.identify_duplicated(num))
|
||||
Ok(ctx.identify_duplicated(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"unions",
|
||||
"add_one_distinguishable_num",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
num: DistinguishableNum,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<DistinguishableNum> {
|
||||
p: DistinguishableNum|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.add_one_distinguishable_num(num))
|
||||
Ok(ctx.add_one_distinguishable_num(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"unions",
|
||||
"identify_distinguishable_num",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
num: DistinguishableNum,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u8> {
|
||||
p: DistinguishableNum|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.identify_distinguishable_num(num))
|
||||
Ok(ctx.identify_distinguishable_num(p))
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
@@ -150,137 +150,98 @@ pub mod variants {
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
T: Send + Sync + 'static,
|
||||
U: Variants + Send + Sync + 'static,
|
||||
{
|
||||
let wrapped_get_cx = ::std::sync::Arc::new(get_cx);
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"e1_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: E1,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: E1| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.e1_arg(x))
|
||||
Ok(ctx.e1_arg(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"e1_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<E1> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.e1_result())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"u1_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: U1,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: U1| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.u1_arg(x))
|
||||
Ok(ctx.u1_arg(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"u1_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<U1> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.u1_result())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"v1_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: V1,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: V1| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.v1_arg(x))
|
||||
Ok(ctx.v1_arg(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"v1_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<V1> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.v1_result())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"bool_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
x: bool,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: bool| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.bool_arg(x))
|
||||
Ok(ctx.bool_arg(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"bool_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<bool> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.bool_result())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"option_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
a: Option<bool>,
|
||||
b: Option<()>,
|
||||
c: Option<u32>,
|
||||
d: Option<E1>,
|
||||
e: Option<f32>,
|
||||
f: Option<U1>,
|
||||
g: Option<Option<bool>>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.option_arg(a, b, c, d, e, f, g))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
"variants",
|
||||
"option_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<
|
||||
(
|
||||
p: (
|
||||
Option<bool>,
|
||||
Option<()>,
|
||||
Option<u32>,
|
||||
@@ -288,200 +249,171 @@ pub mod variants {
|
||||
Option<f32>,
|
||||
Option<U1>,
|
||||
Option<Option<bool>>,
|
||||
),
|
||||
> {
|
||||
)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.option_arg(p.0, p.1, p.2, p.3, p.4, p.5, p.6))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define(
|
||||
"variants",
|
||||
"option_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.option_result())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"casts",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
a: Casts1,
|
||||
b: Casts2,
|
||||
c: Casts3,
|
||||
d: Casts4,
|
||||
e: Casts5,
|
||||
f: Casts6,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<
|
||||
(Casts1, Casts2, Casts3, Casts4, Casts5, Casts6),
|
||||
> {
|
||||
p: (Casts1, Casts2, Casts3, Casts4, Casts5, Casts6)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.casts(a, b, c, d, e, f))
|
||||
Ok(ctx.casts(p.0, p.1, p.2, p.3, p.4, p.5))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"result_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
a: Result<(), ()>,
|
||||
b: Result<(), E1>,
|
||||
c: Result<E1, ()>,
|
||||
d: Result<(), ()>,
|
||||
e: Result<u32, V1>,
|
||||
f: Result<String, Vec<u8>>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.result_arg(a, b, c, d, e, f))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
"variants",
|
||||
"result_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<
|
||||
(
|
||||
p: (
|
||||
Result<(), ()>,
|
||||
Result<(), E1>,
|
||||
Result<E1, ()>,
|
||||
Result<(), ()>,
|
||||
Result<u32, V1>,
|
||||
Result<String, Vec<u8>>,
|
||||
),
|
||||
> {
|
||||
)|
|
||||
{
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.result_arg(p.0, p.1, p.2, p.3, p.4, p.5))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.define(
|
||||
"variants",
|
||||
"result_result",
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.result_result())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"return_result_sugar",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<i32, MyErrno>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_result_sugar())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"return_result_sugar2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<(), MyErrno>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_result_sugar2())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"return_result_sugar3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<MyErrno, MyErrno>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_result_sugar3())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"return_result_sugar4",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<(i32, u32), MyErrno>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_result_sugar4())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"return_option_sugar",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Option<i32>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_option_sugar())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"return_option_sugar2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Option<MyErrno>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_option_sugar2())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"result_simple",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<u32, i32>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.result_simple())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"is_clone_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
a: IsClone,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: IsClone| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.is_clone_arg(a))
|
||||
Ok(ctx.is_clone_arg(p))
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"is_clone_return",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<IsClone> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.is_clone_return())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"return_named_option",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Option<u8>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_named_option())
|
||||
},
|
||||
)?;
|
||||
let get_cx = ::std::sync::Arc::clone(&wrapped_get_cx);
|
||||
router
|
||||
.func_wrap(
|
||||
.define(
|
||||
"variants",
|
||||
"return_named_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<u8, MyErrno>> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, p: ()| {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_named_result())
|
||||
},
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
### Function take_char
|
||||
|
||||
`func take_char (x: char)`
|
||||
` func take_char (x: char)`
|
||||
|
||||
A function that accepts a character
|
||||
### Function return_char
|
||||
|
||||
`func return_char () -> char`
|
||||
` func return_char () -> char`
|
||||
|
||||
A function that returns a character
|
||||
@@ -20,60 +20,60 @@
|
||||
|
||||
### Function kebab_case
|
||||
|
||||
`func kebab_case ()`
|
||||
` func kebab_case ()`
|
||||
|
||||
|
||||
### Function foo
|
||||
|
||||
`func foo (x: [ludicrous_speed](#ludicrous_speed))`
|
||||
` func foo (x: [ludicrous_speed](#ludicrous_speed))`
|
||||
|
||||
|
||||
### Function function_with_underscores
|
||||
|
||||
`func function_with_underscores ()`
|
||||
` func function_with_underscores ()`
|
||||
|
||||
|
||||
### Function function_with_no_weird_characters
|
||||
|
||||
`func function_with_no_weird_characters ()`
|
||||
` func function_with_no_weird_characters ()`
|
||||
|
||||
|
||||
### Function apple
|
||||
|
||||
`func apple ()`
|
||||
` func apple ()`
|
||||
|
||||
|
||||
### Function apple_pear
|
||||
|
||||
`func apple_pear ()`
|
||||
` func apple_pear ()`
|
||||
|
||||
|
||||
### Function apple_pear_grape
|
||||
|
||||
`func apple_pear_grape ()`
|
||||
` func apple_pear_grape ()`
|
||||
|
||||
|
||||
### Function a0
|
||||
|
||||
`func a0 ()`
|
||||
` func a0 ()`
|
||||
|
||||
|
||||
### Function is_XML
|
||||
|
||||
`func is_XML ()`
|
||||
` func is_XML ()`
|
||||
|
||||
|
||||
### Function explicit
|
||||
|
||||
`func explicit ()`
|
||||
` func explicit ()`
|
||||
|
||||
|
||||
### Function explicit_snake
|
||||
|
||||
`func explicit_snake ()`
|
||||
` func explicit_snake ()`
|
||||
|
||||
|
||||
### Function bool
|
||||
|
||||
`func bool ()`
|
||||
` func bool ()`
|
||||
|
||||
|
||||
@@ -312,35 +312,35 @@
|
||||
|
||||
### Function roundtrip_flag1
|
||||
|
||||
`func roundtrip_flag1 (x: [flag1](#flag1)) -> [flag1](#flag1)`
|
||||
` func roundtrip_flag1 (x: [flag1](#flag1)) -> [flag1](#flag1)`
|
||||
|
||||
|
||||
### Function roundtrip_flag2
|
||||
|
||||
`func roundtrip_flag2 (x: [flag2](#flag2)) -> [flag2](#flag2)`
|
||||
` func roundtrip_flag2 (x: [flag2](#flag2)) -> [flag2](#flag2)`
|
||||
|
||||
|
||||
### Function roundtrip_flag4
|
||||
|
||||
`func roundtrip_flag4 (x: [flag4](#flag4)) -> [flag4](#flag4)`
|
||||
` func roundtrip_flag4 (x: [flag4](#flag4)) -> [flag4](#flag4)`
|
||||
|
||||
|
||||
### Function roundtrip_flag8
|
||||
|
||||
`func roundtrip_flag8 (x: [flag8](#flag8)) -> [flag8](#flag8)`
|
||||
` func roundtrip_flag8 (x: [flag8](#flag8)) -> [flag8](#flag8)`
|
||||
|
||||
|
||||
### Function roundtrip_flag16
|
||||
|
||||
`func roundtrip_flag16 (x: [flag16](#flag16)) -> [flag16](#flag16)`
|
||||
` func roundtrip_flag16 (x: [flag16](#flag16)) -> [flag16](#flag16)`
|
||||
|
||||
|
||||
### Function roundtrip_flag32
|
||||
|
||||
`func roundtrip_flag32 (x: [flag32](#flag32)) -> [flag32](#flag32)`
|
||||
` func roundtrip_flag32 (x: [flag32](#flag32)) -> [flag32](#flag32)`
|
||||
|
||||
|
||||
### Function roundtrip_flag64
|
||||
|
||||
`func roundtrip_flag64 (x: [flag64](#flag64)) -> [flag64](#flag64)`
|
||||
` func roundtrip_flag64 (x: [flag64](#flag64)) -> [flag64](#flag64)`
|
||||
|
||||
|
||||
@@ -10,20 +10,20 @@
|
||||
|
||||
### Function float32_param
|
||||
|
||||
`func float32_param (x: float32)`
|
||||
` func float32_param (x: float32)`
|
||||
|
||||
|
||||
### Function float64_param
|
||||
|
||||
`func float64_param (x: float64)`
|
||||
` func float64_param (x: float64)`
|
||||
|
||||
|
||||
### Function float32_result
|
||||
|
||||
`func float32_result () -> float32`
|
||||
` func float32_result () -> float32`
|
||||
|
||||
|
||||
### Function float64_result
|
||||
|
||||
`func float64_result () -> float64`
|
||||
` func float64_result () -> float64`
|
||||
|
||||
|
||||
@@ -10,110 +10,110 @@
|
||||
|
||||
### Function a1
|
||||
|
||||
`func a1 (x: u8)`
|
||||
` func a1 (x: u8)`
|
||||
|
||||
|
||||
### Function a2
|
||||
|
||||
`func a2 (x: s8)`
|
||||
` func a2 (x: s8)`
|
||||
|
||||
|
||||
### Function a3
|
||||
|
||||
`func a3 (x: u16)`
|
||||
` func a3 (x: u16)`
|
||||
|
||||
|
||||
### Function a4
|
||||
|
||||
`func a4 (x: s16)`
|
||||
` func a4 (x: s16)`
|
||||
|
||||
|
||||
### Function a5
|
||||
|
||||
`func a5 (x: u32)`
|
||||
` func a5 (x: u32)`
|
||||
|
||||
|
||||
### Function a6
|
||||
|
||||
`func a6 (x: s32)`
|
||||
` func a6 (x: s32)`
|
||||
|
||||
|
||||
### Function a7
|
||||
|
||||
`func a7 (x: u64)`
|
||||
` func a7 (x: u64)`
|
||||
|
||||
|
||||
### Function a8
|
||||
|
||||
`func a8 (x: s64)`
|
||||
` func a8 (x: s64)`
|
||||
|
||||
|
||||
### Function a9
|
||||
|
||||
`func a9 (x: u128)`
|
||||
` func a9 (x: u128)`
|
||||
|
||||
|
||||
### Function a10
|
||||
|
||||
`func a10 (x: s128)`
|
||||
` func a10 (x: s128)`
|
||||
|
||||
|
||||
### Function a11
|
||||
|
||||
`func a11 (p1: u8, p2: s8, p3: u16, p4: s16, p5: u32, p6: s32, p7: u64, p8: s64, p9: u128, p10: s128)`
|
||||
` func a11 (p1: u8, p2: s8, p3: u16, p4: s16, p5: u32, p6: s32, p7: u64, p8: s64, p9: u128, p10: s128)`
|
||||
|
||||
|
||||
### Function r1
|
||||
|
||||
`func r1 () -> u8`
|
||||
` func r1 () -> u8`
|
||||
|
||||
|
||||
### Function r2
|
||||
|
||||
`func r2 () -> s8`
|
||||
` func r2 () -> s8`
|
||||
|
||||
|
||||
### Function r3
|
||||
|
||||
`func r3 () -> u16`
|
||||
` func r3 () -> u16`
|
||||
|
||||
|
||||
### Function r4
|
||||
|
||||
`func r4 () -> s16`
|
||||
` func r4 () -> s16`
|
||||
|
||||
|
||||
### Function r5
|
||||
|
||||
`func r5 () -> u32`
|
||||
` func r5 () -> u32`
|
||||
|
||||
|
||||
### Function r6
|
||||
|
||||
`func r6 () -> s32`
|
||||
` func r6 () -> s32`
|
||||
|
||||
|
||||
### Function r7
|
||||
|
||||
`func r7 () -> u64`
|
||||
` func r7 () -> u64`
|
||||
|
||||
|
||||
### Function r8
|
||||
|
||||
`func r8 () -> s64`
|
||||
` func r8 () -> s64`
|
||||
|
||||
|
||||
### Function r9
|
||||
|
||||
`func r9 () -> u128`
|
||||
` func r9 () -> u128`
|
||||
|
||||
|
||||
### Function r10
|
||||
|
||||
`func r10 () -> s128`
|
||||
` func r10 () -> s128`
|
||||
|
||||
|
||||
### Function pair_ret
|
||||
|
||||
`func pair_ret () -> tuple<s64, u8>`
|
||||
` func pair_ret () -> tuple<s64, u8>`
|
||||
|
||||
|
||||
@@ -82,165 +82,165 @@
|
||||
|
||||
### Function list_u8_param
|
||||
|
||||
`func list_u8_param (x: list<u8>)`
|
||||
` func list_u8_param (x: list<u8>)`
|
||||
|
||||
|
||||
### Function list_u16_param
|
||||
|
||||
`func list_u16_param (x: list<u16>)`
|
||||
` func list_u16_param (x: list<u16>)`
|
||||
|
||||
|
||||
### Function list_u32_param
|
||||
|
||||
`func list_u32_param (x: list<u32>)`
|
||||
` func list_u32_param (x: list<u32>)`
|
||||
|
||||
|
||||
### Function list_u64_param
|
||||
|
||||
`func list_u64_param (x: list<u64>)`
|
||||
` func list_u64_param (x: list<u64>)`
|
||||
|
||||
|
||||
### Function list_u128_param
|
||||
|
||||
`func list_u128_param (x: list<u128>)`
|
||||
` func list_u128_param (x: list<u128>)`
|
||||
|
||||
|
||||
### Function list_s8_param
|
||||
|
||||
`func list_s8_param (x: list<s8>)`
|
||||
` func list_s8_param (x: list<s8>)`
|
||||
|
||||
|
||||
### Function list_s16_param
|
||||
|
||||
`func list_s16_param (x: list<s16>)`
|
||||
` func list_s16_param (x: list<s16>)`
|
||||
|
||||
|
||||
### Function list_s32_param
|
||||
|
||||
`func list_s32_param (x: list<s32>)`
|
||||
` func list_s32_param (x: list<s32>)`
|
||||
|
||||
|
||||
### Function list_s64_param
|
||||
|
||||
`func list_s64_param (x: list<s64>)`
|
||||
` func list_s64_param (x: list<s64>)`
|
||||
|
||||
|
||||
### Function list_s128_param
|
||||
|
||||
`func list_s128_param (x: list<s128>)`
|
||||
` func list_s128_param (x: list<s128>)`
|
||||
|
||||
|
||||
### Function list_float32_param
|
||||
|
||||
`func list_float32_param (x: list<float32>)`
|
||||
` func list_float32_param (x: list<float32>)`
|
||||
|
||||
|
||||
### Function list_float64_param
|
||||
|
||||
`func list_float64_param (x: list<float64>)`
|
||||
` func list_float64_param (x: list<float64>)`
|
||||
|
||||
|
||||
### Function list_u8_ret
|
||||
|
||||
`func list_u8_ret () -> list<u8>`
|
||||
` func list_u8_ret () -> list<u8>`
|
||||
|
||||
|
||||
### Function list_u16_ret
|
||||
|
||||
`func list_u16_ret () -> list<u16>`
|
||||
` func list_u16_ret () -> list<u16>`
|
||||
|
||||
|
||||
### Function list_u32_ret
|
||||
|
||||
`func list_u32_ret () -> list<u32>`
|
||||
` func list_u32_ret () -> list<u32>`
|
||||
|
||||
|
||||
### Function list_u64_ret
|
||||
|
||||
`func list_u64_ret () -> list<u64>`
|
||||
` func list_u64_ret () -> list<u64>`
|
||||
|
||||
|
||||
### Function list_u128_ret
|
||||
|
||||
`func list_u128_ret () -> list<u128>`
|
||||
` func list_u128_ret () -> list<u128>`
|
||||
|
||||
|
||||
### Function list_s8_ret
|
||||
|
||||
`func list_s8_ret () -> list<s8>`
|
||||
` func list_s8_ret () -> list<s8>`
|
||||
|
||||
|
||||
### Function list_s16_ret
|
||||
|
||||
`func list_s16_ret () -> list<s16>`
|
||||
` func list_s16_ret () -> list<s16>`
|
||||
|
||||
|
||||
### Function list_s32_ret
|
||||
|
||||
`func list_s32_ret () -> list<s32>`
|
||||
` func list_s32_ret () -> list<s32>`
|
||||
|
||||
|
||||
### Function list_s64_ret
|
||||
|
||||
`func list_s64_ret () -> list<s64>`
|
||||
` func list_s64_ret () -> list<s64>`
|
||||
|
||||
|
||||
### Function list_s128_ret
|
||||
|
||||
`func list_s128_ret () -> list<s128>`
|
||||
` func list_s128_ret () -> list<s128>`
|
||||
|
||||
|
||||
### Function list_float32_ret
|
||||
|
||||
`func list_float32_ret () -> list<float32>`
|
||||
` func list_float32_ret () -> list<float32>`
|
||||
|
||||
|
||||
### Function list_float64_ret
|
||||
|
||||
`func list_float64_ret () -> list<float64>`
|
||||
` func list_float64_ret () -> list<float64>`
|
||||
|
||||
|
||||
### Function tuple_list
|
||||
|
||||
`func tuple_list (x: list<tuple<u8, s8>>) -> list<tuple<s64, u32>>`
|
||||
` func tuple_list (x: list<tuple<u8, s8>>) -> list<tuple<s64, u32>>`
|
||||
|
||||
|
||||
### Function string_list_arg
|
||||
|
||||
`func string_list_arg (a: list<string>)`
|
||||
` func string_list_arg (a: list<string>)`
|
||||
|
||||
|
||||
### Function string_list_ret
|
||||
|
||||
`func string_list_ret () -> list<string>`
|
||||
` func string_list_ret () -> list<string>`
|
||||
|
||||
|
||||
### Function tuple_string_list
|
||||
|
||||
`func tuple_string_list (x: list<tuple<u8, string>>) -> list<tuple<string, u8>>`
|
||||
` func tuple_string_list (x: list<tuple<u8, string>>) -> list<tuple<string, u8>>`
|
||||
|
||||
|
||||
### Function string_list
|
||||
|
||||
`func string_list (x: list<string>) -> list<string>`
|
||||
` func string_list (x: list<string>) -> list<string>`
|
||||
|
||||
|
||||
### Function record_list
|
||||
|
||||
`func record_list (x: list<[some_record](#some_record)>) -> list<[other_record](#other_record)>`
|
||||
` func record_list (x: list<[some_record](#some_record)>) -> list<[other_record](#other_record)>`
|
||||
|
||||
|
||||
### Function record_list_reverse
|
||||
|
||||
`func record_list_reverse (x: list<[other_record](#other_record)>) -> list<[some_record](#some_record)>`
|
||||
` func record_list_reverse (x: list<[other_record](#other_record)>) -> list<[some_record](#some_record)>`
|
||||
|
||||
|
||||
### Function variant_list
|
||||
|
||||
`func variant_list (x: list<[some_variant](#some_variant)>) -> list<[other_variant](#other_variant)>`
|
||||
` func variant_list (x: list<[some_variant](#some_variant)>) -> list<[other_variant](#other_variant)>`
|
||||
|
||||
|
||||
### Function load_store_everything
|
||||
|
||||
`func load_store_everything (a: [load_store_all_sizes](#load_store_all_sizes)) -> [load_store_all_sizes](#load_store_all_sizes)`
|
||||
` func load_store_everything (a: [load_store_all_sizes](#load_store_all_sizes)) -> [load_store_all_sizes](#load_store_all_sizes)`
|
||||
|
||||
|
||||
@@ -56,10 +56,10 @@
|
||||
|
||||
### Function many_args
|
||||
|
||||
`func many_args (a1: u64, a2: u64, a3: u64, a4: u64, a5: u64, a6: u64, a7: u64, a8: u64, a9: u64, a10: u64, a11: u64, a12: u64, a13: u64, a14: u64, a15: u64, a16: u64)`
|
||||
` func many_args (a1: u64, a2: u64, a3: u64, a4: u64, a5: u64, a6: u64, a7: u64, a8: u64, a9: u64, a10: u64, a11: u64, a12: u64, a13: u64, a14: u64, a15: u64, a16: u64)`
|
||||
|
||||
|
||||
### Function big_argument
|
||||
|
||||
`func big_argument (x: [big_struct](#big_struct))`
|
||||
` func big_argument (x: [big_struct](#big_struct))`
|
||||
|
||||
|
||||
@@ -10,25 +10,25 @@
|
||||
|
||||
### Function mra
|
||||
|
||||
`func mra ()`
|
||||
` func mra ()`
|
||||
|
||||
|
||||
### Function mrb
|
||||
|
||||
`func mrb () -> ()`
|
||||
` func mrb () -> ()`
|
||||
|
||||
|
||||
### Function mrc
|
||||
|
||||
`func mrc () -> u32`
|
||||
` func mrc () -> u32`
|
||||
|
||||
|
||||
### Function mrd
|
||||
|
||||
`func mrd () -> (a: u32)`
|
||||
` func mrd () -> (a: u32)`
|
||||
|
||||
|
||||
### Function mre
|
||||
|
||||
`func mre () -> (a: u32, b: float32)`
|
||||
` func mre () -> (a: u32, b: float32)`
|
||||
|
||||
|
||||
@@ -81,55 +81,55 @@ All of the fields are bool
|
||||
|
||||
### Function tuple_arg
|
||||
|
||||
`func tuple_arg (x: tuple<char, u32>)`
|
||||
` func tuple_arg (x: tuple<char, u32>)`
|
||||
|
||||
|
||||
### Function tuple_result
|
||||
|
||||
`func tuple_result () -> tuple<char, u32>`
|
||||
` func tuple_result () -> tuple<char, u32>`
|
||||
|
||||
|
||||
### Function empty_arg
|
||||
|
||||
`func empty_arg (x: [empty](#empty))`
|
||||
` func empty_arg (x: [empty](#empty))`
|
||||
|
||||
|
||||
### Function empty_result
|
||||
|
||||
`func empty_result () -> [empty](#empty)`
|
||||
` func empty_result () -> [empty](#empty)`
|
||||
|
||||
|
||||
### Function scalar_arg
|
||||
|
||||
`func scalar_arg (x: [scalars](#scalars))`
|
||||
` func scalar_arg (x: [scalars](#scalars))`
|
||||
|
||||
|
||||
### Function scalar_result
|
||||
|
||||
`func scalar_result () -> [scalars](#scalars)`
|
||||
` func scalar_result () -> [scalars](#scalars)`
|
||||
|
||||
|
||||
### Function flags_arg
|
||||
|
||||
`func flags_arg (x: [really_flags](#really_flags))`
|
||||
` func flags_arg (x: [really_flags](#really_flags))`
|
||||
|
||||
|
||||
### Function flags_result
|
||||
|
||||
`func flags_result () -> [really_flags](#really_flags)`
|
||||
` func flags_result () -> [really_flags](#really_flags)`
|
||||
|
||||
|
||||
### Function aggregate_arg
|
||||
|
||||
`func aggregate_arg (x: [aggregates](#aggregates))`
|
||||
` func aggregate_arg (x: [aggregates](#aggregates))`
|
||||
|
||||
|
||||
### Function aggregate_result
|
||||
|
||||
`func aggregate_result () -> [aggregates](#aggregates)`
|
||||
` func aggregate_result () -> [aggregates](#aggregates)`
|
||||
|
||||
|
||||
### Function typedef_inout
|
||||
|
||||
`func typedef_inout (e: [tuple_typedef2](#tuple_typedef2)) -> s32`
|
||||
` func typedef_inout (e: [tuple_typedef2](#tuple_typedef2)) -> s32`
|
||||
|
||||
|
||||
@@ -47,10 +47,10 @@
|
||||
|
||||
### Function constructor_a
|
||||
|
||||
`func constructor_a () -> [a](#a)`
|
||||
` func constructor_a () -> [a](#a)`
|
||||
|
||||
|
||||
### Function constructor_b
|
||||
|
||||
`func constructor_b () -> [b](#b)`
|
||||
` func constructor_b () -> [b](#b)`
|
||||
|
||||
|
||||
@@ -10,30 +10,30 @@
|
||||
|
||||
### Function f1
|
||||
|
||||
`func f1 ()`
|
||||
` func f1 ()`
|
||||
|
||||
|
||||
### Function f2
|
||||
|
||||
`func f2 (a: u32)`
|
||||
` func f2 (a: u32)`
|
||||
|
||||
|
||||
### Function f3
|
||||
|
||||
`func f3 (a: u32, b: u32)`
|
||||
` func f3 (a: u32, b: u32)`
|
||||
|
||||
|
||||
### Function f4
|
||||
|
||||
`func f4 () -> u32`
|
||||
` func f4 () -> u32`
|
||||
|
||||
|
||||
### Function f5
|
||||
|
||||
`func f5 () -> tuple<u32, u32>`
|
||||
` func f5 () -> tuple<u32, u32>`
|
||||
|
||||
|
||||
### Function f6
|
||||
|
||||
`func f6 (a: u32, b: u32, c: u32) -> tuple<u32, u32, u32>`
|
||||
` func f6 (a: u32, b: u32, c: u32) -> tuple<u32, u32, u32>`
|
||||
|
||||
|
||||
@@ -10,20 +10,20 @@
|
||||
|
||||
### Function simple_list1
|
||||
|
||||
`func simple_list1 (l: list<u32>)`
|
||||
` func simple_list1 (l: list<u32>)`
|
||||
|
||||
|
||||
### Function simple_list2
|
||||
|
||||
`func simple_list2 () -> list<u32>`
|
||||
` func simple_list2 () -> list<u32>`
|
||||
|
||||
|
||||
### Function simple_list3
|
||||
|
||||
`func simple_list3 (a: list<u32>, b: list<u32>) -> tuple<list<u32>, list<u32>>`
|
||||
` func simple_list3 (a: list<u32>, b: list<u32>) -> tuple<list<u32>, list<u32>>`
|
||||
|
||||
|
||||
### Function simple_list4
|
||||
|
||||
`func simple_list4 (l: list<list<u32>>) -> list<list<u32>>`
|
||||
` func simple_list4 (l: list<list<u32>>) -> list<list<u32>>`
|
||||
|
||||
|
||||
@@ -20,5 +20,5 @@
|
||||
|
||||
### Function option_test
|
||||
|
||||
`func option_test () -> result<option<string>, [error](#error)>`
|
||||
` func option_test () -> result<option<string>, [error](#error)>`
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
|
||||
### Function a
|
||||
|
||||
`func a (x: string)`
|
||||
` func a (x: string)`
|
||||
|
||||
|
||||
### Function b
|
||||
|
||||
`func b () -> string`
|
||||
` func b () -> string`
|
||||
|
||||
|
||||
### Function c
|
||||
|
||||
`func c (a: string, b: string) -> string`
|
||||
` func c (a: string, b: string) -> string`
|
||||
|
||||
|
||||
@@ -81,50 +81,50 @@ A Signed Integer
|
||||
|
||||
### Function add_one_integer
|
||||
|
||||
`func add_one_integer (num: [all_integers](#all_integers)) -> [all_integers](#all_integers)`
|
||||
` func add_one_integer (num: [all_integers](#all_integers)) -> [all_integers](#all_integers)`
|
||||
|
||||
|
||||
### Function add_one_float
|
||||
|
||||
`func add_one_float (num: [all_floats](#all_floats)) -> [all_floats](#all_floats)`
|
||||
` func add_one_float (num: [all_floats](#all_floats)) -> [all_floats](#all_floats)`
|
||||
|
||||
|
||||
### Function replace_first_char
|
||||
|
||||
`func replace_first_char (text: [all_text](#all_text), letter: char) -> [all_text](#all_text)`
|
||||
` func replace_first_char (text: [all_text](#all_text), letter: char) -> [all_text](#all_text)`
|
||||
|
||||
|
||||
### Function identify_integer
|
||||
|
||||
`func identify_integer (num: [all_integers](#all_integers)) -> u8`
|
||||
` func identify_integer (num: [all_integers](#all_integers)) -> u8`
|
||||
|
||||
|
||||
### Function identify_float
|
||||
|
||||
`func identify_float (num: [all_floats](#all_floats)) -> u8`
|
||||
` func identify_float (num: [all_floats](#all_floats)) -> u8`
|
||||
|
||||
|
||||
### Function identify_text
|
||||
|
||||
`func identify_text (text: [all_text](#all_text)) -> u8`
|
||||
` func identify_text (text: [all_text](#all_text)) -> u8`
|
||||
|
||||
|
||||
### Function add_one_duplicated
|
||||
|
||||
`func add_one_duplicated (num: [duplicated_s32](#duplicated_s32)) -> [duplicated_s32](#duplicated_s32)`
|
||||
` func add_one_duplicated (num: [duplicated_s32](#duplicated_s32)) -> [duplicated_s32](#duplicated_s32)`
|
||||
|
||||
|
||||
### Function identify_duplicated
|
||||
|
||||
`func identify_duplicated (num: [duplicated_s32](#duplicated_s32)) -> u8`
|
||||
` func identify_duplicated (num: [duplicated_s32](#duplicated_s32)) -> u8`
|
||||
|
||||
|
||||
### Function add_one_distinguishable_num
|
||||
|
||||
`func add_one_distinguishable_num (num: [distinguishable_num](#distinguishable_num)) -> [distinguishable_num](#distinguishable_num)`
|
||||
` func add_one_distinguishable_num (num: [distinguishable_num](#distinguishable_num)) -> [distinguishable_num](#distinguishable_num)`
|
||||
|
||||
|
||||
### Function identify_distinguishable_num
|
||||
|
||||
`func identify_distinguishable_num (num: [distinguishable_num](#distinguishable_num)) -> u8`
|
||||
` func identify_distinguishable_num (num: [distinguishable_num](#distinguishable_num)) -> u8`
|
||||
|
||||
|
||||
@@ -143,120 +143,120 @@
|
||||
|
||||
### Function e1_arg
|
||||
|
||||
`func e1_arg (x: [e1](#e1))`
|
||||
` func e1_arg (x: [e1](#e1))`
|
||||
|
||||
|
||||
### Function e1_result
|
||||
|
||||
`func e1_result () -> [e1](#e1)`
|
||||
` func e1_result () -> [e1](#e1)`
|
||||
|
||||
|
||||
### Function u1_arg
|
||||
|
||||
`func u1_arg (x: [u1](#u1))`
|
||||
` func u1_arg (x: [u1](#u1))`
|
||||
|
||||
|
||||
### Function u1_result
|
||||
|
||||
`func u1_result () -> [u1](#u1)`
|
||||
` func u1_result () -> [u1](#u1)`
|
||||
|
||||
|
||||
### Function v1_arg
|
||||
|
||||
`func v1_arg (x: [v1](#v1))`
|
||||
` func v1_arg (x: [v1](#v1))`
|
||||
|
||||
|
||||
### Function v1_result
|
||||
|
||||
`func v1_result () -> [v1](#v1)`
|
||||
` func v1_result () -> [v1](#v1)`
|
||||
|
||||
|
||||
### Function bool_arg
|
||||
|
||||
`func bool_arg (x: bool)`
|
||||
` func bool_arg (x: bool)`
|
||||
|
||||
|
||||
### Function bool_result
|
||||
|
||||
`func bool_result () -> bool`
|
||||
` func bool_result () -> bool`
|
||||
|
||||
|
||||
### Function option_arg
|
||||
|
||||
`func option_arg (a: option<bool>, b: option<tuple<>>, c: option<u32>, d: option<[e1](#e1)>, e: option<float32>, f: option<[u1](#u1)>, g: option<option<bool>>)`
|
||||
` func option_arg (a: option<bool>, b: option<tuple<>>, c: option<u32>, d: option<[e1](#e1)>, e: option<float32>, f: option<[u1](#u1)>, g: option<option<bool>>)`
|
||||
|
||||
|
||||
### Function option_result
|
||||
|
||||
`func option_result () -> tuple<option<bool>, option<tuple<>>, option<u32>, option<[e1](#e1)>, option<float32>, option<[u1](#u1)>, option<option<bool>>>`
|
||||
` func option_result () -> tuple<option<bool>, option<tuple<>>, option<u32>, option<[e1](#e1)>, option<float32>, option<[u1](#u1)>, option<option<bool>>>`
|
||||
|
||||
|
||||
### Function casts
|
||||
|
||||
`func casts (a: [casts1](#casts1), b: [casts2](#casts2), c: [casts3](#casts3), d: [casts4](#casts4), e: [casts5](#casts5), f: [casts6](#casts6)) -> tuple<[casts1](#casts1), [casts2](#casts2), [casts3](#casts3), [casts4](#casts4), [casts5](#casts5), [casts6](#casts6)>`
|
||||
` func casts (a: [casts1](#casts1), b: [casts2](#casts2), c: [casts3](#casts3), d: [casts4](#casts4), e: [casts5](#casts5), f: [casts6](#casts6)) -> tuple<[casts1](#casts1), [casts2](#casts2), [casts3](#casts3), [casts4](#casts4), [casts5](#casts5), [casts6](#casts6)>`
|
||||
|
||||
|
||||
### Function result_arg
|
||||
|
||||
`func result_arg (a: result<_, _>, b: result<_, [e1](#e1)>, c: result<[e1](#e1), _>, d: result<tuple<>, tuple<>>, e: result<u32, [v1](#v1)>, f: result<string, list<u8>>)`
|
||||
` func result_arg (a: result<_, _>, b: result<_, [e1](#e1)>, c: result<[e1](#e1), _>, d: result<tuple<>, tuple<>>, e: result<u32, [v1](#v1)>, f: result<string, list<u8>>)`
|
||||
|
||||
|
||||
### Function result_result
|
||||
|
||||
`func result_result () -> tuple<result<_, _>, result<_, [e1](#e1)>, result<[e1](#e1), _>, result<tuple<>, tuple<>>, result<u32, [v1](#v1)>, result<string, list<u8>>>`
|
||||
` func result_result () -> tuple<result<_, _>, result<_, [e1](#e1)>, result<[e1](#e1), _>, result<tuple<>, tuple<>>, result<u32, [v1](#v1)>, result<string, list<u8>>>`
|
||||
|
||||
|
||||
### Function return_result_sugar
|
||||
|
||||
`func return_result_sugar () -> result<s32, [my_errno](#my_errno)>`
|
||||
` func return_result_sugar () -> result<s32, [my_errno](#my_errno)>`
|
||||
|
||||
|
||||
### Function return_result_sugar2
|
||||
|
||||
`func return_result_sugar2 () -> result<_, [my_errno](#my_errno)>`
|
||||
` func return_result_sugar2 () -> result<_, [my_errno](#my_errno)>`
|
||||
|
||||
|
||||
### Function return_result_sugar3
|
||||
|
||||
`func return_result_sugar3 () -> result<[my_errno](#my_errno), [my_errno](#my_errno)>`
|
||||
` func return_result_sugar3 () -> result<[my_errno](#my_errno), [my_errno](#my_errno)>`
|
||||
|
||||
|
||||
### Function return_result_sugar4
|
||||
|
||||
`func return_result_sugar4 () -> result<tuple<s32, u32>, [my_errno](#my_errno)>`
|
||||
` func return_result_sugar4 () -> result<tuple<s32, u32>, [my_errno](#my_errno)>`
|
||||
|
||||
|
||||
### Function return_option_sugar
|
||||
|
||||
`func return_option_sugar () -> option<s32>`
|
||||
` func return_option_sugar () -> option<s32>`
|
||||
|
||||
|
||||
### Function return_option_sugar2
|
||||
|
||||
`func return_option_sugar2 () -> option<[my_errno](#my_errno)>`
|
||||
` func return_option_sugar2 () -> option<[my_errno](#my_errno)>`
|
||||
|
||||
|
||||
### Function result_simple
|
||||
|
||||
`func result_simple () -> result<u32, s32>`
|
||||
` func result_simple () -> result<u32, s32>`
|
||||
|
||||
|
||||
### Function is_clone_arg
|
||||
|
||||
`func is_clone_arg (a: [is_clone](#is_clone))`
|
||||
` func is_clone_arg (a: [is_clone](#is_clone))`
|
||||
|
||||
|
||||
### Function is_clone_return
|
||||
|
||||
`func is_clone_return () -> [is_clone](#is_clone)`
|
||||
` func is_clone_return () -> [is_clone](#is_clone)`
|
||||
|
||||
|
||||
### Function return_named_option
|
||||
|
||||
`func return_named_option () -> (a: option<u8>)`
|
||||
` func return_named_option () -> (a: option<u8>)`
|
||||
|
||||
|
||||
### Function return_named_result
|
||||
|
||||
`func return_named_result () -> (a: result<u8, [my_errno](#my_errno)>)`
|
||||
` func return_named_result () -> (a: result<u8, [my_errno](#my_errno)>)`
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ rust-version.workspace = true
|
||||
bitflags.workspace = true
|
||||
tauri-bindgen-host-macro = { path = "../host-macro" }
|
||||
async-trait = "0.1.73"
|
||||
tauri = "1.4.1"
|
||||
tauri.workspace = true
|
||||
tracing = { version = "0.1.37", features = ["log", "log-always"] }
|
||||
anyhow = "1.0.75"
|
||||
serde.workspace = true
|
||||
|
||||
@@ -12,5 +12,6 @@ anyhow = "1.0.75"
|
||||
serde.workspace = true
|
||||
log.workspace = true
|
||||
postcard = { version = "1.0.7", features = ["alloc"] }
|
||||
tauri = "1.4.1"
|
||||
url = "2.4.1"
|
||||
tauri.workspace = true
|
||||
tokio = { version = "1.32.0", features = ["sync", "macros"] }
|
||||
futures-util = "0.3.28"
|
||||
|
||||
@@ -1,33 +1,34 @@
|
||||
#![allow(clippy::missing_panics_doc, clippy::missing_errors_doc)]
|
||||
|
||||
pub use anyhow::Error;
|
||||
use anyhow::{bail, Result};
|
||||
|
||||
use futures_util::FutureExt;
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use std::{
|
||||
collections::{hash_map::Entry, HashMap},
|
||||
sync::{mpsc::Sender, Arc, Mutex},
|
||||
future::Future,
|
||||
marker::PhantomData,
|
||||
pin::Pin,
|
||||
sync::Arc,
|
||||
};
|
||||
use tauri::{AppHandle, Manager, Runtime};
|
||||
use url::Url;
|
||||
use tauri::http::{header::CONTENT_TYPE, Request, Response, StatusCode};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Router<T> {
|
||||
type Definition<T> =
|
||||
Box<dyn Fn(Caller<T>, &[u8]) -> anyhow::Result<CallResult> + Send + Sync + 'static>;
|
||||
|
||||
enum CallResult {
|
||||
Value(Vec<u8>),
|
||||
Future(Pin<Box<dyn Future<Output = anyhow::Result<Vec<u8>>> + Send + 'static>>),
|
||||
}
|
||||
|
||||
pub struct Caller<T> {
|
||||
data: Arc<T>,
|
||||
string2idx: HashMap<Arc<str>, usize>,
|
||||
strings: Vec<Arc<str>>,
|
||||
map: HashMap<ImportKey, Definition<T>>,
|
||||
}
|
||||
|
||||
pub type Definition<T> =
|
||||
Box<dyn Fn(Caller<T>, &[u8], Sender<Vec<u8>>) -> anyhow::Result<()> + Send + Sync>;
|
||||
|
||||
pub struct Caller<'a, T> {
|
||||
data: &'a T,
|
||||
}
|
||||
|
||||
impl<'a, T> Caller<'a, T> {
|
||||
impl<T> Caller<T> {
|
||||
#[must_use]
|
||||
pub fn data(&self) -> &T {
|
||||
self.data
|
||||
&self.data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,53 +38,101 @@ struct ImportKey {
|
||||
name: usize,
|
||||
}
|
||||
|
||||
impl<U> Router<U> {
|
||||
#[must_use]
|
||||
pub fn new(data: U) -> Self {
|
||||
pub struct Router<T> {
|
||||
data: Arc<T>,
|
||||
_m: PhantomData<T>,
|
||||
string2idx: HashMap<Arc<str>, usize>,
|
||||
strings: Vec<Arc<str>>,
|
||||
map: HashMap<ImportKey, Definition<T>>,
|
||||
}
|
||||
|
||||
impl<T> Router<T> {
|
||||
pub fn new(data: T) -> Self {
|
||||
Self {
|
||||
data: Arc::new(data),
|
||||
_m: PhantomData,
|
||||
string2idx: HashMap::new(),
|
||||
strings: Vec::new(),
|
||||
map: HashMap::new(),
|
||||
data: Arc::new(data),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn func_wrap<Params, Args>(
|
||||
pub fn define<F, P, R>(&mut self, module: &str, name: &str, func: F) -> anyhow::Result<()>
|
||||
where
|
||||
F: Fn(Caller<T>, P) -> anyhow::Result<R> + Send + Sync + 'static,
|
||||
P: DeserializeOwned,
|
||||
R: Serialize,
|
||||
{
|
||||
let key = self.import_key(Some(module), name);
|
||||
|
||||
self.insert(
|
||||
key,
|
||||
Box::new(move |caller, params| {
|
||||
let params = postcard::from_bytes(params)?;
|
||||
|
||||
let res = func(caller, params)?;
|
||||
|
||||
Ok(CallResult::Value(postcard::to_allocvec(&res).unwrap()))
|
||||
}),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn define_async<F, P, R, RV>(
|
||||
&mut self,
|
||||
module: &str,
|
||||
name: &str,
|
||||
func: impl IntoFunc<U, Params, Args>,
|
||||
) -> Result<&mut Self> {
|
||||
let func = func.into_func();
|
||||
|
||||
func: F,
|
||||
) -> anyhow::Result<()>
|
||||
where
|
||||
F: Fn(Caller<T>, P) -> Pin<Box<R>> + Send + Sync + 'static,
|
||||
P: DeserializeOwned,
|
||||
R: Future<Output = anyhow::Result<RV>> + Send + 'static,
|
||||
RV: Serialize,
|
||||
{
|
||||
let key = self.import_key(Some(module), name);
|
||||
self.insert(key, func)?;
|
||||
|
||||
Ok(self)
|
||||
self.insert(
|
||||
key,
|
||||
Box::new(move |caller, params| {
|
||||
let params = postcard::from_bytes(params)?;
|
||||
|
||||
let fut = func(caller, params)
|
||||
.map(|res| postcard::to_allocvec(&res?).map_err(Into::into))
|
||||
.boxed();
|
||||
|
||||
Ok(CallResult::Future(fut))
|
||||
}),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn handle_request(
|
||||
&mut self,
|
||||
module: Option<impl AsRef<str>>,
|
||||
name: impl AsRef<str>,
|
||||
async fn call(
|
||||
&self,
|
||||
module: Option<&str>,
|
||||
name: &str,
|
||||
params: &[u8],
|
||||
res_tx: Sender<Vec<u8>>,
|
||||
) -> anyhow::Result<()> {
|
||||
let key = self.import_key(module, name.as_ref());
|
||||
) -> anyhow::Result<Vec<u8>> {
|
||||
let key = self.import_key_read_only(module, name)?;
|
||||
|
||||
let handler = self
|
||||
.map
|
||||
.get(&key)
|
||||
.ok_or(anyhow::anyhow!("method not found"))?;
|
||||
|
||||
let caller = Caller { data: &*self.data };
|
||||
let caller = Caller {
|
||||
data: self.data.clone(),
|
||||
};
|
||||
|
||||
handler(caller, params, res_tx)?;
|
||||
|
||||
Ok(())
|
||||
match handler(caller, params)? {
|
||||
CallResult::Value(val) => Ok(val),
|
||||
CallResult::Future(fut) => Ok(fut.await?),
|
||||
}
|
||||
}
|
||||
|
||||
fn insert(&mut self, key: ImportKey, item: Definition<U>) -> Result<()> {
|
||||
fn insert(&mut self, key: ImportKey, item: Definition<T>) -> anyhow::Result<()> {
|
||||
match self.map.entry(key) {
|
||||
Entry::Occupied(_) => {
|
||||
let module = &self.strings[key.module];
|
||||
@@ -91,7 +140,7 @@ impl<U> Router<U> {
|
||||
Some(name) => format!("{module}::{name}"),
|
||||
None => module.to_string(),
|
||||
};
|
||||
bail!("import of `{}` defined twice", desc)
|
||||
anyhow::bail!("import of `{}` defined twice", desc)
|
||||
}
|
||||
Entry::Vacant(v) => {
|
||||
v.insert(item);
|
||||
@@ -107,6 +156,24 @@ impl<U> Router<U> {
|
||||
}
|
||||
}
|
||||
|
||||
fn import_key_read_only(&self, module: Option<&str>, name: &str) -> anyhow::Result<ImportKey> {
|
||||
let module = if let Some(module) = module {
|
||||
*self
|
||||
.string2idx
|
||||
.get(module)
|
||||
.ok_or(anyhow::anyhow!("unknown module"))?
|
||||
} else {
|
||||
usize::MAX
|
||||
};
|
||||
|
||||
let name = *self
|
||||
.string2idx
|
||||
.get(name)
|
||||
.ok_or(anyhow::anyhow!("unknown function"))?;
|
||||
|
||||
Ok(ImportKey { module, name })
|
||||
}
|
||||
|
||||
fn intern_str(&mut self, string: &str) -> usize {
|
||||
if let Some(idx) = self.string2idx.get(string) {
|
||||
return *idx;
|
||||
@@ -119,129 +186,44 @@ impl<U> Router<U> {
|
||||
}
|
||||
}
|
||||
|
||||
pub trait IntoFunc<U, Params, Results>: Send + Sync {
|
||||
#[doc(hidden)]
|
||||
fn into_func(self) -> Definition<U>;
|
||||
}
|
||||
|
||||
macro_rules! impl_into_func {
|
||||
($num:tt $($params:ident)*) => {
|
||||
// Implement for functions without a leading `&Caller` parameter,
|
||||
// delegating to the implementation below which does have the leading
|
||||
// `Caller` parameter.
|
||||
#[allow(non_snake_case)]
|
||||
impl<T, F, $($params,)* R> IntoFunc<T, ($($params,)*), R> for F
|
||||
where
|
||||
F: Fn($($params),*) -> anyhow::Result<R> + Send + Sync + 'static,
|
||||
$($params: serde::de::DeserializeOwned,)*
|
||||
R: serde::Serialize
|
||||
{
|
||||
fn into_func(self) -> Definition<T> {
|
||||
let f = move |_: Caller<T>, $($params:$params),*| {
|
||||
self($($params),*)
|
||||
};
|
||||
|
||||
f.into_func()
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
impl<T, F, $($params,)* R> IntoFunc<T, (Caller<'_, T>, $($params,)*), R> for F
|
||||
where
|
||||
F: Fn(Caller<T>, $($params),*) -> anyhow::Result<R> + Send + Sync + 'static,
|
||||
$($params: serde::de::DeserializeOwned,)*
|
||||
R: serde::Serialize
|
||||
{
|
||||
fn into_func(self) -> Definition<T> {
|
||||
Box::new(move |caller, params, tx| {
|
||||
log::debug!("Deserializing parameters...");
|
||||
let ($($params,)*) = postcard::from_bytes(params)?;
|
||||
|
||||
log::debug!("Calling handler...");
|
||||
let out = self(caller, $($params),*)?;
|
||||
|
||||
log::debug!("Serializing response...");
|
||||
let out = postcard::to_allocvec(&out)?;
|
||||
|
||||
tx.send(out)?;
|
||||
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! for_each_function_signature {
|
||||
($mac:ident) => {
|
||||
$mac!(0);
|
||||
$mac!(1 A1);
|
||||
$mac!(2 A1 A2);
|
||||
$mac!(3 A1 A2 A3);
|
||||
$mac!(4 A1 A2 A3 A4);
|
||||
$mac!(5 A1 A2 A3 A4 A5);
|
||||
$mac!(6 A1 A2 A3 A4 A5 A6);
|
||||
$mac!(7 A1 A2 A3 A4 A5 A6 A7);
|
||||
$mac!(8 A1 A2 A3 A4 A5 A6 A7 A8);
|
||||
$mac!(9 A1 A2 A3 A4 A5 A6 A7 A8 A9);
|
||||
$mac!(10 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10);
|
||||
$mac!(11 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11);
|
||||
$mac!(12 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12);
|
||||
$mac!(13 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13);
|
||||
$mac!(14 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14);
|
||||
$mac!(15 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15);
|
||||
$mac!(16 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A16);
|
||||
};
|
||||
}
|
||||
|
||||
for_each_function_signature!(impl_into_func);
|
||||
|
||||
pub trait BuilderExt {
|
||||
#[must_use]
|
||||
fn ipc_router<U: Send + Sync + 'static>(self, router: Router<U>) -> Self;
|
||||
}
|
||||
|
||||
impl<R: Runtime> BuilderExt for tauri::Builder<R> {
|
||||
impl<R: tauri::Runtime> BuilderExt for tauri::Builder<R> {
|
||||
fn ipc_router<U: Send + Sync + 'static>(self, router: Router<U>) -> Self {
|
||||
self.manage(Mutex::new(router))
|
||||
.register_uri_scheme_protocol("ipc", |app, req| {
|
||||
let res = uri_scheme_handler_inner::<U, _>(app, req);
|
||||
let router = Arc::new(router);
|
||||
|
||||
log::debug!("call result {:?}", res);
|
||||
self.register_asynchronous_uri_scheme_protocol("ipc", move |_app, req, responder| {
|
||||
let router = router.clone();
|
||||
|
||||
let mut resp = match res {
|
||||
Ok(val) => {
|
||||
let mut resp = tauri::http::Response::new(val);
|
||||
resp.set_status(tauri::http::status::StatusCode::OK);
|
||||
resp.set_mimetype(Some("application/octet-stream".to_string()));
|
||||
resp
|
||||
}
|
||||
Err(err) => {
|
||||
let mut resp = tauri::http::Response::new(err.to_string().into_bytes());
|
||||
resp.set_status(tauri::http::status::StatusCode::BAD_REQUEST);
|
||||
resp
|
||||
}
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let mut response = match uri_scheme_inner(&router, req).await {
|
||||
Ok(res) => res,
|
||||
Err(err) => Response::builder()
|
||||
.status(StatusCode::BAD_REQUEST)
|
||||
.body(err.to_string().into_bytes())
|
||||
.unwrap(),
|
||||
};
|
||||
|
||||
resp.headers_mut().insert(
|
||||
response.headers_mut().insert(
|
||||
tauri::http::header::ACCESS_CONTROL_ALLOW_ORIGIN,
|
||||
tauri::http::header::HeaderValue::from_static("*"),
|
||||
);
|
||||
|
||||
log::trace!("sending response {:?}", resp);
|
||||
|
||||
Ok(resp)
|
||||
responder.respond(response);
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn uri_scheme_handler_inner<U: Send + Sync + 'static, R: Runtime>(
|
||||
app: &AppHandle<R>,
|
||||
req: &tauri::http::Request,
|
||||
) -> anyhow::Result<Vec<u8>> {
|
||||
let url = Url::parse(req.uri())?;
|
||||
|
||||
let path = url.path().strip_prefix('/').unwrap();
|
||||
#[inline]
|
||||
async fn uri_scheme_inner<T>(
|
||||
router: &Router<T>,
|
||||
request: Request<Vec<u8>>,
|
||||
) -> anyhow::Result<Response<Vec<u8>>> {
|
||||
let path = request.uri().path().strip_prefix('/').unwrap();
|
||||
|
||||
let (module, method) = path
|
||||
.split_once('/')
|
||||
@@ -249,13 +231,15 @@ fn uri_scheme_handler_inner<U: Send + Sync + 'static, R: Runtime>(
|
||||
|
||||
log::debug!("ipc request for {:?}::{}", module, method);
|
||||
|
||||
let (res_tx, res_rx) = std::sync::mpsc::channel();
|
||||
let response = router.call(module, method, request.body()).await?;
|
||||
|
||||
let router = app.state::<Mutex<Router<U>>>();
|
||||
let mut router = router.lock().unwrap();
|
||||
log::debug!("call result {:?}", response);
|
||||
|
||||
// this is terrible we should not clone here
|
||||
router.handle_request(module, method, req.body(), res_tx)?;
|
||||
let mut resp = Response::builder().status(StatusCode::OK);
|
||||
resp.headers_mut().unwrap().insert(
|
||||
CONTENT_TYPE,
|
||||
tauri::http::header::HeaderValue::from_static("application/octet-stream"),
|
||||
);
|
||||
|
||||
Ok(res_rx.recv()?)
|
||||
Ok(resp.body(response)?)
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ pub enum Error {
|
||||
#[label("cannot be defined twice")]
|
||||
location: Span,
|
||||
},
|
||||
/// Types can't recursively refer to themselves as that would make then possibly infinitly-sized.
|
||||
/// Types can't recursively refer to themselves as that would make then possibly infinitely-sized.
|
||||
/// In Rust the compiler would force you to use heap indirection, however such a thing doesn't exist in out type system.
|
||||
///
|
||||
/// This wouldn't be a problem with the current JSON format, but a custom binary one would have this limitation so for future proofing we deny recursive types.
|
||||
|
||||
@@ -111,7 +111,7 @@ func greet(name: string) -> string
|
||||
At the top-level of each `wit` document lives the `interface` definition, file must contain exactly one such definition.
|
||||
The name you give to an interface will dictate the name of the generated module and printed debug output.
|
||||
|
||||
An interface may contain function declarations and type defintions. The order of declaration doesn't matter so you are free to define types after you have used them for example.
|
||||
An interface may contain function declarations and type definitions. The order of declaration doesn't matter so you are free to define types after you have used them for example.
|
||||
|
||||
```wit
|
||||
interface empty {}
|
||||
|
||||
@@ -16,7 +16,7 @@ tauri-build = { version = "1.1", features = [] }
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.2.4", features = ["api-all"] }
|
||||
tauri = { git = "https://github.com/tauri-apps/tauri", features = [] }
|
||||
tauri-bindgen-host = { path = "../../../crates/host" }
|
||||
tracing-subscriber = "0.3.16"
|
||||
tracing = "0.1.37"
|
||||
|
||||
@@ -8,15 +8,16 @@ use tracing_subscriber;
|
||||
|
||||
tauri_bindgen_host::generate!({
|
||||
path: "../greet.wit",
|
||||
async: false,
|
||||
async: true,
|
||||
tracing: true
|
||||
});
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
struct GreetCtx;
|
||||
|
||||
#[::tauri_bindgen_host::async_trait]
|
||||
impl greet::Greet for GreetCtx {
|
||||
fn greet(&self, name: String) -> String {
|
||||
async fn greet(&self, name: String) -> String {
|
||||
format!(
|
||||
"Hello, {}! You've been greeted from code-generated Rust!",
|
||||
name
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
"version": "0.0.0"
|
||||
},
|
||||
"tauri": {
|
||||
"allowlist": {
|
||||
"all": true
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"category": "DeveloperTool",
|
||||
@@ -50,9 +47,6 @@
|
||||
"security": {
|
||||
"csp": null
|
||||
},
|
||||
"updater": {
|
||||
"active": false
|
||||
},
|
||||
"windows": [
|
||||
{
|
||||
"fullscreen": false,
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:base"
|
||||
]
|
||||
}
|
||||
103
renovate.json5
Normal file
103
renovate.json5
Normal file
@@ -0,0 +1,103 @@
|
||||
{
|
||||
// schedule: [
|
||||
// 'before 5am on the first day of the month',
|
||||
//],
|
||||
semanticCommits: 'enabled',
|
||||
configMigration: true,
|
||||
dependencyDashboard: true,
|
||||
regexManagers: [
|
||||
{
|
||||
customType: 'regex',
|
||||
fileMatch: [
|
||||
'^rust-toolchain\\.toml$',
|
||||
'Cargo.toml$',
|
||||
'clippy.toml$',
|
||||
'\\.clippy.toml$',
|
||||
'^\\.github/workflows/ci.yml$',
|
||||
'^\\.github/workflows/rust-next.yml$',
|
||||
],
|
||||
matchStrings: [
|
||||
'MSRV.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)',
|
||||
'(?<currentValue>\\d+\\.\\d+(\\.\\d+)?).*?MSRV',
|
||||
],
|
||||
depNameTemplate: 'rust',
|
||||
packageNameTemplate: 'rust-lang/rust',
|
||||
datasourceTemplate: 'github-releases',
|
||||
},
|
||||
],
|
||||
packageRules: [
|
||||
{
|
||||
commitMessageTopic: 'MSRV',
|
||||
matchManagers: [
|
||||
'regex',
|
||||
],
|
||||
matchPackageNames: [
|
||||
'rust',
|
||||
],
|
||||
minimumReleaseAge: '252 days', // 6 releases * 6 weeks per release * 7 days per week
|
||||
internalChecksFilter: 'strict',
|
||||
},
|
||||
// Goals:
|
||||
// - Keep version reqs low, ignoring compatible normal/build dependencies
|
||||
// - Take advantage of latest dev-dependencies
|
||||
// - Rollup safe upgrades to reduce CI runner load
|
||||
// - Help keep number of versions down by always using latest breaking change
|
||||
// - Have lockfile and manifest in-sync
|
||||
{
|
||||
matchManagers: [
|
||||
'cargo',
|
||||
],
|
||||
matchDepTypes: [
|
||||
'build-dependencies',
|
||||
'dependencies',
|
||||
],
|
||||
matchCurrentVersion: '>=0.1.0',
|
||||
matchUpdateTypes: [
|
||||
'patch',
|
||||
],
|
||||
enabled: false,
|
||||
},
|
||||
{
|
||||
matchManagers: [
|
||||
'cargo',
|
||||
],
|
||||
matchDepTypes: [
|
||||
'build-dependencies',
|
||||
'dependencies',
|
||||
],
|
||||
matchCurrentVersion: '>=1.0.0',
|
||||
matchUpdateTypes: [
|
||||
'minor',
|
||||
],
|
||||
enabled: false,
|
||||
},
|
||||
{
|
||||
matchManagers: [
|
||||
'cargo',
|
||||
],
|
||||
matchDepTypes: [
|
||||
'dev-dependencies',
|
||||
],
|
||||
matchCurrentVersion: '>=0.1.0',
|
||||
matchUpdateTypes: [
|
||||
'patch',
|
||||
],
|
||||
automerge: true,
|
||||
groupName: 'compatible (dev)',
|
||||
},
|
||||
{
|
||||
matchManagers: [
|
||||
'cargo',
|
||||
],
|
||||
matchDepTypes: [
|
||||
'dev-dependencies',
|
||||
],
|
||||
matchCurrentVersion: '>=1.0.0',
|
||||
matchUpdateTypes: [
|
||||
'minor',
|
||||
],
|
||||
automerge: true,
|
||||
groupName: 'compatible (dev)',
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -29,7 +29,7 @@ struct Cli {
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
enum Command {
|
||||
/// Check a defintion file for errors.
|
||||
/// Check a definition file for errors.
|
||||
Check {
|
||||
#[clap(flatten)]
|
||||
world: WorldOpt,
|
||||
|
||||
4
typos.toml
Normal file
4
typos.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[default.extend-words]
|
||||
# Abbreviations
|
||||
inout = "inout"
|
||||
ser = "ser"
|
||||
@@ -1,5 +1,6 @@
|
||||
cargo build --features unstable
|
||||
for i in wit/*.wit; do target/debug/tauri-bindgen host --tracing --out-dir crates/gen-host/tests --fmt $i; done
|
||||
for i in wit/*.wit; do target/debug/tauri-bindgen host --tracing --out-dir crates/gen-host/tests/sync --fmt $i; done
|
||||
for i in wit/*.wit; do target/debug/tauri-bindgen host --tracing --async --out-dir crates/gen-host/tests/async --fmt $i; done
|
||||
|
||||
for i in wit/*.wit; do target/debug/tauri-bindgen markdown --out-dir crates/gen-markdown/tests $i; done
|
||||
|
||||
@@ -7,4 +8,3 @@ for i in wit/*.wit; do target/debug/tauri-bindgen guest rust --out-dir crates/ge
|
||||
for i in wit/*.wit; do target/debug/tauri-bindgen guest javascript --out-dir crates/gen-guest-js/tests $i; done
|
||||
for i in wit/*.wit; do target/debug/tauri-bindgen guest typescript --out-dir crates/gen-guest-ts/tests $i; done
|
||||
# for i in wit/*.wit; do target/debug/tauri-bindgen guest rescript --fmt --out-dir crates/gen-guest-rescript/tests $i; done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user