mirror of
https://github.com/tauri-apps/tauri-bindgen.git
synced 2026-01-31 00:45:21 +01:00
wip
This commit is contained in:
@@ -33,6 +33,7 @@ serde = "1.0.188"
|
||||
quote = "1.0.33"
|
||||
proc-macro2 = "1.0.66"
|
||||
syn = "2.0.31"
|
||||
tauri = { git = "https://github.com/tauri-apps/tauri" }
|
||||
|
||||
[dependencies]
|
||||
clap.workspace = true
|
||||
|
||||
@@ -334,7 +334,7 @@ impl Host {
|
||||
router.func_wrap(
|
||||
#mod_name,
|
||||
#func_name,
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>, #params| -> ::tauri_bindgen_host::anyhow::Result<#result> {
|
||||
move |ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>, #params| -> ::tauri_bindgen_host::anyhow::Result<#result> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
|
||||
Ok(ctx.#func_ident(#(#param_idents),*))
|
||||
@@ -344,8 +344,8 @@ impl Host {
|
||||
});
|
||||
|
||||
quote! {
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
|
||||
@@ -9,8 +9,8 @@ pub mod chars {
|
||||
///A function that returns a character
|
||||
fn return_char(&self) -> char;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -23,7 +23,7 @@ pub mod chars {
|
||||
"chars",
|
||||
"take_char",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: char,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -36,7 +36,7 @@ pub mod chars {
|
||||
"chars",
|
||||
"return_char",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<char> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_char())
|
||||
|
||||
@@ -23,8 +23,8 @@ pub mod conventions {
|
||||
fn explicit_snake(&self);
|
||||
fn bool(&self);
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -37,7 +37,7 @@ pub mod conventions {
|
||||
"conventions",
|
||||
"kebab_case",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.kebab_case())
|
||||
@@ -49,7 +49,7 @@ pub mod conventions {
|
||||
"conventions",
|
||||
"foo",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: LudicrousSpeed,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -62,7 +62,7 @@ pub mod conventions {
|
||||
"conventions",
|
||||
"function_with_underscores",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.function_with_underscores())
|
||||
@@ -74,7 +74,7 @@ pub mod conventions {
|
||||
"conventions",
|
||||
"function_with_no_weird_characters",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.function_with_no_weird_characters())
|
||||
@@ -86,7 +86,7 @@ pub mod conventions {
|
||||
"conventions",
|
||||
"apple",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.apple())
|
||||
@@ -98,7 +98,7 @@ pub mod conventions {
|
||||
"conventions",
|
||||
"apple_pear",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.apple_pear())
|
||||
@@ -110,7 +110,7 @@ pub mod conventions {
|
||||
"conventions",
|
||||
"apple_pear_grape",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.apple_pear_grape())
|
||||
@@ -122,7 +122,7 @@ pub mod conventions {
|
||||
"conventions",
|
||||
"a0",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.a0())
|
||||
@@ -134,7 +134,7 @@ pub mod conventions {
|
||||
"conventions",
|
||||
"is_xml",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.is_xml())
|
||||
@@ -146,7 +146,7 @@ pub mod conventions {
|
||||
"conventions",
|
||||
"explicit",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.explicit())
|
||||
@@ -158,7 +158,7 @@ pub mod conventions {
|
||||
"conventions",
|
||||
"explicit_snake",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.explicit_snake())
|
||||
@@ -170,7 +170,7 @@ pub mod conventions {
|
||||
"conventions",
|
||||
"bool",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.bool())
|
||||
|
||||
@@ -4,8 +4,8 @@ pub mod empty {
|
||||
use ::tauri_bindgen_host::serde;
|
||||
use ::tauri_bindgen_host::bitflags;
|
||||
pub trait Empty: Sized {}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
|
||||
@@ -67,8 +67,8 @@ pub mod flegs {
|
||||
fn roundtrip_flag32(&self, x: Flag32) -> Flag32;
|
||||
fn roundtrip_flag64(&self, x: Flag64) -> Flag64;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -81,7 +81,7 @@ pub mod flegs {
|
||||
"flegs",
|
||||
"roundtrip_flag1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Flag1,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag1> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -94,7 +94,7 @@ pub mod flegs {
|
||||
"flegs",
|
||||
"roundtrip_flag2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Flag2,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag2> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -107,7 +107,7 @@ pub mod flegs {
|
||||
"flegs",
|
||||
"roundtrip_flag4",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Flag4,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag4> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -120,7 +120,7 @@ pub mod flegs {
|
||||
"flegs",
|
||||
"roundtrip_flag8",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Flag8,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag8> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -133,7 +133,7 @@ pub mod flegs {
|
||||
"flegs",
|
||||
"roundtrip_flag16",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Flag16,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag16> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -146,7 +146,7 @@ pub mod flegs {
|
||||
"flegs",
|
||||
"roundtrip_flag32",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Flag32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag32> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -159,7 +159,7 @@ pub mod flegs {
|
||||
"flegs",
|
||||
"roundtrip_flag64",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Flag64,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Flag64> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
|
||||
@@ -9,8 +9,8 @@ pub mod floats {
|
||||
fn float32_result(&self) -> f32;
|
||||
fn float64_result(&self) -> f64;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -23,7 +23,7 @@ pub mod floats {
|
||||
"floats",
|
||||
"float32_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: f32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -36,7 +36,7 @@ pub mod floats {
|
||||
"floats",
|
||||
"float64_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: f64,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -49,7 +49,7 @@ pub mod floats {
|
||||
"floats",
|
||||
"float32_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<f32> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.float32_result())
|
||||
@@ -61,7 +61,7 @@ pub mod floats {
|
||||
"floats",
|
||||
"float64_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<f64> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.float64_result())
|
||||
|
||||
@@ -39,8 +39,8 @@ pub mod integers {
|
||||
fn r10(&self) -> i128;
|
||||
fn pair_ret(&self) -> (i64, u8);
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -53,7 +53,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"a1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: u8,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -66,7 +66,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"a2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: i8,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -79,7 +79,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"a3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: u16,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -92,7 +92,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"a4",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: i16,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -105,7 +105,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"a5",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: u32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -118,7 +118,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"a6",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: i32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -131,7 +131,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"a7",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: u64,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -144,7 +144,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"a8",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: i64,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -157,7 +157,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"a9",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: u128,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -170,7 +170,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"a10",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: i128,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -183,7 +183,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"a11",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
p1: u8,
|
||||
p2: i8,
|
||||
p3: u16,
|
||||
@@ -205,7 +205,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"r1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u8> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r1())
|
||||
@@ -217,7 +217,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"r2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<i8> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r2())
|
||||
@@ -229,7 +229,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"r3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u16> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r3())
|
||||
@@ -241,7 +241,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"r4",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<i16> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r4())
|
||||
@@ -253,7 +253,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"r5",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u32> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r5())
|
||||
@@ -265,7 +265,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"r6",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<i32> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r6())
|
||||
@@ -277,7 +277,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"r7",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u64> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r7())
|
||||
@@ -289,7 +289,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"r8",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<i64> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r8())
|
||||
@@ -301,7 +301,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"r9",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u128> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r9())
|
||||
@@ -313,7 +313,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"r10",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<i128> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.r10())
|
||||
@@ -325,7 +325,7 @@ pub mod integers {
|
||||
"integers",
|
||||
"pair_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<(i64, u8)> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.pair_ret())
|
||||
|
||||
@@ -77,8 +77,8 @@ pub mod lists {
|
||||
fn variant_list(&self, x: Vec<SomeVariant>) -> Vec<OtherVariant>;
|
||||
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>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -91,7 +91,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_u8_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<u8>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -104,7 +104,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_u16_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<u16>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -117,7 +117,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_u32_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<u32>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -130,7 +130,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_u64_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<u64>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -143,7 +143,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_u128_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<u128>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -156,7 +156,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_s8_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<i8>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -169,7 +169,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_s16_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<i16>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -182,7 +182,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_s32_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<i32>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -195,7 +195,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_s64_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<i64>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -208,7 +208,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_s128_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<i128>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -221,7 +221,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_float32_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<f32>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -234,7 +234,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_float64_param",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<f64>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -247,7 +247,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_u8_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<u8>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u8_ret())
|
||||
@@ -259,7 +259,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_u16_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<u16>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u16_ret())
|
||||
@@ -271,7 +271,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_u32_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<u32>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u32_ret())
|
||||
@@ -283,7 +283,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_u64_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<u64>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u64_ret())
|
||||
@@ -295,7 +295,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_u128_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<u128>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_u128_ret())
|
||||
@@ -307,7 +307,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_s8_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<i8>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s8_ret())
|
||||
@@ -319,7 +319,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_s16_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<i16>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s16_ret())
|
||||
@@ -331,7 +331,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_s32_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<i32>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s32_ret())
|
||||
@@ -343,7 +343,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_s64_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<i64>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s64_ret())
|
||||
@@ -355,7 +355,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_s128_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<i128>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_s128_ret())
|
||||
@@ -367,7 +367,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_float32_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<f32>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_float32_ret())
|
||||
@@ -379,7 +379,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"list_float64_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<f64>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.list_float64_ret())
|
||||
@@ -391,7 +391,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"tuple_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<(u8, i8)>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<(i64, u32)>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -404,7 +404,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"string_list_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
a: Vec<String>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -417,7 +417,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"string_list_ret",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<String>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.string_list_ret())
|
||||
@@ -429,7 +429,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"tuple_string_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<(u8, String)>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<(String, u8)>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -442,7 +442,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"string_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<String>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<String>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -455,7 +455,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"record_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<SomeRecord>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<OtherRecord>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -468,7 +468,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"record_list_reverse",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<OtherRecord>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<SomeRecord>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -481,7 +481,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"variant_list",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Vec<SomeVariant>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<OtherVariant>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -494,7 +494,7 @@ pub mod lists {
|
||||
"lists",
|
||||
"load_store_everything",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
a: LoadStoreAllSizes,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<LoadStoreAllSizes> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
|
||||
@@ -49,8 +49,8 @@ pub mod many_arguments {
|
||||
);
|
||||
fn big_argument(&self, x: BigStruct);
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -63,7 +63,7 @@ pub mod many_arguments {
|
||||
"many_arguments",
|
||||
"many_args",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
a1: u64,
|
||||
a2: u64,
|
||||
a3: u64,
|
||||
@@ -111,7 +111,7 @@ pub mod many_arguments {
|
||||
"many_arguments",
|
||||
"big_argument",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: BigStruct,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
|
||||
@@ -10,8 +10,8 @@ pub mod multi_return {
|
||||
fn mrd(&self) -> u32;
|
||||
fn mre(&self) -> (u32, f32);
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -24,7 +24,7 @@ pub mod multi_return {
|
||||
"multi_return",
|
||||
"mra",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mra())
|
||||
@@ -36,7 +36,7 @@ pub mod multi_return {
|
||||
"multi_return",
|
||||
"mrb",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mrb())
|
||||
@@ -48,7 +48,7 @@ pub mod multi_return {
|
||||
"multi_return",
|
||||
"mrc",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u32> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mrc())
|
||||
@@ -60,7 +60,7 @@ pub mod multi_return {
|
||||
"multi_return",
|
||||
"mrd",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u32> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mrd())
|
||||
@@ -72,7 +72,7 @@ pub mod multi_return {
|
||||
"multi_return",
|
||||
"mre",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<(u32, f32)> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.mre())
|
||||
|
||||
@@ -55,8 +55,8 @@ All of the fields are bool*/
|
||||
fn aggregate_result(&self) -> Aggregates;
|
||||
fn typedef_inout(&self, e: TupleTypedef2) -> i32;
|
||||
}
|
||||
pub fn add_to_router<T, U>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -69,7 +69,7 @@ All of the fields are bool*/
|
||||
"records",
|
||||
"tuple_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: (char, u32),
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -82,7 +82,7 @@ All of the fields are bool*/
|
||||
"records",
|
||||
"tuple_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<(char, u32)> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.tuple_result())
|
||||
@@ -94,7 +94,7 @@ All of the fields are bool*/
|
||||
"records",
|
||||
"empty_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Empty,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -107,7 +107,7 @@ All of the fields are bool*/
|
||||
"records",
|
||||
"empty_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Empty> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.empty_result())
|
||||
@@ -119,7 +119,7 @@ All of the fields are bool*/
|
||||
"records",
|
||||
"scalar_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Scalars,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -132,7 +132,7 @@ All of the fields are bool*/
|
||||
"records",
|
||||
"scalar_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Scalars> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.scalar_result())
|
||||
@@ -144,7 +144,7 @@ All of the fields are bool*/
|
||||
"records",
|
||||
"flags_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: ReallyFlags,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -157,7 +157,7 @@ All of the fields are bool*/
|
||||
"records",
|
||||
"flags_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<ReallyFlags> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.flags_result())
|
||||
@@ -169,7 +169,7 @@ All of the fields are bool*/
|
||||
"records",
|
||||
"aggregate_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: Aggregates,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -182,7 +182,7 @@ All of the fields are bool*/
|
||||
"records",
|
||||
"aggregate_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Aggregates> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.aggregate_result())
|
||||
@@ -194,7 +194,7 @@ All of the fields are bool*/
|
||||
"records",
|
||||
"typedef_inout",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
e: TupleTypedef2,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<i32> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
|
||||
@@ -25,8 +25,8 @@ pub mod resources {
|
||||
fn constructor_a(&self) -> ::tauri_bindgen_host::ResourceId;
|
||||
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>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -39,7 +39,7 @@ pub mod resources {
|
||||
"resources",
|
||||
"constructor_a",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<
|
||||
::tauri_bindgen_host::ResourceId,
|
||||
> {
|
||||
@@ -53,7 +53,7 @@ pub mod resources {
|
||||
"resources",
|
||||
"constructor_b",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<
|
||||
::tauri_bindgen_host::ResourceId,
|
||||
> {
|
||||
|
||||
@@ -11,8 +11,8 @@ pub mod simple_functions {
|
||||
fn f5(&self) -> (u32, u32);
|
||||
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>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -25,7 +25,7 @@ pub mod simple_functions {
|
||||
"simple_functions",
|
||||
"f1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f1())
|
||||
@@ -37,7 +37,7 @@ pub mod simple_functions {
|
||||
"simple_functions",
|
||||
"f2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
a: u32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -50,7 +50,7 @@ pub mod simple_functions {
|
||||
"simple_functions",
|
||||
"f3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
a: u32,
|
||||
b: u32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
@@ -64,7 +64,7 @@ pub mod simple_functions {
|
||||
"simple_functions",
|
||||
"f4",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u32> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f4())
|
||||
@@ -76,7 +76,7 @@ pub mod simple_functions {
|
||||
"simple_functions",
|
||||
"f5",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<(u32, u32)> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.f5())
|
||||
@@ -88,7 +88,7 @@ pub mod simple_functions {
|
||||
"simple_functions",
|
||||
"f6",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
a: u32,
|
||||
b: u32,
|
||||
c: u32,
|
||||
|
||||
@@ -9,8 +9,8 @@ pub mod simple_lists {
|
||||
fn simple_list3(&self, a: Vec<u32>, b: Vec<u32>) -> (Vec<u32>, Vec<u32>);
|
||||
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>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -23,7 +23,7 @@ pub mod simple_lists {
|
||||
"simple_lists",
|
||||
"simple_list1",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
l: Vec<u32>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -36,7 +36,7 @@ pub mod simple_lists {
|
||||
"simple_lists",
|
||||
"simple_list2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<u32>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.simple_list2())
|
||||
@@ -48,7 +48,7 @@ pub mod simple_lists {
|
||||
"simple_lists",
|
||||
"simple_list3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
a: Vec<u32>,
|
||||
b: Vec<u32>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<(Vec<u32>, Vec<u32>)> {
|
||||
@@ -62,7 +62,7 @@ pub mod simple_lists {
|
||||
"simple_lists",
|
||||
"simple_list4",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
l: Vec<Vec<u32>>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Vec<Vec<u32>>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
|
||||
@@ -12,8 +12,8 @@ pub mod small_anonymous {
|
||||
pub trait SmallAnonymous: Sized {
|
||||
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>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -26,7 +26,7 @@ pub mod small_anonymous {
|
||||
"small_anonymous",
|
||||
"option_test",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<Option<String>, Error>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.option_test())
|
||||
|
||||
@@ -8,8 +8,8 @@ pub mod strings {
|
||||
fn b(&self) -> String;
|
||||
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>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -22,7 +22,7 @@ pub mod strings {
|
||||
"strings",
|
||||
"a",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: String,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -35,7 +35,7 @@ pub mod strings {
|
||||
"strings",
|
||||
"b",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<String> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.b())
|
||||
@@ -47,7 +47,7 @@ pub mod strings {
|
||||
"strings",
|
||||
"c",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
a: String,
|
||||
b: String,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<String> {
|
||||
|
||||
@@ -65,8 +65,8 @@ and is treated that way in some languages*/
|
||||
) -> DistinguishableNum;
|
||||
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>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -79,7 +79,7 @@ and is treated that way in some languages*/
|
||||
"unions",
|
||||
"add_one_integer",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
num: AllIntegers,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<AllIntegers> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -92,7 +92,7 @@ and is treated that way in some languages*/
|
||||
"unions",
|
||||
"add_one_float",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
num: AllFloats,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<AllFloats> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -105,7 +105,7 @@ and is treated that way in some languages*/
|
||||
"unions",
|
||||
"replace_first_char",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
text: AllText,
|
||||
letter: char,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<AllText> {
|
||||
@@ -119,7 +119,7 @@ and is treated that way in some languages*/
|
||||
"unions",
|
||||
"identify_integer",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
num: AllIntegers,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u8> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -132,7 +132,7 @@ and is treated that way in some languages*/
|
||||
"unions",
|
||||
"identify_float",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
num: AllFloats,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u8> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -145,7 +145,7 @@ and is treated that way in some languages*/
|
||||
"unions",
|
||||
"identify_text",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
text: AllText,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u8> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -158,7 +158,7 @@ and is treated that way in some languages*/
|
||||
"unions",
|
||||
"add_one_duplicated",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
num: DuplicatedS32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<DuplicatedS32> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -171,7 +171,7 @@ and is treated that way in some languages*/
|
||||
"unions",
|
||||
"identify_duplicated",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
num: DuplicatedS32,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u8> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -184,7 +184,7 @@ and is treated that way in some languages*/
|
||||
"unions",
|
||||
"add_one_distinguishable_num",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
num: DistinguishableNum,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<DistinguishableNum> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -197,7 +197,7 @@ and is treated that way in some languages*/
|
||||
"unions",
|
||||
"identify_distinguishable_num",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
num: DistinguishableNum,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<u8> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
|
||||
@@ -145,8 +145,8 @@ pub mod variants {
|
||||
fn return_named_option(&self) -> Option<u8>;
|
||||
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>,
|
||||
pub fn add_to_router<T, U, R: ::tauri_bindgen_host::tauri::Runtime>(
|
||||
router: &mut ::tauri_bindgen_host::ipc_router_wip::Router<T, R>,
|
||||
get_cx: impl Fn(&T) -> &U + Send + Sync + 'static,
|
||||
) -> Result<(), ::tauri_bindgen_host::ipc_router_wip::Error>
|
||||
where
|
||||
@@ -159,7 +159,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"e1_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: E1,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -172,7 +172,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"e1_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<E1> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.e1_result())
|
||||
@@ -184,7 +184,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"u1_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: U1,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -197,7 +197,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"u1_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<U1> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.u1_result())
|
||||
@@ -209,7 +209,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"v1_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: V1,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -222,7 +222,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"v1_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<V1> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.v1_result())
|
||||
@@ -234,7 +234,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"bool_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
x: bool,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -247,7 +247,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"bool_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<bool> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.bool_result())
|
||||
@@ -259,7 +259,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"option_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
a: Option<bool>,
|
||||
b: Option<()>,
|
||||
c: Option<u32>,
|
||||
@@ -278,7 +278,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"option_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<
|
||||
(
|
||||
Option<bool>,
|
||||
@@ -300,7 +300,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"casts",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
a: Casts1,
|
||||
b: Casts2,
|
||||
c: Casts3,
|
||||
@@ -320,7 +320,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"result_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
a: Result<(), ()>,
|
||||
b: Result<(), E1>,
|
||||
c: Result<E1, ()>,
|
||||
@@ -338,7 +338,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"result_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<
|
||||
(
|
||||
Result<(), ()>,
|
||||
@@ -359,7 +359,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"return_result_sugar",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<i32, MyErrno>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_result_sugar())
|
||||
@@ -371,7 +371,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"return_result_sugar2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<(), MyErrno>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_result_sugar2())
|
||||
@@ -383,7 +383,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"return_result_sugar3",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<MyErrno, MyErrno>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_result_sugar3())
|
||||
@@ -395,7 +395,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"return_result_sugar4",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<(i32, u32), MyErrno>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_result_sugar4())
|
||||
@@ -407,7 +407,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"return_option_sugar",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Option<i32>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_option_sugar())
|
||||
@@ -419,7 +419,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"return_option_sugar2",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Option<MyErrno>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_option_sugar2())
|
||||
@@ -431,7 +431,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"result_simple",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<u32, i32>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.result_simple())
|
||||
@@ -443,7 +443,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"is_clone_arg",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
a: IsClone,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<()> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
@@ -456,7 +456,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"is_clone_return",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<IsClone> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.is_clone_return())
|
||||
@@ -468,7 +468,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"return_named_option",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Option<u8>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_named_option())
|
||||
@@ -480,7 +480,7 @@ pub mod variants {
|
||||
"variants",
|
||||
"return_named_result",
|
||||
move |
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T>,
|
||||
ctx: ::tauri_bindgen_host::ipc_router_wip::Caller<T, R>,
|
||||
| -> ::tauri_bindgen_host::anyhow::Result<Result<u8, MyErrno>> {
|
||||
let ctx = get_cx(ctx.data());
|
||||
Ok(ctx.return_named_result())
|
||||
|
||||
@@ -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,5 @@ 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"] }
|
||||
|
||||
@@ -4,31 +4,42 @@ pub use anyhow::Error;
|
||||
use anyhow::{bail, Result};
|
||||
use std::{
|
||||
collections::{hash_map::Entry, HashMap},
|
||||
sync::{mpsc::Sender, Arc, Mutex},
|
||||
sync::Arc,
|
||||
};
|
||||
use tauri::{
|
||||
http::{header::CONTENT_TYPE, Request, Response, StatusCode},
|
||||
AppHandle, Runtime,
|
||||
};
|
||||
use tokio::sync::{
|
||||
mpsc,
|
||||
oneshot::{self, Sender},
|
||||
};
|
||||
use tauri::{AppHandle, Manager, Runtime};
|
||||
use url::Url;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Router<T> {
|
||||
pub struct Router<T, R: Runtime> {
|
||||
data: Arc<T>,
|
||||
string2idx: HashMap<Arc<str>, usize>,
|
||||
strings: Vec<Arc<str>>,
|
||||
map: HashMap<ImportKey, Definition<T>>,
|
||||
map: HashMap<ImportKey, Definition<T, R>>,
|
||||
}
|
||||
|
||||
pub type Definition<T> =
|
||||
Box<dyn Fn(Caller<T>, &[u8], Sender<Vec<u8>>) -> anyhow::Result<()> + Send + Sync>;
|
||||
pub type Definition<T, R> =
|
||||
Box<dyn Fn(Caller<T, R>, &[u8], Sender<Vec<u8>>) -> anyhow::Result<()> + Send + Sync>;
|
||||
|
||||
pub struct Caller<'a, T> {
|
||||
pub struct Caller<'a, T, R: Runtime> {
|
||||
data: &'a T,
|
||||
app_handle: AppHandle<R>,
|
||||
}
|
||||
|
||||
impl<'a, T> Caller<'a, T> {
|
||||
impl<'a, T, R: Runtime> Caller<'a, T, R> {
|
||||
#[must_use]
|
||||
pub fn data(&self) -> &T {
|
||||
self.data
|
||||
}
|
||||
#[must_use]
|
||||
pub fn app_handle(&self) -> &AppHandle<R> {
|
||||
&self.app_handle
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
|
||||
@@ -37,7 +48,7 @@ struct ImportKey {
|
||||
name: usize,
|
||||
}
|
||||
|
||||
impl<U> Router<U> {
|
||||
impl<U, R: Runtime> Router<U, R> {
|
||||
#[must_use]
|
||||
pub fn new(data: U) -> Self {
|
||||
Self {
|
||||
@@ -52,7 +63,7 @@ impl<U> Router<U> {
|
||||
&mut self,
|
||||
module: &str,
|
||||
name: &str,
|
||||
func: impl IntoFunc<U, Params, Args>,
|
||||
func: impl IntoFunc<U, Params, Args, R>,
|
||||
) -> Result<&mut Self> {
|
||||
let func = func.into_func();
|
||||
|
||||
@@ -67,7 +78,8 @@ impl<U> Router<U> {
|
||||
module: Option<impl AsRef<str>>,
|
||||
name: impl AsRef<str>,
|
||||
params: &[u8],
|
||||
res_tx: Sender<Vec<u8>>,
|
||||
app_handle: AppHandle<R>,
|
||||
tx: Sender<Vec<u8>>,
|
||||
) -> anyhow::Result<()> {
|
||||
let key = self.import_key(module, name.as_ref());
|
||||
|
||||
@@ -76,14 +88,17 @@ impl<U> Router<U> {
|
||||
.get(&key)
|
||||
.ok_or(anyhow::anyhow!("method not found"))?;
|
||||
|
||||
let caller = Caller { data: &*self.data };
|
||||
let caller = Caller {
|
||||
data: &*self.data,
|
||||
app_handle,
|
||||
};
|
||||
|
||||
handler(caller, params, res_tx)?;
|
||||
handler(caller, params, tx)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn insert(&mut self, key: ImportKey, item: Definition<U>) -> Result<()> {
|
||||
fn insert(&mut self, key: ImportKey, item: Definition<U, R>) -> Result<()> {
|
||||
match self.map.entry(key) {
|
||||
Entry::Occupied(_) => {
|
||||
let module = &self.strings[key.module];
|
||||
@@ -119,9 +134,9 @@ impl<U> Router<U> {
|
||||
}
|
||||
}
|
||||
|
||||
pub trait IntoFunc<U, Params, Results>: Send + Sync {
|
||||
pub trait IntoFunc<U, Params, Results, R: Runtime>: Send + Sync {
|
||||
#[doc(hidden)]
|
||||
fn into_func(self) -> Definition<U>;
|
||||
fn into_func(self) -> Definition<U, R>;
|
||||
}
|
||||
|
||||
macro_rules! impl_into_func {
|
||||
@@ -130,14 +145,14 @@ macro_rules! impl_into_func {
|
||||
// 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
|
||||
impl<T, F, $($params,)* R, Rt: Runtime> IntoFunc<T, ($($params,)*), R, Rt> for F
|
||||
where
|
||||
F: Fn($($params),*) -> anyhow::Result<R> + Send + Sync + 'static,
|
||||
$($params: serde::de::DeserializeOwned,)*
|
||||
R: serde::Serialize
|
||||
R: serde::Serialize,
|
||||
{
|
||||
fn into_func(self) -> Definition<T> {
|
||||
let f = move |_: Caller<T>, $($params:$params),*| {
|
||||
fn into_func(self) -> Definition<T, Rt> {
|
||||
let f = move |_: Caller<T, Rt>, $($params:$params),*| {
|
||||
self($($params),*)
|
||||
};
|
||||
|
||||
@@ -146,13 +161,13 @@ macro_rules! impl_into_func {
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
impl<T, F, $($params,)* R> IntoFunc<T, (Caller<'_, T>, $($params,)*), R> for F
|
||||
impl<T, F, $($params,)* R, Rt: Runtime> IntoFunc<T, (Caller<'_, T, Rt>, $($params,)*), R, Rt> for F
|
||||
where
|
||||
F: Fn(Caller<T>, $($params),*) -> anyhow::Result<R> + Send + Sync + 'static,
|
||||
F: Fn(Caller<T, Rt>, $($params),*) -> anyhow::Result<R> + Send + Sync + 'static,
|
||||
$($params: serde::de::DeserializeOwned,)*
|
||||
R: serde::Serialize
|
||||
R: serde::Serialize,
|
||||
{
|
||||
fn into_func(self) -> Definition<T> {
|
||||
fn into_func(self) -> Definition<T, Rt> {
|
||||
Box::new(move |caller, params, tx| {
|
||||
log::debug!("Deserializing parameters...");
|
||||
let ($($params,)*) = postcard::from_bytes(params)?;
|
||||
@@ -163,7 +178,7 @@ macro_rules! impl_into_func {
|
||||
log::debug!("Serializing response...");
|
||||
let out = postcard::to_allocvec(&out)?;
|
||||
|
||||
tx.send(out)?;
|
||||
tx.send(out).unwrap();
|
||||
|
||||
Ok(())
|
||||
})
|
||||
@@ -196,66 +211,87 @@ macro_rules! for_each_function_signature {
|
||||
|
||||
for_each_function_signature!(impl_into_func);
|
||||
|
||||
pub trait BuilderExt {
|
||||
pub trait BuilderExt<R: Runtime> {
|
||||
#[must_use]
|
||||
fn ipc_router<U: Send + Sync + 'static>(self, router: Router<U>) -> Self;
|
||||
fn ipc_router<U: Send + Sync + 'static>(self, router: Router<U, R>) -> Self;
|
||||
}
|
||||
|
||||
impl<R: 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);
|
||||
impl<R: Runtime> BuilderExt<R> for tauri::Builder<R> {
|
||||
fn ipc_router<U: Send + Sync + 'static>(self, mut router: Router<U, R>) -> Self {
|
||||
let (tx, mut rx) = mpsc::channel::<(AppHandle<R>, Request<Vec<u8>>, _)>(250);
|
||||
|
||||
let this =
|
||||
self.register_asynchronous_uri_scheme_protocol("ipc", move |app, req, responder| {
|
||||
tx.try_send((app.clone(), req, responder)).unwrap();
|
||||
});
|
||||
|
||||
tauri::async_runtime::handle().spawn(async move {
|
||||
while let Some((app, req, responder)) = rx.recv().await {
|
||||
let path = req.uri().path().strip_prefix('/').unwrap();
|
||||
|
||||
let (module, method) = path
|
||||
.split_once('/')
|
||||
.map_or((None, path), |(module, method)| (Some(module), method));
|
||||
|
||||
log::debug!("ipc request for {:?}::{}", module, method);
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
router
|
||||
.handle_request(module, method, req.body(), app, tx)
|
||||
.unwrap();
|
||||
let res = rx.await;
|
||||
|
||||
log::debug!("call result {:?}", res);
|
||||
|
||||
let mut resp = match res {
|
||||
let mut response = 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
|
||||
let mut resp = Response::builder().status(StatusCode::OK);
|
||||
resp.headers_mut().unwrap().insert(
|
||||
CONTENT_TYPE,
|
||||
tauri::http::header::HeaderValue::from_static(
|
||||
"application/octet-stream",
|
||||
),
|
||||
);
|
||||
resp.body(val).unwrap()
|
||||
}
|
||||
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);
|
||||
responder.respond(response);
|
||||
}
|
||||
});
|
||||
|
||||
Ok(resp)
|
||||
})
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
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())?;
|
||||
// async fn uri_scheme_handler_inner<U: Send + Sync + 'static, R: Runtime>(
|
||||
// app: &AppHandle<R>,
|
||||
// req: &tauri::http::Request<Vec<u8>>,
|
||||
// ) -> anyhow::Result<Vec<u8>> {
|
||||
// let path = req.uri().path().strip_prefix('/').unwrap();
|
||||
|
||||
let path = url.path().strip_prefix('/').unwrap();
|
||||
// let (module, method) = path
|
||||
// .split_once('/')
|
||||
// .map_or((None, path), |(module, method)| (Some(module), method));
|
||||
|
||||
let (module, method) = path
|
||||
.split_once('/')
|
||||
.map_or((None, path), |(module, method)| (Some(module), method));
|
||||
// log::debug!("ipc request for {:?}::{}", module, method);
|
||||
|
||||
log::debug!("ipc request for {:?}::{}", module, method);
|
||||
// let (res_tx, res_rx) = oneshot::channel();
|
||||
|
||||
let (res_tx, res_rx) = std::sync::mpsc::channel();
|
||||
// let router = app.state::<Mutex<Router<U>>>();
|
||||
// let mut router = router.lock().unwrap();
|
||||
|
||||
let router = app.state::<Mutex<Router<U>>>();
|
||||
let mut router = router.lock().unwrap();
|
||||
// // this is terrible we should not clone here
|
||||
// router.handle_request(module, method, req.body(), res_tx)?;
|
||||
|
||||
// this is terrible we should not clone here
|
||||
router.handle_request(module, method, req.body(), res_tx)?;
|
||||
|
||||
Ok(res_rx.recv()?)
|
||||
}
|
||||
// Ok(res_rx.await?)
|
||||
// }
|
||||
|
||||
@@ -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" }
|
||||
tauri-bindgen-host = { path = "../../../crates/host" }
|
||||
tracing-subscriber = "0.3.16"
|
||||
tracing = "0.1.37"
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user