From 2d4e51bc7fff99959888a5fec68e36e795ee549a Mon Sep 17 00:00:00 2001 From: Felix Prillwitz <36958734+photovoltex@users.noreply.github.com> Date: Tue, 26 Dec 2023 12:26:27 +0100 Subject: [PATCH 01/60] introduce Emit trait --- Cargo.lock | 1 + Cargo.toml | 10 +- src/bindings.rs | 3 +- src/emit.rs | 43 +++++++ src/lib.rs | 15 ++- tauri-interop-macro/Cargo.toml | 5 +- tauri-interop-macro/src/lib.rs | 198 ++++++++++++++++++++++----------- test-project/Cargo.lock | 2 + test-project/api/Cargo.toml | 10 +- test-project/api/src/cmd.rs | 22 ++-- 10 files changed, 219 insertions(+), 90 deletions(-) create mode 100644 src/emit.rs diff --git a/Cargo.lock b/Cargo.lock index 212928f..6d044cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3549,6 +3549,7 @@ dependencies = [ "convert_case 0.6.0", "lazy_static", "quote", + "serde", "syn 2.0.39", ] diff --git a/Cargo.toml b/Cargo.toml index c9b2353..73d9409 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,8 @@ thiserror = "1.0.50" serde-wasm-bindgen = "0.6.1" log = "0.4.20" +tauri = { version = "1.5.2", default-features = false, features = ["wry"], optional = true } + # leptos feature leptos = { version = "0.5.2", optional = true } @@ -39,6 +41,8 @@ leptos = { version = "0.5.2", optional = true } tauri = "1.5.2" [features] -default = [ "listen" ] -listen = [ "tauri-interop-macro/listen" ] -leptos = [ "dep:leptos", "tauri-interop-macro/leptos" ] +default = [ "event", "tauri" ] +wasm = [] +event = [ "tauri-interop-macro/event" ] +tauri = [ "dep:tauri" ] +leptos = [ "dep:leptos", "tauri-interop-macro/leptos" ] diff --git a/src/bindings.rs b/src/bindings.rs index 052cf25..d815484 100644 --- a/src/bindings.rs +++ b/src/bindings.rs @@ -1,6 +1,5 @@ use wasm_bindgen::prelude::*; -#[cfg(target_family = "wasm")] #[wasm_bindgen] extern "C" { #[wasm_bindgen(js_name = "invoke", js_namespace = ["window", "__TAURI__", "tauri"])] @@ -12,7 +11,7 @@ extern "C" { #[wasm_bindgen(catch, js_name = "invoke", js_namespace = ["window", "__TAURI__", "tauri"])] pub async fn invoke_catch(cmd: &str, args: JsValue) -> Result; - #[cfg(feature = "listen")] + #[cfg(feature = "event")] #[wasm_bindgen(catch, js_namespace = ["window", "__TAURI__", "event"])] pub async fn listen( event: &str, diff --git a/src/emit.rs b/src/emit.rs new file mode 100644 index 0000000..053677d --- /dev/null +++ b/src/emit.rs @@ -0,0 +1,43 @@ +use std::fmt::Debug; + +use serde::Serialize; +use tauri::{AppHandle, Error, Wry}; + +/// Trait intended to mark an enum as usable [Emit::Fields] +pub trait EmitFields: Debug {} + +/// Trait defining a [Field] to a related struct implementing [Emit] with the related [EmitField::Type] +pub trait EmitField +where + S: Emit, + ::Fields: EmitFields, + >::Type: Serialize + Clone, +{ + /// The type of the field + type Type; + + /// Updates the related field and emit it's event + fn update(s: &mut S, handle: &AppHandle, v: Self::Type) -> Result<(), Error>; +} + +/// Trait that defines the available event emitting methods +pub trait Emit +where + ::Fields: EmitFields, +{ + /// Fields that are used to emit an event + type Fields; + + /// Emit a single field event + fn emit(&self, handle: &AppHandle, field: Self::Fields) -> Result<(), Error>; + /// Emit all field events + fn emit_all(&self, handle: &AppHandle) -> Result<(), Error>; + /// Emit and update a single field + fn update>( + &mut self, + handle: &AppHandle, + field: F::Type, + ) -> Result<(), Error> + where + Self: Sized; +} diff --git a/src/lib.rs b/src/lib.rs index cedfa3d..5e23fb9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,14 +1,17 @@ #![warn(missing_docs)] #![doc = include_str!("../README.md")] -/// wasm bindings for tauri's provided js functions -#[cfg(target_family = "wasm")] +/// wasm bindings for tauri's provided js functions (target: `wasm` or feat: `wasm`) +#[cfg(any(target_family = "wasm", feature = "wasm"))] pub mod bindings; -/// wrapped bindings for easier use in the generated wasm commands -#[cfg(target_family = "wasm")] +/// wrapped bindings for easier use in the generated wasm commands (target: `wasm` or feat: `wasm`) +#[cfg(any(target_family = "wasm", feature = "wasm"))] pub mod command; -/// related generic struct and functions for autogenerated listen functions -#[cfg(all(target_family = "wasm", feature = "listen"))] +/// traits for event emitting in the host code (feat: `event` and feat: `tauri`) +#[cfg(all(not(target_family = "wasm"), feature = "event", feature = "tauri"))] +pub mod emit; +/// related generic struct and functions for autogenerated listen functions (target: `wasm` or feat: `wasm` and feat: `event`) +#[cfg(all(any(target_family = "wasm", feature = "wasm"), feature = "event"))] pub mod listen; pub use tauri_interop_macro::*; diff --git a/tauri-interop-macro/Cargo.toml b/tauri-interop-macro/Cargo.toml index da3c954..fb1e4d8 100644 --- a/tauri-interop-macro/Cargo.toml +++ b/tauri-interop-macro/Cargo.toml @@ -17,8 +17,9 @@ syn = { version = "2.0", features = [ "full" ]} quote = "1.0" convert_case = "0.6.0" lazy_static = "1.4.0" +serde = "1.0.193" [features] -default = [ "listen" ] -listen = [] +default = [ "event" ] +event = [] leptos = [] diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 1b60222..9a99ab7 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -1,7 +1,7 @@ #![warn(missing_docs)] //! The macros use by `tauri_interop` to generate dynamic code depending on the target -#[cfg(feature = "listen")] +#[cfg(feature = "event")] use std::fmt::Display; use std::{collections::BTreeSet, sync::Mutex}; @@ -9,21 +9,21 @@ use convert_case::{Case, Casing}; use proc_macro::{Span, TokenStream}; use quote::{format_ident, quote, ToTokens}; use syn::{ - parse_macro_input, punctuated::Punctuated, token::Comma, FnArg, Ident, ItemFn, ItemUse, - Lifetime, LifetimeParam, Pat, PathSegment, ReturnType, Signature, Type, + parse_macro_input, punctuated::Punctuated, token::Comma, Data, DeriveInput, FnArg, Ident, + ItemFn, ItemUse, Lifetime, LifetimeParam, Pat, PathSegment, ReturnType, Signature, Type, }; -#[cfg(feature = "listen")] +#[cfg(feature = "event")] use syn::ItemStruct; -/// Conditionally adds [macro@listen_to] or [macro@emit] to a struct -#[cfg(feature = "listen")] +/// Conditionally adds [macro@listen_to] or [Emit] to a struct +#[cfg(feature = "event")] #[proc_macro_attribute] pub fn emit_or_listen(_: TokenStream, stream: TokenStream) -> TokenStream { let stream_struct = parse_macro_input!(stream as ItemStruct); let stream = quote! { #[cfg_attr(target_family = "wasm", tauri_interop::listen_to)] - #[cfg_attr(not(target_family = "wasm"), tauri_interop::emit)] + #[cfg_attr(not(target_family = "wasm"), derive(tauri_interop::Emit))] #stream_struct }; @@ -31,7 +31,7 @@ pub fn emit_or_listen(_: TokenStream, stream: TokenStream) -> TokenStream { } /// function to build the same unique event name for wasm and host triplet -#[cfg(feature = "listen")] +#[cfg(feature = "event")] fn get_event_name(struct_name: &S, field_name: &F) -> String where S: Display, @@ -40,97 +40,169 @@ where format!("{struct_name}::{field_name}") } -/// Generates an `emit` function for the given struct with a -/// correlation enum for emitting a single field of the struct. +/// Generates an default `Emit` implementation for the given struct with a +/// correlation enum, mod and field-structs for emitting a single field of +/// the struct. /// /// Used for host code generation. -#[cfg(feature = "listen")] -#[proc_macro_attribute] -pub fn emit(_: TokenStream, stream: TokenStream) -> TokenStream { - let stream_struct = parse_macro_input!(stream as ItemStruct); +#[cfg(feature = "event")] +#[proc_macro_derive(Emit)] +pub fn derive_emit(stream: TokenStream) -> TokenStream { + let item_struct = parse_macro_input!(stream as ItemStruct); - if stream_struct.fields.is_empty() { + if item_struct.fields.is_empty() { panic!("No fields provided") } - if stream_struct - .fields - .iter() - .any(|field| field.ident.is_none()) - { + if item_struct.fields.iter().any(|field| field.ident.is_none()) { panic!("Tuple Structs aren't supported") } - let name = format_ident!("{}Emit", stream_struct.ident); - let variants = stream_struct + let struct_name = &item_struct.ident; + + let mod_name = struct_name.to_string().to_case(Case::Snake); + let mod_name = format_ident!("{mod_name}"); + + let fields_name = format_ident!("{}Emit", struct_name); + + let mut enum_arm_variation = vec![]; + let mut fields_enum_variation = vec![]; + let struct_field_fields = item_struct .fields .iter() .map(|field| { - let field_ident = field.ident.as_ref().expect("handled before"); - let variation = field_ident.to_string().to_case(Case::Pascal); + let field_ident = field.ident.as_ref().unwrap(); + let field_name = field_ident.to_string().to_case(Case::Pascal); - (field_ident, format_ident!("{variation}"), &field.ty) - }) - .collect::>(); + let field_name = format_ident!("{field_name}"); + let field_ty = &field.ty; - let struct_ident = &stream_struct.ident; - let mut updaters = Vec::new(); - let mapped_variants = variants - .iter() - .map(|(field_ident, variant_ident, ty)| { - let update = format_ident!("update_{}", field_ident); - updaters.push(quote!{ - pub fn #update(&mut self, handle: &tauri::AppHandle, #field_ident: #ty) -> Result<(), tauri::Error> { - self.#field_ident = #field_ident; - self.emit(handle, #name::#variant_ident) - } - }); + fields_enum_variation.push(field_name.clone()); - let event_name = get_event_name(struct_ident, field_ident); - - quote! { - #name::#variant_ident => { + let event_name = get_event_name(struct_name, field_ident); + enum_arm_variation.push(quote! { + #fields_name::#field_name => { log::trace!( "Emitted event [{}::{}]", - stringify!(#struct_ident), - stringify!(#variant_ident), + stringify!(#struct_name), + stringify!(#field_name), ); handle.emit_all(#event_name, self.#field_ident.clone()) } + }); + + quote! { + #[allow(dead_code)] + #[derive(::tauri_interop::Field)] + pub struct #field_name { + #[parent(#struct_name)] #field_ident: #field_ty + } } }) .collect::>(); - let variants = variants - .into_iter() - .map(|(_, variation, _)| variation) - .collect::>(); - let stream = quote! { - #[derive(Debug, Clone)] - pub enum #name { - #( #variants ),* - } + use tauri_interop::emit::{Emit, EmitField, EmitFields}; - #stream_struct + pub mod #mod_name { + use super::#struct_name; + use tauri_interop::emit::{Emit, EmitField, EmitFields}; - impl #struct_ident { - #( #updaters )* + #[derive(Debug)] + pub enum #fields_name { + #( #fields_enum_variation ),* + } + + impl EmitFields for #fields_name {} + + // to each field a defined struct tuple is provided + #( #struct_field_fields )* + } - #[must_use] - pub fn emit(&self, handle: &::tauri::AppHandle, field: #name) -> Result<(), tauri::Error> { + impl Emit for #struct_name { + type Fields = #mod_name::#fields_name; + + fn emit(&self, handle: &::tauri::AppHandle, field: Self::Fields) -> Result<(), ::tauri::Error> { use tauri::Manager; + use #mod_name::#fields_name; match field { - #( #mapped_variants ),* + #( #enum_arm_variation ),* } } - pub fn emit_all(&self, handle: &::tauri::AppHandle) -> Result<(), tauri::Error> { - #( self.emit(handle, #name::#variants)?; )* + fn emit_all(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { + #( self.emit(handle, #mod_name::#fields_name::#fields_enum_variation)?; )* Ok(()) } + + fn update>(&mut self, handle: &::tauri::AppHandle, field: F::Type) -> Result<(), ::tauri::Error> + where + Self: Sized + { + F::update(self, handle, field) + } + } + }; + + TokenStream::from(stream.to_token_stream()) +} + +/// Generates an default `Field` implementation for the given struct. +/// +/// ## Example +/// ``` +/// #[derive(Field)] +/// struct Foo { +/// bar: usize +/// } +/// ``` +/// +/// Used for host code generation. +#[cfg(feature = "event")] +#[proc_macro_derive(Field, attributes(parent))] +pub fn derive_field(stream: TokenStream) -> TokenStream { + let derive_input = syn::parse_macro_input!(stream as DeriveInput); + let struct_data = match derive_input.data { + Data::Struct(data) => data, + others => { + let data = match others { + Data::Enum(_) => "Enum", + Data::Union(_) => "Union", + _ => "unexpected data enum variation", + }; + + panic!("Expected Struct, got {data}") + } + }; + + if struct_data.fields.is_empty() || struct_data.fields.len() > 1 { + panic!("Only Structs with one type are supported") + } + + let struct_field = struct_data.fields.iter().next().unwrap(); + + let field_parent = struct_field + .attrs + .iter() + .find(|a| a.path().is_ident("parent")) + .expect("expected parent attribute") + .parse_args::() + .unwrap(); + + let field_ty = &struct_field.ty; + let field_ident = struct_field.ident.as_ref().unwrap(); + let struct_name = &derive_input.ident; + + let stream = quote! { + impl EmitField<#field_parent> for #struct_name { + type Type = #field_ty; + + fn update(s: &mut #field_parent, handle: &::tauri::AppHandle, v: Self::Type) -> Result<(), ::tauri::Error> { + s.#field_ident = v; + s.emit(handle, <#field_parent as Emit>::Fields::#struct_name) + } } }; @@ -141,7 +213,7 @@ pub fn emit(_: TokenStream, stream: TokenStream) -> TokenStream { /// struct for the correlating host code. /// /// Used for wasm code generation -#[cfg(feature = "listen")] +#[cfg(feature = "event")] #[proc_macro_attribute] pub fn listen_to(_: TokenStream, stream: TokenStream) -> TokenStream { let stream_struct = parse_macro_input!(stream as ItemStruct); diff --git a/test-project/Cargo.lock b/test-project/Cargo.lock index 7dbcece..6819c86 100644 --- a/test-project/Cargo.lock +++ b/test-project/Cargo.lock @@ -3674,6 +3674,7 @@ dependencies = [ "log", "serde", "serde-wasm-bindgen 0.6.1", + "tauri", "tauri-interop-macro", "thiserror", "wasm-bindgen", @@ -3687,6 +3688,7 @@ dependencies = [ "convert_case 0.6.0", "lazy_static", "quote", + "serde", "syn 2.0.39", ] diff --git a/test-project/api/Cargo.toml b/test-project/api/Cargo.toml index 20d905a..125301d 100644 --- a/test-project/api/Cargo.toml +++ b/test-project/api/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -tauri-interop = { path = "../..", features = [ "listen" ]} +tauri-interop = { path = "../..", default-features = false, features = [ "event" ]} # common log = "0.4.20" @@ -22,7 +22,7 @@ leptos = { version = "0.5.2", features = ["csr"], optional = true } [features] default = [ "host" ] -host = ["dep:tauri"] -wasm = ["dep:js-sys", "dep:serde-wasm-bindgen", "dep:wasm-bindgen", "dep:wasm-bindgen-futures"] -leptos = [ "dep:leptos", "tauri-interop/leptos" ] -broken = [] +host = [ "dep:tauri", "tauri-interop/tauri" ] +wasm = [ "dep:js-sys", "dep:serde-wasm-bindgen", "dep:wasm-bindgen", "dep:wasm-bindgen-futures"] +leptos = [ "dep:leptos", "tauri-interop/leptos" ] +broken = [] diff --git a/test-project/api/src/cmd.rs b/test-project/api/src/cmd.rs index 98c7310..27a2875 100644 --- a/test-project/api/src/cmd.rs +++ b/test-project/api/src/cmd.rs @@ -1,5 +1,5 @@ #[tauri_interop::host_usage] -use crate::model::{TestState, TestStateEmit}; +use crate::model::TestState; #[tauri_interop::host_usage] use std::sync::RwLock; @@ -38,21 +38,25 @@ pub fn result_test() -> Result { } #[tauri_interop::command] -pub fn emit(test_state: tauri::State>, handle: tauri::AppHandle) { +pub fn emit(state: tauri::State>, handle: tauri::AppHandle) { + use tauri_interop::emit::Emit; + // newly generated mod + use crate::model::test_state; + log::info!("emit cmd received"); - let mut test_state = test_state.write().unwrap(); + let mut state = state.write().unwrap(); - if test_state.bar { - test_state.update_foo(&handle, "bar".into()).unwrap(); + if state.bar { + state.update::(&handle, false).unwrap(); } else { - test_state.update_foo(&handle, "foo".into()).unwrap(); + state.update::(&handle, "foo".into()).unwrap(); } - test_state.bar = !test_state.bar; - test_state.emit(&handle, TestStateEmit::Bar).unwrap(); + state.bar = !state.bar; + state.emit(&handle, ::Fields::Bar).unwrap(); - test_state.emit_all(&handle).unwrap(); + state.emit_all(&handle).unwrap(); } #[cfg(feature = "broken")] From 3e815c2b427d47da3df4d6a1c00adb851de07bba Mon Sep 17 00:00:00 2001 From: Felix Prillwitz <36958734+photovoltex@users.noreply.github.com> Date: Tue, 26 Dec 2023 16:37:18 +0100 Subject: [PATCH 02/60] add event module --- src/event.rs | 6 ++++++ src/{ => event}/emit.rs | 4 ++-- src/{ => event}/listen.rs | 0 src/lib.rs | 9 +++------ tauri-interop-macro/src/lib.rs | 18 +++++------------- test-project/api/src/cmd.rs | 2 +- 6 files changed, 17 insertions(+), 22 deletions(-) create mode 100644 src/event.rs rename src/{ => event}/emit.rs (90%) rename src/{ => event}/listen.rs (100%) diff --git a/src/event.rs b/src/event.rs new file mode 100644 index 0000000..4ee84cc --- /dev/null +++ b/src/event.rs @@ -0,0 +1,6 @@ +/// traits for event emitting in the host code (feat: `tauri`) +#[cfg(any(not(target_family = "wasm"), feature = "tauri"))] +pub mod emit; +/// related generic struct and functions for autogenerated listen functions (target: `wasm` or feat: `wasm`) +#[cfg(any(target_family = "wasm", feature = "wasm"))] +pub mod listen; diff --git a/src/emit.rs b/src/event/emit.rs similarity index 90% rename from src/emit.rs rename to src/event/emit.rs index 053677d..1be7b29 100644 --- a/src/emit.rs +++ b/src/event/emit.rs @@ -1,6 +1,6 @@ use std::fmt::Debug; -use serde::Serialize; +use serde::{Deserialize, Serialize}; use tauri::{AppHandle, Error, Wry}; /// Trait intended to mark an enum as usable [Emit::Fields] @@ -11,7 +11,7 @@ pub trait EmitField where S: Emit, ::Fields: EmitFields, - >::Type: Serialize + Clone, + >::Type: Serialize + for<'de> Deserialize<'de> + Clone, { /// The type of the field type Type; diff --git a/src/listen.rs b/src/event/listen.rs similarity index 100% rename from src/listen.rs rename to src/event/listen.rs diff --git a/src/lib.rs b/src/lib.rs index 5e23fb9..29649c2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,11 +7,8 @@ pub mod bindings; /// wrapped bindings for easier use in the generated wasm commands (target: `wasm` or feat: `wasm`) #[cfg(any(target_family = "wasm", feature = "wasm"))] pub mod command; -/// traits for event emitting in the host code (feat: `event` and feat: `tauri`) -#[cfg(all(not(target_family = "wasm"), feature = "event", feature = "tauri"))] -pub mod emit; -/// related generic struct and functions for autogenerated listen functions (target: `wasm` or feat: `wasm` and feat: `event`) -#[cfg(all(any(target_family = "wasm", feature = "wasm"), feature = "event"))] -pub mod listen; +/// event traits and overall logic for event emitting and listening (feat: `event`) +#[cfg(feature = "event")] +pub mod event; pub use tauri_interop_macro::*; diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 9a99ab7..882bddf 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -102,11 +102,11 @@ pub fn derive_emit(stream: TokenStream) -> TokenStream { .collect::>(); let stream = quote! { - use tauri_interop::emit::{Emit, EmitField, EmitFields}; + use tauri_interop::event::emit::{Emit, EmitField, EmitFields}; pub mod #mod_name { use super::#struct_name; - use tauri_interop::emit::{Emit, EmitField, EmitFields}; + use tauri_interop::event::emit::{Emit, EmitField, EmitFields}; #[derive(Debug)] pub enum #fields_name { @@ -151,14 +151,6 @@ pub fn derive_emit(stream: TokenStream) -> TokenStream { /// Generates an default `Field` implementation for the given struct. /// -/// ## Example -/// ``` -/// #[derive(Field)] -/// struct Foo { -/// bar: usize -/// } -/// ``` -/// /// Used for host code generation. #[cfg(feature = "event")] #[proc_macro_derive(Field, attributes(parent))] @@ -251,7 +243,7 @@ pub fn listen_to(_: TokenStream, stream: TokenStream) -> TokenStream { quote! { #[must_use = "If the returned handle is dropped, the contained closure goes out of scope and can't be called"] pub fn #use_fn_name(initial_value: #ty) -> (::leptos::ReadSignal<#ty>, ::leptos::WriteSignal<#ty>) { - ::tauri_interop::listen::ListenHandle::use_register(#event_name, initial_value) + ::tauri_interop::event::listen::ListenHandle::use_register(#event_name, initial_value) } } }); @@ -262,8 +254,8 @@ pub fn listen_to(_: TokenStream, stream: TokenStream) -> TokenStream { #leptos #[must_use = "If the returned handle is dropped, the contained closure goes out of scope and can't be called"] - pub async fn #listen_to_fn_name<'s>(callback: impl Fn(#ty) + 'static) -> ::tauri_interop::listen::ListenResult<'s> { - ::tauri_interop::listen::ListenHandle::register(#event_name, callback).await + pub async fn #listen_to_fn_name<'s>(callback: impl Fn(#ty) + 'static) -> ::tauri_interop::event::listen::ListenResult<'s> { + ::tauri_interop::event::listen::ListenHandle::register(#event_name, callback).await } } }).collect::>(); diff --git a/test-project/api/src/cmd.rs b/test-project/api/src/cmd.rs index 27a2875..866d5d0 100644 --- a/test-project/api/src/cmd.rs +++ b/test-project/api/src/cmd.rs @@ -39,7 +39,7 @@ pub fn result_test() -> Result { #[tauri_interop::command] pub fn emit(state: tauri::State>, handle: tauri::AppHandle) { - use tauri_interop::emit::Emit; + use tauri_interop::event::emit::Emit; // newly generated mod use crate::model::test_state; From 9cb0abbfbac5f8d6f2046b8997496bc8024b0994 Mon Sep 17 00:00:00 2001 From: Felix Prillwitz <36958734+photovoltex@users.noreply.github.com> Date: Tue, 26 Dec 2023 18:06:57 +0100 Subject: [PATCH 03/60] update readme --- README.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0e14971..2e6c016 100644 --- a/README.md +++ b/README.md @@ -104,19 +104,22 @@ async fn heavy_computation() { ### Event (Backend => Frontend Communication) Definition for both tauri supported triplet and wasm: -```rust , ignore-wasm32-unknown-unknown +```rust #[derive(Default)] #[tauri_interop::emit_or_listen] pub struct Test { foo: String, pub bar: bool, } + +// when main isn't defined, `super::Test` results in an error +fn main() {} ``` Using `tauri_interop::emit_or_listen` does provides the command with two macros, which are used depending on the `target_family` - `tauri_interop::listen_to` is used when compiling to `wasm` - - `tauri_interop::emit` is used otherwise + - derive trait `tauri_interop::Emit` is used otherwise To emit a variable from the above struct (which is mostly intended to be used as state) in the host triplet ```rust , ignore-wasm32-unknown-unknown @@ -127,14 +130,18 @@ pub struct Test { pub bar: bool, } +// via `tauri_interop::Emit` a new modul named after the struct (as snake_case) +// is created where the struct Test is defined, here it creates module `test` +// in this module the Fields and Field are generated + // one context where `tauri::AppHandle` can be obtained #[tauri_interop::command] fn emit_bar(handle: tauri::AppHandle) { let mut test = Test::default(); - test.emit(&handle, TestEmit::Bar); // emits `false` + test.emit(&handle, test::TestEmit::Bar); // emits `false` test.bar = true; - test.emit(&handle, TestEmit::Bar); // emits updated value `true` + test.emit(&handle, ::Fields::Bar); // emits updated value `true` } // a different context where `tauri::AppHandle` can be obtained @@ -146,7 +153,7 @@ fn main() { let mut test = Test::default(); // to emit and update an field an update function for each field is generated - test.update_foo(&handle, "Bar".into()); // emits '"Bar"' + test.update::(&handle, "Bar".into()); // emits '"Bar"' Ok(()) }); From ca54ea261d02c201f9fcd1bd0a1d69c2f3f4e56e Mon Sep 17 00:00:00 2001 From: Felix Prillwitz <36958734+photovoltex@users.noreply.github.com> Date: Tue, 26 Dec 2023 18:07:39 +0100 Subject: [PATCH 04/60] introduce Listen trait --- src/event/emit.rs | 6 +- src/event/listen.rs | 41 +++++++++ tauri-interop-macro/src/lib.rs | 157 ++++++++++++++++++--------------- test-project/api/src/cmd.rs | 8 +- test-project/src/main.rs | 11 +-- 5 files changed, 144 insertions(+), 79 deletions(-) diff --git a/src/event/emit.rs b/src/event/emit.rs index 1be7b29..f4f9315 100644 --- a/src/event/emit.rs +++ b/src/event/emit.rs @@ -1,17 +1,17 @@ use std::fmt::Debug; -use serde::{Deserialize, Serialize}; +use serde::Serialize; use tauri::{AppHandle, Error, Wry}; /// Trait intended to mark an enum as usable [Emit::Fields] pub trait EmitFields: Debug {} -/// Trait defining a [Field] to a related struct implementing [Emit] with the related [EmitField::Type] +/// Trait defining a [EmitField] to a related struct implementing [Emit] with the related [EmitField::Type] pub trait EmitField where S: Emit, ::Fields: EmitFields, - >::Type: Serialize + for<'de> Deserialize<'de> + Clone, + >::Type: Serialize + Clone, { /// The type of the field type Type; diff --git a/src/event/listen.rs b/src/event/listen.rs index f7400fe..478f4cf 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -112,3 +112,44 @@ impl<'s> ListenHandle<'s> { (signal, set_signal) } } + +/// Trait defining a [ListenField] to a related struct implementing [Listen] +/// with the related [ListenField::Type] and [ListenField::EVENT_NAME] +pub trait ListenField +where + S: Listen, + >::Type: Default + for<'de> Deserialize<'de>, +{ + /// The type of the field + type Type; + /// The event of the field + const EVENT_NAME: &'static str; +} + +/// Trait that defines the available listen methods +pub trait Listen { + /// Registers an callback to a [ListenField] + /// + /// Default Implementation: see [ListenHandle::register] + fn listen_to<'r, F: ListenField>( + callback: impl Fn(F::Type) + 'static, + ) -> impl std::future::Future> + where + Self: Sized, + { + ListenHandle::register(F::EVENT_NAME, callback) + } + + /// Creates a signal to a [ListenField] + /// + /// Default Implementation: see [ListenHandle::use_register] + #[cfg(feature = "leptos")] + fn use_field>( + initial: F::Type, + ) -> (ReadSignal, WriteSignal) + where + Self: Sized, + { + ListenHandle::use_register(F::EVENT_NAME, initial) + } +} diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 882bddf..3769b62 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -9,7 +9,7 @@ use convert_case::{Case, Casing}; use proc_macro::{Span, TokenStream}; use quote::{format_ident, quote, ToTokens}; use syn::{ - parse_macro_input, punctuated::Punctuated, token::Comma, Data, DeriveInput, FnArg, Ident, + parse_macro_input, punctuated::Punctuated, token::Comma, Attribute, DeriveInput, FnArg, Ident, ItemFn, ItemUse, Lifetime, LifetimeParam, Pat, PathSegment, ReturnType, Signature, Type, }; @@ -22,7 +22,7 @@ use syn::ItemStruct; pub fn emit_or_listen(_: TokenStream, stream: TokenStream) -> TokenStream { let stream_struct = parse_macro_input!(stream as ItemStruct); let stream = quote! { - #[cfg_attr(target_family = "wasm", tauri_interop::listen_to)] + #[cfg_attr(target_family = "wasm", derive(tauri_interop::Listen))] #[cfg_attr(not(target_family = "wasm"), derive(tauri_interop::Emit))] #stream_struct }; @@ -93,10 +93,11 @@ pub fn derive_emit(stream: TokenStream) -> TokenStream { quote! { #[allow(dead_code)] - #[derive(::tauri_interop::Field)] - pub struct #field_name { - #[parent(#struct_name)] #field_ident: #field_ty - } + #[derive(::tauri_interop::EmitField)] + #[parent(#struct_name)] + #[name(#field_ident)] + #[ty(#field_ty)] + pub struct #field_name; } }) .collect::>(); @@ -149,51 +150,54 @@ pub fn derive_emit(stream: TokenStream) -> TokenStream { TokenStream::from(stream.to_token_stream()) } -/// Generates an default `Field` implementation for the given struct. -/// -/// Used for host code generation. -#[cfg(feature = "event")] -#[proc_macro_derive(Field, attributes(parent))] -pub fn derive_field(stream: TokenStream) -> TokenStream { - let derive_input = syn::parse_macro_input!(stream as DeriveInput); - let struct_data = match derive_input.data { - Data::Struct(data) => data, - others => { - let data = match others { - Data::Enum(_) => "Enum", - Data::Union(_) => "Union", - _ => "unexpected data enum variation", - }; - - panic!("Expected Struct, got {data}") - } - }; - - if struct_data.fields.is_empty() || struct_data.fields.len() > 1 { - panic!("Only Structs with one type are supported") - } - - let struct_field = struct_data.fields.iter().next().unwrap(); +struct FieldValues { + pub parent: Ident, + pub name: Option, + pub ty: Type, +} - let field_parent = struct_field - .attrs +fn get_field_values(attrs: Vec) -> FieldValues { + let parent = attrs .iter() .find(|a| a.path().is_ident("parent")) .expect("expected parent attribute") - .parse_args::() + .parse_args() + .unwrap(); + + let name = attrs + .iter() + .find(|a| a.path().is_ident("name")) + .and_then(|name| name.parse_args().ok()); + + let ty = attrs + .iter() + .find(|a| a.path().is_ident("ty")) + .expect("expected ty attribute") + .parse_args() .unwrap(); - let field_ty = &struct_field.ty; - let field_ident = struct_field.ident.as_ref().unwrap(); + FieldValues { parent, name, ty } +} + +/// Generates an default `EmitField` implementation for the given struct. +/// +/// Used for host code generation. +#[cfg(feature = "event")] +#[proc_macro_derive(EmitField, attributes(parent, name, ty))] +pub fn derive_emit_field(stream: TokenStream) -> TokenStream { + let derive_input = syn::parse_macro_input!(stream as DeriveInput); + + let FieldValues { parent, name, ty } = get_field_values(derive_input.attrs); + let name = name.expect("name attribute was expected"); let struct_name = &derive_input.ident; let stream = quote! { - impl EmitField<#field_parent> for #struct_name { - type Type = #field_ty; + impl EmitField<#parent> for #struct_name { + type Type = #ty; - fn update(s: &mut #field_parent, handle: &::tauri::AppHandle, v: Self::Type) -> Result<(), ::tauri::Error> { - s.#field_ident = v; - s.emit(handle, <#field_parent as Emit>::Fields::#struct_name) + fn update(s: &mut #parent, handle: &::tauri::AppHandle, v: Self::Type) -> Result<(), ::tauri::Error> { + s.#name = v; + s.emit(handle, <#parent as Emit>::Fields::#struct_name) } } }; @@ -206,8 +210,8 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { /// /// Used for wasm code generation #[cfg(feature = "event")] -#[proc_macro_attribute] -pub fn listen_to(_: TokenStream, stream: TokenStream) -> TokenStream { +#[proc_macro_derive(Listen)] +pub fn derive_listen(stream: TokenStream) -> TokenStream { let stream_struct = parse_macro_input!(stream as ItemStruct); if stream_struct.fields.is_empty() { @@ -224,7 +228,10 @@ pub fn listen_to(_: TokenStream, stream: TokenStream) -> TokenStream { let struct_ident = &stream_struct.ident; - let mapped_variants = stream_struct + let mod_name = struct_ident.to_string().to_case(Case::Snake); + let mod_name = format_ident!("{mod_name}"); + + let struct_field_fields = stream_struct .fields .iter() .map(|field| { @@ -233,38 +240,50 @@ pub fn listen_to(_: TokenStream, stream: TokenStream) -> TokenStream { .ident .as_ref() .expect("handled before") - .clone(); + .to_string() + .to_case(Case::Pascal); + let field_ident = format_ident!("{field_ident}"); - let fn_ident = field_ident.to_string().to_case(Case::Snake).to_lowercase(); - let event_name = get_event_name(struct_ident, &field_ident); + quote! { + #[derive(::tauri_interop::ListenField)] + #[parent(#struct_ident)] + #[ty(#ty)] + pub struct #field_ident; + } + }) + .collect::>(); - let leptos = cfg!(feature = "leptos").then(|| { - let use_fn_name = format_ident!("use_{fn_ident}"); - quote! { - #[must_use = "If the returned handle is dropped, the contained closure goes out of scope and can't be called"] - pub fn #use_fn_name(initial_value: #ty) -> (::leptos::ReadSignal<#ty>, ::leptos::WriteSignal<#ty>) { - ::tauri_interop::event::listen::ListenHandle::use_register(#event_name, initial_value) - } - } - }); + let stream = quote! { + pub mod #mod_name { + use super::#struct_ident; + use ::tauri_interop::event::listen::ListenField; - let listen_to_fn_name = format_ident!("listen_to_{fn_ident}"); + #( #struct_field_fields )* + } - quote! { - #leptos + impl ::tauri_interop::event::listen::Listen for #struct_ident {} + }; - #[must_use = "If the returned handle is dropped, the contained closure goes out of scope and can't be called"] - pub async fn #listen_to_fn_name<'s>(callback: impl Fn(#ty) + 'static) -> ::tauri_interop::event::listen::ListenResult<'s> { - ::tauri_interop::event::listen::ListenHandle::register(#event_name, callback).await - } - } - }).collect::>(); + TokenStream::from(stream.to_token_stream()) +} - let stream = quote! { - #stream_struct +/// Generates an default `ListenField` implementation for the given struct. +/// +/// Used for wasm code generation. +#[cfg(feature = "event")] +#[proc_macro_derive(ListenField, attributes(parent, ty))] +pub fn derive_listen_field(stream: TokenStream) -> TokenStream { + let derive_input = syn::parse_macro_input!(stream as DeriveInput); + + let FieldValues { parent, ty, .. } = get_field_values(derive_input.attrs); + let struct_name = &derive_input.ident; + + let event_name = get_event_name(&parent, &struct_name); - impl #struct_ident { - #( #mapped_variants )* + let stream = quote! { + impl ListenField<#parent> for #struct_name { + type Type = #ty; + const EVENT_NAME: &'static str = #event_name; } }; diff --git a/test-project/api/src/cmd.rs b/test-project/api/src/cmd.rs index 866d5d0..1ba9c91 100644 --- a/test-project/api/src/cmd.rs +++ b/test-project/api/src/cmd.rs @@ -50,11 +50,15 @@ pub fn emit(state: tauri::State>, handle: tauri::AppHandle) { if state.bar { state.update::(&handle, false).unwrap(); } else { - state.update::(&handle, "foo".into()).unwrap(); + state + .update::(&handle, "foo".into()) + .unwrap(); } state.bar = !state.bar; - state.emit(&handle, ::Fields::Bar).unwrap(); + state + .emit(&handle, ::Fields::Bar) + .unwrap(); state.emit_all(&handle).unwrap(); } diff --git a/test-project/src/main.rs b/test-project/src/main.rs index fee2e18..8c093e0 100644 --- a/test-project/src/main.rs +++ b/test-project/src/main.rs @@ -1,6 +1,7 @@ #![allow(clippy::disallowed_names)] -use api::model::TestState; +use api::event::listen::Listen; +use api::model::{test_state, TestState}; use gloo_timers::callback::Timeout; #[cfg(feature = "leptos")] use leptos::{component, create_signal, view, IntoView}; @@ -13,13 +14,13 @@ fn main() { wasm_bindgen_futures::spawn_local(async { log::info!("{}", api::cmd::greet("frontend").await); - + api::cmd::await_heavy_computing().await; log::info!("heavy computing finished") }); wasm_bindgen_futures::spawn_local(async move { - let handle_bar = TestState::listen_to_bar(|echo| log::info!("bar: {echo}")) + let handle_bar = TestState::listen_to::(|echo| log::info!("bar: {echo}")) .await .unwrap(); @@ -46,7 +47,7 @@ fn App() -> impl IntoView { let (bar, set_bar) = create_signal(false); leptos::spawn_local(async move { - let handle_bar = TestState::listen_to_bar(move |bar| set_bar.set(bar)) + let handle_bar = TestState::listen_to::(move |bar| set_bar.set(bar)) .await .unwrap(); @@ -70,7 +71,7 @@ fn App() -> impl IntoView { fn Foo() -> impl IntoView { Timeout::new(2000, api::cmd::emit).forget(); - let (foo, _set_foo) = TestState::use_foo("Test".into()); + let (foo, _set_foo) = TestState::use_field::("Test".into()); view! {

{foo}

} } From 3bc4f11719cf97b9d846c7add571a1743771a95e Mon Sep 17 00:00:00 2001 From: Felix Prillwitz <36958734+photovoltex@users.noreply.github.com> Date: Tue, 26 Dec 2023 18:13:02 +0100 Subject: [PATCH 05/60] update readme --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2e6c016..b3e31e2 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,11 @@ pub struct Test { pub bar: bool, } -let listen_handle: ListenHandle<'_> = Test::listen_to_foo(|foo| { /* use received foo here */ }).await; +fn main() { + use tauri_interop::event::listen::Listen; + + let _listen_handle: ListenHandle<'_> = Test::listen_to::(|foo| { /* use received foo: String here */ }).await; +} ``` The `liste_handle` contains the provided closure and the "unlisten" method. It has to be hold in scope as long @@ -187,7 +191,11 @@ pub struct Test { pub bar: bool, } -let (foo: leptos::ReadSignal, set_foo: leptos::WriteSignal) = Test::use_foo(String::default()); +fn main() { + use tauri_interop::event::listen::Listen; + + let (foo: leptos::ReadSignal, set_foo: leptos::WriteSignal) = Test::use_field::(String::default()); +} ``` ## Known Issues: From f8860a6d2aab0a6ebebd1070c488834c20f56ff7 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Tue, 20 Feb 2024 20:42:49 +0100 Subject: [PATCH 06/60] simplify emit of field --- .gitignore | 1 + README.md | 28 ++++++------- src/event/emit.rs | 37 ++++++++--------- tauri-interop-macro/src/lib.rs | 72 +++++++++++++++------------------- test-project/api/src/cmd.rs | 2 +- 5 files changed, 62 insertions(+), 78 deletions(-) diff --git a/.gitignore b/.gitignore index 73b9c10..650b174 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +.idea/ target/ dist/ diff --git a/README.md b/README.md index b3e31e2..49c909a 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ fn main() { - all arguments with type "State", "AppHandle" and "Window" are removed automatically > the current implementation relies on the name of the type and can not separate between a > tauri::State and a self defined "State" struct -- asynchron commands are values as is see [async-commands](https://tauri.app/v1/guides/features/command#async-commands) for a detail explanation +- asynchronous commands are values as is seen [async-commands](https://tauri.app/v1/guides/features/command#async-commands) for a detail explanation ```rust , ignore-wasm32-unknown-unknown // let _: () = trigger_something(); @@ -85,17 +85,17 @@ fn wait_for_sync_execution(value: &str) -> String { format!("Has to wait that the backend completes the computation and returns the {value}") } -// let result: Result = asynchrone_execution(true).await; +// let result: Result = asynchronous_execution(true).await; #[tauri_interop::command] -async fn asynchrone_execution(change: bool) -> Result { +async fn asynchronous_execution(change: bool) -> Result { if change { - Ok("asynchrone execution requires result definition".into()) + Ok("asynchronous execution requires result definition".into()) } else { Err("and ".into()) } } -// let _wait_for_completion: () = asynchrone_execution(true).await; +// let _wait_for_completion: () = asynchronous_execution(true).await; #[tauri_interop::command] async fn heavy_computation() { std::thread::sleep(std::time::Duration::from_millis(5000)) @@ -130,18 +130,16 @@ pub struct Test { pub bar: bool, } -// via `tauri_interop::Emit` a new modul named after the struct (as snake_case) +// via `tauri_interop::Emit` a new module named after the struct (as snake_case) // is created where the struct Test is defined, here it creates module `test` -// in this module the Fields and Field are generated +// in this module the related Fields are generated // one context where `tauri::AppHandle` can be obtained #[tauri_interop::command] fn emit_bar(handle: tauri::AppHandle) { - let mut test = Test::default(); + let mut t = Test::default(); - test.emit(&handle, test::TestEmit::Bar); // emits `false` - test.bar = true; - test.emit(&handle, ::Fields::Bar); // emits updated value `true` + t.emit::(&handle); // emits the current state: `false` } // a different context where `tauri::AppHandle` can be obtained @@ -150,10 +148,10 @@ fn main() { .setup(|app| { let handle: tauri::AppHandle = app.handle(); - let mut test = Test::default(); + let mut t = Test::default(); - // to emit and update an field an update function for each field is generated - test.update::(&handle, "Bar".into()); // emits '"Bar"' + // to emit and update a field an update function for each field is generated + t.update::(&handle, "Bar".into()); // assigns "Bar" to t.foo and emits the same value Ok(()) }); @@ -168,7 +166,7 @@ pub struct Test { pub bar: bool, } -fn main() { +async fn main() { use tauri_interop::event::listen::Listen; let _listen_handle: ListenHandle<'_> = Test::listen_to::(|foo| { /* use received foo: String here */ }).await; diff --git a/src/event/emit.rs b/src/event/emit.rs index f4f9315..63b1937 100644 --- a/src/event/emit.rs +++ b/src/event/emit.rs @@ -1,38 +1,33 @@ -use std::fmt::Debug; - use serde::Serialize; use tauri::{AppHandle, Error, Wry}; -/// Trait intended to mark an enum as usable [Emit::Fields] -pub trait EmitFields: Debug {} - /// Trait defining a [EmitField] to a related struct implementing [Emit] with the related [EmitField::Type] -pub trait EmitField +pub trait EmitField where - S: Emit, - ::Fields: EmitFields, - >::Type: Serialize + Clone, + Parent: Emit, + >::Type: Serialize + Clone, { /// The type of the field type Type; - /// Updates the related field and emit it's event - fn update(s: &mut S, handle: &AppHandle, v: Self::Type) -> Result<(), Error>; + /// Emits event of the related field with their value + fn emit(parent: &Parent, handle: &AppHandle) -> Result<(), Error>; + + /// Updates the related field and emits it + fn update(parent: &mut Parent, handle: &AppHandle, v: Self::Type) -> Result<(), Error>; } /// Trait that defines the available event emitting methods -pub trait Emit -where - ::Fields: EmitFields, -{ - /// Fields that are used to emit an event - type Fields; - - /// Emit a single field event - fn emit(&self, handle: &AppHandle, field: Self::Fields) -> Result<(), Error>; +pub trait Emit { /// Emit all field events fn emit_all(&self, handle: &AppHandle) -> Result<(), Error>; - /// Emit and update a single field + + /// Emit a single field event + fn emit>(&self, handle: &AppHandle) -> Result<(), Error> + where + Self: Sized; + + /// Update a single field and emit it afterward fn update>( &mut self, handle: &AppHandle, diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 3769b62..fb8f07d 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -63,10 +63,7 @@ pub fn derive_emit(stream: TokenStream) -> TokenStream { let mod_name = struct_name.to_string().to_case(Case::Snake); let mod_name = format_ident!("{mod_name}"); - let fields_name = format_ident!("{}Emit", struct_name); - - let mut enum_arm_variation = vec![]; - let mut fields_enum_variation = vec![]; + let mut fields = vec![]; let struct_field_fields = item_struct .fields .iter() @@ -77,19 +74,7 @@ pub fn derive_emit(stream: TokenStream) -> TokenStream { let field_name = format_ident!("{field_name}"); let field_ty = &field.ty; - fields_enum_variation.push(field_name.clone()); - - let event_name = get_event_name(struct_name, field_ident); - enum_arm_variation.push(quote! { - #fields_name::#field_name => { - log::trace!( - "Emitted event [{}::{}]", - stringify!(#struct_name), - stringify!(#field_name), - ); - handle.emit_all(#event_name, self.#field_ident.clone()) - } - }); + fields.push(field_name.clone()); quote! { #[allow(dead_code)] @@ -103,39 +88,30 @@ pub fn derive_emit(stream: TokenStream) -> TokenStream { .collect::>(); let stream = quote! { - use tauri_interop::event::emit::{Emit, EmitField, EmitFields}; + use tauri_interop::event::emit::{Emit, EmitField}; pub mod #mod_name { use super::#struct_name; - use tauri_interop::event::emit::{Emit, EmitField, EmitFields}; - - #[derive(Debug)] - pub enum #fields_name { - #( #fields_enum_variation ),* - } - - impl EmitFields for #fields_name {} + use tauri_interop::event::emit::{Emit, EmitField}; // to each field a defined struct tuple is provided #( #struct_field_fields )* } impl Emit for #struct_name { - type Fields = #mod_name::#fields_name; + fn emit_all(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { + use #mod_name::*; - fn emit(&self, handle: &::tauri::AppHandle, field: Self::Fields) -> Result<(), ::tauri::Error> { - use tauri::Manager; - use #mod_name::#fields_name; + #( #fields::emit(self, handle)?; )* - match field { - #( #enum_arm_variation ),* - } + Ok(()) } - fn emit_all(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { - #( self.emit(handle, #mod_name::#fields_name::#fields_enum_variation)?; )* - - Ok(()) + fn emit>(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> + where + Self: Sized + { + F::emit(self, handle) } fn update>(&mut self, handle: &::tauri::AppHandle, field: F::Type) -> Result<(), ::tauri::Error> @@ -191,13 +167,27 @@ pub fn derive_emit_field(stream: TokenStream) -> TokenStream { let name = name.expect("name attribute was expected"); let struct_name = &derive_input.ident; + let event_name = get_event_name(&parent, struct_name); + let stream = quote! { impl EmitField<#parent> for #struct_name { type Type = #ty; - fn update(s: &mut #parent, handle: &::tauri::AppHandle, v: Self::Type) -> Result<(), ::tauri::Error> { - s.#name = v; - s.emit(handle, <#parent as Emit>::Fields::#struct_name) + fn emit(parent: &#parent, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { + use tauri::Manager; + + log::trace!( + "Emitted event [{}::{}]", + stringify!(#parent), + stringify!(#struct_name), + ); + + handle.emit_all(#event_name, parent.#name.clone()) + } + + fn update(parent: &mut #parent, handle: &::tauri::AppHandle, v: Self::Type) -> Result<(), ::tauri::Error> { + parent.#name = v; + Self::emit(parent, handle) } } }; @@ -383,7 +373,7 @@ pub fn binding(_: TokenStream, stream: TokenStream) -> TokenStream { .push(syn::GenericParam::Lifetime(LifetimeParam::new(lt))) } - let async_ident = (invoke_type.ne(&Invoke::Empty)).then_some(format_ident!("async")); + let async_ident = invoke_type.ne(&Invoke::Empty).then_some(format_ident!("async")); let invoke = match invoke_type { Invoke::Empty => quote!(::tauri_interop::bindings::invoke(stringify!(#ident), args);), Invoke::Async | Invoke::AsyncEmpty => { diff --git a/test-project/api/src/cmd.rs b/test-project/api/src/cmd.rs index 1ba9c91..8aad1fa 100644 --- a/test-project/api/src/cmd.rs +++ b/test-project/api/src/cmd.rs @@ -57,7 +57,7 @@ pub fn emit(state: tauri::State>, handle: tauri::AppHandle) { state.bar = !state.bar; state - .emit(&handle, ::Fields::Bar) + .emit::(&handle) .unwrap(); state.emit_all(&handle).unwrap(); From 727a951ebe0ebbdc807b7c7780e606135f0f39af Mon Sep 17 00:00:00 2001 From: photovoltex Date: Tue, 20 Feb 2024 20:43:02 +0100 Subject: [PATCH 07/60] fix typos --- src/command.rs | 4 ++-- tauri-interop-macro/src/lib.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/command.rs b/src/command.rs index 5effffe..9016197 100644 --- a/src/command.rs +++ b/src/command.rs @@ -1,7 +1,7 @@ use serde::Deserialize; use wasm_bindgen::JsValue; -/// Wrapper for [crate::bindings::async_invoke], to return a +/// Wrapper for [crate::bindings::async_invoke], to return an /// expected [Deserialize] object pub async fn async_invoke(command: &str, args: JsValue) -> T where @@ -11,7 +11,7 @@ where serde_wasm_bindgen::from_value(value).expect("conversion error") } -/// Wrapper for [crate::bindings::invoke_catch], to return a +/// Wrapper for [crate::bindings::invoke_catch], to return an /// expected [Result] where T and E is [Deserialize] pub async fn invoke_catch(command: &str, args: JsValue) -> Result where diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index fb8f07d..024dcd4 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -40,7 +40,7 @@ where format!("{struct_name}::{field_name}") } -/// Generates an default `Emit` implementation for the given struct with a +/// Generates a default `Emit` implementation for the given struct with a /// correlation enum, mod and field-structs for emitting a single field of /// the struct. /// @@ -155,7 +155,7 @@ fn get_field_values(attrs: Vec) -> FieldValues { FieldValues { parent, name, ty } } -/// Generates an default `EmitField` implementation for the given struct. +/// Generates a default `EmitField` implementation for the given struct. /// /// Used for host code generation. #[cfg(feature = "event")] @@ -257,7 +257,7 @@ pub fn derive_listen(stream: TokenStream) -> TokenStream { TokenStream::from(stream.to_token_stream()) } -/// Generates an default `ListenField` implementation for the given struct. +/// Generates a default `ListenField` implementation for the given struct. /// /// Used for wasm code generation. #[cfg(feature = "event")] From cd8d4b1e87f73936fcf4be60c8c908ba9bda692c Mon Sep 17 00:00:00 2001 From: Felix Prillwitz <36958734+photovoltex@users.noreply.github.com> Date: Thu, 4 Jan 2024 21:10:20 +0100 Subject: [PATCH 08/60] simplify inclusion of crate --- Cargo.lock | 5 +++-- Cargo.toml | 20 +++++++++++++------- tauri-interop-macro/Cargo.toml | 8 ++++++-- test-project/Cargo.lock | 5 +++-- test-project/Cargo.toml | 2 +- test-project/api/Cargo.toml | 8 ++++---- 6 files changed, 30 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d044cc..bb98414 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2564,9 +2564,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" dependencies = [ "unicode-ident", ] @@ -3548,6 +3548,7 @@ version = "1.3.0" dependencies = [ "convert_case 0.6.0", "lazy_static", + "proc-macro2", "quote", "serde", "syn 2.0.39", diff --git a/Cargo.toml b/Cargo.toml index 73d9409..6ccd5c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,18 +31,24 @@ thiserror = "1.0.50" serde-wasm-bindgen = "0.6.1" log = "0.4.20" -tauri = { version = "1.5.2", default-features = false, features = ["wry"], optional = true } - # leptos feature leptos = { version = "0.5.2", optional = true } -[dev-dependencies] -# comment when target is set to wasm in .cargo/config.toml +# only include if not wasm +[target.'cfg(not(target_family = "wasm"))'.dependencies] +tauri = { version = "1.5.2", default-features = false, features = ["wry"] } + +[target.'cfg(target_family = "wasm")'.dependencies] +tauri-interop-macro = { path = "./tauri-interop-macro", features = [ "wasm" ] } +# tauri-interop-macro = { version = "1.2.0", features = [ "wasm" ] } + +[target.'cfg(not(target_family = "wasm"))'.dev-dependencies] tauri = "1.5.2" [features] -default = [ "event", "tauri" ] -wasm = [] +# todo: remove default feature before publish +default = [ "event" ] event = [ "tauri-interop-macro/event" ] -tauri = [ "dep:tauri" ] leptos = [ "dep:leptos", "tauri-interop-macro/leptos" ] +# used to generated the missing documentation only generated for "target_family = wasm" +wasm = [] diff --git a/tauri-interop-macro/Cargo.toml b/tauri-interop-macro/Cargo.toml index fb1e4d8..7fcea5e 100644 --- a/tauri-interop-macro/Cargo.toml +++ b/tauri-interop-macro/Cargo.toml @@ -18,8 +18,12 @@ quote = "1.0" convert_case = "0.6.0" lazy_static = "1.4.0" serde = "1.0.193" +proc-macro2 = "1.0.75" [features] +# todo: remove default feature before publish default = [ "event" ] -event = [] -leptos = [] +leptos = [ "event" ] +event = [] +# feature to get info that context is wasm +wasm = [] diff --git a/test-project/Cargo.lock b/test-project/Cargo.lock index 6819c86..2bc03f0 100644 --- a/test-project/Cargo.lock +++ b/test-project/Cargo.lock @@ -2668,9 +2668,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" dependencies = [ "unicode-ident", ] @@ -3687,6 +3687,7 @@ version = "1.3.0" dependencies = [ "convert_case 0.6.0", "lazy_static", + "proc-macro2", "quote", "serde", "syn 2.0.39", diff --git a/test-project/Cargo.toml b/test-project/Cargo.toml index c0a788d..1611ae7 100644 --- a/test-project/Cargo.toml +++ b/test-project/Cargo.toml @@ -23,4 +23,4 @@ leptos = { version = "0.5.2", optional = true } [features] default = [ "leptos" ] -leptos = ["dep:leptos", "api/leptos"] +leptos = [ "dep:leptos", "api/leptos" ] diff --git a/test-project/api/Cargo.toml b/test-project/api/Cargo.toml index 125301d..f4ebad7 100644 --- a/test-project/api/Cargo.toml +++ b/test-project/api/Cargo.toml @@ -22,7 +22,7 @@ leptos = { version = "0.5.2", features = ["csr"], optional = true } [features] default = [ "host" ] -host = [ "dep:tauri", "tauri-interop/tauri" ] -wasm = [ "dep:js-sys", "dep:serde-wasm-bindgen", "dep:wasm-bindgen", "dep:wasm-bindgen-futures"] -leptos = [ "dep:leptos", "tauri-interop/leptos" ] -broken = [] +host = [ "dep:tauri" ] +wasm = [ "dep:js-sys", "dep:serde-wasm-bindgen", "dep:wasm-bindgen", "dep:wasm-bindgen-futures"] +leptos = [ "dep:leptos", "tauri-interop/leptos" ] +broken = [] From fa33dcecb89b11682926492ef8f3954cdc7e7e6d Mon Sep 17 00:00:00 2001 From: Felix Prillwitz <36958734+photovoltex@users.noreply.github.com> Date: Thu, 4 Jan 2024 21:11:42 +0100 Subject: [PATCH 09/60] change macro to derive --- tauri-interop-macro/src/lib.rs | 19 ++++++++----------- test-project/api/src/model.rs | 9 +++++---- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 024dcd4..6ff0ac3 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -16,18 +16,15 @@ use syn::{ #[cfg(feature = "event")] use syn::ItemStruct; -/// Conditionally adds [macro@listen_to] or [Emit] to a struct +/// Conditionally adds [Listen] or [Emit] to a struct #[cfg(feature = "event")] -#[proc_macro_attribute] -pub fn emit_or_listen(_: TokenStream, stream: TokenStream) -> TokenStream { - let stream_struct = parse_macro_input!(stream as ItemStruct); - let stream = quote! { - #[cfg_attr(target_family = "wasm", derive(tauri_interop::Listen))] - #[cfg_attr(not(target_family = "wasm"), derive(tauri_interop::Emit))] - #stream_struct - }; - - TokenStream::from(stream.to_token_stream()) +#[proc_macro_derive(Event)] +pub fn derive_event(stream: TokenStream) -> TokenStream { + if cfg!(feature = "wasm") { + derive_listen(stream) + } else { + derive_emit(stream) + } } /// function to build the same unique event name for wasm and host triplet diff --git a/test-project/api/src/model.rs b/test-project/api/src/model.rs index d6d43fa..ec205be 100644 --- a/test-project/api/src/model.rs +++ b/test-project/api/src/model.rs @@ -1,15 +1,16 @@ +use tauri_interop::Event; + #[allow(dead_code)] -#[derive(Default)] -#[tauri_interop::emit_or_listen] +#[derive(Default, Event)] pub struct TestState { foo: String, pub bar: bool, } // /// not allowed -// #[tauri_interop::emit_or_listen] +// #[derive(Default, Event)] // pub struct StructTupleState(String); // /// not allowed -// #[tauri_interop::emit_or_listen] +// #[derive(Default, Event)] // pub struct PanicState {} From 637880caf1f967004b226416ab871b4ec70aacd8 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Tue, 20 Feb 2024 21:33:00 +0100 Subject: [PATCH 10/60] improve derive attribute naming --- tauri-interop-macro/src/lib.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 6ff0ac3..5a1eb07 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -77,8 +77,8 @@ pub fn derive_emit(stream: TokenStream) -> TokenStream { #[allow(dead_code)] #[derive(::tauri_interop::EmitField)] #[parent(#struct_name)] - #[name(#field_ident)] - #[ty(#field_ty)] + #[field_name(#field_ident)] + #[field_ty(#field_ty)] pub struct #field_name; } }) @@ -139,12 +139,12 @@ fn get_field_values(attrs: Vec) -> FieldValues { let name = attrs .iter() - .find(|a| a.path().is_ident("name")) + .find(|a| a.path().is_ident("field_name")) .and_then(|name| name.parse_args().ok()); let ty = attrs .iter() - .find(|a| a.path().is_ident("ty")) + .find(|a| a.path().is_ident("field_ty")) .expect("expected ty attribute") .parse_args() .unwrap(); @@ -156,7 +156,7 @@ fn get_field_values(attrs: Vec) -> FieldValues { /// /// Used for host code generation. #[cfg(feature = "event")] -#[proc_macro_derive(EmitField, attributes(parent, name, ty))] +#[proc_macro_derive(EmitField, attributes(parent, field_name, field_ty))] pub fn derive_emit_field(stream: TokenStream) -> TokenStream { let derive_input = syn::parse_macro_input!(stream as DeriveInput); @@ -171,7 +171,7 @@ pub fn derive_emit_field(stream: TokenStream) -> TokenStream { type Type = #ty; fn emit(parent: &#parent, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { - use tauri::Manager; + use ::tauri::Manager; log::trace!( "Emitted event [{}::{}]", @@ -234,7 +234,7 @@ pub fn derive_listen(stream: TokenStream) -> TokenStream { quote! { #[derive(::tauri_interop::ListenField)] #[parent(#struct_ident)] - #[ty(#ty)] + #[field_ty(#ty)] pub struct #field_ident; } }) @@ -258,7 +258,7 @@ pub fn derive_listen(stream: TokenStream) -> TokenStream { /// /// Used for wasm code generation. #[cfg(feature = "event")] -#[proc_macro_derive(ListenField, attributes(parent, ty))] +#[proc_macro_derive(ListenField, attributes(parent, field_ty))] pub fn derive_listen_field(stream: TokenStream) -> TokenStream { let derive_input = syn::parse_macro_input!(stream as DeriveInput); From 0e5570c1a8c1844cb0fce39f6cbad9f40a1f71e0 Mon Sep 17 00:00:00 2001 From: Felix Prillwitz <36958734+photovoltex@users.noreply.github.com> Date: Thu, 4 Jan 2024 21:12:43 +0100 Subject: [PATCH 11/60] unify field traits --- src/event.rs | 46 +++++++++++++++++++++++++++++++++- src/event/emit.rs | 25 ++++-------------- src/event/listen.rs | 26 ++++++------------- src/lib.rs | 2 ++ tauri-interop-macro/src/lib.rs | 16 ++++++------ 5 files changed, 68 insertions(+), 47 deletions(-) diff --git a/src/event.rs b/src/event.rs index 4ee84cc..faa7e3b 100644 --- a/src/event.rs +++ b/src/event.rs @@ -1,6 +1,50 @@ +use serde::{Serialize, Deserialize}; +#[cfg(not(target_family = "wasm"))] +use tauri::{AppHandle, Wry, Error}; + /// traits for event emitting in the host code (feat: `tauri`) -#[cfg(any(not(target_family = "wasm"), feature = "tauri"))] +#[cfg(not(target_family = "wasm"))] pub mod emit; /// related generic struct and functions for autogenerated listen functions (target: `wasm` or feat: `wasm`) #[cfg(any(target_family = "wasm", feature = "wasm"))] pub mod listen; + +/// The trait which needs to be implemented for a [Field] +/// +/// Conditionally changes between [listen::Listen] and [emit::Emit] +/// +/// When compiled to "target_family = wasm" then following is true. +/// ``` +/// trait Parent = listen::Listen; +/// ``` +#[cfg(not(target_family = "wasm"))] +pub trait Parent = emit::Emit; +/// The trait which needs to be implemented for a [Field] +/// +/// Conditionally changes between [listen::Listen] and [emit::Emit] +#[cfg(target_family = "wasm")] +pub trait Parent = listen::Listen; + +/// Trait defining a [Field] to a related struct implementing [Parent] with the related [Field::Type] +pub trait Field

+where + P: Parent, + >::Type: Clone + Serialize + for<'de> Deserialize<'de>, +{ + /// The type of the field + type Type; + + #[cfg(any(target_family = "wasm", feature = "wasm"))] + /// The event of the field + const EVENT_NAME: &'static str; + + #[cfg(not(target_family = "wasm"))] + /// Emits event of the related field with their value + fn emit(parent: &P, handle: &AppHandle) -> Result<(), Error>; + + #[cfg(not(target_family = "wasm"))] + /// Updates the related field and emit its event + /// + /// Only required for "target_family = wasm" + fn update(s: &mut P, handle: &AppHandle, v: Self::Type) -> Result<(), Error>; +} diff --git a/src/event/emit.rs b/src/event/emit.rs index 63b1937..3abad17 100644 --- a/src/event/emit.rs +++ b/src/event/emit.rs @@ -1,21 +1,6 @@ -use serde::Serialize; use tauri::{AppHandle, Error, Wry}; -/// Trait defining a [EmitField] to a related struct implementing [Emit] with the related [EmitField::Type] -pub trait EmitField -where - Parent: Emit, - >::Type: Serialize + Clone, -{ - /// The type of the field - type Type; - - /// Emits event of the related field with their value - fn emit(parent: &Parent, handle: &AppHandle) -> Result<(), Error>; - - /// Updates the related field and emits it - fn update(parent: &mut Parent, handle: &AppHandle, v: Self::Type) -> Result<(), Error>; -} +use super::Field; /// Trait that defines the available event emitting methods pub trait Emit { @@ -23,16 +8,16 @@ pub trait Emit { fn emit_all(&self, handle: &AppHandle) -> Result<(), Error>; /// Emit a single field event - fn emit>(&self, handle: &AppHandle) -> Result<(), Error> + fn emit>(&self, handle: &AppHandle) -> Result<(), Error> where - Self: Sized; + Self: Sized + Emit; /// Update a single field and emit it afterward - fn update>( + fn update>( &mut self, handle: &AppHandle, field: F::Type, ) -> Result<(), Error> where - Self: Sized; + Self: Sized + Emit; } diff --git a/src/event/listen.rs b/src/event/listen.rs index 478f4cf..4c6437a 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -5,6 +5,8 @@ use wasm_bindgen::{closure::Closure, JsCast, JsValue}; #[cfg(feature = "leptos")] use leptos::{ReadSignal, WriteSignal}; +use super::Field; + /// The result type that is returned by [ListenHandle::register] pub type ListenResult<'s> = Result, ListenError>; @@ -113,42 +115,30 @@ impl<'s> ListenHandle<'s> { } } -/// Trait defining a [ListenField] to a related struct implementing [Listen] -/// with the related [ListenField::Type] and [ListenField::EVENT_NAME] -pub trait ListenField -where - S: Listen, - >::Type: Default + for<'de> Deserialize<'de>, -{ - /// The type of the field - type Type; - /// The event of the field - const EVENT_NAME: &'static str; -} /// Trait that defines the available listen methods pub trait Listen { - /// Registers an callback to a [ListenField] + /// Registers an callback to a [Field] /// /// Default Implementation: see [ListenHandle::register] - fn listen_to<'r, F: ListenField>( + fn listen_to<'r, F: Field>( callback: impl Fn(F::Type) + 'static, ) -> impl std::future::Future> where - Self: Sized, + Self: Sized + super::Parent, { ListenHandle::register(F::EVENT_NAME, callback) } - /// Creates a signal to a [ListenField] + /// Creates a signal to a [Field] /// /// Default Implementation: see [ListenHandle::use_register] #[cfg(feature = "leptos")] - fn use_field>( + fn use_field>( initial: F::Type, ) -> (ReadSignal, WriteSignal) where - Self: Sized, + Self: Sized + super::Parent, { ListenHandle::use_register(F::EVENT_NAME, initial) } diff --git a/src/lib.rs b/src/lib.rs index 29649c2..e727190 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,8 @@ #![warn(missing_docs)] #![doc = include_str!("../README.md")] +#![feature(trait_alias)] + /// wasm bindings for tauri's provided js functions (target: `wasm` or feat: `wasm`) #[cfg(any(target_family = "wasm", feature = "wasm"))] pub mod bindings; diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 5a1eb07..58f3f5a 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -85,13 +85,13 @@ pub fn derive_emit(stream: TokenStream) -> TokenStream { .collect::>(); let stream = quote! { - use tauri_interop::event::emit::{Emit, EmitField}; + use tauri_interop::event::{Field, emit::Emit}; pub mod #mod_name { use super::#struct_name; - use tauri_interop::event::emit::{Emit, EmitField}; + use tauri_interop::event::{Field, emit::Emit}; - // to each field a defined struct tuple is provided + // to each field a defined struct tuple is generated #( #struct_field_fields )* } @@ -104,14 +104,14 @@ pub fn derive_emit(stream: TokenStream) -> TokenStream { Ok(()) } - fn emit>(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> + fn emit>(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> where Self: Sized { F::emit(self, handle) } - fn update>(&mut self, handle: &::tauri::AppHandle, field: F::Type) -> Result<(), ::tauri::Error> + fn update>(&mut self, handle: &::tauri::AppHandle, field: F::Type) -> Result<(), ::tauri::Error> where Self: Sized { @@ -167,7 +167,7 @@ pub fn derive_emit_field(stream: TokenStream) -> TokenStream { let event_name = get_event_name(&parent, struct_name); let stream = quote! { - impl EmitField<#parent> for #struct_name { + impl Field<#parent> for #struct_name { type Type = #ty; fn emit(parent: &#parent, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { @@ -243,7 +243,7 @@ pub fn derive_listen(stream: TokenStream) -> TokenStream { let stream = quote! { pub mod #mod_name { use super::#struct_ident; - use ::tauri_interop::event::listen::ListenField; + use ::tauri_interop::event::Field; #( #struct_field_fields )* } @@ -268,7 +268,7 @@ pub fn derive_listen_field(stream: TokenStream) -> TokenStream { let event_name = get_event_name(&parent, &struct_name); let stream = quote! { - impl ListenField<#parent> for #struct_name { + impl Field<#parent> for #struct_name { type Type = #ty; const EVENT_NAME: &'static str = #event_name; } From 30d7e281478510e0d5bc6002fcdef7af987c8b7d Mon Sep 17 00:00:00 2001 From: photovoltex Date: Tue, 20 Feb 2024 22:14:28 +0100 Subject: [PATCH 12/60] enable ci for version branches --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c881d2e..b9d9162 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,9 +2,9 @@ name: Rust on: push: - branches: [ "main" ] + branches: [ "main", "v[0-9]+.[0-9]+.[0-9]+*" ] pull_request: - branches: [ "main" ] + branches: [ "main", "v[0-9]+.[0-9]+.[0-9]+*" ] env: CARGO_TERM_COLOR: always From 7673d572ebc8df1e3497af73f96eddea08bd4116 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Tue, 20 Feb 2024 22:35:02 +0100 Subject: [PATCH 13/60] fix test, update version --- Cargo.lock | 18 +++--------------- Cargo.toml | 6 +++--- README.md | 10 ++++++---- src/event.rs | 2 +- test-project/Cargo.lock | 6 ++---- 5 files changed, 15 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d2bd1a9..9abd483 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3528,7 +3528,7 @@ dependencies = [ [[package]] name = "tauri-interop" -version = "1.3.0" +version = "2.0.0-dev" dependencies = [ "js-sys", "leptos", @@ -3536,7 +3536,7 @@ dependencies = [ "serde", "serde-wasm-bindgen 0.6.1", "tauri", - "tauri-interop-macro 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tauri-interop-macro", "thiserror", "wasm-bindgen", "wasm-bindgen-futures", @@ -3544,7 +3544,7 @@ dependencies = [ [[package]] name = "tauri-interop-macro" -version = "1.3.0" +version = "2.0.0-dev" dependencies = [ "convert_case 0.6.0", "lazy_static", @@ -3554,18 +3554,6 @@ dependencies = [ "syn 2.0.39", ] -[[package]] -name = "tauri-interop-macro" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a35de4cedf72f55955a1078d4ae8d6acbb18fc9e69502fbb6f7710c37eb1d91" -dependencies = [ - "convert_case 0.6.0", - "lazy_static", - "quote", - "syn 2.0.39", -] - [[package]] name = "tauri-macros" version = "1.4.1" diff --git a/Cargo.toml b/Cargo.toml index f76d703..e0fb283 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] members = [ "tauri-interop-macro" ] package.edition = "2021" -package.version = "1.3.0" +package.version = "2.0.0-dev" package.keywords = [ "wasm", "tauri", "command", "event", "leptos" ] package.authors = [ "photovoltex" ] package.repository = "https://github.com/photovoltex/tauri-interop.git" @@ -20,8 +20,8 @@ description = "Easily connect your rust frontend and backend without writing dup readme = "README.md" [dependencies] -# tauri-interop-macro = { path = "./tauri-interop-macro" } -tauri-interop-macro = "1.3.0" +tauri-interop-macro = { path = "./tauri-interop-macro" } +#tauri-interop-macro = "2.0.0" js-sys = "0.3.65" serde = { version = "1.0.193", features = ["derive"] } diff --git a/README.md b/README.md index 49c909a..b70336a 100644 --- a/README.md +++ b/README.md @@ -105,8 +105,9 @@ async fn heavy_computation() { ### Event (Backend => Frontend Communication) Definition for both tauri supported triplet and wasm: ```rust -#[derive(Default)] -#[tauri_interop::emit_or_listen] +use tauri_interop::Event; + +#[derive(Default, Event)] pub struct Test { foo: String, pub bar: bool, @@ -123,8 +124,9 @@ which are used depending on the `target_family` To emit a variable from the above struct (which is mostly intended to be used as state) in the host triplet ```rust , ignore-wasm32-unknown-unknown -#[derive(Default)] -#[tauri_interop::emit_or_listen] +use tauri_interop::Event; + +#[derive(Default, Event)] pub struct Test { foo: String, pub bar: bool, diff --git a/src/event.rs b/src/event.rs index faa7e3b..29845ee 100644 --- a/src/event.rs +++ b/src/event.rs @@ -14,7 +14,7 @@ pub mod listen; /// Conditionally changes between [listen::Listen] and [emit::Emit] /// /// When compiled to "target_family = wasm" then following is true. -/// ``` +/// ```ignore /// trait Parent = listen::Listen; /// ``` #[cfg(not(target_family = "wasm"))] diff --git a/test-project/Cargo.lock b/test-project/Cargo.lock index a7b5a9e..52d9f41 100644 --- a/test-project/Cargo.lock +++ b/test-project/Cargo.lock @@ -3667,7 +3667,7 @@ dependencies = [ [[package]] name = "tauri-interop" -version = "1.3.0" +version = "2.0.0-dev" dependencies = [ "js-sys", "leptos", @@ -3683,9 +3683,7 @@ dependencies = [ [[package]] name = "tauri-interop-macro" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a35de4cedf72f55955a1078d4ae8d6acbb18fc9e69502fbb6f7710c37eb1d91" +version = "2.0.0-dev" dependencies = [ "convert_case 0.6.0", "lazy_static", From b658cbd2652ef237fa30d21f7cbaedf5ec8ff431 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Wed, 21 Feb 2024 00:45:03 +0100 Subject: [PATCH 14/60] split event macros into multiple files --- tauri-interop-macro/src/event.rs | 113 +++++++++++ tauri-interop-macro/src/event/emit.rs | 101 ++++++++++ tauri-interop-macro/src/event/listen.rs | 59 ++++++ tauri-interop-macro/src/lib.rs | 240 ++---------------------- 4 files changed, 287 insertions(+), 226 deletions(-) create mode 100644 tauri-interop-macro/src/event.rs create mode 100644 tauri-interop-macro/src/event/emit.rs create mode 100644 tauri-interop-macro/src/event/listen.rs diff --git a/tauri-interop-macro/src/event.rs b/tauri-interop-macro/src/event.rs new file mode 100644 index 0000000..0f8c9a0 --- /dev/null +++ b/tauri-interop-macro/src/event.rs @@ -0,0 +1,113 @@ +use std::fmt::Display; +use convert_case::{Case, Casing}; +use proc_macro2::Ident; +use quote::format_ident; +use syn::{ItemStruct, Type, Attribute, DeriveInput}; + +pub(crate) mod emit; +pub(crate) mod listen; + +struct Event { + ident: Ident, + mod_name: Ident, + fields: Vec, +} + +struct EventField { + name: Ident, + field: Ident, + ty: Type, +} + +fn prepare(stream_struct: ItemStruct) -> Event { + if stream_struct.fields.is_empty() { + panic!("No fields provided") + } + + if stream_struct + .fields + .iter() + .any(|field| field.ident.is_none()) + { + panic!("Tuple Structs aren't supported") + } + + let struct_name = &stream_struct.ident; + let mod_name = struct_name.to_string().to_case(Case::Snake); + + let fields = stream_struct + .fields + .iter() + .map(|field| { + let field_ident = field.ident.as_ref().unwrap(); + let field_name = field_ident.to_string().to_case(Case::Pascal); + + EventField { + name: field_ident.clone(), + field: format_ident!("{field_name}"), + ty: field.ty.clone(), + } + }) + .collect::>(); + + Event { + ident: struct_name.clone(), + mod_name: format_ident!("{mod_name}"), + fields, + } +} + +struct Field { + ident: Ident, + attributes: FieldAttributes, + event: String, +} + +struct FieldAttributes { + pub parent: Ident, + pub name: Option, + pub ty: Type, +} + +fn get_field_values(attrs: Vec) -> FieldAttributes { + let parent = attrs + .iter() + .find(|a| a.path().is_ident("parent")) + .expect("expected parent attribute") + .parse_args() + .unwrap(); + + let name = attrs + .iter() + .find(|a| a.path().is_ident("field_name")) + .and_then(|name| name.parse_args().ok()); + + let ty = attrs + .iter() + .find(|a| a.path().is_ident("field_ty")) + .expect("expected ty attribute") + .parse_args() + .unwrap(); + + FieldAttributes { parent, name, ty } +} + +/// function to build the same unique event name for wasm and host triplet +fn get_event_name(struct_name: &S, field_name: &F) -> String + where + S: Display, + F: Display, +{ + format!("{struct_name}::{field_name}") +} + +fn prepare_field(derive_input: DeriveInput) -> Field { + let ident = derive_input.ident.clone(); + let attributes = get_field_values(derive_input.attrs); + + Field{ + event: get_event_name(&attributes.parent, &ident), + ident, + attributes, + } +} diff --git a/tauri-interop-macro/src/event/emit.rs b/tauri-interop-macro/src/event/emit.rs new file mode 100644 index 0000000..c8f68a2 --- /dev/null +++ b/tauri-interop-macro/src/event/emit.rs @@ -0,0 +1,101 @@ +use crate::event::{Event, EventField, Field, FieldAttributes}; +use proc_macro::TokenStream; +use quote::{quote, ToTokens}; +use syn::{parse_macro_input, DeriveInput, ItemStruct}; + +pub fn derive(stream: TokenStream) -> TokenStream { + let stream_struct = parse_macro_input!(stream as ItemStruct); + let Event { + ident, + mod_name, + fields, + } = super::prepare(stream_struct); + + let emit_fields = fields.iter().map(|field| { + let EventField { name, field, ty } = field; + + quote! { + #[allow(dead_code)] + #[derive(::tauri_interop::EmitField)] + #[parent(#ident)] + #[field_name(#field)] + #[field_ty(#ty)] + pub struct #name; + } + }); + + let event_fields = fields.iter().map(|field| &field.name); + + let stream = quote! { + use tauri_interop::event::{Field, emit::Emit}; + + pub mod #mod_name { + use super::#ident; + use tauri_interop::event::{Field, emit::Emit}; + + // to each field a defined struct tuple is generated + #( #emit_fields )* + } + + impl Emit for #ident { + fn emit_all(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { + use #mod_name::*; + + #( #event_fields::emit(self, handle)?; )* + + Ok(()) + } + + fn emit>(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> + where + Self: Sized + { + F::emit(self, handle) + } + + fn update>(&mut self, handle: &::tauri::AppHandle, field: F::Type) -> Result<(), ::tauri::Error> + where + Self: Sized + { + F::update(self, handle, field) + } + } + }; + + TokenStream::from(stream.to_token_stream()) +} + +pub fn derive_field(stream: TokenStream) -> TokenStream { + let derive_input = syn::parse_macro_input!(stream as DeriveInput); + + let Field { + ident, + attributes, + event, + } = super::prepare_field(derive_input); + + let FieldAttributes { parent, name, ty } = attributes; + + name.as_ref().expect("name attribute was expected"); + + let stream = quote! { + impl Field<#parent> for #ident { + type Type = #ty; + + fn emit(parent: &#parent, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { + use ::tauri::Manager; + + log::trace!("Emitted event [{}]", #event); + + handle.emit_all(#event, parent.#name.clone()) + } + + fn update(parent: &mut #parent, handle: &::tauri::AppHandle, v: Self::Type) -> Result<(), ::tauri::Error> { + parent.#name = v; + Self::emit(parent, handle) + } + } + }; + + TokenStream::from(stream.to_token_stream()) +} diff --git a/tauri-interop-macro/src/event/listen.rs b/tauri-interop-macro/src/event/listen.rs new file mode 100644 index 0000000..9809ab0 --- /dev/null +++ b/tauri-interop-macro/src/event/listen.rs @@ -0,0 +1,59 @@ +use crate::event::{Event, EventField, Field, FieldAttributes}; +use proc_macro::TokenStream; +use quote::{quote, ToTokens}; +use syn::{parse_macro_input, ItemStruct, DeriveInput}; + +pub fn derive(stream: TokenStream) -> TokenStream { + let stream_struct = parse_macro_input!(stream as ItemStruct); + let Event { + ident, + mod_name, + fields, + } = super::prepare(stream_struct); + + let listen_fields = fields.iter().map(|field| { + let EventField { name, ty, .. } = field; + + quote! { + #[allow(dead_code)] + #[derive(::tauri_interop::ListenField)] + #[parent(#ident)] + #[field_ty(#ty)] + pub struct #name; + } + }); + + let stream = quote! { + pub mod #mod_name { + use super::#ident; + use ::tauri_interop::event::Field; + + #( #listen_fields )* + } + + impl ::tauri_interop::event::listen::Listen for #ident {} + }; + + TokenStream::from(stream.to_token_stream()) +} + +pub fn derive_field(stream: TokenStream) -> TokenStream { + let derive_input = syn::parse_macro_input!(stream as DeriveInput); + + let Field { + ident, + attributes, + event, + } = super::prepare_field(derive_input); + + let FieldAttributes { parent, ty, .. } = attributes; + + let stream = quote! { + impl Field<#parent> for #ident { + type Type = #ty; + const EVENT_NAME: &'static str = #event; + } + }; + + TokenStream::from(stream.to_token_stream()) +} diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 58f3f5a..a978c8c 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -1,42 +1,29 @@ #![warn(missing_docs)] //! The macros use by `tauri_interop` to generate dynamic code depending on the target -#[cfg(feature = "event")] -use std::fmt::Display; +mod event; + use std::{collections::BTreeSet, sync::Mutex}; use convert_case::{Case, Casing}; use proc_macro::{Span, TokenStream}; use quote::{format_ident, quote, ToTokens}; use syn::{ - parse_macro_input, punctuated::Punctuated, token::Comma, Attribute, DeriveInput, FnArg, Ident, - ItemFn, ItemUse, Lifetime, LifetimeParam, Pat, PathSegment, ReturnType, Signature, Type, + parse_macro_input, punctuated::Punctuated, token::Comma, FnArg, Ident, ItemFn, ItemUse, + Lifetime, LifetimeParam, Pat, PathSegment, ReturnType, Signature, Type, }; -#[cfg(feature = "event")] -use syn::ItemStruct; - /// Conditionally adds [Listen] or [Emit] to a struct #[cfg(feature = "event")] #[proc_macro_derive(Event)] pub fn derive_event(stream: TokenStream) -> TokenStream { if cfg!(feature = "wasm") { - derive_listen(stream) + event::listen::derive(stream) } else { - derive_emit(stream) + event::emit::derive(stream) } } -/// function to build the same unique event name for wasm and host triplet -#[cfg(feature = "event")] -fn get_event_name(struct_name: &S, field_name: &F) -> String -where - S: Display, - F: Display, -{ - format!("{struct_name}::{field_name}") -} - /// Generates a default `Emit` implementation for the given struct with a /// correlation enum, mod and field-structs for emitting a single field of /// the struct. @@ -45,111 +32,7 @@ where #[cfg(feature = "event")] #[proc_macro_derive(Emit)] pub fn derive_emit(stream: TokenStream) -> TokenStream { - let item_struct = parse_macro_input!(stream as ItemStruct); - - if item_struct.fields.is_empty() { - panic!("No fields provided") - } - - if item_struct.fields.iter().any(|field| field.ident.is_none()) { - panic!("Tuple Structs aren't supported") - } - - let struct_name = &item_struct.ident; - - let mod_name = struct_name.to_string().to_case(Case::Snake); - let mod_name = format_ident!("{mod_name}"); - - let mut fields = vec![]; - let struct_field_fields = item_struct - .fields - .iter() - .map(|field| { - let field_ident = field.ident.as_ref().unwrap(); - let field_name = field_ident.to_string().to_case(Case::Pascal); - - let field_name = format_ident!("{field_name}"); - let field_ty = &field.ty; - - fields.push(field_name.clone()); - - quote! { - #[allow(dead_code)] - #[derive(::tauri_interop::EmitField)] - #[parent(#struct_name)] - #[field_name(#field_ident)] - #[field_ty(#field_ty)] - pub struct #field_name; - } - }) - .collect::>(); - - let stream = quote! { - use tauri_interop::event::{Field, emit::Emit}; - - pub mod #mod_name { - use super::#struct_name; - use tauri_interop::event::{Field, emit::Emit}; - - // to each field a defined struct tuple is generated - #( #struct_field_fields )* - } - - impl Emit for #struct_name { - fn emit_all(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { - use #mod_name::*; - - #( #fields::emit(self, handle)?; )* - - Ok(()) - } - - fn emit>(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> - where - Self: Sized - { - F::emit(self, handle) - } - - fn update>(&mut self, handle: &::tauri::AppHandle, field: F::Type) -> Result<(), ::tauri::Error> - where - Self: Sized - { - F::update(self, handle, field) - } - } - }; - - TokenStream::from(stream.to_token_stream()) -} - -struct FieldValues { - pub parent: Ident, - pub name: Option, - pub ty: Type, -} - -fn get_field_values(attrs: Vec) -> FieldValues { - let parent = attrs - .iter() - .find(|a| a.path().is_ident("parent")) - .expect("expected parent attribute") - .parse_args() - .unwrap(); - - let name = attrs - .iter() - .find(|a| a.path().is_ident("field_name")) - .and_then(|name| name.parse_args().ok()); - - let ty = attrs - .iter() - .find(|a| a.path().is_ident("field_ty")) - .expect("expected ty attribute") - .parse_args() - .unwrap(); - - FieldValues { parent, name, ty } + event::emit::derive(stream) } /// Generates a default `EmitField` implementation for the given struct. @@ -158,38 +41,7 @@ fn get_field_values(attrs: Vec) -> FieldValues { #[cfg(feature = "event")] #[proc_macro_derive(EmitField, attributes(parent, field_name, field_ty))] pub fn derive_emit_field(stream: TokenStream) -> TokenStream { - let derive_input = syn::parse_macro_input!(stream as DeriveInput); - - let FieldValues { parent, name, ty } = get_field_values(derive_input.attrs); - let name = name.expect("name attribute was expected"); - let struct_name = &derive_input.ident; - - let event_name = get_event_name(&parent, struct_name); - - let stream = quote! { - impl Field<#parent> for #struct_name { - type Type = #ty; - - fn emit(parent: &#parent, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { - use ::tauri::Manager; - - log::trace!( - "Emitted event [{}::{}]", - stringify!(#parent), - stringify!(#struct_name), - ); - - handle.emit_all(#event_name, parent.#name.clone()) - } - - fn update(parent: &mut #parent, handle: &::tauri::AppHandle, v: Self::Type) -> Result<(), ::tauri::Error> { - parent.#name = v; - Self::emit(parent, handle) - } - } - }; - - TokenStream::from(stream.to_token_stream()) + event::emit::derive_field(stream) } /// Generates `listen_to_` functions for the given @@ -199,59 +51,7 @@ pub fn derive_emit_field(stream: TokenStream) -> TokenStream { #[cfg(feature = "event")] #[proc_macro_derive(Listen)] pub fn derive_listen(stream: TokenStream) -> TokenStream { - let stream_struct = parse_macro_input!(stream as ItemStruct); - - if stream_struct.fields.is_empty() { - panic!("No fields provided") - } - - if stream_struct - .fields - .iter() - .any(|field| field.ident.is_none()) - { - panic!("Tuple Structs aren't supported") - } - - let struct_ident = &stream_struct.ident; - - let mod_name = struct_ident.to_string().to_case(Case::Snake); - let mod_name = format_ident!("{mod_name}"); - - let struct_field_fields = stream_struct - .fields - .iter() - .map(|field| { - let ty = &field.ty; - let field_ident = field - .ident - .as_ref() - .expect("handled before") - .to_string() - .to_case(Case::Pascal); - let field_ident = format_ident!("{field_ident}"); - - quote! { - #[derive(::tauri_interop::ListenField)] - #[parent(#struct_ident)] - #[field_ty(#ty)] - pub struct #field_ident; - } - }) - .collect::>(); - - let stream = quote! { - pub mod #mod_name { - use super::#struct_ident; - use ::tauri_interop::event::Field; - - #( #struct_field_fields )* - } - - impl ::tauri_interop::event::listen::Listen for #struct_ident {} - }; - - TokenStream::from(stream.to_token_stream()) + event::listen::derive(stream) } /// Generates a default `ListenField` implementation for the given struct. @@ -260,21 +60,7 @@ pub fn derive_listen(stream: TokenStream) -> TokenStream { #[cfg(feature = "event")] #[proc_macro_derive(ListenField, attributes(parent, field_ty))] pub fn derive_listen_field(stream: TokenStream) -> TokenStream { - let derive_input = syn::parse_macro_input!(stream as DeriveInput); - - let FieldValues { parent, ty, .. } = get_field_values(derive_input.attrs); - let struct_name = &derive_input.ident; - - let event_name = get_event_name(&parent, &struct_name); - - let stream = quote! { - impl Field<#parent> for #struct_name { - type Type = #ty; - const EVENT_NAME: &'static str = #event_name; - } - }; - - TokenStream::from(stream.to_token_stream()) + event::listen::derive_field(stream) } lazy_static::lazy_static! { @@ -344,7 +130,7 @@ pub fn binding(_: TokenStream, stream: TokenStream) -> TokenStream { if let FnArg::Typed(ref mut typed) = fn_inputs { match typed.ty.as_mut() { Type::Path(path) if path.path.segments.iter().any(is_tauri_type) => { - return None + return None; } Type::Reference(reference) => { reference.lifetime = @@ -370,7 +156,9 @@ pub fn binding(_: TokenStream, stream: TokenStream) -> TokenStream { .push(syn::GenericParam::Lifetime(LifetimeParam::new(lt))) } - let async_ident = invoke_type.ne(&Invoke::Empty).then_some(format_ident!("async")); + let async_ident = invoke_type + .ne(&Invoke::Empty) + .then_some(format_ident!("async")); let invoke = match invoke_type { Invoke::Empty => quote!(::tauri_interop::bindings::invoke(stringify!(#ident), args);), Invoke::Async | Invoke::AsyncEmpty => { From 3e96e788cd6779739638551e5ec38e0a0a360398 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Wed, 21 Feb 2024 00:49:44 +0100 Subject: [PATCH 15/60] it's late... --- tauri-interop-macro/src/event.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tauri-interop-macro/src/event.rs b/tauri-interop-macro/src/event.rs index 0f8c9a0..88becf4 100644 --- a/tauri-interop-macro/src/event.rs +++ b/tauri-interop-macro/src/event.rs @@ -43,8 +43,8 @@ fn prepare(stream_struct: ItemStruct) -> Event { let field_name = field_ident.to_string().to_case(Case::Pascal); EventField { - name: field_ident.clone(), - field: format_ident!("{field_name}"), + name: format_ident!("{field_name}"), + field: field_ident.clone(), ty: field.ty.clone(), } }) From ce5729f5423e4acd1fa12ee9fc523c61d2c7d483 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Wed, 21 Feb 2024 19:58:51 +0100 Subject: [PATCH 16/60] rename fields to make more sense and formatting --- Cargo.toml | 2 +- src/event.rs | 6 +- src/event/listen.rs | 5 +- src/lib.rs | 1 - tauri-interop-macro/src/event.rs | 73 ++++++++++++------------- tauri-interop-macro/src/event/emit.rs | 53 ++++++++++-------- tauri-interop-macro/src/event/listen.rs | 42 ++++++++------ tauri-interop-macro/src/lib.rs | 4 +- 8 files changed, 97 insertions(+), 89 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e0fb283..7cd4b92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,5 +50,5 @@ tauri = "1.5.2" default = [ "event" ] event = [ "tauri-interop-macro/event" ] leptos = [ "dep:leptos", "tauri-interop-macro/leptos" ] -# used to generated the missing documentation only generated for "target_family = wasm" +# used to generate the missing documentation, otherwise it's only generated for "target_family = wasm" wasm = [] diff --git a/src/event.rs b/src/event.rs index 29845ee..2be5512 100644 --- a/src/event.rs +++ b/src/event.rs @@ -1,6 +1,6 @@ -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; #[cfg(not(target_family = "wasm"))] -use tauri::{AppHandle, Wry, Error}; +use tauri::{AppHandle, Error, Wry}; /// traits for event emitting in the host code (feat: `tauri`) #[cfg(not(target_family = "wasm"))] @@ -44,7 +44,7 @@ where #[cfg(not(target_family = "wasm"))] /// Updates the related field and emit its event - /// + /// /// Only required for "target_family = wasm" fn update(s: &mut P, handle: &AppHandle, v: Self::Type) -> Result<(), Error>; } diff --git a/src/event/listen.rs b/src/event/listen.rs index 4c6437a..26d5fc7 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -115,7 +115,6 @@ impl<'s> ListenHandle<'s> { } } - /// Trait that defines the available listen methods pub trait Listen { /// Registers an callback to a [Field] @@ -134,9 +133,7 @@ pub trait Listen { /// /// Default Implementation: see [ListenHandle::use_register] #[cfg(feature = "leptos")] - fn use_field>( - initial: F::Type, - ) -> (ReadSignal, WriteSignal) + fn use_field>(initial: F::Type) -> (ReadSignal, WriteSignal) where Self: Sized + super::Parent, { diff --git a/src/lib.rs b/src/lib.rs index e727190..f2ff837 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,5 @@ #![warn(missing_docs)] #![doc = include_str!("../README.md")] - #![feature(trait_alias)] /// wasm bindings for tauri's provided js functions (target: `wasm` or feat: `wasm`) diff --git a/tauri-interop-macro/src/event.rs b/tauri-interop-macro/src/event.rs index 88becf4..d691072 100644 --- a/tauri-interop-macro/src/event.rs +++ b/tauri-interop-macro/src/event.rs @@ -1,25 +1,24 @@ -use std::fmt::Display; use convert_case::{Case, Casing}; use proc_macro2::Ident; use quote::format_ident; -use syn::{ItemStruct, Type, Attribute, DeriveInput}; +use syn::{Attribute, DeriveInput, ItemStruct, Type}; pub(crate) mod emit; pub(crate) mod listen; -struct Event { - ident: Ident, +struct EventStruct { + name: Ident, mod_name: Ident, fields: Vec, } struct EventField { - name: Ident, - field: Ident, - ty: Type, + field_name: Ident, + parent_field_name: Ident, + parent_field_ty: Type, } -fn prepare(stream_struct: ItemStruct) -> Event { +fn prepare_event(stream_struct: ItemStruct) -> EventStruct { if stream_struct.fields.is_empty() { panic!("No fields provided") } @@ -32,41 +31,41 @@ fn prepare(stream_struct: ItemStruct) -> Event { panic!("Tuple Structs aren't supported") } - let struct_name = &stream_struct.ident; - let mod_name = struct_name.to_string().to_case(Case::Snake); + let name = stream_struct.ident.clone(); + let mod_name = format_ident!("{}", name.to_string().to_case(Case::Snake)); let fields = stream_struct .fields .iter() .map(|field| { let field_ident = field.ident.as_ref().unwrap(); - let field_name = field_ident.to_string().to_case(Case::Pascal); + let field_name = format_ident!("{}", field_ident.to_string().to_case(Case::Pascal)); EventField { - name: format_ident!("{field_name}"), - field: field_ident.clone(), - ty: field.ty.clone(), + field_name, + parent_field_name: field_ident.clone(), + parent_field_ty: field.ty.clone(), } }) .collect::>(); - Event { - ident: struct_name.clone(), - mod_name: format_ident!("{mod_name}"), + EventStruct { + name, + mod_name, fields, } } struct Field { - ident: Ident, + name: Ident, attributes: FieldAttributes, - event: String, + event_name: String, } struct FieldAttributes { pub parent: Ident, - pub name: Option, - pub ty: Type, + pub parent_field_name: Option, + pub parent_field_ty: Type, } fn get_field_values(attrs: Vec) -> FieldAttributes { @@ -77,37 +76,33 @@ fn get_field_values(attrs: Vec) -> FieldAttributes { .parse_args() .unwrap(); - let name = attrs + let parent_field_name = attrs .iter() - .find(|a| a.path().is_ident("field_name")) + .find(|a| a.path().is_ident("parent_field_name")) .and_then(|name| name.parse_args().ok()); - let ty = attrs + let parent_field_ty = attrs .iter() - .find(|a| a.path().is_ident("field_ty")) + .find(|a| a.path().is_ident("parent_field_ty")) .expect("expected ty attribute") .parse_args() .unwrap(); - FieldAttributes { parent, name, ty } -} - -/// function to build the same unique event name for wasm and host triplet -fn get_event_name(struct_name: &S, field_name: &F) -> String - where - S: Display, - F: Display, -{ - format!("{struct_name}::{field_name}") + FieldAttributes { + parent, + parent_field_name, + parent_field_ty, + } } fn prepare_field(derive_input: DeriveInput) -> Field { - let ident = derive_input.ident.clone(); + let name = derive_input.ident.clone(); let attributes = get_field_values(derive_input.attrs); + let event_name = format!("{}::{}", &attributes.parent, &name); - Field{ - event: get_event_name(&attributes.parent, &ident), - ident, + Field { + event_name, + name, attributes, } } diff --git a/tauri-interop-macro/src/event/emit.rs b/tauri-interop-macro/src/event/emit.rs index c8f68a2..62dd9c7 100644 --- a/tauri-interop-macro/src/event/emit.rs +++ b/tauri-interop-macro/src/event/emit.rs @@ -1,43 +1,46 @@ -use crate::event::{Event, EventField, Field, FieldAttributes}; +use crate::event::{EventField, EventStruct, Field, FieldAttributes}; use proc_macro::TokenStream; use quote::{quote, ToTokens}; use syn::{parse_macro_input, DeriveInput, ItemStruct}; pub fn derive(stream: TokenStream) -> TokenStream { let stream_struct = parse_macro_input!(stream as ItemStruct); - let Event { - ident, + let EventStruct { + name, mod_name, fields, - } = super::prepare(stream_struct); + } = super::prepare_event(stream_struct); let emit_fields = fields.iter().map(|field| { - let EventField { name, field, ty } = field; + let EventField { + field_name, + parent_field_name, + parent_field_ty, + } = field; quote! { #[allow(dead_code)] #[derive(::tauri_interop::EmitField)] - #[parent(#ident)] - #[field_name(#field)] - #[field_ty(#ty)] - pub struct #name; + #[parent(#name)] + #[parent_field_name(#parent_field_name)] + #[parent_field_ty(#parent_field_ty)] + pub struct #field_name; } }); - let event_fields = fields.iter().map(|field| &field.name); + let event_fields = fields.iter().map(|field| &field.field_name); let stream = quote! { use tauri_interop::event::{Field, emit::Emit}; pub mod #mod_name { - use super::#ident; + use super::#name; use tauri_interop::event::{Field, emit::Emit}; - // to each field a defined struct tuple is generated #( #emit_fields )* } - impl Emit for #ident { + impl Emit for #name { fn emit_all(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { use #mod_name::*; @@ -69,29 +72,35 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { let derive_input = syn::parse_macro_input!(stream as DeriveInput); let Field { - ident, + name, attributes, - event, + event_name, } = super::prepare_field(derive_input); - let FieldAttributes { parent, name, ty } = attributes; + let FieldAttributes { + parent, + parent_field_name, + parent_field_ty, + } = attributes; - name.as_ref().expect("name attribute was expected"); + parent_field_name + .as_ref() + .expect("name attribute was expected"); let stream = quote! { - impl Field<#parent> for #ident { - type Type = #ty; + impl Field<#parent> for #name { + type Type = #parent_field_ty; fn emit(parent: &#parent, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { use ::tauri::Manager; - log::trace!("Emitted event [{}]", #event); + log::trace!("Emitted event [{}]", #event_name); - handle.emit_all(#event, parent.#name.clone()) + handle.emit_all(#event_name, parent.#parent_field_name.clone()) } fn update(parent: &mut #parent, handle: &::tauri::AppHandle, v: Self::Type) -> Result<(), ::tauri::Error> { - parent.#name = v; + parent.#parent_field_name = v; Self::emit(parent, handle) } } diff --git a/tauri-interop-macro/src/event/listen.rs b/tauri-interop-macro/src/event/listen.rs index 9809ab0..b31a935 100644 --- a/tauri-interop-macro/src/event/listen.rs +++ b/tauri-interop-macro/src/event/listen.rs @@ -1,37 +1,41 @@ -use crate::event::{Event, EventField, Field, FieldAttributes}; +use crate::event::{EventField, EventStruct, Field, FieldAttributes}; use proc_macro::TokenStream; use quote::{quote, ToTokens}; -use syn::{parse_macro_input, ItemStruct, DeriveInput}; +use syn::{parse_macro_input, DeriveInput, ItemStruct}; pub fn derive(stream: TokenStream) -> TokenStream { let stream_struct = parse_macro_input!(stream as ItemStruct); - let Event { - ident, + let EventStruct { + name, mod_name, fields, - } = super::prepare(stream_struct); + } = super::prepare_event(stream_struct); let listen_fields = fields.iter().map(|field| { - let EventField { name, ty, .. } = field; + let EventField { + field_name, + parent_field_ty, + .. + } = field; quote! { #[allow(dead_code)] #[derive(::tauri_interop::ListenField)] - #[parent(#ident)] - #[field_ty(#ty)] - pub struct #name; + #[parent(#name)] + #[parent_field_ty(#parent_field_ty)] + pub struct #field_name; } }); let stream = quote! { pub mod #mod_name { - use super::#ident; + use super::#name; use ::tauri_interop::event::Field; #( #listen_fields )* } - impl ::tauri_interop::event::listen::Listen for #ident {} + impl ::tauri_interop::event::listen::Listen for #name {} }; TokenStream::from(stream.to_token_stream()) @@ -41,17 +45,21 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { let derive_input = syn::parse_macro_input!(stream as DeriveInput); let Field { - ident, + name, attributes, - event, + event_name, } = super::prepare_field(derive_input); - let FieldAttributes { parent, ty, .. } = attributes; + let FieldAttributes { + parent, + parent_field_ty, + .. + } = attributes; let stream = quote! { - impl Field<#parent> for #ident { - type Type = #ty; - const EVENT_NAME: &'static str = #event; + impl Field<#parent> for #name { + type Type = #parent_field_ty; + const EVENT_NAME: &'static str = #event_name; } }; diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index a978c8c..f330e53 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -39,7 +39,7 @@ pub fn derive_emit(stream: TokenStream) -> TokenStream { /// /// Used for host code generation. #[cfg(feature = "event")] -#[proc_macro_derive(EmitField, attributes(parent, field_name, field_ty))] +#[proc_macro_derive(EmitField, attributes(parent, parent_field_name, parent_field_ty))] pub fn derive_emit_field(stream: TokenStream) -> TokenStream { event::emit::derive_field(stream) } @@ -58,7 +58,7 @@ pub fn derive_listen(stream: TokenStream) -> TokenStream { /// /// Used for wasm code generation. #[cfg(feature = "event")] -#[proc_macro_derive(ListenField, attributes(parent, field_ty))] +#[proc_macro_derive(ListenField, attributes(parent, parent_field_ty))] pub fn derive_listen_field(stream: TokenStream) -> TokenStream { event::listen::derive_field(stream) } From 602140e5c6893620592f11e55ff53e2b88aba6a1 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Wed, 21 Feb 2024 22:41:04 +0100 Subject: [PATCH 17/60] split binding macro into multiple files --- tauri-interop-macro/src/command.rs | 59 ++++++++ tauri-interop-macro/src/command/wrapper.rs | 164 +++++++++++++++++++++ tauri-interop-macro/src/lib.rs | 144 ++---------------- 3 files changed, 236 insertions(+), 131 deletions(-) create mode 100644 tauri-interop-macro/src/command.rs create mode 100644 tauri-interop-macro/src/command/wrapper.rs diff --git a/tauri-interop-macro/src/command.rs b/tauri-interop-macro/src/command.rs new file mode 100644 index 0000000..e660341 --- /dev/null +++ b/tauri-interop-macro/src/command.rs @@ -0,0 +1,59 @@ +use crate::command::wrapper::{InvokeArgument, InvokeCommand}; +use proc_macro::TokenStream; +use proc_macro2::Ident; +use quote::{format_ident, quote, ToTokens}; +use syn::punctuated::Punctuated; +use syn::token::Comma; +use syn::{parse_macro_input, FnArg, ItemFn}; + +mod wrapper; + +pub fn convert_to_binding(stream: TokenStream) -> TokenStream { + let item_fn = parse_macro_input!(stream as ItemFn); + let InvokeCommand { + attributes, + name, + generics, + return_type, + invoke, + invoke_argument, + } = wrapper::prepare(item_fn); + + let InvokeArgument { + argument_name, + fields, + } = invoke_argument; + + let async_ident = invoke.as_async(); + let field_usage = fields + .iter() + .map(|field| field.ident.clone()) + .collect::>(); + let field_definitions = fields + .into_iter() + .map(|field| field.argument) + .collect::>(); + + let command_name = name.to_string(); + let args_ident = format_ident!("args"); + let invoke_binding = invoke.as_expr(command_name, &args_ident); + + let stream = quote! { + #[derive(::serde::Serialize, ::serde::Deserialize)] + struct #argument_name #generics { + #field_definitions + } + + #( #attributes )* + pub #async_ident fn #name #generics (#field_definitions) #return_type + { + let #args_ident = #argument_name { #field_usage }; + let #args_ident = ::serde_wasm_bindgen::to_value(&#args_ident) + .expect("serialized arguments"); + + #invoke_binding + } + }; + + TokenStream::from(stream.to_token_stream()) +} diff --git a/tauri-interop-macro/src/command/wrapper.rs b/tauri-interop-macro/src/command/wrapper.rs new file mode 100644 index 0000000..d0e001d --- /dev/null +++ b/tauri-interop-macro/src/command/wrapper.rs @@ -0,0 +1,164 @@ +use convert_case::{Case, Casing}; +use proc_macro::Span; +use proc_macro2::Ident; +use quote::{format_ident, ToTokens}; +use syn::{ + parse_quote, Attribute, Expr, ExprPath, FnArg, GenericParam, Generics, ItemFn, Lifetime, + LifetimeParam, Pat, PathSegment, ReturnType, Signature, Type, TypePath, +}; + +#[derive(PartialEq)] +pub enum Invoke { + Empty, + AsyncEmpty, + Async, + AsyncResult, +} + +impl Invoke { + pub fn as_async(&self) -> Option { + self.ne(&Invoke::Empty).then_some(format_ident!("async")) + } + + pub fn as_expr(&self, cmd_name: String, arg_name: &Ident) -> Expr { + let expr: ExprPath = match self { + Invoke::Empty => parse_quote!(bindings::invoke), + Invoke::Async | Invoke::AsyncEmpty => parse_quote!(command::async_invoke), + Invoke::AsyncResult => parse_quote!(command::invoke_catch), + }; + + let call = parse_quote!( ::tauri_interop::#expr(#cmd_name, #arg_name) ); + + if self.as_async().is_some() { + Expr::Await(parse_quote!(#call.await)) + } else { + Expr::Call(call) + } + } +} + +fn is_result(segment: &PathSegment) -> bool { + segment.ident.to_string().as_str() == "Result" +} + +fn determine_invoke(return_type: &ReturnType, is_async: bool) -> Invoke { + match return_type { + ReturnType::Default => { + if is_async { + Invoke::AsyncEmpty + } else { + Invoke::Empty + } + } + ReturnType::Type(_, ty) => match ty.as_ref() { + // fixme: if it's an single ident, catch isn't needed this could probably be a problem later + Type::Path(path) if path.path.segments.iter().any(is_result) => Invoke::AsyncResult, + Type::Path(_) => Invoke::Async, + others => panic!("no support for '{}'", others.to_token_stream()), + }, + } +} + +const ARGUMENT_LIFETIME: &str = "'arg_lifetime"; + +fn new_arg_lt() -> Lifetime { + Lifetime::new(ARGUMENT_LIFETIME, Span::call_site().into()) +} + +const TAURI_TYPES: [&str; 3] = ["State", "AppHandle", "Window"]; + +fn any_tauri(ty_path: &TypePath) -> bool { + ty_path + .path + .segments + .iter() + .any(|segment| TAURI_TYPES.contains(&segment.ident.to_string().as_str())) +} + +pub struct InvokeCommand { + pub attributes: Vec, + pub name: Ident, + pub generics: Generics, + pub return_type: ReturnType, + pub invoke: Invoke, + pub invoke_argument: InvokeArgument, +} + +pub struct InvokeArgument { + pub argument_name: Ident, + pub fields: Vec, +} + +pub struct FieldArg { + pub ident: Ident, + pub argument: FnArg, + requires_lifetime: bool, +} + +pub fn prepare(function: ItemFn) -> InvokeCommand { + let ItemFn { + attrs: attributes, + sig, + .. + } = function; + + let Signature { + ident: name, + mut generics, + inputs, + output: return_type, + asyncness, + .. + } = sig; + + let filtered_fields = inputs + .into_iter() + .filter_map(|mut fn_arg| { + let typed = match fn_arg { + FnArg::Typed(ref mut typed) => typed, + _ => return None, + }; + + if matches!(typed.ty.as_ref(), Type::Path(ty_path) if any_tauri(ty_path)) { + return None; + } + + let req_lf = if let Type::Reference(ty_ref) = typed.ty.as_mut() { + ty_ref.lifetime = Some(new_arg_lt()); + true + } else { + false + }; + + match typed.pat.as_ref() { + Pat::Ident(ident) => Some(FieldArg { + ident: ident.ident.clone(), + argument: fn_arg, + requires_lifetime: req_lf, + }), + _ => None, + } + }) + .collect::>(); + + if filtered_fields.iter().any(|field| field.requires_lifetime) { + generics + .params + .push(GenericParam::Lifetime(LifetimeParam::new(new_arg_lt()))) + } + + let invoke = determine_invoke(&return_type, asyncness.is_some()); + let argument_name = format_ident!("{}Args", name.to_string().to_case(Case::Pascal)); + + InvokeCommand { + attributes, + name, + generics, + return_type, + invoke, + invoke_argument: InvokeArgument { + argument_name, + fields: filtered_fields, + }, + } +} diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index f330e53..4db6bcc 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -1,17 +1,14 @@ #![warn(missing_docs)] //! The macros use by `tauri_interop` to generate dynamic code depending on the target +mod command; mod event; use std::{collections::BTreeSet, sync::Mutex}; -use convert_case::{Case, Casing}; -use proc_macro::{Span, TokenStream}; +use proc_macro::TokenStream; use quote::{format_ident, quote, ToTokens}; -use syn::{ - parse_macro_input, punctuated::Punctuated, token::Comma, FnArg, Ident, ItemFn, ItemUse, - Lifetime, LifetimeParam, Pat, PathSegment, ReturnType, Signature, Type, -}; +use syn::{parse_macro_input, punctuated::Punctuated, token::Comma, Ident, ItemFn, ItemUse}; /// Conditionally adds [Listen] or [Emit] to a struct #[cfg(feature = "event")] @@ -63,136 +60,19 @@ pub fn derive_listen_field(stream: TokenStream) -> TokenStream { event::listen::derive_field(stream) } -lazy_static::lazy_static! { - static ref HANDLER_LIST: Mutex> = Mutex::new(Default::default()); -} - -const ARGUMENT_LIFETIME: &str = "'arg_lifetime"; -const TAURI_TYPES: [&str; 3] = ["State", "AppHandle", "Window"]; - -/// really cheap filter for TAURI_TYPES -/// -/// didn't figure out a way to only include tauri:: Structs/Enums and -/// for now all ident name like the above TAURI_TYPES are filtered -fn is_tauri_type(segment: &PathSegment) -> bool { - TAURI_TYPES.contains(&segment.ident.to_string().as_str()) -} - -/// simple filter for determining if the given path is a [Result] -fn is_result(segment: &PathSegment) -> bool { - segment.ident.to_string().as_str() == "Result" -} - -#[derive(PartialEq)] -enum Invoke { - Empty, - AsyncEmpty, - Async, - AsyncResult, -} - /// Generates the wasm counterpart to a defined `tauri::command` #[proc_macro_attribute] -pub fn binding(_: TokenStream, stream: TokenStream) -> TokenStream { - let ItemFn { attrs, sig, .. } = parse_macro_input!(stream as ItemFn); - - let Signature { - ident, - mut generics, - inputs, - variadic, - output, - asyncness, - .. - } = sig; - - let invoke_type = match &output { - ReturnType::Default => { - if asyncness.is_some() { - Invoke::AsyncEmpty - } else { - Invoke::Empty - } - } - ReturnType::Type(_, ty) => match ty.as_ref() { - // fixme: if it's an single ident, catch isn't needed this could probably be a problem later - Type::Path(path) if path.path.segments.iter().any(is_result) => Invoke::AsyncResult, - Type::Path(_) => Invoke::Async, - others => panic!("no support for '{}'", others.to_token_stream()), - }, - }; - - let mut requires_lifetime_constrain = false; - let mut args_inputs: Punctuated = Punctuated::new(); - let wasm_inputs = inputs - .into_iter() - .filter_map(|mut fn_inputs| { - if let FnArg::Typed(ref mut typed) = fn_inputs { - match typed.ty.as_mut() { - Type::Path(path) if path.path.segments.iter().any(is_tauri_type) => { - return None; - } - Type::Reference(reference) => { - reference.lifetime = - Some(Lifetime::new(ARGUMENT_LIFETIME, Span::call_site().into())); - requires_lifetime_constrain = true; - } - _ => {} - } - - if let Pat::Ident(ident) = typed.pat.as_ref() { - args_inputs.push(ident.ident.clone()); - return Some(fn_inputs); - } - } - None - }) - .collect::>(); - - if requires_lifetime_constrain { - let lt = Lifetime::new(ARGUMENT_LIFETIME, Span::call_site().into()); - generics - .params - .push(syn::GenericParam::Lifetime(LifetimeParam::new(lt))) - } - - let async_ident = invoke_type - .ne(&Invoke::Empty) - .then_some(format_ident!("async")); - let invoke = match invoke_type { - Invoke::Empty => quote!(::tauri_interop::bindings::invoke(stringify!(#ident), args);), - Invoke::Async | Invoke::AsyncEmpty => { - quote!(::tauri_interop::command::async_invoke(stringify!(#ident), args).await) - } - Invoke::AsyncResult => { - quote!(::tauri_interop::command::invoke_catch(stringify!(#ident), args).await) - } - }; - - let args_ident = format_ident!("{}Args", ident.to_string().to_case(Case::Pascal)); - let stream = quote! { - #[derive(::serde::Serialize, ::serde::Deserialize)] - struct #args_ident #generics { - #wasm_inputs - } - - #( #attrs )* - pub #async_ident fn #ident #generics (#wasm_inputs) #variadic #output - { - let args = #args_ident { #args_inputs }; - let args = ::serde_wasm_bindgen::to_value(&args) - .expect("serialized arguments"); - - #invoke - } - }; +pub fn binding(_attributes: TokenStream, stream: TokenStream) -> TokenStream { + command::convert_to_binding(stream) +} - TokenStream::from(stream.to_token_stream()) +lazy_static::lazy_static! { + static ref HANDLER_LIST: Mutex> = Mutex::new(Default::default()); } -/// Conditionally adds [macro@binding] or `tauri::command` to a struct +/// Conditionally adds `tauri_interop::binding` or `tauri::command` to a struct #[proc_macro_attribute] -pub fn command(_: TokenStream, stream: TokenStream) -> TokenStream { +pub fn command(_attributes: TokenStream, stream: TokenStream) -> TokenStream { let fn_item = syn::parse::(stream).unwrap(); HANDLER_LIST @@ -209,8 +89,10 @@ pub fn command(_: TokenStream, stream: TokenStream) -> TokenStream { TokenStream::from(command_macro.to_token_stream()) } -/// Collects all commands annotated with [macro@command] and +/// Collects all commands annotated with `tauri_interop::command` and /// provides these with a `get_handlers()` in the current namespace +/// +/// The provided function isn't available for wasm #[proc_macro] pub fn collect_commands(_: TokenStream) -> TokenStream { let handler = HANDLER_LIST.lock().unwrap(); From 1d95553b662b689670f229772114c86308f38448 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Wed, 21 Feb 2024 22:40:24 +0100 Subject: [PATCH 18/60] update readme --- README.md | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index b70336a..2fb4036 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ ![License](https://img.shields.io/crates/l/tauri-interop.svg) What this crate tries to achieve: -- generate a equal wasm-function from your defined `tauri::command` -- collect all defined `tauri::command`s without adding them manually -- a simplified way to sending events from tauri and receiving them in the frontend +- generate a equal wasm-function for your defined `tauri::command` +- collecting all defined `tauri::command`s without adding them manually +- a way to sending events from tauri and receiving them in the frontend ## Basic usage: @@ -41,8 +41,8 @@ Using `tauri_interop::command` does two things: - it provides the command with two macros which are used depending on the `target_family` - `tauri_interop::binding` is used when compiling to `wasm` - `tauri::command` is used otherwise -- it adds an entry to `tauri_interop::collect_commands!()` so that the generated - `get_commands()` function includes/registers the given commands for the tauri context +- it adds an entry to `tauri_interop::collect_commands!()` so that the generated `get_handlers()` function includes the given commands for the tauri context + - the function is not generated when targeting `wasm` The defined command above can then be used in wasm as below. Due to receiving data from tauri via a promise, the command response has to be awaited. @@ -64,13 +64,13 @@ fn main() { #### Command representation Host/Wasm -- technically all commands need to be of type `Result` - - where E is a error that the command isn't defined, if not explicitly redefined via the return type - - this error will show up in the web console, so there shouldn't be a problem ignoring it +- the returned type of the wasm binding should be 1:1 the same type as send from the "backend" + - technically all commands need to be of type `Result` because there is always the possibility of a command getting called, that isn't registered in the context of tauri + - when using `tauri_interop::collect_commands!()` this possibility is near fully removed + - for convenience, we ignore that possibility, and even if the error occurs it will be logged into the console - all arguments with type "State", "AppHandle" and "Window" are removed automatically > the current implementation relies on the name of the type and can not separate between a > tauri::State and a self defined "State" struct -- asynchronous commands are values as is seen [async-commands](https://tauri.app/v1/guides/features/command#async-commands) for a detail explanation ```rust , ignore-wasm32-unknown-unknown // let _: () = trigger_something(); @@ -95,7 +95,7 @@ async fn asynchronous_execution(change: bool) -> Result { } } -// let _wait_for_completion: () = asynchronous_execution(true).await; +// let _wait_for_completion: () = heavy_computation().await; #[tauri_interop::command] async fn heavy_computation() { std::thread::sleep(std::time::Duration::from_millis(5000)) @@ -117,10 +117,9 @@ pub struct Test { fn main() {} ``` -Using `tauri_interop::emit_or_listen` does provides the command with two macros, -which are used depending on the `target_family` - - `tauri_interop::listen_to` is used when compiling to `wasm` - - derive trait `tauri_interop::Emit` is used otherwise +When using the derive macro `tauri_interop::Event` it expands depending on the `target_family` to + - derive trait `tauri_interop::Listen` (when compiling to `wasm`) + - derive trait `tauri_interop::Emit` (otherwise) To emit a variable from the above struct (which is mostly intended to be used as state) in the host triplet ```rust , ignore-wasm32-unknown-unknown @@ -162,7 +161,9 @@ fn main() { the above emitted value can then be received in wasm as: ```rust , ignore -#[tauri_interop::emit_or_listen] +use tauri_interop::Event; + +#[derive(Default, Event)] pub struct Test { foo: String, pub bar: bool, @@ -175,17 +176,19 @@ async fn main() { } ``` -The `liste_handle` contains the provided closure and the "unlisten" method. It has to be hold in scope as long +The `ListenHandle` contains the provided closure and the "unlisten" method. It has to be hold in scope as long as the event should be received. Dropping it will automatically detach the closure from the event. See [cmd.rs](./test-project/api/src/cmd.rs) for other example how it could be used. #### Feature: leptos When the `leptos` feature is enabled it will add additional `use_` methods on the provided struct. -These methods take care of the required initial asynchron call to register the listener and will hold the +These methods take care of the required initial asynchronous call to register the listener and will hold the handle in scope as long as the component is rendered. ```rust , ignore -#[tauri_interop::emit_or_listen] +use tauri_interop::Event; + +#[derive(Default, Event)] pub struct Test { foo: String, pub bar: bool, From cc7819187778325bb9e3044ba5febb2298111576 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 22 Feb 2024 20:51:52 +0100 Subject: [PATCH 19/60] remove seemingly useless lifetime --- src/event/listen.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/event/listen.rs b/src/event/listen.rs index 26d5fc7..6c62947 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -8,7 +8,7 @@ use leptos::{ReadSignal, WriteSignal}; use super::Field; /// The result type that is returned by [ListenHandle::register] -pub type ListenResult<'s> = Result, ListenError>; +pub type ListenResult = Result; /// The generic payload received from [crate::bindings::listen] used for deserialization #[derive(Debug, Serialize, Deserialize)] @@ -30,26 +30,26 @@ pub enum ListenError { } /// Handle which holds the unlisten function and the correlated callback -pub struct ListenHandle<'s> { - /// The callback which is invoke for the registered event +pub struct ListenHandle { + /// The callback which is invoked for the registered event /// /// The callback will get detached, when the handle is dropped. Alternatively it can /// also be given to the js runtime (see [Closure] `into_js_value`/`forget`). This isn't /// recommended because this will leak memory by default. pub closure: Option>, - event: &'s str, + event: &'static str, detach_fn: Function, } -impl Drop for ListenHandle<'_> { +impl Drop for ListenHandle { fn drop(&mut self) { self.detach_listen() } } -impl<'s> ListenHandle<'s> { +impl<'s> ListenHandle { /// Registers a given event with the correlation callback and returns a [ListenResult] - pub async fn register(event: &str, callback: impl Fn(T) + 'static) -> ListenResult + pub async fn register(event: &'static str, callback: impl Fn(T) + 'static) -> ListenResult where T: for<'de> Deserialize<'de>, { @@ -120,9 +120,9 @@ pub trait Listen { /// Registers an callback to a [Field] /// /// Default Implementation: see [ListenHandle::register] - fn listen_to<'r, F: Field>( + fn listen_to>( callback: impl Fn(F::Type) + 'static, - ) -> impl std::future::Future> + ) -> impl std::future::Future where Self: Sized + super::Parent, { From 7f621fb2303b8b60a246ed54b06bb6221a0ea33e Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 22 Feb 2024 21:38:07 +0100 Subject: [PATCH 20/60] change Deserialize to DeserializeOwned --- src/command.rs | 12 ++++++------ src/event.rs | 5 +++-- src/event/listen.rs | 8 ++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/command.rs b/src/command.rs index 9016197..03b5f49 100644 --- a/src/command.rs +++ b/src/command.rs @@ -1,22 +1,22 @@ -use serde::Deserialize; +use serde::de::DeserializeOwned; use wasm_bindgen::JsValue; /// Wrapper for [crate::bindings::async_invoke], to return an -/// expected [Deserialize] object +/// expected [DeserializeOwned] object pub async fn async_invoke(command: &str, args: JsValue) -> T where - T: for<'de> Deserialize<'de>, + T: DeserializeOwned, { let value = crate::bindings::async_invoke(command, args).await; serde_wasm_bindgen::from_value(value).expect("conversion error") } /// Wrapper for [crate::bindings::invoke_catch], to return an -/// expected [Result] where T and E is [Deserialize] +/// expected [Result] where [T] and [E] is [DeserializeOwned] pub async fn invoke_catch(command: &str, args: JsValue) -> Result where - T: for<'de> Deserialize<'de>, - E: for<'de> Deserialize<'de>, + T: DeserializeOwned, + E: DeserializeOwned, { crate::bindings::invoke_catch(command, args) .await diff --git a/src/event.rs b/src/event.rs index 2be5512..3a5a2f5 100644 --- a/src/event.rs +++ b/src/event.rs @@ -1,4 +1,4 @@ -use serde::{Deserialize, Serialize}; +use serde::{de::DeserializeOwned, Serialize}; #[cfg(not(target_family = "wasm"))] use tauri::{AppHandle, Error, Wry}; @@ -19,6 +19,7 @@ pub mod listen; /// ``` #[cfg(not(target_family = "wasm"))] pub trait Parent = emit::Emit; + /// The trait which needs to be implemented for a [Field] /// /// Conditionally changes between [listen::Listen] and [emit::Emit] @@ -29,7 +30,7 @@ pub trait Parent = listen::Listen; pub trait Field

where P: Parent, - >::Type: Clone + Serialize + for<'de> Deserialize<'de>, + >::Type: Clone + Serialize + DeserializeOwned, { /// The type of the field type Type; diff --git a/src/event/listen.rs b/src/event/listen.rs index 6c62947..66b7172 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -1,5 +1,5 @@ use js_sys::Function; -use serde::{Deserialize, Serialize}; +use serde::{de::DeserializeOwned, Deserialize, Serialize}; use wasm_bindgen::{closure::Closure, JsCast, JsValue}; #[cfg(feature = "leptos")] @@ -51,9 +51,9 @@ impl<'s> ListenHandle { /// Registers a given event with the correlation callback and returns a [ListenResult] pub async fn register(event: &'static str, callback: impl Fn(T) + 'static) -> ListenResult where - T: for<'de> Deserialize<'de>, + T: DeserializeOwned, { - let closure = wasm_bindgen::prelude::Closure::new(move |value| { + let closure = Closure::new(move |value| { let payload: Payload = serde_wasm_bindgen::from_value(value) .map_err(|why| log::error!("{why:?}")) .expect("passed value from backend didn't serialized correctly"); @@ -91,7 +91,7 @@ impl<'s> ListenHandle { #[cfg(feature = "leptos")] pub fn use_register(event: &'static str, initial_value: T) -> (ReadSignal, WriteSignal) where - T: for<'de> Deserialize<'de>, + T: DeserializeOwned, { use leptos::SignalSet; From 314b47da58a0a01c19b52d522068dc24a77b4269 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 22 Feb 2024 21:52:22 +0100 Subject: [PATCH 21/60] removed remaining lifetime --- src/event/listen.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/event/listen.rs b/src/event/listen.rs index 66b7172..fa58ed8 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -47,7 +47,7 @@ impl Drop for ListenHandle { } } -impl<'s> ListenHandle { +impl ListenHandle { /// Registers a given event with the correlation callback and returns a [ListenResult] pub async fn register(event: &'static str, callback: impl Fn(T) + 'static) -> ListenResult where From 3659bcc0db2e31865fe2dc388b4f841e38b79336 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 22 Feb 2024 21:58:38 +0100 Subject: [PATCH 22/60] cleanup --- src/event/listen.rs | 5 ++--- src/lib.rs | 4 ++-- tauri-interop-macro/src/command.rs | 8 ++++---- tauri-interop-macro/src/command/wrapper.rs | 5 +++-- tauri-interop-macro/src/event/emit.rs | 4 +++- tauri-interop-macro/src/event/listen.rs | 4 +++- tauri-interop-macro/src/lib.rs | 8 ++++---- 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/event/listen.rs b/src/event/listen.rs index fa58ed8..1192b3a 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -1,9 +1,8 @@ use js_sys::Function; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; -use wasm_bindgen::{closure::Closure, JsCast, JsValue}; - #[cfg(feature = "leptos")] use leptos::{ReadSignal, WriteSignal}; +use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use wasm_bindgen::{closure::Closure, JsCast, JsValue}; use super::Field; diff --git a/src/lib.rs b/src/lib.rs index f2ff837..b9d0a9c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,6 +2,8 @@ #![doc = include_str!("../README.md")] #![feature(trait_alias)] +pub use tauri_interop_macro::*; + /// wasm bindings for tauri's provided js functions (target: `wasm` or feat: `wasm`) #[cfg(any(target_family = "wasm", feature = "wasm"))] pub mod bindings; @@ -11,5 +13,3 @@ pub mod command; /// event traits and overall logic for event emitting and listening (feat: `event`) #[cfg(feature = "event")] pub mod event; - -pub use tauri_interop_macro::*; diff --git a/tauri-interop-macro/src/command.rs b/tauri-interop-macro/src/command.rs index e660341..5f8eca3 100644 --- a/tauri-interop-macro/src/command.rs +++ b/tauri-interop-macro/src/command.rs @@ -1,10 +1,10 @@ -use crate::command::wrapper::{InvokeArgument, InvokeCommand}; use proc_macro::TokenStream; + use proc_macro2::Ident; use quote::{format_ident, quote, ToTokens}; -use syn::punctuated::Punctuated; -use syn::token::Comma; -use syn::{parse_macro_input, FnArg, ItemFn}; +use syn::{parse_macro_input, punctuated::Punctuated, token::Comma, FnArg, ItemFn}; + +use crate::command::wrapper::{InvokeArgument, InvokeCommand}; mod wrapper; diff --git a/tauri-interop-macro/src/command/wrapper.rs b/tauri-interop-macro/src/command/wrapper.rs index d0e001d..46b9134 100644 --- a/tauri-interop-macro/src/command/wrapper.rs +++ b/tauri-interop-macro/src/command/wrapper.rs @@ -1,10 +1,11 @@ -use convert_case::{Case, Casing}; use proc_macro::Span; + +use convert_case::{Case, Casing}; use proc_macro2::Ident; use quote::{format_ident, ToTokens}; use syn::{ parse_quote, Attribute, Expr, ExprPath, FnArg, GenericParam, Generics, ItemFn, Lifetime, - LifetimeParam, Pat, PathSegment, ReturnType, Signature, Type, TypePath, + LifetimeParam, Pat, ReturnType, Signature, Type, TypePath, }; #[derive(PartialEq)] diff --git a/tauri-interop-macro/src/event/emit.rs b/tauri-interop-macro/src/event/emit.rs index 62dd9c7..49b7bb5 100644 --- a/tauri-interop-macro/src/event/emit.rs +++ b/tauri-interop-macro/src/event/emit.rs @@ -1,8 +1,10 @@ -use crate::event::{EventField, EventStruct, Field, FieldAttributes}; use proc_macro::TokenStream; + use quote::{quote, ToTokens}; use syn::{parse_macro_input, DeriveInput, ItemStruct}; +use crate::event::{EventField, EventStruct, Field, FieldAttributes}; + pub fn derive(stream: TokenStream) -> TokenStream { let stream_struct = parse_macro_input!(stream as ItemStruct); let EventStruct { diff --git a/tauri-interop-macro/src/event/listen.rs b/tauri-interop-macro/src/event/listen.rs index b31a935..9d26a47 100644 --- a/tauri-interop-macro/src/event/listen.rs +++ b/tauri-interop-macro/src/event/listen.rs @@ -1,8 +1,10 @@ -use crate::event::{EventField, EventStruct, Field, FieldAttributes}; use proc_macro::TokenStream; + use quote::{quote, ToTokens}; use syn::{parse_macro_input, DeriveInput, ItemStruct}; +use crate::event::{EventField, EventStruct, Field, FieldAttributes}; + pub fn derive(stream: TokenStream) -> TokenStream { let stream_struct = parse_macro_input!(stream as ItemStruct); let EventStruct { diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 4db6bcc..b2daa0b 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -1,15 +1,15 @@ #![warn(missing_docs)] //! The macros use by `tauri_interop` to generate dynamic code depending on the target -mod command; -mod event; - +use proc_macro::TokenStream; use std::{collections::BTreeSet, sync::Mutex}; -use proc_macro::TokenStream; use quote::{format_ident, quote, ToTokens}; use syn::{parse_macro_input, punctuated::Punctuated, token::Comma, Ident, ItemFn, ItemUse}; +mod command; +mod event; + /// Conditionally adds [Listen] or [Emit] to a struct #[cfg(feature = "event")] #[proc_macro_derive(Event)] From 36ef0a7647245bea609b29aec6067c69cfa4e474 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 22 Feb 2024 23:06:28 +0100 Subject: [PATCH 23/60] new solution to exclude tauri types --- README.md | 7 ++-- src/bindings.rs | 20 ---------- src/command.rs | 37 ++++++++---------- src/command/bindings.rs | 44 ++++++++++++++++++++++ src/event/listen.rs | 10 +++-- src/lib.rs | 6 +-- tauri-interop-macro/src/command/wrapper.rs | 38 +++++++++---------- test-project/api/src/cmd.rs | 4 +- 8 files changed, 90 insertions(+), 76 deletions(-) delete mode 100644 src/bindings.rs create mode 100644 src/command/bindings.rs diff --git a/README.md b/README.md index 2fb4036..dc9087d 100644 --- a/README.md +++ b/README.md @@ -68,9 +68,10 @@ fn main() { - technically all commands need to be of type `Result` because there is always the possibility of a command getting called, that isn't registered in the context of tauri - when using `tauri_interop::collect_commands!()` this possibility is near fully removed - for convenience, we ignore that possibility, and even if the error occurs it will be logged into the console -- all arguments with type "State", "AppHandle" and "Window" are removed automatically -> the current implementation relies on the name of the type and can not separate between a -> tauri::State and a self defined "State" struct +- all arguments with `tauri` in their name (case-insensitive) are removed automatically as argument in a defined command + - the crate itself provides type aliases for usable tauri types in a command +- most return types are automatically determined + - when using a return type with `Result` in the name, the function will also return a result ```rust , ignore-wasm32-unknown-unknown // let _: () = trigger_something(); diff --git a/src/bindings.rs b/src/bindings.rs deleted file mode 100644 index d815484..0000000 --- a/src/bindings.rs +++ /dev/null @@ -1,20 +0,0 @@ -use wasm_bindgen::prelude::*; - -#[wasm_bindgen] -extern "C" { - #[wasm_bindgen(js_name = "invoke", js_namespace = ["window", "__TAURI__", "tauri"])] - pub fn invoke(cmd: &str, args: JsValue); - - #[wasm_bindgen(js_name = "invoke", js_namespace = ["window", "__TAURI__", "tauri"])] - pub async fn async_invoke(cmd: &str, args: JsValue) -> JsValue; - - #[wasm_bindgen(catch, js_name = "invoke", js_namespace = ["window", "__TAURI__", "tauri"])] - pub async fn invoke_catch(cmd: &str, args: JsValue) -> Result; - - #[cfg(feature = "event")] - #[wasm_bindgen(catch, js_namespace = ["window", "__TAURI__", "event"])] - pub async fn listen( - event: &str, - closure: &Closure, - ) -> Result; -} diff --git a/src/command.rs b/src/command.rs index 03b5f49..afe018f 100644 --- a/src/command.rs +++ b/src/command.rs @@ -1,25 +1,18 @@ -use serde::de::DeserializeOwned; -use wasm_bindgen::JsValue; +#[cfg(not(target_family = "wasm"))] +pub use type_aliases::*; -/// Wrapper for [crate::bindings::async_invoke], to return an -/// expected [DeserializeOwned] object -pub async fn async_invoke(command: &str, args: JsValue) -> T -where - T: DeserializeOwned, -{ - let value = crate::bindings::async_invoke(command, args).await; - serde_wasm_bindgen::from_value(value).expect("conversion error") -} +/// wasm bindings for tauri's provided js functions (target: `wasm` or feat: `wasm`) +#[cfg(any(target_family = "wasm", feature = "wasm"))] +pub mod bindings; + +#[cfg(not(target_family = "wasm"))] +mod type_aliases { + /// Type alias to easier identify [tauri::State] via [tauri_interop_macro::command] macro + pub type TauriState<'r, T> = tauri::State<'r, T>; + + /// Type alias to easier identify [tauri::Window] via [tauri_interop_macro::command] macro + pub type TauriWindow = tauri::Window; -/// Wrapper for [crate::bindings::invoke_catch], to return an -/// expected [Result] where [T] and [E] is [DeserializeOwned] -pub async fn invoke_catch(command: &str, args: JsValue) -> Result -where - T: DeserializeOwned, - E: DeserializeOwned, -{ - crate::bindings::invoke_catch(command, args) - .await - .map(|value| serde_wasm_bindgen::from_value(value).expect("ok: conversion error")) - .map_err(|value| serde_wasm_bindgen::from_value(value).expect("err: conversion error")) + /// Type alias to easier identify [tauri::AppHandle] via [tauri_interop_macro::command] macro + pub type TauriAppHandle = tauri::AppHandle; } diff --git a/src/command/bindings.rs b/src/command/bindings.rs new file mode 100644 index 0000000..b0ea9f7 --- /dev/null +++ b/src/command/bindings.rs @@ -0,0 +1,44 @@ +use serde::de::DeserializeOwned; +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(js_name = "invoke", js_namespace = ["window", "__TAURI__", "tauri"])] + pub fn invoke(cmd: &str, args: JsValue); + + #[wasm_bindgen(js_name = "invoke", js_namespace = ["window", "__TAURI__", "tauri"])] + pub async fn async_invoke(cmd: &str, args: JsValue) -> JsValue; + + #[wasm_bindgen(catch, js_name = "invoke", js_namespace = ["window", "__TAURI__", "tauri"])] + pub async fn invoke_catch(cmd: &str, args: JsValue) -> Result; + + #[cfg(feature = "event")] + #[wasm_bindgen(catch, js_namespace = ["window", "__TAURI__", "event"])] + pub async fn listen( + event: &str, + closure: &Closure, + ) -> Result; +} + +/// Wrapper for [async_invoke], to return an +/// expected [DeserializeOwned] object +pub async fn wrapped_async_invoke(command: &str, args: JsValue) -> T +where + T: DeserializeOwned, +{ + let value = async_invoke(command, args).await; + serde_wasm_bindgen::from_value(value).expect("conversion error") +} + +/// Wrapper for [invoke_catch], to return an +/// expected [Result] where [T] and [E] is [DeserializeOwned] +pub async fn wrapped_invoke_catch(command: &str, args: JsValue) -> Result +where + T: DeserializeOwned, + E: DeserializeOwned, +{ + invoke_catch(command, args) + .await + .map(|value| serde_wasm_bindgen::from_value(value).expect("ok: conversion error")) + .map_err(|value| serde_wasm_bindgen::from_value(value).expect("err: conversion error")) +} diff --git a/src/event/listen.rs b/src/event/listen.rs index 1192b3a..6b171c8 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -4,12 +4,14 @@ use leptos::{ReadSignal, WriteSignal}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use wasm_bindgen::{closure::Closure, JsCast, JsValue}; +use crate::command::bindings::listen; + use super::Field; /// The result type that is returned by [ListenHandle::register] pub type ListenResult = Result; -/// The generic payload received from [crate::bindings::listen] used for deserialization +/// The generic payload received from [listen] used for deserialization #[derive(Debug, Serialize, Deserialize)] pub struct Payload { payload: T, @@ -19,11 +21,11 @@ pub struct Payload { /// Errors that can occur during registering the callback in [ListenHandle::register] #[derive(Debug, thiserror::Error)] pub enum ListenError { - /// The promised given by [crate::bindings::listen] failed to resolve + /// The promised given by [listen] failed to resolve #[error("The promise to register the listener failed: {0:?}")] PromiseFailed(JsValue), /// The returned value from the resolved [js_sys::Promise] retrieved - /// from [crate::bindings::listen] wasn't a function + /// from [listen] wasn't a function #[error("The function to detach the listener wasn't a function: {0:?}")] NotAFunction(JsValue), } @@ -60,7 +62,7 @@ impl ListenHandle { callback(payload.payload) }); - let detach_fn = crate::bindings::listen(event, &closure) + let detach_fn = listen(event, &closure) .await .map_err(ListenError::PromiseFailed)? .dyn_into() diff --git a/src/lib.rs b/src/lib.rs index b9d0a9c..93fd0fc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,11 +4,7 @@ pub use tauri_interop_macro::*; -/// wasm bindings for tauri's provided js functions (target: `wasm` or feat: `wasm`) -#[cfg(any(target_family = "wasm", feature = "wasm"))] -pub mod bindings; -/// wrapped bindings for easier use in the generated wasm commands (target: `wasm` or feat: `wasm`) -#[cfg(any(target_family = "wasm", feature = "wasm"))] +/// wrapped bindings for easier use in the generated wasm commands pub mod command; /// event traits and overall logic for event emitting and listening (feat: `event`) #[cfg(feature = "event")] diff --git a/tauri-interop-macro/src/command/wrapper.rs b/tauri-interop-macro/src/command/wrapper.rs index 46b9134..e67fb71 100644 --- a/tauri-interop-macro/src/command/wrapper.rs +++ b/tauri-interop-macro/src/command/wrapper.rs @@ -4,8 +4,8 @@ use convert_case::{Case, Casing}; use proc_macro2::Ident; use quote::{format_ident, ToTokens}; use syn::{ - parse_quote, Attribute, Expr, ExprPath, FnArg, GenericParam, Generics, ItemFn, Lifetime, - LifetimeParam, Pat, ReturnType, Signature, Type, TypePath, + parse_quote, Attribute, Expr, FnArg, GenericParam, Generics, ItemFn, Lifetime, LifetimeParam, + Pat, ReturnType, Signature, Type, TypePath, }; #[derive(PartialEq)] @@ -22,13 +22,13 @@ impl Invoke { } pub fn as_expr(&self, cmd_name: String, arg_name: &Ident) -> Expr { - let expr: ExprPath = match self { - Invoke::Empty => parse_quote!(bindings::invoke), - Invoke::Async | Invoke::AsyncEmpty => parse_quote!(command::async_invoke), - Invoke::AsyncResult => parse_quote!(command::invoke_catch), + let expr: Ident = match self { + Invoke::Empty => parse_quote!(invoke), + Invoke::Async | Invoke::AsyncEmpty => parse_quote!(wrapped_async_invoke), + Invoke::AsyncResult => parse_quote!(wrapped_invoke_catch), }; - let call = parse_quote!( ::tauri_interop::#expr(#cmd_name, #arg_name) ); + let call = parse_quote!( ::tauri_interop::command::bindings::#expr(#cmd_name, #arg_name) ); if self.as_async().is_some() { Expr::Await(parse_quote!(#call.await)) @@ -38,22 +38,20 @@ impl Invoke { } } -fn is_result(segment: &PathSegment) -> bool { - segment.ident.to_string().as_str() == "Result" +fn is_result(type_path: &TypePath) -> bool { + type_path + .path + .segments + .iter() + .any(|segment| "Result".eq(&segment.ident.to_string())) } fn determine_invoke(return_type: &ReturnType, is_async: bool) -> Invoke { match return_type { - ReturnType::Default => { - if is_async { - Invoke::AsyncEmpty - } else { - Invoke::Empty - } - } + ReturnType::Default if is_async => Invoke::AsyncEmpty, + ReturnType::Default => Invoke::Empty, ReturnType::Type(_, ty) => match ty.as_ref() { - // fixme: if it's an single ident, catch isn't needed this could probably be a problem later - Type::Path(path) if path.path.segments.iter().any(is_result) => Invoke::AsyncResult, + Type::Path(path) if is_result(path) => Invoke::AsyncResult, Type::Path(_) => Invoke::Async, others => panic!("no support for '{}'", others.to_token_stream()), }, @@ -66,14 +64,12 @@ fn new_arg_lt() -> Lifetime { Lifetime::new(ARGUMENT_LIFETIME, Span::call_site().into()) } -const TAURI_TYPES: [&str; 3] = ["State", "AppHandle", "Window"]; - fn any_tauri(ty_path: &TypePath) -> bool { ty_path .path .segments .iter() - .any(|segment| TAURI_TYPES.contains(&segment.ident.to_string().as_str())) + .any(|segment| segment.ident.to_string().to_lowercase().contains("tauri")) } pub struct InvokeCommand { diff --git a/test-project/api/src/cmd.rs b/test-project/api/src/cmd.rs index 8aad1fa..f94c37a 100644 --- a/test-project/api/src/cmd.rs +++ b/test-project/api/src/cmd.rs @@ -2,6 +2,8 @@ use crate::model::TestState; #[tauri_interop::host_usage] use std::sync::RwLock; +#[tauri_interop::host_usage] +use tauri_interop::command::{TauriAppHandle, TauriState}; #[tauri_interop::command] pub fn empty_invoke() {} @@ -38,7 +40,7 @@ pub fn result_test() -> Result { } #[tauri_interop::command] -pub fn emit(state: tauri::State>, handle: tauri::AppHandle) { +pub fn emit(state: TauriState>, handle: TauriAppHandle) { use tauri_interop::event::emit::Emit; // newly generated mod use crate::model::test_state; From dbced71f4c1e8910a1b4dc6975c810a01fc08ca9 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Fri, 23 Feb 2024 00:10:16 +0100 Subject: [PATCH 24/60] reduced usage of host/wasm_usage macro --- tauri-interop-macro/src/lib.rs | 63 +++++++++++++++++++--------------- test-project/api/src/cmd.rs | 11 +++--- 2 files changed, 43 insertions(+), 31 deletions(-) diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 4db6bcc..15de9fc 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -1,14 +1,17 @@ #![warn(missing_docs)] //! The macros use by `tauri_interop` to generate dynamic code depending on the target -mod command; -mod event; - +use proc_macro::TokenStream; use std::{collections::BTreeSet, sync::Mutex}; -use proc_macro::TokenStream; use quote::{format_ident, quote, ToTokens}; -use syn::{parse_macro_input, punctuated::Punctuated, token::Comma, Ident, ItemFn, ItemUse}; +use syn::{ + parse::Parser, parse_macro_input, punctuated::Punctuated, token::Comma, Ident, ItemFn, ItemUse, + Token, +}; + +mod command; +mod event; /// Conditionally adds [Listen] or [Emit] to a struct #[cfg(feature = "event")] @@ -73,7 +76,7 @@ lazy_static::lazy_static! { /// Conditionally adds `tauri_interop::binding` or `tauri::command` to a struct #[proc_macro_attribute] pub fn command(_attributes: TokenStream, stream: TokenStream) -> TokenStream { - let fn_item = syn::parse::(stream).unwrap(); + let fn_item = parse_macro_input!(stream as ItemFn); HANDLER_LIST .lock() @@ -115,28 +118,34 @@ pub fn collect_commands(_: TokenStream) -> TokenStream { TokenStream::from(stream.to_token_stream()) } -/// Simple macro to include given `use` only in host -#[proc_macro_attribute] -pub fn host_usage(_: TokenStream, stream: TokenStream) -> TokenStream { - let item_use = parse_macro_input!(stream as ItemUse); - - let command_macro = quote! { - #[cfg(not(target_family = "wasm"))] - #item_use - }; - - TokenStream::from(command_macro.to_token_stream()) +fn collect_uses(stream: TokenStream) -> Vec { + Punctuated::::parse_terminated + .parse2(stream.into()) + .unwrap() + .into_iter() + .collect::>() } -/// Simple macro to include given `use` only in wasm -#[proc_macro_attribute] -pub fn wasm_usage(_: TokenStream, stream: TokenStream) -> TokenStream { - let item_use = parse_macro_input!(stream as ItemUse); - - let command_macro = quote! { - #[cfg(target_family = "wasm")] - #item_use - }; +/// Simple macro to include multiple imports (seperated by `|`) not in wasm +#[proc_macro] +pub fn host_usage(stream: TokenStream) -> TokenStream { + let uses = collect_uses(stream); + TokenStream::from(quote! { + #( + #[cfg(not(target_family = "wasm"))] + #uses + )* + }) +} - TokenStream::from(command_macro.to_token_stream()) +/// Simple macro to include multiple imports (seperated by `|`) only in wasm +#[proc_macro] +pub fn wasm_usage(stream: TokenStream) -> TokenStream { + let uses = collect_uses(stream); + TokenStream::from(quote! { + #( + #[cfg(target_family = "wasm")] + #uses + )* + }) } diff --git a/test-project/api/src/cmd.rs b/test-project/api/src/cmd.rs index 8aad1fa..7ac27c8 100644 --- a/test-project/api/src/cmd.rs +++ b/test-project/api/src/cmd.rs @@ -1,7 +1,10 @@ -#[tauri_interop::host_usage] -use crate::model::TestState; -#[tauri_interop::host_usage] -use std::sync::RwLock; +tauri_interop::host_usage! { + // usually u don't need to exclude the crates inside the api, + // but when the type is removed because it is wrapped in a State, + // it produced a warning... and we don't like warnings, so we exclude it + use crate::model::TestState; + | use std::sync::RwLock; +} #[tauri_interop::command] pub fn empty_invoke() {} From 0a786e1d950dab64af89c8d1af25d2c395af4720 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Mon, 26 Feb 2024 20:26:54 +0100 Subject: [PATCH 25/60] add section explaining the _usage macros --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2fb4036..b9a8333 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ ![License](https://img.shields.io/crates/l/tauri-interop.svg) What this crate tries to achieve: -- generate a equal wasm-function for your defined `tauri::command` +- generate an equal wasm-function for your defined `tauri::command` - collecting all defined `tauri::command`s without adding them manually -- a way to sending events from tauri and receiving them in the frontend +- a convenient way to send events from tauri and receiving them in the frontend ## Basic usage: @@ -17,6 +17,52 @@ What this crate tries to achieve: > Some examples in this documentation can't be executed with doctests due to > required wasm target and tauri modified environment (see [withGlobalTauri](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri)) +### QOL macros + +This crate also adds some quality-of-life macros. These are intended to ease the drawbacks of compiling to +multiple architectures. + +#### Conditional `use` +Because most crates are not intended to be compiled to wasm and most wasm crates are not intended to be compiled to +the host-triplet they have to be excluded in each others compile process. The usual process to exclude uses for a certain +architecture would look something like this: + +```rust +#[cfg(not(target_family = "wasm"))] +use tauri::AppHandle; + +#[tauri_interop::command] +pub fn empty_invoke(_handle: AppHandle) {} +``` + +**General usage:** + +With the help of `tauri_interop::host_usage!()` and `tauri_interop::wasm_usage!()` we don't need to remember which +attribute we have to add and can just convert the above to the following: + +```rust +tauri_interop::host_usage! { + use tauri::AppHandle; +} + +#[tauri_interop::command] +pub fn empty_invoke(_handle: AppHandle) {} +``` + +**Multiple `use` usage:** + +When multiple `use` should be excluded, they need to be separated by a single pipe (`|`). For example: + +```rust +tauri_interop::host_usage! { + use tauri::State; + | use std::sync::RwLock; +} + +#[tauri_interop::command] +pub fn empty_invoke(_state: State>) {} +``` + ### Command (Frontend => Backend Communication) > For more examples see [cmd.rs](./test-project/api/src/cmd.rs) in test-project From e95b606a6b55ee5776b15dc42ed6eb4153287b34 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Mon, 26 Feb 2024 21:32:21 +0100 Subject: [PATCH 26/60] update docs and separated aliases --- README.md | 14 +++++++++----- src/command.rs | 11 +---------- src/command/bindings.rs | 2 +- src/command/type_aliases.rs | 10 ++++++++++ 4 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 src/command/type_aliases.rs diff --git a/README.md b/README.md index dc9087d..ab10293 100644 --- a/README.md +++ b/README.md @@ -65,13 +65,17 @@ fn main() { #### Command representation Host/Wasm - the returned type of the wasm binding should be 1:1 the same type as send from the "backend" - - technically all commands need to be of type `Result` because there is always the possibility of a command getting called, that isn't registered in the context of tauri - - when using `tauri_interop::collect_commands!()` this possibility is near fully removed + - technically all commands need to be of type `Result` because there is always the possibility of a command + getting called, that isn't registered in the context of tauri + - when using `tauri_interop::collect_commands!()` this possibility is fully™️ removed - for convenience, we ignore that possibility, and even if the error occurs it will be logged into the console -- all arguments with `tauri` in their name (case-insensitive) are removed automatically as argument in a defined command - - the crate itself provides type aliases for usable tauri types in a command +- all arguments with `tauri` in their name (case-insensitive) are removed as argument in a defined command + - that includes `tauri::*` usages and `Tauri` named types + - the crate itself provides type aliases for tauri types usable in a command (see [type_aliases](./src/command/type_aliases.rs)) - most return types are automatically determined - - when using a return type with `Result` in the name, the function will also return a result + - when using a return type with `Result` in the name, the function will also return a `Result` + - that also means, if you create a type alias for `Result` and don't include `Result` in the name of the alias, + it will not map the `Result` correctly ```rust , ignore-wasm32-unknown-unknown // let _: () = trigger_something(); diff --git a/src/command.rs b/src/command.rs index afe018f..140efd8 100644 --- a/src/command.rs +++ b/src/command.rs @@ -6,13 +6,4 @@ pub use type_aliases::*; pub mod bindings; #[cfg(not(target_family = "wasm"))] -mod type_aliases { - /// Type alias to easier identify [tauri::State] via [tauri_interop_macro::command] macro - pub type TauriState<'r, T> = tauri::State<'r, T>; - - /// Type alias to easier identify [tauri::Window] via [tauri_interop_macro::command] macro - pub type TauriWindow = tauri::Window; - - /// Type alias to easier identify [tauri::AppHandle] via [tauri_interop_macro::command] macro - pub type TauriAppHandle = tauri::AppHandle; -} +mod type_aliases; diff --git a/src/command/bindings.rs b/src/command/bindings.rs index b0ea9f7..2ef2b3a 100644 --- a/src/command/bindings.rs +++ b/src/command/bindings.rs @@ -31,7 +31,7 @@ where } /// Wrapper for [invoke_catch], to return an -/// expected [Result] where [T] and [E] is [DeserializeOwned] +/// expected [Result] where both generics are [DeserializeOwned] pub async fn wrapped_invoke_catch(command: &str, args: JsValue) -> Result where T: DeserializeOwned, diff --git a/src/command/type_aliases.rs b/src/command/type_aliases.rs new file mode 100644 index 0000000..5e30eda --- /dev/null +++ b/src/command/type_aliases.rs @@ -0,0 +1,10 @@ +use tauri::{AppHandle, State, Window}; + +/// Type alias to easier identify [State] via [tauri_interop_macro::command] macro +pub type TauriState<'r, T> = State<'r, T>; + +/// Type alias to easier identify [Window] via [tauri_interop_macro::command] macro +pub type TauriWindow = Window; + +/// Type alias to easier identify [AppHandle] via [tauri_interop_macro::command] macro +pub type TauriAppHandle = AppHandle; From e6f0e2a22bbb1fe25735a7e7b6dbc6b57b496beb Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 29 Feb 2024 20:48:53 +0100 Subject: [PATCH 27/60] change parsed type to allow attributes --- tauri-interop-macro/src/event.rs | 28 +++++++++++++++---------- tauri-interop-macro/src/event/emit.rs | 4 ++-- tauri-interop-macro/src/event/listen.rs | 4 ++-- tauri-interop-macro/src/lib.rs | 6 +++--- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/tauri-interop-macro/src/event.rs b/tauri-interop-macro/src/event.rs index d691072..d5f6a20 100644 --- a/tauri-interop-macro/src/event.rs +++ b/tauri-interop-macro/src/event.rs @@ -1,7 +1,7 @@ use convert_case::{Case, Casing}; use proc_macro2::Ident; use quote::format_ident; -use syn::{Attribute, DeriveInput, ItemStruct, Type}; +use syn::{Attribute, Data, DeriveInput, Type}; pub(crate) mod emit; pub(crate) mod listen; @@ -18,23 +18,29 @@ struct EventField { parent_field_ty: Type, } -fn prepare_event(stream_struct: ItemStruct) -> EventStruct { - if stream_struct.fields.is_empty() { +fn prepare_event(derive_input: DeriveInput) -> EventStruct { + let data_struct = match derive_input.data { + Data::Struct(data_struct) => data_struct, + _ => panic!("The macro only works with structs"), + }; + + if data_struct.fields.is_empty() { panic!("No fields provided") } - if stream_struct - .fields - .iter() - .any(|field| field.ident.is_none()) - { + if data_struct.fields.iter().any(|field| field.ident.is_none()) { panic!("Tuple Structs aren't supported") } - let name = stream_struct.ident.clone(); - let mod_name = format_ident!("{}", name.to_string().to_case(Case::Snake)); + let name = derive_input.ident.clone(); + let mod_name = derive_input + .attrs + .iter() + .find(|attr| attr.path().is_ident("mod_name")) + .map(|attr| attr.parse_args::().unwrap()) + .unwrap_or(format_ident!("{}", name.to_string().to_case(Case::Snake))); - let fields = stream_struct + let fields = data_struct .fields .iter() .map(|field| { diff --git a/tauri-interop-macro/src/event/emit.rs b/tauri-interop-macro/src/event/emit.rs index 49b7bb5..9e44bc9 100644 --- a/tauri-interop-macro/src/event/emit.rs +++ b/tauri-interop-macro/src/event/emit.rs @@ -1,12 +1,12 @@ use proc_macro::TokenStream; use quote::{quote, ToTokens}; -use syn::{parse_macro_input, DeriveInput, ItemStruct}; +use syn::{parse_macro_input, DeriveInput}; use crate::event::{EventField, EventStruct, Field, FieldAttributes}; pub fn derive(stream: TokenStream) -> TokenStream { - let stream_struct = parse_macro_input!(stream as ItemStruct); + let stream_struct = parse_macro_input!(stream as DeriveInput); let EventStruct { name, mod_name, diff --git a/tauri-interop-macro/src/event/listen.rs b/tauri-interop-macro/src/event/listen.rs index 9d26a47..10c92bd 100644 --- a/tauri-interop-macro/src/event/listen.rs +++ b/tauri-interop-macro/src/event/listen.rs @@ -1,12 +1,12 @@ use proc_macro::TokenStream; use quote::{quote, ToTokens}; -use syn::{parse_macro_input, DeriveInput, ItemStruct}; +use syn::{parse_macro_input, DeriveInput}; use crate::event::{EventField, EventStruct, Field, FieldAttributes}; pub fn derive(stream: TokenStream) -> TokenStream { - let stream_struct = parse_macro_input!(stream as ItemStruct); + let stream_struct = parse_macro_input!(stream as DeriveInput); let EventStruct { name, mod_name, diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 15de9fc..526da83 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -15,7 +15,7 @@ mod event; /// Conditionally adds [Listen] or [Emit] to a struct #[cfg(feature = "event")] -#[proc_macro_derive(Event)] +#[proc_macro_derive(Event, attributes(mod_name))] pub fn derive_event(stream: TokenStream) -> TokenStream { if cfg!(feature = "wasm") { event::listen::derive(stream) @@ -30,7 +30,7 @@ pub fn derive_event(stream: TokenStream) -> TokenStream { /// /// Used for host code generation. #[cfg(feature = "event")] -#[proc_macro_derive(Emit)] +#[proc_macro_derive(Emit, attributes(mod_name))] pub fn derive_emit(stream: TokenStream) -> TokenStream { event::emit::derive(stream) } @@ -49,7 +49,7 @@ pub fn derive_emit_field(stream: TokenStream) -> TokenStream { /// /// Used for wasm code generation #[cfg(feature = "event")] -#[proc_macro_derive(Listen)] +#[proc_macro_derive(Listen, attributes(mod_name))] pub fn derive_listen(stream: TokenStream) -> TokenStream { event::listen::derive(stream) } From b595cdb37b50abfaba2a804b9a884ab0cf2acb7f Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 29 Feb 2024 20:49:10 +0100 Subject: [PATCH 28/60] update test-project to test mod rename --- test-project/api/src/cmd.rs | 10 +++++----- test-project/api/src/model.rs | 1 + test-project/src/main.rs | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/test-project/api/src/cmd.rs b/test-project/api/src/cmd.rs index e8b03f8..84a1970 100644 --- a/test-project/api/src/cmd.rs +++ b/test-project/api/src/cmd.rs @@ -44,24 +44,24 @@ pub fn result_test() -> Result { #[tauri_interop::command] pub fn emit(state: TauriState>, handle: TauriAppHandle) { use tauri_interop::event::emit::Emit; - // newly generated mod - use crate::model::test_state; + // newly generated mod, renamed to test_mod, default for TestState is test_state + use crate::model::test_mod; log::info!("emit cmd received"); let mut state = state.write().unwrap(); if state.bar { - state.update::(&handle, false).unwrap(); + state.update::(&handle, false).unwrap(); } else { state - .update::(&handle, "foo".into()) + .update::(&handle, "foo".into()) .unwrap(); } state.bar = !state.bar; state - .emit::(&handle) + .emit::(&handle) .unwrap(); state.emit_all(&handle).unwrap(); diff --git a/test-project/api/src/model.rs b/test-project/api/src/model.rs index ec205be..ba1d24a 100644 --- a/test-project/api/src/model.rs +++ b/test-project/api/src/model.rs @@ -2,6 +2,7 @@ use tauri_interop::Event; #[allow(dead_code)] #[derive(Default, Event)] +#[mod_name(test_mod)] pub struct TestState { foo: String, pub bar: bool, diff --git a/test-project/src/main.rs b/test-project/src/main.rs index 8c093e0..2cecc69 100644 --- a/test-project/src/main.rs +++ b/test-project/src/main.rs @@ -1,7 +1,7 @@ #![allow(clippy::disallowed_names)] use api::event::listen::Listen; -use api::model::{test_state, TestState}; +use api::model::{test_mod, TestState}; use gloo_timers::callback::Timeout; #[cfg(feature = "leptos")] use leptos::{component, create_signal, view, IntoView}; @@ -20,7 +20,7 @@ fn main() { }); wasm_bindgen_futures::spawn_local(async move { - let handle_bar = TestState::listen_to::(|echo| log::info!("bar: {echo}")) + let handle_bar = TestState::listen_to::(|echo| log::info!("bar: {echo}")) .await .unwrap(); @@ -47,7 +47,7 @@ fn App() -> impl IntoView { let (bar, set_bar) = create_signal(false); leptos::spawn_local(async move { - let handle_bar = TestState::listen_to::(move |bar| set_bar.set(bar)) + let handle_bar = TestState::listen_to::(move |bar| set_bar.set(bar)) .await .unwrap(); @@ -71,7 +71,7 @@ fn App() -> impl IntoView { fn Foo() -> impl IntoView { Timeout::new(2000, api::cmd::emit).forget(); - let (foo, _set_foo) = TestState::use_field::("Test".into()); + let (foo, _set_foo) = TestState::use_field::("Test".into()); view! {

{foo}

} } From 1af6d88e0fbddbd03db7d7822610521f02f70484 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 29 Feb 2024 21:15:55 +0100 Subject: [PATCH 29/60] add auto naming option to name mod like an enum --- tauri-interop-macro/src/event.rs | 14 +++++++++++++- tauri-interop-macro/src/event/emit.rs | 11 ++++++----- tauri-interop-macro/src/lib.rs | 6 +++--- test-project/api/src/model.rs | 27 ++++++++++++++++++++++++++- 4 files changed, 48 insertions(+), 10 deletions(-) diff --git a/tauri-interop-macro/src/event.rs b/tauri-interop-macro/src/event.rs index d5f6a20..44cc505 100644 --- a/tauri-interop-macro/src/event.rs +++ b/tauri-interop-macro/src/event.rs @@ -32,13 +32,25 @@ fn prepare_event(derive_input: DeriveInput) -> EventStruct { panic!("Tuple Structs aren't supported") } + let auto_naming = derive_input + .attrs + .iter() + .find(|attr| attr.path().is_ident("auto_naming")) + .map(|attr| attr.parse_args::().unwrap().to_string()); + let name = derive_input.ident.clone(); + let (naming_case, mod_name) = match auto_naming { + Some(naming) if naming == "EnumLike" => (Case::Pascal, format!("{name}Field")), + Some(naming) => panic!("No naming type found for: {naming}"), + None => (Case::Snake, name.to_string()), + }; + let mod_name = derive_input .attrs .iter() .find(|attr| attr.path().is_ident("mod_name")) .map(|attr| attr.parse_args::().unwrap()) - .unwrap_or(format_ident!("{}", name.to_string().to_case(Case::Snake))); + .unwrap_or(format_ident!("{}", mod_name.to_case(naming_case))); let fields = data_struct .fields diff --git a/tauri-interop-macro/src/event/emit.rs b/tauri-interop-macro/src/event/emit.rs index 9e44bc9..c1e4b2d 100644 --- a/tauri-interop-macro/src/event/emit.rs +++ b/tauri-interop-macro/src/event/emit.rs @@ -33,8 +33,6 @@ pub fn derive(stream: TokenStream) -> TokenStream { let event_fields = fields.iter().map(|field| &field.field_name); let stream = quote! { - use tauri_interop::event::{Field, emit::Emit}; - pub mod #mod_name { use super::#name; use tauri_interop::event::{Field, emit::Emit}; @@ -42,26 +40,29 @@ pub fn derive(stream: TokenStream) -> TokenStream { #( #emit_fields )* } - impl Emit for #name { + impl ::tauri_interop::event::emit::Emit for #name { fn emit_all(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { use #mod_name::*; + use ::tauri_interop::event::Field; #( #event_fields::emit(self, handle)?; )* Ok(()) } - fn emit>(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> + fn emit>(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> where Self: Sized { + use ::tauri_interop::event::Field; F::emit(self, handle) } - fn update>(&mut self, handle: &::tauri::AppHandle, field: F::Type) -> Result<(), ::tauri::Error> + fn update>(&mut self, handle: &::tauri::AppHandle, field: F::Type) -> Result<(), ::tauri::Error> where Self: Sized { + use ::tauri_interop::event::Field; F::update(self, handle, field) } } diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 526da83..a5f95cf 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -15,7 +15,7 @@ mod event; /// Conditionally adds [Listen] or [Emit] to a struct #[cfg(feature = "event")] -#[proc_macro_derive(Event, attributes(mod_name))] +#[proc_macro_derive(Event, attributes(auto_naming, mod_name))] pub fn derive_event(stream: TokenStream) -> TokenStream { if cfg!(feature = "wasm") { event::listen::derive(stream) @@ -30,7 +30,7 @@ pub fn derive_event(stream: TokenStream) -> TokenStream { /// /// Used for host code generation. #[cfg(feature = "event")] -#[proc_macro_derive(Emit, attributes(mod_name))] +#[proc_macro_derive(Emit, attributes(auto_naming, mod_name))] pub fn derive_emit(stream: TokenStream) -> TokenStream { event::emit::derive(stream) } @@ -49,7 +49,7 @@ pub fn derive_emit_field(stream: TokenStream) -> TokenStream { /// /// Used for wasm code generation #[cfg(feature = "event")] -#[proc_macro_derive(Listen, attributes(mod_name))] +#[proc_macro_derive(Listen, attributes(auto_naming, mod_name))] pub fn derive_listen(stream: TokenStream) -> TokenStream { event::listen::derive(stream) } diff --git a/test-project/api/src/model.rs b/test-project/api/src/model.rs index ba1d24a..c7c5a18 100644 --- a/test-project/api/src/model.rs +++ b/test-project/api/src/model.rs @@ -1,6 +1,9 @@ +#![allow(clippy::no_effect)] +#![allow(dead_code)] +#![allow(path_statements)] + use tauri_interop::Event; -#[allow(dead_code)] #[derive(Default, Event)] #[mod_name(test_mod)] pub struct TestState { @@ -8,6 +11,28 @@ pub struct TestState { pub bar: bool, } +#[derive(Default, Event)] +#[auto_naming(EnumLike)] +pub struct NamingTestEnum { + foo: String, + pub bar: bool, +} + +#[derive(Default, Event)] +pub struct NamingTestDefault { + foo: String, + pub bar: bool, +} + +fn test_naming() { + test_mod::Bar; + test_mod::Foo; + NamingTestEnumField::Bar; + NamingTestEnumField::Foo; + naming_test_default::Bar; + naming_test_default::Foo; +} + // /// not allowed // #[derive(Default, Event)] // pub struct StructTupleState(String); From cb46642a4a070674f52b1335c6b7cdc89c1eeada Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 29 Feb 2024 22:02:48 +0100 Subject: [PATCH 30/60] add missing import, adjust Field trait --- README.md | 2 +- src/event.rs | 5 +++-- tauri-interop-macro/src/event/emit.rs | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cbc1339..e8afd57 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,7 @@ When using the derive macro `tauri_interop::Event` it expands depending on the ` To emit a variable from the above struct (which is mostly intended to be used as state) in the host triplet ```rust , ignore-wasm32-unknown-unknown -use tauri_interop::Event; +use tauri_interop::{Event, event::emit::Emit}; #[derive(Default, Event)] pub struct Test { diff --git a/src/event.rs b/src/event.rs index 3a5a2f5..934d415 100644 --- a/src/event.rs +++ b/src/event.rs @@ -35,17 +35,18 @@ where /// The type of the field type Type; - #[cfg(any(target_family = "wasm", feature = "wasm"))] /// The event of the field const EVENT_NAME: &'static str; #[cfg(not(target_family = "wasm"))] /// Emits event of the related field with their value + /// + /// not in wasm available fn emit(parent: &P, handle: &AppHandle) -> Result<(), Error>; #[cfg(not(target_family = "wasm"))] /// Updates the related field and emit its event /// - /// Only required for "target_family = wasm" + /// not in wasm available fn update(s: &mut P, handle: &AppHandle, v: Self::Type) -> Result<(), Error>; } diff --git a/tauri-interop-macro/src/event/emit.rs b/tauri-interop-macro/src/event/emit.rs index c1e4b2d..c16cf0b 100644 --- a/tauri-interop-macro/src/event/emit.rs +++ b/tauri-interop-macro/src/event/emit.rs @@ -1,7 +1,7 @@ use proc_macro::TokenStream; use quote::{quote, ToTokens}; -use syn::{parse_macro_input, DeriveInput}; +use syn::{DeriveInput, parse_macro_input}; use crate::event::{EventField, EventStruct, Field, FieldAttributes}; @@ -94,6 +94,8 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { impl Field<#parent> for #name { type Type = #parent_field_ty; + const EVENT_NAME: &'static str = #event_name; + fn emit(parent: &#parent, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { use ::tauri::Manager; From 3fd53d3502cf258665b1a1d211d3001a899f2376 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sat, 2 Mar 2024 12:59:39 +0100 Subject: [PATCH 31/60] adjusted fields to match snake case --- README.md | 3 --- tauri-interop-macro/src/command/wrapper.rs | 16 ++++++++++------ test-project/api/src/cmd.rs | 3 +++ test-project/src/main.rs | 1 + 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e8afd57..c187b14 100644 --- a/README.md +++ b/README.md @@ -253,9 +253,6 @@ fn main() { ``` ## Known Issues: -- arguments used in `tauri::command` beginning with `_` aren't supported yet - - due to [tauri internally converting the argument name](https://tauri.app/v1/guides/features/command#passing-arguments), - which results in losing the _ at the beginning - feature: leptos - sometimes a closure is accessed after being dropped - that is probably a race condition where the unlisten function doesn't detach the callback fast enough diff --git a/tauri-interop-macro/src/command/wrapper.rs b/tauri-interop-macro/src/command/wrapper.rs index e67fb71..04a363c 100644 --- a/tauri-interop-macro/src/command/wrapper.rs +++ b/tauri-interop-macro/src/command/wrapper.rs @@ -127,12 +127,16 @@ pub fn prepare(function: ItemFn) -> InvokeCommand { false }; - match typed.pat.as_ref() { - Pat::Ident(ident) => Some(FieldArg { - ident: ident.ident.clone(), - argument: fn_arg, - requires_lifetime: req_lf, - }), + match typed.pat.as_mut() { + Pat::Ident(ident) => { + // converting the ident to snake case, so it matches the expected snake case + ident.ident = format_ident!("{}", ident.ident.to_string().to_case(Case::Snake)); + Some(FieldArg { + ident: ident.ident.clone(), + argument: fn_arg, + requires_lifetime: req_lf, + }) + }, _ => None, } }) diff --git a/test-project/api/src/cmd.rs b/test-project/api/src/cmd.rs index 84a1970..9b61c0a 100644 --- a/test-project/api/src/cmd.rs +++ b/test-project/api/src/cmd.rs @@ -10,6 +10,9 @@ tauri_interop::host_usage! { #[tauri_interop::command] pub fn empty_invoke() {} +#[tauri_interop::command] +pub fn underscore_invoke(_invoke: u8) {} + #[tauri_interop::command] pub async fn await_heavy_computing() { std::thread::sleep(std::time::Duration::from_millis(5000)) diff --git a/test-project/src/main.rs b/test-project/src/main.rs index 2cecc69..0f984f5 100644 --- a/test-project/src/main.rs +++ b/test-project/src/main.rs @@ -11,6 +11,7 @@ fn main() { console_error_panic_hook::set_once(); api::cmd::empty_invoke(); + api::cmd::underscore_invoke(69); wasm_bindgen_futures::spawn_local(async { log::info!("{}", api::cmd::greet("frontend").await); From a8d0afb4cd2d53378474fbaaaf8b51adf3b00420 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sat, 2 Mar 2024 13:31:36 +0100 Subject: [PATCH 32/60] reduce returned types --- README.md | 8 ++++---- src/event/listen.rs | 10 +++++----- test-project/src/main.rs | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e8afd57..07957c7 100644 --- a/README.md +++ b/README.md @@ -232,9 +232,9 @@ as the event should be received. Dropping it will automatically detach the closu [cmd.rs](./test-project/api/src/cmd.rs) for other example how it could be used. #### Feature: leptos -When the `leptos` feature is enabled it will add additional `use_` methods on the provided struct. -These methods take care of the required initial asynchronous call to register the listener and will hold the -handle in scope as long as the component is rendered. +When the `leptos` feature is enabled the `use_field` method is added to the `Listen` trait when compiling to wasm. +The method takes care of the initial asynchronous call to register the listener and will hold the handle in scope +as long as the leptos component is rendered. ```rust , ignore use tauri_interop::Event; @@ -248,7 +248,7 @@ pub struct Test { fn main() { use tauri_interop::event::listen::Listen; - let (foo: leptos::ReadSignal, set_foo: leptos::WriteSignal) = Test::use_field::(String::default()); + let foo: leptos::ReadSignal = Test::use_field::(String::default()); } ``` diff --git a/src/event/listen.rs b/src/event/listen.rs index 6b171c8..f42d25d 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -1,6 +1,6 @@ use js_sys::Function; #[cfg(feature = "leptos")] -use leptos::{ReadSignal, WriteSignal}; +use leptos::ReadSignal; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use wasm_bindgen::{closure::Closure, JsCast, JsValue}; @@ -87,10 +87,10 @@ impl ListenHandle { /// Registers a given event and binds a returned signal to these event changes /// - /// Internally it stores a created [ListenHandle] for `event` in a [leptos::RwSignal] to hold it + /// Internally it stores a created [ListenHandle] for `event` in a [leptos::RwSignal] to hold it in /// scope, while it is used in a [leptos::component](https://docs.rs/leptos_macro/0.5.2/leptos_macro/attr.component.html) #[cfg(feature = "leptos")] - pub fn use_register(event: &'static str, initial_value: T) -> (ReadSignal, WriteSignal) + pub fn use_register(event: &'static str, initial_value: T) -> ReadSignal where T: DeserializeOwned, { @@ -112,7 +112,7 @@ impl ListenHandle { handle.try_set(Some(listen_handle)); }); - (signal, set_signal) + signal } } @@ -134,7 +134,7 @@ pub trait Listen { /// /// Default Implementation: see [ListenHandle::use_register] #[cfg(feature = "leptos")] - fn use_field>(initial: F::Type) -> (ReadSignal, WriteSignal) + fn use_field>(initial: F::Type) -> ReadSignal where Self: Sized + super::Parent, { diff --git a/test-project/src/main.rs b/test-project/src/main.rs index 2cecc69..1549964 100644 --- a/test-project/src/main.rs +++ b/test-project/src/main.rs @@ -71,7 +71,7 @@ fn App() -> impl IntoView { fn Foo() -> impl IntoView { Timeout::new(2000, api::cmd::emit).forget(); - let (foo, _set_foo) = TestState::use_field::("Test".into()); + let foo = TestState::use_field::("Test".into()); view! {

{foo}

} } From e361b02735a7dc5d138b60a7868f19d10933c85b Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 29 Feb 2024 22:30:49 +0100 Subject: [PATCH 33/60] adjust docs, move some mods internally --- README.md | 7 +++---- src/command/type_aliases.rs | 9 ++++++--- src/event.rs | 18 ++++++++++++------ tauri-interop-macro/src/event/emit.rs | 4 ++-- tauri-interop-macro/src/event/listen.rs | 2 +- test-project/api/src/cmd.rs | 2 +- test-project/src/main.rs | 2 +- 7 files changed, 26 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9a11663..9ce36eb 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,9 @@ ![License](https://img.shields.io/crates/l/tauri-interop.svg) What this crate tries to achieve: -- generate an equal wasm-function for your defined `tauri::command` +- generate an equal rust-wasm-function for a defined `tauri::command` - collecting all defined `tauri::command`s without adding them manually -- a convenient way to send events from tauri and receiving them in the frontend - +- a convenient way to send events from tauri and receiving them in a rust based wasm-frontend ## Basic usage: @@ -174,7 +173,7 @@ When using the derive macro `tauri_interop::Event` it expands depending on the ` To emit a variable from the above struct (which is mostly intended to be used as state) in the host triplet ```rust , ignore-wasm32-unknown-unknown -use tauri_interop::{Event, event::emit::Emit}; +use tauri_interop::{Event, event::Emit}; #[derive(Default, Event)] pub struct Test { diff --git a/src/command/type_aliases.rs b/src/command/type_aliases.rs index 5e30eda..5e016e0 100644 --- a/src/command/type_aliases.rs +++ b/src/command/type_aliases.rs @@ -1,10 +1,13 @@ use tauri::{AppHandle, State, Window}; -/// Type alias to easier identify [State] via [tauri_interop_macro::command] macro +#[allow(unused_imports)] +use tauri_interop_macro::command; + +/// Type alias to easier identify [State] via [command] macro pub type TauriState<'r, T> = State<'r, T>; -/// Type alias to easier identify [Window] via [tauri_interop_macro::command] macro +/// Type alias to easier identify [Window] via [command] macro pub type TauriWindow = Window; -/// Type alias to easier identify [AppHandle] via [tauri_interop_macro::command] macro +/// Type alias to easier identify [AppHandle] via [command] macro pub type TauriAppHandle = AppHandle; diff --git a/src/event.rs b/src/event.rs index 934d415..b7c957f 100644 --- a/src/event.rs +++ b/src/event.rs @@ -2,29 +2,35 @@ use serde::{de::DeserializeOwned, Serialize}; #[cfg(not(target_family = "wasm"))] use tauri::{AppHandle, Error, Wry}; +#[cfg(not(target_family = "wasm"))] +pub use emit::*; +#[cfg(any(target_family = "wasm", feature = "wasm"))] +pub use listen::*; + /// traits for event emitting in the host code (feat: `tauri`) #[cfg(not(target_family = "wasm"))] -pub mod emit; +mod emit; + /// related generic struct and functions for autogenerated listen functions (target: `wasm` or feat: `wasm`) #[cfg(any(target_family = "wasm", feature = "wasm"))] -pub mod listen; +mod listen; /// The trait which needs to be implemented for a [Field] /// -/// Conditionally changes between [listen::Listen] and [emit::Emit] +/// Conditionally changes between [Listen] and [Emit] /// /// When compiled to "target_family = wasm" then following is true. /// ```ignore /// trait Parent = listen::Listen; /// ``` #[cfg(not(target_family = "wasm"))] -pub trait Parent = emit::Emit; +pub trait Parent = Emit; /// The trait which needs to be implemented for a [Field] /// -/// Conditionally changes between [listen::Listen] and [emit::Emit] +/// Conditionally changes between [Listen] and [Emit] #[cfg(target_family = "wasm")] -pub trait Parent = listen::Listen; +pub trait Parent = Listen; /// Trait defining a [Field] to a related struct implementing [Parent] with the related [Field::Type] pub trait Field

diff --git a/tauri-interop-macro/src/event/emit.rs b/tauri-interop-macro/src/event/emit.rs index c16cf0b..3bbfdd3 100644 --- a/tauri-interop-macro/src/event/emit.rs +++ b/tauri-interop-macro/src/event/emit.rs @@ -35,12 +35,12 @@ pub fn derive(stream: TokenStream) -> TokenStream { let stream = quote! { pub mod #mod_name { use super::#name; - use tauri_interop::event::{Field, emit::Emit}; + use tauri_interop::event::{Field, Emit}; #( #emit_fields )* } - impl ::tauri_interop::event::emit::Emit for #name { + impl ::tauri_interop::event::Emit for #name { fn emit_all(&self, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { use #mod_name::*; use ::tauri_interop::event::Field; diff --git a/tauri-interop-macro/src/event/listen.rs b/tauri-interop-macro/src/event/listen.rs index 10c92bd..3c1abc6 100644 --- a/tauri-interop-macro/src/event/listen.rs +++ b/tauri-interop-macro/src/event/listen.rs @@ -37,7 +37,7 @@ pub fn derive(stream: TokenStream) -> TokenStream { #( #listen_fields )* } - impl ::tauri_interop::event::listen::Listen for #name {} + impl ::tauri_interop::event::Listen for #name {} }; TokenStream::from(stream.to_token_stream()) diff --git a/test-project/api/src/cmd.rs b/test-project/api/src/cmd.rs index 9b61c0a..c1b9a32 100644 --- a/test-project/api/src/cmd.rs +++ b/test-project/api/src/cmd.rs @@ -46,7 +46,7 @@ pub fn result_test() -> Result { #[tauri_interop::command] pub fn emit(state: TauriState>, handle: TauriAppHandle) { - use tauri_interop::event::emit::Emit; + use tauri_interop::event::Emit; // newly generated mod, renamed to test_mod, default for TestState is test_state use crate::model::test_mod; diff --git a/test-project/src/main.rs b/test-project/src/main.rs index f47c588..65c48fd 100644 --- a/test-project/src/main.rs +++ b/test-project/src/main.rs @@ -1,6 +1,6 @@ #![allow(clippy::disallowed_names)] -use api::event::listen::Listen; +use api::event::Listen; use api::model::{test_mod, TestState}; use gloo_timers::callback::Timeout; #[cfg(feature = "leptos")] From 91f827599494d2c7fb9797fb666cc1a05fa96982 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sat, 2 Mar 2024 13:31:59 +0100 Subject: [PATCH 34/60] cleanup docs --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9ce36eb..1b986cf 100644 --- a/README.md +++ b/README.md @@ -135,13 +135,19 @@ fn wait_for_sync_execution(value: &str) -> String { format!("Has to wait that the backend completes the computation and returns the {value}") } +// let result: Result = asynchronous_execution(true).await; +#[tauri_interop::command] +async fn await_heavy_computing() { + std::thread::sleep(std::time::Duration::from_millis(5000)) +} + // let result: Result = asynchronous_execution(true).await; #[tauri_interop::command] async fn asynchronous_execution(change: bool) -> Result { if change { - Ok("asynchronous execution requires result definition".into()) + Ok("asynchronous execution returning result, need Result in their type name".into()) } else { - Err("and ".into()) + Err("if they don't it, the error will be not be parsed/handled".into()) } } From 6da9a1c972e52944206bfc6d826a7438dc243356 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sun, 3 Mar 2024 10:31:56 +0100 Subject: [PATCH 35/60] transfer known issues to issues --- README.md | 5 ----- src/event/listen.rs | 4 ++-- test-project/api/src/cmd.rs | 19 +++++++------------ test-project/src/main.rs | 22 +++++++++------------- 4 files changed, 18 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 1b986cf..90e1984 100644 --- a/README.md +++ b/README.md @@ -256,8 +256,3 @@ fn main() { let foo: leptos::ReadSignal = Test::use_field::(String::default()); } ``` - -## Known Issues: -- feature: leptos - - sometimes a closure is accessed after being dropped - - that is probably a race condition where the unlisten function doesn't detach the callback fast enough diff --git a/src/event/listen.rs b/src/event/listen.rs index f42d25d..4befc1b 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -88,7 +88,7 @@ impl ListenHandle { /// Registers a given event and binds a returned signal to these event changes /// /// Internally it stores a created [ListenHandle] for `event` in a [leptos::RwSignal] to hold it in - /// scope, while it is used in a [leptos::component](https://docs.rs/leptos_macro/0.5.2/leptos_macro/attr.component.html) + /// scope, while it is used in a leptos [component](https://docs.rs/leptos_macro/0.5.2/leptos_macro/attr.component.html) #[cfg(feature = "leptos")] pub fn use_register(event: &'static str, initial_value: T) -> ReadSignal where @@ -98,7 +98,7 @@ impl ListenHandle { let (signal, set_signal) = leptos::create_signal(initial_value); - // creating this signal in a leptos::component holdes the value in scope, and drops it automatically + // creating this signal in a leptos component holds the value in scope, and drops it automatically let handle = leptos::create_rw_signal(None); leptos::spawn_local(async move { let listen_handle = ListenHandle::register(event, move |value: T| { diff --git a/test-project/api/src/cmd.rs b/test-project/api/src/cmd.rs index c1b9a32..b2eed18 100644 --- a/test-project/api/src/cmd.rs +++ b/test-project/api/src/cmd.rs @@ -54,20 +54,15 @@ pub fn emit(state: TauriState>, handle: TauriAppHandle) { let mut state = state.write().unwrap(); - if state.bar { - state.update::(&handle, false).unwrap(); + let bar_value = !state.bar; + let foo_value = if state.bar { + "bar" } else { - state - .update::(&handle, "foo".into()) - .unwrap(); - } - - state.bar = !state.bar; - state - .emit::(&handle) - .unwrap(); + "foo" + }; - state.emit_all(&handle).unwrap(); + state.update::(&handle, foo_value.into()).unwrap(); + state.update::(&handle, bar_value).unwrap(); } #[cfg(feature = "broken")] diff --git a/test-project/src/main.rs b/test-project/src/main.rs index 65c48fd..06635c1 100644 --- a/test-project/src/main.rs +++ b/test-project/src/main.rs @@ -4,7 +4,7 @@ use api::event::Listen; use api::model::{test_mod, TestState}; use gloo_timers::callback::Timeout; #[cfg(feature = "leptos")] -use leptos::{component, create_signal, view, IntoView}; +use leptos::{component, view, IntoView}; fn main() { console_log::init_with_level(log::Level::Trace).expect("no errors during logger init"); @@ -43,23 +43,15 @@ fn main() { #[cfg(feature = "leptos")] #[component] fn App() -> impl IntoView { - use leptos::{SignalGet, SignalSet}; + use leptos::SignalGet; - let (bar, set_bar) = create_signal(false); - - leptos::spawn_local(async move { - let handle_bar = TestState::listen_to::(move |bar| set_bar.set(bar)) - .await - .unwrap(); - - Timeout::new(5000, move || drop(handle_bar)).forget(); - }); + let bar = TestState::use_field::(true); view! {

{move || if bar.get() { - "No Foo".into_view() + Foo.into_view() } else { Foo.into_view() }} @@ -70,7 +62,11 @@ fn App() -> impl IntoView { #[cfg(feature = "leptos")] #[component] fn Foo() -> impl IntoView { - Timeout::new(2000, api::cmd::emit).forget(); + log::info!("create foo"); + Timeout::new(3000, || { + log::info!("emit foo"); + api::cmd::emit(); + }).forget(); let foo = TestState::use_field::("Test".into()); From 3515fb6c022ac355308b1a441f6cf0214dc909fa Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sun, 3 Mar 2024 11:08:25 +0100 Subject: [PATCH 36/60] simplify and update dependencies --- Cargo.lock | 1030 ++++---- Cargo.toml | 22 +- tauri-interop-macro/Cargo.lock | 69 - tauri-interop-macro/Cargo.toml | 12 +- test-project/Cargo.lock | 1074 ++++---- test-project/Cargo.toml | 16 +- test-project/api/Cargo.toml | 12 +- test-project/src-tauri/Cargo.lock | 3797 ----------------------------- test-project/src-tauri/Cargo.toml | 4 +- 9 files changed, 1155 insertions(+), 4881 deletions(-) delete mode 100644 tauri-interop-macro/Cargo.lock delete mode 100644 test-project/src-tauri/Cargo.lock diff --git a/Cargo.lock b/Cargo.lock index 9abd483..4fd1193 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -58,9 +58,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" [[package]] name = "async-recursion" @@ -70,18 +70,18 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -117,7 +117,7 @@ dependencies = [ "attribute-derive-macro", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -133,7 +133,7 @@ dependencies = [ "proc-macro2", "quote", "quote-use", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -165,9 +165,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bitflags" @@ -177,9 +177,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "block" @@ -219,9 +219,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.8.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" +checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" dependencies = [ "memchr", "serde", @@ -229,15 +229,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" [[package]] name = "byteorder" @@ -283,12 +283,9 @@ checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc" [[package]] name = "cesu8" @@ -318,9 +315,9 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.15.5" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3" +checksum = "fa50868b64a9a6fda9d593ce778849ea8715cd2a3d2cc17ffdb4a2f2f2f1961d" dependencies = [ "smallvec", "target-lexicon", @@ -334,22 +331,22 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", "serde", - "windows-targets", + "windows-targets 0.52.4", ] [[package]] name = "ciborium" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" dependencies = [ "ciborium-io", "ciborium-ll", @@ -358,15 +355,15 @@ dependencies = [ [[package]] name = "ciborium-io" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" [[package]] name = "ciborium-ll" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" dependencies = [ "ciborium-io", "half", @@ -475,9 +472,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -485,9 +482,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "core-graphics" @@ -504,9 +501,9 @@ dependencies = [ [[package]] name = "core-graphics-types" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -515,64 +512,61 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-common" @@ -608,24 +602,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "ctor" -version = "0.1.26" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" +checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" dependencies = [ "quote", - "syn 1.0.109", + "syn 2.0.52", ] [[package]] name = "darling" -version = "0.20.3" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" dependencies = [ "darling_core", "darling_macro", @@ -633,34 +627,34 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.3" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "darling_macro" -version = "0.20.3" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", @@ -668,13 +662,13 @@ dependencies = [ [[package]] name = "derive-where" -version = "1.2.5" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146398d62142a0f35248a608f17edf0dde57338354966d6e41d0eb2d16980ccb" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -756,9 +750,9 @@ checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "embed_plist" @@ -783,12 +777,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -799,9 +793,9 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fdeflate" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d6dafc854908ff5da46ff3f8f473c6984119a2876a383a860246dd7841a868" +checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" dependencies = [ "simd-adler32", ] @@ -818,14 +812,14 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.22" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", - "windows-sys", + "redox_syscall", + "windows-sys 0.52.0", ] [[package]] @@ -880,9 +874,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -895,9 +889,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -905,15 +899,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -922,38 +916,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -1064,15 +1058,16 @@ dependencies = [ [[package]] name = "generator" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" +checksum = "b5b25e5b3e733153bcab35ee4671b46604b42516163cae442d1601cb716f2ac5" dependencies = [ "cc", + "cfg-if", "libc", "log", "rustversion", - "windows 0.48.0", + "windows 0.53.0", ] [[package]] @@ -1098,9 +1093,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "js-sys", @@ -1205,7 +1200,7 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] @@ -1310,9 +1305,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", @@ -1320,7 +1315,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.1.0", + "indexmap 2.2.5", "slab", "tokio", "tokio-util", @@ -1329,9 +1324,13 @@ dependencies = [ [[package]] name = "half" -version = "1.8.2" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e" +dependencies = [ + "cfg-if", + "crunchy", +] [[package]] name = "hashbrown" @@ -1362,9 +1361,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -1381,20 +1380,6 @@ dependencies = [ "utf8-width", ] -[[package]] -name = "html5ever" -version = "0.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c13fb08e5d4dfc151ee5e88bae63f7773d61852f3bdc73c9f4b9e1bde03148" -dependencies = [ - "log", - "mac", - "markup5ever 0.10.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "html5ever" version = "0.26.0" @@ -1403,7 +1388,7 @@ checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7" dependencies = [ "log", "mac", - "markup5ever 0.11.0", + "markup5ever", "proc-macro2", "quote", "syn 1.0.109", @@ -1417,14 +1402,14 @@ checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", - "itoa 1.0.9", + "itoa 1.0.10", ] [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http", @@ -1451,9 +1436,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -1464,9 +1449,9 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.9", + "itoa 1.0.10", "pin-project-lite", - "socket2 0.4.10", + "socket2", "tokio", "tower-service", "tracing", @@ -1475,16 +1460,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -1524,15 +1509,15 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747ad1b4ae841a78e8aba0d63adbfbeaea26b517b63705d47856b73015d27060" +checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" dependencies = [ "crossbeam-deque", "globset", "log", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "same-file", "walkdir", "winapi-util", @@ -1540,14 +1525,13 @@ dependencies = [ [[package]] name = "image" -version = "0.24.7" +version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f3dfdbdd72063086ff443e297b61695500514b1e41095b6fb9a5ab48a70a711" +checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" dependencies = [ "bytemuck", "byteorder", "color_quant", - "num-rational", "num-traits", ] @@ -1564,9 +1548,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -1575,9 +1559,9 @@ dependencies = [ [[package]] name = "infer" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a898e4b7951673fce96614ce5751d13c40fc5674bc2d759288e46c3ab62598b3" +checksum = "f551f8c3a39f68f986517db0d1759de85881894fdc7db798bd2a9df9cb04b7fc" dependencies = [ "cfb", ] @@ -1599,9 +1583,9 @@ checksum = "71dd52191aae121e8611f1e8dc3e324dd0dd1dee1e6dd91d10ee07a3cfb4d9d8" [[package]] name = "inventory" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0508c56cfe9bfd5dfeb0c22ab9a6abfda2f27bdca422132e494266351ed8d83c" +checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" [[package]] name = "ipnet" @@ -1611,18 +1595,9 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -1635,9 +1610,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "javascriptcore-rs" @@ -1684,9 +1659,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.65" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -1703,18 +1678,6 @@ dependencies = [ "treediff", ] -[[package]] -name = "kuchiki" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ea8e9c6e031377cff82ee3001dc8026cdf431ed4e2e6b51f98ab8c73484a358" -dependencies = [ - "cssparser", - "html5ever 0.25.2", - "matches", - "selectors", -] - [[package]] name = "kuchikiki" version = "0.8.2" @@ -1722,7 +1685,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f29e4755b7b995046f510a7520c42b2fed58b77bd94d5a87a8eb43d2fd126da8" dependencies = [ "cssparser", - "html5ever 0.26.0", + "html5ever", "indexmap 1.9.3", "matches", "selectors", @@ -1736,9 +1699,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leptos" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98f0fe11faa66358ff8c2ee48881c54f8f216ecddabfc5b69cdc2e90c8e337b" +checksum = "269ba4ba91ffa73d9559c975e0be17bd4eb34c6b6abd7fdd5704106132d89d2a" dependencies = [ "cfg-if", "leptos_config", @@ -1755,9 +1718,9 @@ dependencies = [ [[package]] name = "leptos_config" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f0e1a9a583d943b19c740c82a3ec69224c979af90f40738d93ec59ee1475bb" +checksum = "e72d8689d54737991831e9b279bb4fba36d27a93aa975c75cd4241d9a4a425ec" dependencies = [ "config", "regex", @@ -1768,18 +1731,18 @@ dependencies = [ [[package]] name = "leptos_dom" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111391d1ccbc3355344f90f0893f4137db13a7f98d53fede0a3613c522ebaf19" +checksum = "ad314950d41acb1bfdb8b5924811b2983484a8d6f69a20b834a173a682657ed4" dependencies = [ "async-recursion", "cfg-if", "drain_filter_polyfill", "futures", - "getrandom 0.2.11", + "getrandom 0.2.12", "html-escape", - "indexmap 2.1.0", - "itertools 0.10.5", + "indexmap 2.2.5", + "itertools", "js-sys", "leptos_reactive", "once_cell", @@ -1798,33 +1761,33 @@ dependencies = [ [[package]] name = "leptos_hot_reload" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6902fabee84955a85a6cdebf8ddfbfb134091087b172e32ebb26e571d4640ca" +checksum = "3f62dcab17728877f2d2f16d2c8a6701c4c5fbdfb4964792924acb0b50529659" dependencies = [ "anyhow", "camino", - "indexmap 2.1.0", + "indexmap 2.2.5", "parking_lot", "proc-macro2", "quote", "rstml", "serde", - "syn 2.0.39", + "syn 2.0.52", "walkdir", ] [[package]] name = "leptos_macro" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68201041cc5af68f7eb35015336827a36c543d87dcf2403117d7244db1f14a0" +checksum = "57955d66f624265222444a5c565fea38efa5b0152a1dfc7c060a78e5fb62a852" dependencies = [ "attribute-derive", "cfg-if", "convert_case 0.6.0", "html-escape", - "itertools 0.11.0", + "itertools", "leptos_hot_reload", "prettyplease", "proc-macro-error", @@ -1832,21 +1795,21 @@ dependencies = [ "quote", "rstml", "server_fn_macro", - "syn 2.0.39", + "syn 2.0.52", "tracing", "uuid", ] [[package]] name = "leptos_reactive" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282e84ae3e3eb30ab1eb1c881bfeea8a3cb6d6c683dc99f26f2f69ee240b148d" +checksum = "b4f54a525a0edfc8c2bf3ee92aae411800b8b10892c9cd819f8e8a6d4f0d62f3" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "cfg-if", "futures", - "indexmap 2.1.0", + "indexmap 2.2.5", "paste", "pin-project", "rustc-hash", @@ -1862,9 +1825,9 @@ dependencies = [ [[package]] name = "leptos_server" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67f3810352bab860bcfa85f1760de4bd6e82cd72b14a97779d9168d37661bbf" +checksum = "2fd1517c2024bc47d764e96053e55b927f8a2159e735a0cc47232542b493df9d" dependencies = [ "inventory", "lazy_static", @@ -1878,9 +1841,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.150" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libredox" @@ -1888,9 +1851,9 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "libc", - "redox_syscall 0.4.1", + "redox_syscall", ] [[package]] @@ -1904,9 +1867,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.11" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -1920,9 +1883,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "loom" @@ -1963,7 +1926,7 @@ dependencies = [ "manyhow-macros", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -1977,20 +1940,6 @@ dependencies = [ "quote", ] -[[package]] -name = "markup5ever" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" -dependencies = [ - "log", - "phf 0.8.0", - "phf_codegen 0.8.0", - "string_cache", - "string_cache_codegen", - "tendril", -] - [[package]] name = "markup5ever" version = "0.11.0" @@ -2022,9 +1971,9 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memoffset" @@ -2049,9 +1998,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", "simd-adler32", @@ -2059,13 +2008,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.9" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2129,31 +2078,16 @@ dependencies = [ ] [[package]] -name = "num-integer" -version = "0.1.45" +name = "num-conv" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -2219,18 +2153,18 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "overload" @@ -2287,9 +2221,9 @@ checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", + "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -2327,9 +2261,17 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" dependencies = [ - "phf_macros 0.10.0", "phf_shared 0.10.0", - "proc-macro-hack", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_macros 0.11.2", + "phf_shared 0.11.2", ] [[package]] @@ -2372,6 +2314,16 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared 0.11.2", + "rand 0.8.5", +] + [[package]] name = "phf_macros" version = "0.8.0" @@ -2388,16 +2340,15 @@ dependencies = [ [[package]] name = "phf_macros" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", - "proc-macro-hack", + "phf_generator 0.11.2", + "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.52", ] [[package]] @@ -2418,24 +2369,33 @@ dependencies = [ "siphasher", ] +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -2452,9 +2412,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "plist" @@ -2462,8 +2422,8 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef" dependencies = [ - "base64 0.21.5", - "indexmap 2.1.0", + "base64 0.21.7", + "indexmap 2.2.5", "line-wrap", "quick-xml", "serde", @@ -2472,9 +2432,9 @@ dependencies = [ [[package]] name = "png" -version = "0.17.10" +version = "0.17.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd75bf2d8dd3702b9707cdbc56a5b9ef42cec752eb8b3bafc01234558442aa64" +checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" dependencies = [ "bitflags 1.3.2", "crc32fast", @@ -2503,12 +2463,12 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "prettyplease" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -2564,9 +2524,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.75" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -2579,7 +2539,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", "version_check", "yansi", ] @@ -2595,9 +2555,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -2610,7 +2570,7 @@ checksum = "a7b5abe3fe82fdeeb93f44d66a7b444dedf2e4827defb0a8e69c437b2de2ef94" dependencies = [ "quote", "quote-use-macros", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -2622,7 +2582,7 @@ dependencies = [ "derive-where", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -2685,7 +2645,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", ] [[package]] @@ -2712,15 +2672,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -2736,20 +2687,20 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "libredox", "thiserror", ] [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] @@ -2764,9 +2715,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -2787,11 +2738,11 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.22" +version = "0.11.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -2810,6 +2761,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", "system-configuration", "tokio", "tower-service", @@ -2829,7 +2781,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.39", + "syn 2.0.52", "syn_derive", "thiserror", ] @@ -2857,15 +2809,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.25" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -2876,9 +2828,9 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "safemem" @@ -2929,24 +2881,24 @@ dependencies = [ [[package]] name = "self_cell" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e388332cd64eb80cd595a00941baf513caffae8dce9cfd0467fc9c66397dade6" +checksum = "58bf37232d3bb9a2c4e641ca2a11d83b5062066f88df7fed36c28772046d65ba" [[package]] name = "semver" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.193" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] @@ -2964,9 +2916,9 @@ dependencies = [ [[package]] name = "serde-wasm-bindgen" -version = "0.6.1" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ba92964781421b6cef36bf0d7da26d201e96d84e1b10e7ae6ed416e516906d" +checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b" dependencies = [ "js-sys", "serde", @@ -2975,22 +2927,23 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ - "itoa 1.0.9", + "indexmap 2.2.5", + "itoa 1.0.10", "ryu", "serde", ] @@ -3008,20 +2961,20 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" +checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "serde_spanned" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ "serde", ] @@ -3033,23 +2986,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.9", + "itoa 1.0.10", "ryu", "serde", ] [[package]] name = "serde_with" -version = "3.4.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.1.0", + "indexmap 2.2.5", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -3057,14 +3011,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.4.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -3091,9 +3045,9 @@ dependencies = [ [[package]] name = "server_fn" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0186f969a1f9572af27159b8273252abf9a6a38934130fe6f3ae0e439d48cf14" +checksum = "6c265de965fe48e09ad8899d0ab1ffebdfa1a9914e4de5ff107b07bd94cf7541" dependencies = [ "ciborium", "const_format", @@ -3108,34 +3062,34 @@ dependencies = [ "serde_json", "serde_qs", "server_fn_macro_default", - "syn 2.0.39", + "syn 2.0.52", "thiserror", "xxhash-rust", ] [[package]] name = "server_fn_macro" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dbc70e4f185ff2b5c11f02a91baf830f33e456e0571d0680d1d76999ed242ed" +checksum = "f77000541a62ceeec01eef3ee0f86c155c33dac5fae750ad04a40852c6d5469a" dependencies = [ "const_format", "proc-macro-error", "proc-macro2", "quote", "serde", - "syn 2.0.39", + "syn 2.0.52", "xxhash-rust", ] [[package]] name = "server_fn_macro_default" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8aaf8cf1f5dde82d3f37548732a4852f65d5279b4ae40add5a2a3c9e559f662" +checksum = "8a3353f22e2bcc451074d4feaa37317d9d17dff11d4311928384734ea17ab9ca" dependencies = [ "server_fn_macro", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -3191,9 +3145,9 @@ dependencies = [ [[package]] name = "slotmap" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" dependencies = [ "serde", "version_check", @@ -3201,28 +3155,18 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - -[[package]] -name = "socket2" -version = "0.4.10" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -3313,9 +3257,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -3331,9 +3275,15 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "system-configuration" version = "0.5.1" @@ -3374,18 +3324,18 @@ version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a2d580ff6a20c55dfb86be5f9c238f67835d0e81cbdea8bf5680e0897320331" dependencies = [ - "cfg-expr 0.15.5", + "cfg-expr 0.15.7", "heck 0.4.1", "pkg-config", - "toml 0.8.8", + "toml 0.8.10", "version-compare 0.1.1", ] [[package]] name = "tao" -version = "0.16.5" +version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f5aefd6be4cd3ad3f047442242fd9f57cbfb3e565379f66b5e14749364fa4f" +checksum = "d22205b267a679ca1c590b9f178488d50981fc3e48a1b91641ae31593db875ce" dependencies = [ "bitflags 1.3.2", "cairo-rs", @@ -3452,19 +3402,20 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.12" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tauri" -version = "1.5.2" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bfe673cf125ef364d6f56b15e8ce7537d9ca7e4dae1cf6fbbdeed2e024db3d9" +checksum = "f078117725e36d55d29fafcbb4b1e909073807ca328ae8deb8c0b3843aac0fed" dependencies = [ "anyhow", "cocoa", "dirs-next", + "dunce", "embed_plist", "encoding_rs", "flate2", @@ -3503,11 +3454,11 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3475e55acec0b4a50fb96435f19631fb58cbcd31923e1a213de5c382536bbb" +checksum = "a1554c5857f65dbc377cefb6b97c8ac77b1cb2a90d30d3448114d5d6b48a77fc" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "brotli", "ico", "json-patch", @@ -3534,7 +3485,7 @@ dependencies = [ "leptos", "log", "serde", - "serde-wasm-bindgen 0.6.1", + "serde-wasm-bindgen 0.6.5", "tauri", "tauri-interop-macro", "thiserror", @@ -3551,14 +3502,14 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "tauri-macros" -version = "1.4.1" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613740228de92d9196b795ac455091d3a5fbdac2654abb8bb07d010b62ab43af" +checksum = "277abf361a3a6993ec16bcbb179de0d6518009b851090a01adfea12ac89fa875" dependencies = [ "heck 0.4.1", "proc-macro2", @@ -3570,9 +3521,9 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07f8e9e53e00e9f41212c115749e87d5cd2a9eebccafca77a19722eeecd56d43" +checksum = "cf2d0652aa2891ff3e9caa2401405257ea29ab8372cce01f186a5825f1bd0e76" dependencies = [ "gtk", "http", @@ -3591,9 +3542,9 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "0.14.1" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8141d72b6b65f2008911e9ef5b98a68d1e3413b7a1464e8f85eb3673bb19a895" +checksum = "067c56fc153b3caf406d7cd6de4486c80d1d66c0f414f39e94cb2f5543f6445f" dependencies = [ "cocoa", "gtk", @@ -3611,22 +3562,22 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "1.5.0" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d55e185904a84a419308d523c2c6891d5e2dbcee740c4997eb42e75a7b0f46" +checksum = "75ad0bbb31fccd1f4c56275d0a5c3abdf1f59999f72cb4ef8b79b4ed42082a21" dependencies = [ "brotli", "ctor", "dunce", "glob", "heck 0.4.1", - "html5ever 0.26.0", + "html5ever", "infer", "json-patch", "kuchikiki", "log", "memchr", - "phf 0.10.1", + "phf 0.11.2", "proc-macro2", "quote", "semver", @@ -3636,20 +3587,19 @@ dependencies = [ "thiserror", "url", "walkdir", - "windows 0.39.0", + "windows-version", ] [[package]] name = "tempfile" -version = "3.8.1" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.4.1", "rustix", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -3671,29 +3621,29 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -3701,12 +3651,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", - "itoa 1.0.9", + "itoa 1.0.10", + "num-conv", "powerfmt", "serde", "time-core", @@ -3721,10 +3672,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -3745,9 +3697,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.34.0" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -3755,8 +3707,8 @@ dependencies = [ "mio", "num_cpus", "pin-project-lite", - "socket2 0.5.5", - "windows-sys", + "socket2", + "windows-sys 0.48.0", ] [[package]] @@ -3784,14 +3736,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" +checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.21.0", + "toml_edit 0.22.6", ] [[package]] @@ -3809,22 +3761,22 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.5", "toml_datetime", - "winnow", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.21.0" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.5", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.5", ] [[package]] @@ -3852,7 +3804,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -3896,37 +3848,37 @@ dependencies = [ [[package]] name = "treediff" -version = "4.0.2" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52984d277bdf2a751072b5df30ec0377febdb02f7696d64c2d7d54630bac4303" +checksum = "4d127780145176e2b5d16611cc25a900150e86e9fd79d3bde6ff3a37359c9cb5" dependencies = [ "serde_json", ] [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typed-builder" -version = "0.16.2" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34085c17941e36627a879208083e25d357243812c30e7d7387c3b954f30ade16" +checksum = "444d8748011b93cb168770e8092458cb0f8854f931ff82fdf6ddfbd72a9c933e" dependencies = [ "typed-builder-macro", ] [[package]] name = "typed-builder-macro" -version = "0.16.2" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f03ca4cb38206e2bef0700092660bb74d696f808514dae47fa1467cbfe26e96e" +checksum = "563b3b88238ec95680aef36bdece66896eaa7ce3c0f1b4f39d38fb2435261352" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -3937,9 +3889,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -3949,18 +3901,18 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-xid" @@ -3994,11 +3946,11 @@ checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" [[package]] name = "uuid" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", ] [[package]] @@ -4027,9 +3979,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -4058,9 +4010,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.88" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4068,24 +4020,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.88" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.38" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ "cfg-if", "js-sys", @@ -4095,9 +4047,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.88" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4105,28 +4057,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.88" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.88" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "web-sys" -version = "0.3.65" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" dependencies = [ "js-sys", "wasm-bindgen", @@ -4264,11 +4216,12 @@ dependencies = [ [[package]] name = "windows" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "efc5cf48f83140dcaab716eeaea345f9e93d0018fb81162753a3f76c3397b538" dependencies = [ - "windows-targets", + "windows-core 0.53.0", + "windows-targets 0.52.4", ] [[package]] @@ -4283,11 +4236,21 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets", + "windows-targets 0.52.4", +] + +[[package]] +name = "windows-core" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dcc5b895a6377f1ab9fa55acedab1fd5ac0db66ad1e6c7f47e28a22e446a5dd" +dependencies = [ + "windows-result", + "windows-targets 0.52.4", ] [[package]] @@ -4306,13 +4269,31 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ee5e275231f07c6e240d14f34e1b635bf1faa1c76c57cfd59a5cdb9848e4278" +[[package]] +name = "windows-result" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd19df78e5168dfb0aedc343d1d1b8d422ab2db6756d2dc3fef75035402a3f64" +dependencies = [ + "windows-targets 0.52.4", +] + [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.4", ] [[package]] @@ -4321,27 +4302,57 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", + "windows_aarch64_gnullvm 0.48.5", "windows_aarch64_msvc 0.48.5", "windows_i686_gnu 0.48.5", "windows_i686_msvc 0.48.5", "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm", + "windows_x86_64_gnullvm 0.48.5", "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows-targets" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +dependencies = [ + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", +] + [[package]] name = "windows-tokens" version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f838de2fe15fe6bac988e74b798f26499a8b21a9d97edec321e79b28d1d7f597" +[[package]] +name = "windows-version" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75aa004c988e080ad34aff5739c39d0312f4684699d6d71fc8a198d057b8b9b4" +dependencies = [ + "windows-targets 0.52.4", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" + [[package]] name = "windows_aarch64_msvc" version = "0.39.0" @@ -4354,6 +4365,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" + [[package]] name = "windows_i686_gnu" version = "0.39.0" @@ -4366,6 +4383,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" + [[package]] name = "windows_i686_msvc" version = "0.39.0" @@ -4378,6 +4401,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" + [[package]] name = "windows_x86_64_gnu" version = "0.39.0" @@ -4390,12 +4419,24 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" + [[package]] name = "windows_x86_64_msvc" version = "0.39.0" @@ -4408,11 +4449,26 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" + [[package]] name = "winnow" -version = "0.5.19" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" dependencies = [ "memchr", ] @@ -4424,14 +4480,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "wry" -version = "0.24.6" +version = "0.24.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a70547e8f9d85da0f5af609143f7bde3ac7457a6e1073104d9b73d6c5ac744" +checksum = "6ad85d0e067359e409fcb88903c3eac817c392e5d638258abfb3da5ad8ba6fc4" dependencies = [ "base64 0.13.1", "block", @@ -4443,9 +4499,9 @@ dependencies = [ "gio", "glib", "gtk", - "html5ever 0.25.2", + "html5ever", "http", - "kuchiki", + "kuchikiki", "libc", "log", "objc", @@ -4488,18 +4544,20 @@ dependencies = [ [[package]] name = "xattr" -version = "1.0.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" +checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", + "linux-raw-sys", + "rustix", ] [[package]] name = "xxhash-rust" -version = "0.8.7" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9828b178da53440fa9c766a3d2f73f7cf5d0ac1fe3980c1e5018d899fd19e07b" +checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03" [[package]] name = "yansi" diff --git a/Cargo.toml b/Cargo.toml index 7cd4b92..dcfa8a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,27 +23,27 @@ readme = "README.md" tauri-interop-macro = { path = "./tauri-interop-macro" } #tauri-interop-macro = "2.0.0" -js-sys = "0.3.65" -serde = { version = "1.0.193", features = ["derive"] } -wasm-bindgen = "0.2.88" -wasm-bindgen-futures = "0.4.38" -thiserror = "1.0.50" -serde-wasm-bindgen = "0.6.1" -log = "0.4.20" +js-sys = "0.3" +serde = { version = "1.0", features = ["derive"] } +wasm-bindgen = "0.2" +wasm-bindgen-futures = "0.4" +thiserror = "1.0" +serde-wasm-bindgen = "0.6" +log = "0.4" # leptos feature -leptos = { version = "0.5.2", optional = true } +leptos = { version = "0.5", optional = true } # only include if not wasm [target.'cfg(not(target_family = "wasm"))'.dependencies] -tauri = { version = "1.5.2", default-features = false, features = ["wry"] } +tauri = { version = "1.5", default-features = false, features = ["wry"] } [target.'cfg(target_family = "wasm")'.dependencies] tauri-interop-macro = { path = "./tauri-interop-macro", features = [ "wasm" ] } -# tauri-interop-macro = { version = "1.2.0", features = [ "wasm" ] } +# tauri-interop-macro = { version = "2", features = [ "wasm" ] } [target.'cfg(not(target_family = "wasm"))'.dev-dependencies] -tauri = "1.5.2" +tauri = "1.5" [features] # todo: remove default feature before publish diff --git a/tauri-interop-macro/Cargo.lock b/tauri-interop-macro/Cargo.lock deleted file mode 100644 index 8f62487..0000000 --- a/tauri-interop-macro/Cargo.lock +++ /dev/null @@ -1,69 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "convert_case" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "proc-macro2" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "syn" -version = "2.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tauri-interop" -version = "0.0.1" -dependencies = [ - "convert_case", - "lazy_static", - "quote", - "syn", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" diff --git a/tauri-interop-macro/Cargo.toml b/tauri-interop-macro/Cargo.toml index 7fcea5e..bca2039 100644 --- a/tauri-interop-macro/Cargo.toml +++ b/tauri-interop-macro/Cargo.toml @@ -13,12 +13,12 @@ description = "Macros for the tauri-interop crate." proc-macro = true [dependencies] -syn = { version = "2.0", features = [ "full" ]} -quote = "1.0" -convert_case = "0.6.0" -lazy_static = "1.4.0" -serde = "1.0.193" -proc-macro2 = "1.0.75" +syn = { version = "^2.0", features = [ "full" ]} +quote = "^1.0" +convert_case = "^0.6" +lazy_static = "^1.4" +serde = "^1.0" +proc-macro2 = "^1.0" [features] # todo: remove default feature before publish diff --git a/test-project/Cargo.lock b/test-project/Cargo.lock index 52d9f41..b1147bc 100644 --- a/test-project/Cargo.lock +++ b/test-project/Cargo.lock @@ -58,9 +58,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" [[package]] name = "api" @@ -70,7 +70,7 @@ dependencies = [ "leptos", "log", "serde", - "serde-wasm-bindgen 0.6.1", + "serde-wasm-bindgen 0.6.5", "tauri", "tauri-interop", "wasm-bindgen", @@ -85,18 +85,18 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -132,7 +132,7 @@ dependencies = [ "attribute-derive-macro", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -148,7 +148,7 @@ dependencies = [ "proc-macro2", "quote", "quote-use", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -180,9 +180,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bitflags" @@ -192,9 +192,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "block" @@ -234,9 +234,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.8.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" +checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" dependencies = [ "memchr", "serde", @@ -244,15 +244,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" [[package]] name = "byteorder" @@ -308,12 +308,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc" [[package]] name = "cesu8" @@ -343,9 +340,9 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.15.5" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3" +checksum = "fa50868b64a9a6fda9d593ce778849ea8715cd2a3d2cc17ffdb4a2f2f2f1961d" dependencies = [ "smallvec", "target-lexicon", @@ -359,22 +356,22 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", "serde", - "windows-targets", + "windows-targets 0.52.4", ] [[package]] name = "ciborium" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" dependencies = [ "ciborium-io", "ciborium-ll", @@ -383,15 +380,15 @@ dependencies = [ [[package]] name = "ciborium-io" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" [[package]] name = "ciborium-ll" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" dependencies = [ "ciborium-io", "half", @@ -520,9 +517,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -530,9 +527,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "core-graphics" @@ -549,9 +546,9 @@ dependencies = [ [[package]] name = "core-graphics-types" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -560,41 +557,62 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] -name = "crossbeam-utils" -version = "0.8.16" +name = "crossbeam-deque" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "crypto-common" version = "0.1.6" @@ -629,24 +647,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "ctor" -version = "0.1.26" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" +checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" dependencies = [ "quote", - "syn 1.0.109", + "syn 2.0.52", ] [[package]] name = "darling" -version = "0.20.3" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" dependencies = [ "darling_core", "darling_macro", @@ -654,34 +672,34 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.3" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "darling_macro" -version = "0.20.3" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", @@ -689,13 +707,13 @@ dependencies = [ [[package]] name = "derive-where" -version = "1.2.5" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146398d62142a0f35248a608f17edf0dde57338354966d6e41d0eb2d16980ccb" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -777,19 +795,20 @@ checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "embed-resource" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54cc3e827ee1c3812239a9a41dede7b4d7d5d5464faa32d71bd7cba28ce2cb2" +checksum = "3bde55e389bea6a966bd467ad1ad7da0ae14546a5bc794d16d1e55e7fca44881" dependencies = [ "cc", + "memchr", "rustc_version", - "toml 0.8.8", + "toml 0.8.10", "vswhom", "winreg 0.51.0", ] @@ -811,9 +830,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ "humantime", "is-terminal", @@ -830,12 +849,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -846,9 +865,9 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fdeflate" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d6dafc854908ff5da46ff3f8f473c6984119a2876a383a860246dd7841a868" +checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" dependencies = [ "simd-adler32", ] @@ -865,14 +884,14 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.22" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", - "windows-sys 0.48.0", + "redox_syscall", + "windows-sys 0.52.0", ] [[package]] @@ -926,7 +945,7 @@ dependencies = [ "leptos", "log", "serde", - "serde-wasm-bindgen 0.6.1", + "serde-wasm-bindgen 0.6.5", "wasm-bindgen-futures", ] @@ -942,9 +961,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -957,9 +976,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -967,15 +986,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -984,38 +1003,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -1126,15 +1145,16 @@ dependencies = [ [[package]] name = "generator" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" +checksum = "b5b25e5b3e733153bcab35ee4671b46604b42516163cae442d1601cb716f2ac5" dependencies = [ "cc", + "cfg-if", "libc", "log", "rustversion", - "windows 0.48.0", + "windows 0.53.0", ] [[package]] @@ -1160,9 +1180,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "js-sys", @@ -1173,9 +1193,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "gio" @@ -1260,15 +1280,15 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" +checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" dependencies = [ "aho-corasick", "bstr", - "fnv", "log", - "regex", + "regex-automata 0.4.5", + "regex-syntax 0.8.2", ] [[package]] @@ -1382,9 +1402,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", @@ -1392,7 +1412,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.1.0", + "indexmap 2.2.5", "slab", "tokio", "tokio-util", @@ -1401,9 +1421,13 @@ dependencies = [ [[package]] name = "half" -version = "1.8.2" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e" +dependencies = [ + "cfg-if", + "crunchy", +] [[package]] name = "hashbrown" @@ -1413,9 +1437,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "heck" @@ -1434,9 +1458,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -1453,20 +1477,6 @@ dependencies = [ "utf8-width", ] -[[package]] -name = "html5ever" -version = "0.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c13fb08e5d4dfc151ee5e88bae63f7773d61852f3bdc73c9f4b9e1bde03148" -dependencies = [ - "log", - "mac", - "markup5ever 0.10.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "html5ever" version = "0.26.0" @@ -1475,7 +1485,7 @@ checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7" dependencies = [ "log", "mac", - "markup5ever 0.11.0", + "markup5ever", "proc-macro2", "quote", "syn 1.0.109", @@ -1489,14 +1499,14 @@ checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", - "itoa 1.0.9", + "itoa 1.0.10", ] [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http", @@ -1529,9 +1539,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -1542,9 +1552,9 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.9", + "itoa 1.0.10", "pin-project-lite", - "socket2 0.4.10", + "socket2", "tokio", "tower-service", "tracing", @@ -1553,16 +1563,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -1602,31 +1612,29 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.20" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492" +checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" dependencies = [ + "crossbeam-deque", "globset", - "lazy_static", "log", "memchr", - "regex", + "regex-automata 0.4.5", "same-file", - "thread_local", "walkdir", "winapi-util", ] [[package]] name = "image" -version = "0.24.7" +version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f3dfdbdd72063086ff443e297b61695500514b1e41095b6fb9a5ab48a70a711" +checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" dependencies = [ "bytemuck", "byteorder", "color_quant", - "num-rational", "num-traits", ] @@ -1643,20 +1651,20 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", - "hashbrown 0.14.2", + "hashbrown 0.14.3", "serde", ] [[package]] name = "infer" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a898e4b7951673fce96614ce5751d13c40fc5674bc2d759288e46c3ab62598b3" +checksum = "f551f8c3a39f68f986517db0d1759de85881894fdc7db798bd2a9df9cb04b7fc" dependencies = [ "cfb", ] @@ -1678,9 +1686,9 @@ checksum = "71dd52191aae121e8611f1e8dc3e324dd0dd1dee1e6dd91d10ee07a3cfb4d9d8" [[package]] name = "inventory" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0508c56cfe9bfd5dfeb0c22ab9a6abfda2f27bdca422132e494266351ed8d83c" +checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" [[package]] name = "ipnet" @@ -1690,29 +1698,20 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", + "libc", + "windows-sys 0.52.0", ] [[package]] name = "itertools" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -1725,9 +1724,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "javascriptcore-rs" @@ -1774,9 +1773,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -1793,18 +1792,6 @@ dependencies = [ "treediff", ] -[[package]] -name = "kuchiki" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ea8e9c6e031377cff82ee3001dc8026cdf431ed4e2e6b51f98ab8c73484a358" -dependencies = [ - "cssparser", - "html5ever 0.25.2", - "matches", - "selectors", -] - [[package]] name = "kuchikiki" version = "0.8.2" @@ -1812,7 +1799,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f29e4755b7b995046f510a7520c42b2fed58b77bd94d5a87a8eb43d2fd126da8" dependencies = [ "cssparser", - "html5ever 0.26.0", + "html5ever", "indexmap 1.9.3", "matches", "selectors", @@ -1826,9 +1813,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leptos" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98f0fe11faa66358ff8c2ee48881c54f8f216ecddabfc5b69cdc2e90c8e337b" +checksum = "269ba4ba91ffa73d9559c975e0be17bd4eb34c6b6abd7fdd5704106132d89d2a" dependencies = [ "cfg-if", "leptos_config", @@ -1846,9 +1833,9 @@ dependencies = [ [[package]] name = "leptos_config" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f0e1a9a583d943b19c740c82a3ec69224c979af90f40738d93ec59ee1475bb" +checksum = "e72d8689d54737991831e9b279bb4fba36d27a93aa975c75cd4241d9a4a425ec" dependencies = [ "config", "regex", @@ -1859,18 +1846,18 @@ dependencies = [ [[package]] name = "leptos_dom" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111391d1ccbc3355344f90f0893f4137db13a7f98d53fede0a3613c522ebaf19" +checksum = "ad314950d41acb1bfdb8b5924811b2983484a8d6f69a20b834a173a682657ed4" dependencies = [ "async-recursion", "cfg-if", "drain_filter_polyfill", "futures", - "getrandom 0.2.11", + "getrandom 0.2.12", "html-escape", - "indexmap 2.1.0", - "itertools 0.10.5", + "indexmap 2.2.5", + "itertools", "js-sys", "leptos_reactive", "once_cell", @@ -1889,33 +1876,33 @@ dependencies = [ [[package]] name = "leptos_hot_reload" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6902fabee84955a85a6cdebf8ddfbfb134091087b172e32ebb26e571d4640ca" +checksum = "3f62dcab17728877f2d2f16d2c8a6701c4c5fbdfb4964792924acb0b50529659" dependencies = [ "anyhow", "camino", - "indexmap 2.1.0", + "indexmap 2.2.5", "parking_lot", "proc-macro2", "quote", "rstml", "serde", - "syn 2.0.39", + "syn 2.0.52", "walkdir", ] [[package]] name = "leptos_macro" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68201041cc5af68f7eb35015336827a36c543d87dcf2403117d7244db1f14a0" +checksum = "57955d66f624265222444a5c565fea38efa5b0152a1dfc7c060a78e5fb62a852" dependencies = [ "attribute-derive", "cfg-if", "convert_case 0.6.0", "html-escape", - "itertools 0.11.0", + "itertools", "leptos_hot_reload", "prettyplease", "proc-macro-error", @@ -1923,21 +1910,21 @@ dependencies = [ "quote", "rstml", "server_fn_macro", - "syn 2.0.39", + "syn 2.0.52", "tracing", "uuid", ] [[package]] name = "leptos_reactive" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282e84ae3e3eb30ab1eb1c881bfeea8a3cb6d6c683dc99f26f2f69ee240b148d" +checksum = "b4f54a525a0edfc8c2bf3ee92aae411800b8b10892c9cd819f8e8a6d4f0d62f3" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "cfg-if", "futures", - "indexmap 2.1.0", + "indexmap 2.2.5", "js-sys", "paste", "pin-project", @@ -1956,9 +1943,9 @@ dependencies = [ [[package]] name = "leptos_server" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67f3810352bab860bcfa85f1760de4bd6e82cd72b14a97779d9168d37661bbf" +checksum = "2fd1517c2024bc47d764e96053e55b927f8a2159e735a0cc47232542b493df9d" dependencies = [ "inventory", "lazy_static", @@ -1972,9 +1959,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.150" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libredox" @@ -1982,9 +1969,9 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "libc", - "redox_syscall 0.4.1", + "redox_syscall", ] [[package]] @@ -1998,9 +1985,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.11" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -2014,9 +2001,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "loom" @@ -2057,7 +2044,7 @@ dependencies = [ "manyhow-macros", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -2071,20 +2058,6 @@ dependencies = [ "quote", ] -[[package]] -name = "markup5ever" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" -dependencies = [ - "log", - "phf 0.8.0", - "phf_codegen 0.8.0", - "string_cache", - "string_cache_codegen", - "tendril", -] - [[package]] name = "markup5ever" version = "0.11.0" @@ -2116,9 +2089,9 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memoffset" @@ -2143,9 +2116,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", "simd-adler32", @@ -2153,9 +2126,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.9" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", @@ -2223,31 +2196,16 @@ dependencies = [ ] [[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.1" +name = "num-conv" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -2313,18 +2271,18 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "open" @@ -2391,9 +2349,9 @@ checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", + "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -2431,9 +2389,17 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" dependencies = [ - "phf_macros 0.10.0", "phf_shared 0.10.0", - "proc-macro-hack", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_macros 0.11.2", + "phf_shared 0.11.2", ] [[package]] @@ -2476,6 +2442,16 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared 0.11.2", + "rand 0.8.5", +] + [[package]] name = "phf_macros" version = "0.8.0" @@ -2492,16 +2468,15 @@ dependencies = [ [[package]] name = "phf_macros" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", - "proc-macro-hack", + "phf_generator 0.11.2", + "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.52", ] [[package]] @@ -2522,24 +2497,33 @@ dependencies = [ "siphasher", ] +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -2556,9 +2540,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "plist" @@ -2566,8 +2550,8 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef" dependencies = [ - "base64 0.21.5", - "indexmap 2.1.0", + "base64 0.21.7", + "indexmap 2.2.5", "line-wrap", "quick-xml", "serde", @@ -2576,9 +2560,9 @@ dependencies = [ [[package]] name = "png" -version = "0.17.10" +version = "0.17.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd75bf2d8dd3702b9707cdbc56a5b9ef42cec752eb8b3bafc01234558442aa64" +checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" dependencies = [ "bitflags 1.3.2", "crc32fast", @@ -2607,12 +2591,12 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "prettyplease" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -2668,9 +2652,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.75" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -2683,7 +2667,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", "version_check", "yansi", ] @@ -2699,9 +2683,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -2714,7 +2698,7 @@ checksum = "a7b5abe3fe82fdeeb93f44d66a7b444dedf2e4827defb0a8e69c437b2de2ef94" dependencies = [ "quote", "quote-use-macros", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -2726,7 +2710,7 @@ dependencies = [ "derive-where", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -2789,7 +2773,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", ] [[package]] @@ -2816,15 +2800,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -2840,20 +2815,20 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "libredox", "thiserror", ] [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] @@ -2868,9 +2843,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -2891,11 +2866,11 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.22" +version = "0.11.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -2914,6 +2889,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", "system-configuration", "tokio", "tower-service", @@ -2933,7 +2909,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.39", + "syn 2.0.52", "syn_derive", "thiserror", ] @@ -2961,15 +2937,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.25" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2980,9 +2956,9 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "safemem" @@ -3033,24 +3009,24 @@ dependencies = [ [[package]] name = "self_cell" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e388332cd64eb80cd595a00941baf513caffae8dce9cfd0467fc9c66397dade6" +checksum = "58bf37232d3bb9a2c4e641ca2a11d83b5062066f88df7fed36c28772046d65ba" [[package]] name = "semver" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.193" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] @@ -3068,9 +3044,9 @@ dependencies = [ [[package]] name = "serde-wasm-bindgen" -version = "0.6.1" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ba92964781421b6cef36bf0d7da26d201e96d84e1b10e7ae6ed416e516906d" +checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b" dependencies = [ "js-sys", "serde", @@ -3079,22 +3055,23 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ - "itoa 1.0.9", + "indexmap 2.2.5", + "itoa 1.0.10", "ryu", "serde", ] @@ -3112,20 +3089,20 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" +checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "serde_spanned" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ "serde", ] @@ -3137,23 +3114,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.9", + "itoa 1.0.10", "ryu", "serde", ] [[package]] name = "serde_with" -version = "3.4.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.1.0", + "indexmap 2.2.5", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -3161,14 +3139,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.4.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -3195,9 +3173,9 @@ dependencies = [ [[package]] name = "server_fn" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0186f969a1f9572af27159b8273252abf9a6a38934130fe6f3ae0e439d48cf14" +checksum = "6c265de965fe48e09ad8899d0ab1ffebdfa1a9914e4de5ff107b07bd94cf7541" dependencies = [ "ciborium", "const_format", @@ -3212,34 +3190,34 @@ dependencies = [ "serde_json", "serde_qs", "server_fn_macro_default", - "syn 2.0.39", + "syn 2.0.52", "thiserror", "xxhash-rust", ] [[package]] name = "server_fn_macro" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dbc70e4f185ff2b5c11f02a91baf830f33e456e0571d0680d1d76999ed242ed" +checksum = "f77000541a62ceeec01eef3ee0f86c155c33dac5fae750ad04a40852c6d5469a" dependencies = [ "const_format", "proc-macro-error", "proc-macro2", "quote", "serde", - "syn 2.0.39", + "syn 2.0.52", "xxhash-rust", ] [[package]] name = "server_fn_macro_default" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8aaf8cf1f5dde82d3f37548732a4852f65d5279b4ae40add5a2a3c9e559f662" +checksum = "8a3353f22e2bcc451074d4feaa37317d9d17dff11d4311928384734ea17ab9ca" dependencies = [ "server_fn_macro", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -3295,9 +3273,9 @@ dependencies = [ [[package]] name = "slotmap" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" dependencies = [ "serde", "version_check", @@ -3305,28 +3283,18 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - -[[package]] -name = "socket2" -version = "0.4.10" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3430,9 +3398,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -3448,9 +3416,15 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "system-configuration" version = "0.5.1" @@ -3491,18 +3465,18 @@ version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a2d580ff6a20c55dfb86be5f9c238f67835d0e81cbdea8bf5680e0897320331" dependencies = [ - "cfg-expr 0.15.5", + "cfg-expr 0.15.7", "heck 0.4.1", "pkg-config", - "toml 0.8.8", + "toml 0.8.10", "version-compare 0.1.1", ] [[package]] name = "tao" -version = "0.16.5" +version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f5aefd6be4cd3ad3f047442242fd9f57cbfb3e565379f66b5e14749364fa4f" +checksum = "d22205b267a679ca1c590b9f178488d50981fc3e48a1b91641ae31593db875ce" dependencies = [ "bitflags 1.3.2", "cairo-rs", @@ -3569,19 +3543,20 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.12" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tauri" -version = "1.5.2" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bfe673cf125ef364d6f56b15e8ce7537d9ca7e4dae1cf6fbbdeed2e024db3d9" +checksum = "f078117725e36d55d29fafcbb4b1e909073807ca328ae8deb8c0b3843aac0fed" dependencies = [ "anyhow", "cocoa", "dirs-next", + "dunce", "embed_plist", "encoding_rs", "flate2", @@ -3622,9 +3597,9 @@ dependencies = [ [[package]] name = "tauri-build" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defbfc551bd38ab997e5f8e458f87396d2559d05ce32095076ad6c30f7fc5f9c" +checksum = "e9914a4715e0b75d9f387a285c7e26b5bbfeb1249ad9f842675a82481565c532" dependencies = [ "anyhow", "cargo_toml", @@ -3641,11 +3616,11 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3475e55acec0b4a50fb96435f19631fb58cbcd31923e1a213de5c382536bbb" +checksum = "a1554c5857f65dbc377cefb6b97c8ac77b1cb2a90d30d3448114d5d6b48a77fc" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "brotli", "ico", "json-patch", @@ -3673,7 +3648,7 @@ dependencies = [ "leptos", "log", "serde", - "serde-wasm-bindgen 0.6.1", + "serde-wasm-bindgen 0.6.5", "tauri", "tauri-interop-macro", "thiserror", @@ -3690,14 +3665,14 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "tauri-macros" -version = "1.4.1" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613740228de92d9196b795ac455091d3a5fbdac2654abb8bb07d010b62ab43af" +checksum = "277abf361a3a6993ec16bcbb179de0d6518009b851090a01adfea12ac89fa875" dependencies = [ "heck 0.4.1", "proc-macro2", @@ -3709,9 +3684,9 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07f8e9e53e00e9f41212c115749e87d5cd2a9eebccafca77a19722eeecd56d43" +checksum = "cf2d0652aa2891ff3e9caa2401405257ea29ab8372cce01f186a5825f1bd0e76" dependencies = [ "gtk", "http", @@ -3730,9 +3705,9 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "0.14.1" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8141d72b6b65f2008911e9ef5b98a68d1e3413b7a1464e8f85eb3673bb19a895" +checksum = "067c56fc153b3caf406d7cd6de4486c80d1d66c0f414f39e94cb2f5543f6445f" dependencies = [ "cocoa", "gtk", @@ -3750,22 +3725,22 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "1.5.0" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d55e185904a84a419308d523c2c6891d5e2dbcee740c4997eb42e75a7b0f46" +checksum = "75ad0bbb31fccd1f4c56275d0a5c3abdf1f59999f72cb4ef8b79b4ed42082a21" dependencies = [ "brotli", "ctor", "dunce", "glob", "heck 0.4.1", - "html5ever 0.26.0", + "html5ever", "infer", "json-patch", "kuchikiki", "log", "memchr", - "phf 0.10.1", + "phf 0.11.2", "proc-macro2", "quote", "semver", @@ -3775,7 +3750,7 @@ dependencies = [ "thiserror", "url", "walkdir", - "windows 0.39.0", + "windows-version", ] [[package]] @@ -3790,15 +3765,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.1" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.4.1", "rustix", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3814,9 +3788,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -3829,29 +3803,29 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -3859,12 +3833,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", - "itoa 1.0.9", + "itoa 1.0.10", + "num-conv", "powerfmt", "serde", "time-core", @@ -3879,10 +3854,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -3903,9 +3879,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.34.0" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -3913,7 +3889,7 @@ dependencies = [ "mio", "num_cpus", "pin-project-lite", - "socket2 0.5.5", + "socket2", "windows-sys 0.48.0", ] @@ -3954,14 +3930,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" +checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.21.0", + "toml_edit 0.22.6", ] [[package]] @@ -3979,24 +3955,24 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.5", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.21.0" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.5", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.5", ] [[package]] @@ -4024,7 +4000,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -4068,37 +4044,37 @@ dependencies = [ [[package]] name = "treediff" -version = "4.0.2" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52984d277bdf2a751072b5df30ec0377febdb02f7696d64c2d7d54630bac4303" +checksum = "4d127780145176e2b5d16611cc25a900150e86e9fd79d3bde6ff3a37359c9cb5" dependencies = [ "serde_json", ] [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typed-builder" -version = "0.16.2" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34085c17941e36627a879208083e25d357243812c30e7d7387c3b954f30ade16" +checksum = "444d8748011b93cb168770e8092458cb0f8854f931ff82fdf6ddfbd72a9c933e" dependencies = [ "typed-builder-macro", ] [[package]] name = "typed-builder-macro" -version = "0.16.2" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f03ca4cb38206e2bef0700092660bb74d696f808514dae47fa1467cbfe26e96e" +checksum = "563b3b88238ec95680aef36bdece66896eaa7ce3c0f1b4f39d38fb2435261352" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", ] [[package]] @@ -4109,9 +4085,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -4121,18 +4097,18 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-xid" @@ -4166,11 +4142,11 @@ checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" [[package]] name = "uuid" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", ] [[package]] @@ -4219,9 +4195,9 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -4250,9 +4226,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "serde", @@ -4262,24 +4238,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.38" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ "cfg-if", "js-sys", @@ -4289,9 +4265,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4299,28 +4275,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.52", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "web-sys" -version = "0.3.65" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" dependencies = [ "js-sys", "wasm-bindgen", @@ -4458,11 +4434,12 @@ dependencies = [ [[package]] name = "windows" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "efc5cf48f83140dcaab716eeaea345f9e93d0018fb81162753a3f76c3397b538" dependencies = [ - "windows-targets", + "windows-core 0.53.0", + "windows-targets 0.52.4", ] [[package]] @@ -4477,11 +4454,21 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.4", +] + +[[package]] +name = "windows-core" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "9dcc5b895a6377f1ab9fa55acedab1fd5ac0db66ad1e6c7f47e28a22e446a5dd" dependencies = [ - "windows-targets", + "windows-result", + "windows-targets 0.52.4", ] [[package]] @@ -4500,6 +4487,15 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ee5e275231f07c6e240d14f34e1b635bf1faa1c76c57cfd59a5cdb9848e4278" +[[package]] +name = "windows-result" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd19df78e5168dfb0aedc343d1d1b8d422ab2db6756d2dc3fef75035402a3f64" +dependencies = [ + "windows-targets 0.52.4", +] + [[package]] name = "windows-sys" version = "0.42.0" @@ -4521,7 +4517,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.4", ] [[package]] @@ -4539,12 +4544,36 @@ dependencies = [ "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows-targets" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +dependencies = [ + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", +] + [[package]] name = "windows-tokens" version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f838de2fe15fe6bac988e74b798f26499a8b21a9d97edec321e79b28d1d7f597" +[[package]] +name = "windows-version" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75aa004c988e080ad34aff5739c39d0312f4684699d6d71fc8a198d057b8b9b4" +dependencies = [ + "windows-targets 0.52.4", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -4557,6 +4586,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" + [[package]] name = "windows_aarch64_msvc" version = "0.39.0" @@ -4575,6 +4610,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" + [[package]] name = "windows_i686_gnu" version = "0.39.0" @@ -4593,6 +4634,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" + [[package]] name = "windows_i686_msvc" version = "0.39.0" @@ -4611,6 +4658,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" + [[package]] name = "windows_x86_64_gnu" version = "0.39.0" @@ -4629,6 +4682,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -4641,6 +4700,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" + [[package]] name = "windows_x86_64_msvc" version = "0.39.0" @@ -4659,11 +4724,26 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" + [[package]] name = "winnow" -version = "0.5.19" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" dependencies = [ "memchr", ] @@ -4690,9 +4770,9 @@ dependencies = [ [[package]] name = "wry" -version = "0.24.6" +version = "0.24.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a70547e8f9d85da0f5af609143f7bde3ac7457a6e1073104d9b73d6c5ac744" +checksum = "6ad85d0e067359e409fcb88903c3eac817c392e5d638258abfb3da5ad8ba6fc4" dependencies = [ "base64 0.13.1", "block", @@ -4704,9 +4784,9 @@ dependencies = [ "gio", "glib", "gtk", - "html5ever 0.25.2", + "html5ever", "http", - "kuchiki", + "kuchikiki", "libc", "log", "objc", @@ -4749,18 +4829,20 @@ dependencies = [ [[package]] name = "xattr" -version = "1.0.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" +checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", + "linux-raw-sys", + "rustix", ] [[package]] name = "xxhash-rust" -version = "0.8.7" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9828b178da53440fa9c766a3d2f73f7cf5d0ac1fe3980c1e5018d899fd19e07b" +checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03" [[package]] name = "yansi" diff --git a/test-project/Cargo.toml b/test-project/Cargo.toml index 1611ae7..ddd601c 100644 --- a/test-project/Cargo.toml +++ b/test-project/Cargo.toml @@ -12,14 +12,14 @@ members = ["src-tauri", "api"] [dependencies] api = { path = "./api", default-features = false, features = [ "wasm" ]} -console_error_panic_hook = "0.1.7" -console_log = "1.0.0" -log = "0.4.20" -gloo-timers = "0.3.0" -serde-wasm-bindgen = "0.6.1" -serde = { version = "1.0.193", features = ["derive"] } -wasm-bindgen-futures = "0.4.38" -leptos = { version = "0.5.2", optional = true } +console_error_panic_hook = "^0.1" +console_log = "^1.0" +log = "^0.4" +gloo-timers = "^0.3" +serde-wasm-bindgen = "^0.6" +serde = { version = "^1.0", features = ["derive"] } +wasm-bindgen-futures = "^0.4" +leptos = { version = "^0.5", optional = true } [features] default = [ "leptos" ] diff --git a/test-project/api/Cargo.toml b/test-project/api/Cargo.toml index f4ebad7..80730da 100644 --- a/test-project/api/Cargo.toml +++ b/test-project/api/Cargo.toml @@ -7,18 +7,18 @@ edition = "2021" tauri-interop = { path = "../..", default-features = false, features = [ "event" ]} # common -log = "0.4.20" -serde = { version = "1.0", features = ["derive"] } +log = "0.4" +serde = { version = "1", features = ["derive"] } # host target -tauri = { version = "1.5.2", optional = true } +tauri = { version = "1.5", optional = true } # wasm target -js-sys = { version = "0.3.65", optional = true } -serde-wasm-bindgen = { version = "0.6.1", optional = true } +js-sys = { version = "0.3", optional = true } +serde-wasm-bindgen = { version = "0.6", optional = true } wasm-bindgen = { version = "0.2", features = ["serde-serialize"], optional = true } wasm-bindgen-futures = {version = "0.4", optional = true} -leptos = { version = "0.5.2", features = ["csr"], optional = true } +leptos = { version = "0.5", features = ["csr"], optional = true } [features] default = [ "host" ] diff --git a/test-project/src-tauri/Cargo.lock b/test-project/src-tauri/Cargo.lock deleted file mode 100644 index 085190c..0000000 --- a/test-project/src-tauri/Cargo.lock +++ /dev/null @@ -1,3797 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aho-corasick" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" -dependencies = [ - "memchr", -] - -[[package]] -name = "alloc-no-stdlib" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" - -[[package]] -name = "alloc-stdlib" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" -dependencies = [ - "alloc-no-stdlib", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anyhow" -version = "1.0.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" - -[[package]] -name = "api" -version = "0.1.0" -dependencies = [ - "log", - "serde", - "tauri", - "tauri-interop", -] - -[[package]] -name = "atk" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c3d816ce6f0e2909a96830d6911c2aff044370b1ef92d7f267b43bae5addedd" -dependencies = [ - "atk-sys", - "bitflags 1.3.2", - "glib", - "libc", -] - -[[package]] -name = "atk-sys" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58aeb089fb698e06db8089971c7ee317ab9644bade33383f63631437b03aafb6" -dependencies = [ - "glib-sys", - "gobject-sys", - "libc", - "system-deps 6.2.0", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" - -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "brotli" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", -] - -[[package]] -name = "brotli-decompressor" -version = "2.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] - -[[package]] -name = "bstr" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - -[[package]] -name = "bytemuck" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" - -[[package]] -name = "cairo-rs" -version = "0.15.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c76ee391b03d35510d9fa917357c7f1855bd9a6659c95a1b392e33f49b3369bc" -dependencies = [ - "bitflags 1.3.2", - "cairo-sys-rs", - "glib", - "libc", - "thiserror", -] - -[[package]] -name = "cairo-sys-rs" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8" -dependencies = [ - "glib-sys", - "libc", - "system-deps 6.2.0", -] - -[[package]] -name = "cargo_toml" -version = "0.15.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "599aa35200ffff8f04c1925aa1acc92fa2e08874379ef42e210a80e527e60838" -dependencies = [ - "serde", - "toml 0.7.8", -] - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" - -[[package]] -name = "cfb" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" -dependencies = [ - "byteorder", - "fnv", - "uuid", -] - -[[package]] -name = "cfg-expr" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3431df59f28accaf4cb4eed4a9acc66bea3f3c3753aa6cdc2f024174ef232af7" -dependencies = [ - "smallvec", -] - -[[package]] -name = "cfg-expr" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3" -dependencies = [ - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "num-traits", - "serde", - "windows-targets", -] - -[[package]] -name = "cocoa" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" -dependencies = [ - "bitflags 1.3.2", - "block", - "cocoa-foundation", - "core-foundation", - "core-graphics", - "foreign-types", - "libc", - "objc", -] - -[[package]] -name = "cocoa-foundation" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" -dependencies = [ - "bitflags 1.3.2", - "block", - "core-foundation", - "core-graphics-types", - "libc", - "objc", -] - -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - -[[package]] -name = "combine" -version = "4.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" -dependencies = [ - "bytes", - "memchr", -] - -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "convert_case" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - -[[package]] -name = "core-graphics" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-graphics-types", - "foreign-types", - "libc", -] - -[[package]] -name = "core-graphics-types" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "libc", -] - -[[package]] -name = "cpufeatures" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "cssparser" -version = "0.27.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a" -dependencies = [ - "cssparser-macros", - "dtoa-short", - "itoa 0.4.8", - "matches", - "phf 0.8.0", - "proc-macro2", - "quote", - "smallvec", - "syn 1.0.109", -] - -[[package]] -name = "cssparser-macros" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" -dependencies = [ - "quote", - "syn 2.0.39", -] - -[[package]] -name = "ctor" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "darling" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.39", -] - -[[package]] -name = "darling_macro" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "deranged" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" -dependencies = [ - "powerfmt", - "serde", -] - -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "convert_case 0.4.0", - "proc-macro2", - "quote", - "rustc_version", - "syn 1.0.109", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "dispatch" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" - -[[package]] -name = "dtoa" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" - -[[package]] -name = "dtoa-short" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbaceec3c6e4211c79e7b1800fb9680527106beb2f9c51904a3210c03a448c74" -dependencies = [ - "dtoa", -] - -[[package]] -name = "dunce" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" - -[[package]] -name = "embed-resource" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54cc3e827ee1c3812239a9a41dede7b4d7d5d5464faa32d71bd7cba28ce2cb2" -dependencies = [ - "cc", - "rustc_version", - "toml 0.8.8", - "vswhom", - "winreg", -] - -[[package]] -name = "embed_plist" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" - -[[package]] -name = "encoding_rs" -version = "0.8.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "env_logger" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - -[[package]] -name = "fdeflate" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d6dafc854908ff5da46ff3f8f473c6984119a2876a383a860246dd7841a868" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "field-offset" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" -dependencies = [ - "memoffset", - "rustc_version", -] - -[[package]] -name = "filetime" -version = "0.2.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.3.5", - "windows-sys 0.48.0", -] - -[[package]] -name = "flate2" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futf" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" -dependencies = [ - "mac", - "new_debug_unreachable", -] - -[[package]] -name = "futures-channel" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" -dependencies = [ - "futures-core", -] - -[[package]] -name = "futures-core" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" - -[[package]] -name = "futures-executor" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" - -[[package]] -name = "futures-macro" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "futures-task" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" - -[[package]] -name = "futures-util" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" -dependencies = [ - "futures-core", - "futures-macro", - "futures-task", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "gdk" -version = "0.15.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6e05c1f572ab0e1f15be94217f0dc29088c248b14f792a5ff0af0d84bcda9e8" -dependencies = [ - "bitflags 1.3.2", - "cairo-rs", - "gdk-pixbuf", - "gdk-sys", - "gio", - "glib", - "libc", - "pango", -] - -[[package]] -name = "gdk-pixbuf" -version = "0.15.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad38dd9cc8b099cceecdf41375bb6d481b1b5a7cd5cd603e10a69a9383f8619a" -dependencies = [ - "bitflags 1.3.2", - "gdk-pixbuf-sys", - "gio", - "glib", - "libc", -] - -[[package]] -name = "gdk-pixbuf-sys" -version = "0.15.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "140b2f5378256527150350a8346dbdb08fadc13453a7a2d73aecd5fab3c402a7" -dependencies = [ - "gio-sys", - "glib-sys", - "gobject-sys", - "libc", - "system-deps 6.2.0", -] - -[[package]] -name = "gdk-sys" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e7a08c1e8f06f4177fb7e51a777b8c1689f743a7bc11ea91d44d2226073a88" -dependencies = [ - "cairo-sys-rs", - "gdk-pixbuf-sys", - "gio-sys", - "glib-sys", - "gobject-sys", - "libc", - "pango-sys", - "pkg-config", - "system-deps 6.2.0", -] - -[[package]] -name = "gdkwayland-sys" -version = "0.15.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cca49a59ad8cfdf36ef7330fe7bdfbe1d34323220cc16a0de2679ee773aee2c2" -dependencies = [ - "gdk-sys", - "glib-sys", - "gobject-sys", - "libc", - "pkg-config", - "system-deps 6.2.0", -] - -[[package]] -name = "gdkx11-sys" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b7f8c7a84b407aa9b143877e267e848ff34106578b64d1e0a24bf550716178" -dependencies = [ - "gdk-sys", - "glib-sys", - "libc", - "system-deps 6.2.0", - "x11", -] - -[[package]] -name = "generator" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" -dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "windows 0.48.0", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "gimli" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" - -[[package]] -name = "gio" -version = "0.15.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68fdbc90312d462781a395f7a16d96a2b379bb6ef8cd6310a2df272771c4283b" -dependencies = [ - "bitflags 1.3.2", - "futures-channel", - "futures-core", - "futures-io", - "gio-sys", - "glib", - "libc", - "once_cell", - "thiserror", -] - -[[package]] -name = "gio-sys" -version = "0.15.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32157a475271e2c4a023382e9cab31c4584ee30a97da41d3c4e9fdd605abcf8d" -dependencies = [ - "glib-sys", - "gobject-sys", - "libc", - "system-deps 6.2.0", - "winapi", -] - -[[package]] -name = "glib" -version = "0.15.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb0306fbad0ab5428b0ca674a23893db909a98582969c9b537be4ced78c505d" -dependencies = [ - "bitflags 1.3.2", - "futures-channel", - "futures-core", - "futures-executor", - "futures-task", - "glib-macros", - "glib-sys", - "gobject-sys", - "libc", - "once_cell", - "smallvec", - "thiserror", -] - -[[package]] -name = "glib-macros" -version = "0.15.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10c6ae9f6fa26f4fb2ac16b528d138d971ead56141de489f8111e259b9df3c4a" -dependencies = [ - "anyhow", - "heck 0.4.1", - "proc-macro-crate", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "glib-sys" -version = "0.15.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4b192f8e65e9cf76cbf4ea71fa8e3be4a0e18ffe3d68b8da6836974cc5bad4" -dependencies = [ - "libc", - "system-deps 6.2.0", -] - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "globset" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" -dependencies = [ - "aho-corasick", - "bstr", - "fnv", - "log", - "regex", -] - -[[package]] -name = "gobject-sys" -version = "0.15.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d57ce44246becd17153bd035ab4d32cfee096a657fc01f2231c9278378d1e0a" -dependencies = [ - "glib-sys", - "libc", - "system-deps 6.2.0", -] - -[[package]] -name = "gtk" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e3004a2d5d6d8b5057d2b57b3712c9529b62e82c77f25c1fecde1fd5c23bd0" -dependencies = [ - "atk", - "bitflags 1.3.2", - "cairo-rs", - "field-offset", - "futures-channel", - "gdk", - "gdk-pixbuf", - "gio", - "glib", - "gtk-sys", - "gtk3-macros", - "libc", - "once_cell", - "pango", - "pkg-config", -] - -[[package]] -name = "gtk-sys" -version = "0.15.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5bc2f0587cba247f60246a0ca11fe25fb733eabc3de12d1965fc07efab87c84" -dependencies = [ - "atk-sys", - "cairo-sys-rs", - "gdk-pixbuf-sys", - "gdk-sys", - "gio-sys", - "glib-sys", - "gobject-sys", - "libc", - "pango-sys", - "system-deps 6.2.0", -] - -[[package]] -name = "gtk3-macros" -version = "0.15.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684c0456c086e8e7e9af73ec5b84e35938df394712054550e81558d21c44ab0d" -dependencies = [ - "anyhow", - "proc-macro-crate", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "html5ever" -version = "0.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c13fb08e5d4dfc151ee5e88bae63f7773d61852f3bdc73c9f4b9e1bde03148" -dependencies = [ - "log", - "mac", - "markup5ever 0.10.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "html5ever" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7" -dependencies = [ - "log", - "mac", - "markup5ever 0.11.0", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "http" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" -dependencies = [ - "bytes", - "fnv", - "itoa 1.0.9", -] - -[[package]] -name = "http-range" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "iana-time-zone" -version = "0.1.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ico" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3804960be0bb5e4edb1e1ad67afd321a9ecfd875c3e65c099468fd2717d7cae" -dependencies = [ - "byteorder", - "png", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "ignore" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492" -dependencies = [ - "globset", - "lazy_static", - "log", - "memchr", - "regex", - "same-file", - "thread_local", - "walkdir", - "winapi-util", -] - -[[package]] -name = "image" -version = "0.24.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f3dfdbdd72063086ff443e297b61695500514b1e41095b6fb9a5ab48a70a711" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "num-rational", - "num-traits", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - -[[package]] -name = "indexmap" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" -dependencies = [ - "equivalent", - "hashbrown 0.14.2", - "serde", -] - -[[package]] -name = "infer" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a898e4b7951673fce96614ce5751d13c40fc5674bc2d759288e46c3ab62598b3" -dependencies = [ - "cfb", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - -[[package]] -name = "itoa" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "javascriptcore-rs" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf053e7843f2812ff03ef5afe34bb9c06ffee120385caad4f6b9967fcd37d41c" -dependencies = [ - "bitflags 1.3.2", - "glib", - "javascriptcore-rs-sys", -] - -[[package]] -name = "javascriptcore-rs-sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "905fbb87419c5cde6e3269537e4ea7d46431f3008c5d057e915ef3f115e7793c" -dependencies = [ - "glib-sys", - "gobject-sys", - "libc", - "system-deps 5.0.0", -] - -[[package]] -name = "jni" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c" -dependencies = [ - "cesu8", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", -] - -[[package]] -name = "jni-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" - -[[package]] -name = "js-sys" -version = "0.3.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "json-patch" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ff1e1486799e3f64129f8ccad108b38290df9cd7015cd31bed17239f0789d6" -dependencies = [ - "serde", - "serde_json", - "thiserror", - "treediff", -] - -[[package]] -name = "kuchiki" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ea8e9c6e031377cff82ee3001dc8026cdf431ed4e2e6b51f98ab8c73484a358" -dependencies = [ - "cssparser", - "html5ever 0.25.2", - "matches", - "selectors", -] - -[[package]] -name = "kuchikiki" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e4755b7b995046f510a7520c42b2fed58b77bd94d5a87a8eb43d2fd126da8" -dependencies = [ - "cssparser", - "html5ever 0.26.0", - "indexmap 1.9.3", - "matches", - "selectors", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.150" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" - -[[package]] -name = "libredox" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" -dependencies = [ - "bitflags 2.4.1", - "libc", - "redox_syscall 0.4.1", -] - -[[package]] -name = "line-wrap" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" -dependencies = [ - "safemem", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" - -[[package]] -name = "lock_api" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "loom" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" -dependencies = [ - "cfg-if", - "generator", - "scoped-tls", - "serde", - "serde_json", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "mac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" - -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - -[[package]] -name = "markup5ever" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" -dependencies = [ - "log", - "phf 0.8.0", - "phf_codegen 0.8.0", - "string_cache", - "string_cache_codegen", - "tendril", -] - -[[package]] -name = "markup5ever" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016" -dependencies = [ - "log", - "phf 0.10.1", - "phf_codegen 0.10.0", - "string_cache", - "string_cache_codegen", - "tendril", -] - -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - -[[package]] -name = "memchr" -version = "2.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" - -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", - "simd-adler32", -] - -[[package]] -name = "ndk" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" -dependencies = [ - "bitflags 1.3.2", - "jni-sys", - "ndk-sys", - "num_enum", - "thiserror", -] - -[[package]] -name = "ndk-context" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" - -[[package]] -name = "ndk-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" -dependencies = [ - "jni-sys", -] - -[[package]] -name = "new_debug_unreachable" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" - -[[package]] -name = "nodrop" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "num_enum" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", - "objc_exception", -] - -[[package]] -name = "objc_exception" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" -dependencies = [ - "cc", -] - -[[package]] -name = "objc_id" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" -dependencies = [ - "objc", -] - -[[package]] -name = "object" -version = "0.32.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - -[[package]] -name = "open" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2078c0039e6a54a0c42c28faa984e115fb4c2d5bf2208f77d1961002df8576f8" -dependencies = [ - "pathdiff", - "windows-sys 0.42.0", -] - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "pango" -version = "0.15.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e4045548659aee5313bde6c582b0d83a627b7904dd20dc2d9ef0895d414e4f" -dependencies = [ - "bitflags 1.3.2", - "glib", - "libc", - "once_cell", - "pango-sys", -] - -[[package]] -name = "pango-sys" -version = "0.15.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2a00081cde4661982ed91d80ef437c20eacaf6aa1a5962c0279ae194662c3aa" -dependencies = [ - "glib-sys", - "gobject-sys", - "libc", - "system-deps 6.2.0", -] - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.4.1", - "smallvec", - "windows-targets", -] - -[[package]] -name = "pathdiff" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "phf" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" -dependencies = [ - "phf_macros 0.8.0", - "phf_shared 0.8.0", - "proc-macro-hack", -] - -[[package]] -name = "phf" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" -dependencies = [ - "phf_macros 0.10.0", - "phf_shared 0.10.0", - "proc-macro-hack", -] - -[[package]] -name = "phf_codegen" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" -dependencies = [ - "phf_generator 0.8.0", - "phf_shared 0.8.0", -] - -[[package]] -name = "phf_codegen" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" -dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", -] - -[[package]] -name = "phf_generator" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" -dependencies = [ - "phf_shared 0.8.0", - "rand 0.7.3", -] - -[[package]] -name = "phf_generator" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" -dependencies = [ - "phf_shared 0.10.0", - "rand 0.8.5", -] - -[[package]] -name = "phf_macros" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" -dependencies = [ - "phf_generator 0.8.0", - "phf_shared 0.8.0", - "proc-macro-hack", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "phf_macros" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" -dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", - "proc-macro-hack", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "phf_shared" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" -dependencies = [ - "siphasher", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" - -[[package]] -name = "plist" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef" -dependencies = [ - "base64 0.21.5", - "indexmap 2.1.0", - "line-wrap", - "quick-xml", - "serde", - "time", -] - -[[package]] -name = "png" -version = "0.17.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd75bf2d8dd3702b9707cdbc56a5b9ef42cec752eb8b3bafc01234558442aa64" -dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit 0.19.15", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro-hack" -version = "0.5.20+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" - -[[package]] -name = "proc-macro2" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quick-xml" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" -dependencies = [ - "memchr", -] - -[[package]] -name = "quote" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", - "rand_pcg", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.11", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "raw-window-handle" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_users" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" -dependencies = [ - "getrandom 0.2.11", - "libredox", - "thiserror", -] - -[[package]] -name = "regex" -version = "1.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.3", - "regex-syntax 0.8.2", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-automata" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.8.2", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.38.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" -dependencies = [ - "bitflags 2.4.1", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - -[[package]] -name = "ryu" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" - -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "selectors" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df320f1889ac4ba6bc0cdc9c9af7af4bd64bb927bccdf32d81140dc1f9be12fe" -dependencies = [ - "bitflags 1.3.2", - "cssparser", - "derive_more", - "fxhash", - "log", - "matches", - "phf 0.8.0", - "phf_codegen 0.8.0", - "precomputed-hash", - "servo_arc", - "smallvec", - "thin-slice", -] - -[[package]] -name = "semver" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" -dependencies = [ - "serde", -] - -[[package]] -name = "serde" -version = "1.0.193" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-wasm-bindgen" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ba92964781421b6cef36bf0d7da26d201e96d84e1b10e7ae6ed416e516906d" -dependencies = [ - "js-sys", - "serde", - "wasm-bindgen", -] - -[[package]] -name = "serde_derive" -version = "1.0.193" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "serde_json" -version = "1.0.108" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" -dependencies = [ - "itoa 1.0.9", - "ryu", - "serde", -] - -[[package]] -name = "serde_repr" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "serde_spanned" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_with" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" -dependencies = [ - "base64 0.21.5", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.1.0", - "serde", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "serialize-to-javascript" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9823f2d3b6a81d98228151fdeaf848206a7855a7a042bbf9bf870449a66cafb" -dependencies = [ - "serde", - "serde_json", - "serialize-to-javascript-impl", -] - -[[package]] -name = "serialize-to-javascript-impl" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74064874e9f6a15f04c1f3cb627902d0e6b410abbf36668afa873c61889f1763" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "servo_arc" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d98238b800e0d1576d8b6e3de32827c2d74bee68bb97748dcf5071fb53965432" -dependencies = [ - "nodrop", - "stable_deref_trait", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - -[[package]] -name = "soup2" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b4d76501d8ba387cf0fefbe055c3e0a59891d09f0f995ae4e4b16f6b60f3c0" -dependencies = [ - "bitflags 1.3.2", - "gio", - "glib", - "libc", - "once_cell", - "soup2-sys", -] - -[[package]] -name = "soup2-sys" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "009ef427103fcb17f802871647a7fa6c60cbb654b4c4e4c0ac60a31c5f6dc9cf" -dependencies = [ - "bitflags 1.3.2", - "gio-sys", - "glib-sys", - "gobject-sys", - "libc", - "system-deps 5.0.0", -] - -[[package]] -name = "src-tauri" -version = "0.1.0" -dependencies = [ - "api", - "env_logger", - "log", - "serde", - "serde_json", - "tauri", - "tauri-build", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "state" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe866e1e51e8260c9eed836a042a5e7f6726bb2b411dffeaa712e19c388f23b" -dependencies = [ - "loom", -] - -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared 0.10.0", - "precomputed-hash", - "serde", -] - -[[package]] -name = "string_cache_codegen" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" -dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", - "proc-macro2", - "quote", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "system-deps" -version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18db855554db7bd0e73e06cf7ba3df39f97812cb11d3f75e71c39bf45171797e" -dependencies = [ - "cfg-expr 0.9.1", - "heck 0.3.3", - "pkg-config", - "toml 0.5.11", - "version-compare 0.0.11", -] - -[[package]] -name = "system-deps" -version = "6.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2d580ff6a20c55dfb86be5f9c238f67835d0e81cbdea8bf5680e0897320331" -dependencies = [ - "cfg-expr 0.15.5", - "heck 0.4.1", - "pkg-config", - "toml 0.8.8", - "version-compare 0.1.1", -] - -[[package]] -name = "tao" -version = "0.16.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f5aefd6be4cd3ad3f047442242fd9f57cbfb3e565379f66b5e14749364fa4f" -dependencies = [ - "bitflags 1.3.2", - "cairo-rs", - "cc", - "cocoa", - "core-foundation", - "core-graphics", - "crossbeam-channel", - "dispatch", - "gdk", - "gdk-pixbuf", - "gdk-sys", - "gdkwayland-sys", - "gdkx11-sys", - "gio", - "glib", - "glib-sys", - "gtk", - "image", - "instant", - "jni", - "lazy_static", - "libc", - "log", - "ndk", - "ndk-context", - "ndk-sys", - "objc", - "once_cell", - "parking_lot", - "png", - "raw-window-handle", - "scopeguard", - "serde", - "tao-macros", - "unicode-segmentation", - "uuid", - "windows 0.39.0", - "windows-implement", - "x11-dl", -] - -[[package]] -name = "tao-macros" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec114582505d158b669b136e6851f85840c109819d77c42bb7c0709f727d18c2" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "tar" -version = "0.4.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" -dependencies = [ - "filetime", - "libc", - "xattr", -] - -[[package]] -name = "target-lexicon" -version = "0.12.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" - -[[package]] -name = "tauri" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bfe673cf125ef364d6f56b15e8ce7537d9ca7e4dae1cf6fbbdeed2e024db3d9" -dependencies = [ - "anyhow", - "cocoa", - "dirs-next", - "embed_plist", - "encoding_rs", - "flate2", - "futures-util", - "glib", - "glob", - "gtk", - "heck 0.4.1", - "http", - "ignore", - "objc", - "once_cell", - "open", - "percent-encoding", - "rand 0.8.5", - "raw-window-handle", - "regex", - "semver", - "serde", - "serde_json", - "serde_repr", - "serialize-to-javascript", - "state", - "tar", - "tauri-macros", - "tauri-runtime", - "tauri-runtime-wry", - "tauri-utils", - "tempfile", - "thiserror", - "tokio", - "url", - "uuid", - "webkit2gtk", - "webview2-com", - "windows 0.39.0", -] - -[[package]] -name = "tauri-build" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defbfc551bd38ab997e5f8e458f87396d2559d05ce32095076ad6c30f7fc5f9c" -dependencies = [ - "anyhow", - "cargo_toml", - "dirs-next", - "heck 0.4.1", - "json-patch", - "semver", - "serde", - "serde_json", - "tauri-utils", - "tauri-winres", - "walkdir", -] - -[[package]] -name = "tauri-codegen" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3475e55acec0b4a50fb96435f19631fb58cbcd31923e1a213de5c382536bbb" -dependencies = [ - "base64 0.21.5", - "brotli", - "ico", - "json-patch", - "plist", - "png", - "proc-macro2", - "quote", - "regex", - "semver", - "serde", - "serde_json", - "sha2", - "tauri-utils", - "thiserror", - "time", - "uuid", - "walkdir", -] - -[[package]] -name = "tauri-interop" -version = "0.1.0" -dependencies = [ - "js-sys", - "serde", - "serde-wasm-bindgen", - "tauri-interop-macro", - "thiserror", - "wasm-bindgen", - "wasm-bindgen-futures", -] - -[[package]] -name = "tauri-interop-macro" -version = "1.0.0" -dependencies = [ - "convert_case 0.6.0", - "lazy_static", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "tauri-macros" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613740228de92d9196b795ac455091d3a5fbdac2654abb8bb07d010b62ab43af" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "syn 1.0.109", - "tauri-codegen", - "tauri-utils", -] - -[[package]] -name = "tauri-runtime" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07f8e9e53e00e9f41212c115749e87d5cd2a9eebccafca77a19722eeecd56d43" -dependencies = [ - "gtk", - "http", - "http-range", - "rand 0.8.5", - "raw-window-handle", - "serde", - "serde_json", - "tauri-utils", - "thiserror", - "url", - "uuid", - "webview2-com", - "windows 0.39.0", -] - -[[package]] -name = "tauri-runtime-wry" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8141d72b6b65f2008911e9ef5b98a68d1e3413b7a1464e8f85eb3673bb19a895" -dependencies = [ - "cocoa", - "gtk", - "percent-encoding", - "rand 0.8.5", - "raw-window-handle", - "tauri-runtime", - "tauri-utils", - "uuid", - "webkit2gtk", - "webview2-com", - "windows 0.39.0", - "wry", -] - -[[package]] -name = "tauri-utils" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d55e185904a84a419308d523c2c6891d5e2dbcee740c4997eb42e75a7b0f46" -dependencies = [ - "brotli", - "ctor", - "dunce", - "glob", - "heck 0.4.1", - "html5ever 0.26.0", - "infer", - "json-patch", - "kuchikiki", - "log", - "memchr", - "phf 0.10.1", - "proc-macro2", - "quote", - "semver", - "serde", - "serde_json", - "serde_with", - "thiserror", - "url", - "walkdir", - "windows 0.39.0", -] - -[[package]] -name = "tauri-winres" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5993dc129e544393574288923d1ec447c857f3f644187f4fbf7d9a875fbfc4fb" -dependencies = [ - "embed-resource", - "toml 0.7.8", -] - -[[package]] -name = "tempfile" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall 0.4.1", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "tendril" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" -dependencies = [ - "futf", - "mac", - "utf-8", -] - -[[package]] -name = "termcolor" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thin-slice" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" - -[[package]] -name = "thiserror" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "time" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" -dependencies = [ - "deranged", - "itoa 1.0.9", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" -dependencies = [ - "time-core", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" -dependencies = [ - "backtrace", - "bytes", - "num_cpus", - "pin-project-lite", -] - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - -[[package]] -name = "toml" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.19.15", -] - -[[package]] -name = "toml" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.21.0", -] - -[[package]] -name = "toml_datetime" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.1.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "toml_edit" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" -dependencies = [ - "indexmap 2.1.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "treediff" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52984d277bdf2a751072b5df30ec0377febdb02f7696d64c2d7d54630bac4303" -dependencies = [ - "serde_json", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - -[[package]] -name = "url" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - -[[package]] -name = "uuid" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" -dependencies = [ - "getrandom 0.2.11", -] - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "version-compare" -version = "0.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b" - -[[package]] -name = "version-compare" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "vswhom" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" -dependencies = [ - "libc", - "vswhom-sys", -] - -[[package]] -name = "vswhom-sys" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3b17ae1f6c8a2b28506cd96d412eebf83b4a0ff2cbefeeb952f2f9dfa44ba18" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "walkdir" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.39", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" - -[[package]] -name = "web-sys" -version = "0.3.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webkit2gtk" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f859735e4a452aeb28c6c56a852967a8a76c8eb1cc32dbf931ad28a13d6370" -dependencies = [ - "bitflags 1.3.2", - "cairo-rs", - "gdk", - "gdk-sys", - "gio", - "gio-sys", - "glib", - "glib-sys", - "gobject-sys", - "gtk", - "gtk-sys", - "javascriptcore-rs", - "libc", - "once_cell", - "soup2", - "webkit2gtk-sys", -] - -[[package]] -name = "webkit2gtk-sys" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d76ca6ecc47aeba01ec61e480139dda143796abcae6f83bcddf50d6b5b1dcf3" -dependencies = [ - "atk-sys", - "bitflags 1.3.2", - "cairo-sys-rs", - "gdk-pixbuf-sys", - "gdk-sys", - "gio-sys", - "glib-sys", - "gobject-sys", - "gtk-sys", - "javascriptcore-rs-sys", - "libc", - "pango-sys", - "pkg-config", - "soup2-sys", - "system-deps 6.2.0", -] - -[[package]] -name = "webview2-com" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4a769c9f1a64a8734bde70caafac2b96cada12cd4aefa49196b3a386b8b4178" -dependencies = [ - "webview2-com-macros", - "webview2-com-sys", - "windows 0.39.0", - "windows-implement", -] - -[[package]] -name = "webview2-com-macros" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaebe196c01691db62e9e4ca52c5ef1e4fd837dcae27dae3ada599b5a8fd05ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "webview2-com-sys" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aac48ef20ddf657755fdcda8dfed2a7b4fc7e4581acce6fe9b88c3d64f29dee7" -dependencies = [ - "regex", - "serde", - "serde_json", - "thiserror", - "windows 0.39.0", - "windows-bindgen", - "windows-metadata", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1c4bd0a50ac6020f65184721f758dba47bb9fbc2133df715ec74a237b26794a" -dependencies = [ - "windows-implement", - "windows_aarch64_msvc 0.39.0", - "windows_i686_gnu 0.39.0", - "windows_i686_msvc 0.39.0", - "windows_x86_64_gnu 0.39.0", - "windows_x86_64_msvc 0.39.0", -] - -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-bindgen" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68003dbd0e38abc0fb85b939240f4bce37c43a5981d3df37ccbaaa981b47cb41" -dependencies = [ - "windows-metadata", - "windows-tokens", -] - -[[package]] -name = "windows-core" -version = "0.51.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-implement" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba01f98f509cb5dc05f4e5fc95e535f78260f15fea8fe1a8abdd08f774f1cee7" -dependencies = [ - "syn 1.0.109", - "windows-tokens", -] - -[[package]] -name = "windows-metadata" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ee5e275231f07c6e240d14f34e1b635bf1faa1c76c57cfd59a5cdb9848e4278" - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-tokens" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f838de2fe15fe6bac988e74b798f26499a8b21a9d97edec321e79b28d1d7f597" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_i686_gnu" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_msvc" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "winnow" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" -dependencies = [ - "memchr", -] - -[[package]] -name = "winreg" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "937f3df7948156640f46aacef17a70db0de5917bda9c92b0f751f3a955b588fc" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - -[[package]] -name = "wry" -version = "0.24.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a70547e8f9d85da0f5af609143f7bde3ac7457a6e1073104d9b73d6c5ac744" -dependencies = [ - "base64 0.13.1", - "block", - "cocoa", - "core-graphics", - "crossbeam-channel", - "dunce", - "gdk", - "gio", - "glib", - "gtk", - "html5ever 0.25.2", - "http", - "kuchiki", - "libc", - "log", - "objc", - "objc_id", - "once_cell", - "serde", - "serde_json", - "sha2", - "soup2", - "tao", - "thiserror", - "url", - "webkit2gtk", - "webkit2gtk-sys", - "webview2-com", - "windows 0.39.0", - "windows-implement", -] - -[[package]] -name = "x11" -version = "2.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" -dependencies = [ - "libc", - "pkg-config", -] - -[[package]] -name = "x11-dl" -version = "2.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" -dependencies = [ - "libc", - "once_cell", - "pkg-config", -] - -[[package]] -name = "xattr" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" -dependencies = [ - "libc", -] diff --git a/test-project/src-tauri/Cargo.toml b/test-project/src-tauri/Cargo.toml index 72bc7b9..7b9002b 100644 --- a/test-project/src-tauri/Cargo.toml +++ b/test-project/src-tauri/Cargo.toml @@ -12,8 +12,8 @@ api = { path = "../api"} tauri = { version = "1.5", features = ["shell-open"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -env_logger = "0.10.1" -log = "0.4.20" +env_logger = "0.10" +log = "0.4" [features] # this feature is used for production builds or when `devPath` points to the filesystem From 6fdfb6f7920c679b77326984b250a79145843d5e Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sun, 3 Mar 2024 11:11:31 +0100 Subject: [PATCH 37/60] ignore Cargo.lock except of the two root projects --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 650b174..9489b48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ .idea/ target/ dist/ +**/Cargo.lock +!Cargo.lock +!test-project/Cargo.lock From f78a4c63b66682d1d9b17ec1c1460631658a2609 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sun, 3 Mar 2024 13:08:40 +0100 Subject: [PATCH 38/60] remove outdated code --- src/event/listen.rs | 2 +- test-project/api/Cargo.toml | 1 - test-project/api/src/cmd.rs | 17 ----------------- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/event/listen.rs b/src/event/listen.rs index 4befc1b..a55b6c1 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -103,7 +103,7 @@ impl ListenHandle { leptos::spawn_local(async move { let listen_handle = ListenHandle::register(event, move |value: T| { log::trace!("update for {}", event); - set_signal.set(value); + set_signal.set(value) }) .await .unwrap(); diff --git a/test-project/api/Cargo.toml b/test-project/api/Cargo.toml index f4ebad7..f8bc69f 100644 --- a/test-project/api/Cargo.toml +++ b/test-project/api/Cargo.toml @@ -25,4 +25,3 @@ default = [ "host" ] host = [ "dep:tauri" ] wasm = [ "dep:js-sys", "dep:serde-wasm-bindgen", "dep:wasm-bindgen", "dep:wasm-bindgen-futures"] leptos = [ "dep:leptos", "tauri-interop/leptos" ] -broken = [] diff --git a/test-project/api/src/cmd.rs b/test-project/api/src/cmd.rs index b2eed18..477877a 100644 --- a/test-project/api/src/cmd.rs +++ b/test-project/api/src/cmd.rs @@ -65,21 +65,4 @@ pub fn emit(state: TauriState>, handle: TauriAppHandle) { state.update::(&handle, bar_value).unwrap(); } -#[cfg(feature = "broken")] -pub mod broken { - use serde::{Deserialize, Serialize}; - - #[derive(Debug, Serialize, Deserialize)] - pub enum State { - Test, - } - - #[allow(clippy::result_unit_err)] - /// currently this doesn't work cause of the way tauri::{AppHandel, State, Window} are filtered - #[tauri_interop::conditional_command] - pub fn invoke_result_tauri(_state: State) -> Result<(), ()> { - Ok(()) - } -} - tauri_interop::collect_commands!(); From 50faf80b46339360bd641a255883a053c8fb0518 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sun, 3 Mar 2024 13:08:51 +0100 Subject: [PATCH 39/60] update intro of readme --- README.md | 132 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 80 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 90e1984..7c1d635 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,35 @@ [![Documentation](https://docs.rs/tauri-interop/badge.svg)](https://docs.rs/tauri-interop) ![License](https://img.shields.io/crates/l/tauri-interop.svg) -What this crate tries to achieve: -- generate an equal rust-wasm-function for a defined `tauri::command` -- collecting all defined `tauri::command`s without adding them manually -- a convenient way to send events from tauri and receiving them in a rust based wasm-frontend +This crate tries to provide a general more enjoyable experience for developing tauri apps with a rust frontend. +> tbf it is a saner approach to write the app in a mix of js + rust, because the frameworks are more mature, there are +> way more devs who have experience with js and their respective frameworks etc... +> +> but tbh... because something is saner, doesn't stop us from doing things differently ^ヮ^ + +Writing an app in a single language give the option to build a common crate/module which connects the backend and +frontend. A common model itself can be most of the time easily compile to both architectures (arch's) when the types +are compatible with both. The commands on the other hand don't have an option to be compiled to wasm. Which means they +need to be handled manually or be call via a wrapper/helper each time. + +Repeating the implementation and handling for a function that is already defined properly seems to be a waste of time. +For that reason this crate provides the `tauri_interop::command` macro. This macro is explained in detail in the +[command representation](#command-representation-hostwasm) section. This new macro provides the option to invoke the +command in wasm and by that call the defined command in tauri. On the other side, when compiling for tauri additionally +to the tauri logic, the macro provides the option to collect all commands in a single file via the invocation of the +`tauri_interop::collect_commands` macro at the end of the file (see [command](#command-frontend--backend-communication)). + +In addition, some quality-of-life macros are provided to eas some inconveniences when compiling to multiple arch's. See +the [QOL](#qol-macros) section. + +**Feature `event`**: + +Tauri has an [event](https://tauri.app/v1/guides/features/events) mechanic with that the tauri side can communicate to +the frontend. The usage is not as intuitive and has to some inconveniences that make it quite hard to recommend. To +improve the usage the crate provides the derive-marcos `Event`, `Emit` and `Listen`. The `Event` macro is just a +conditional wrapper that expands to `Emit` for the tauri compilation and `Listen` for the wasm compilation. It is +the indent way to use this feature. The usage is explained in more detail in the [event](#event-backend--frontend-communication) +section. ## Basic usage: @@ -16,52 +41,6 @@ What this crate tries to achieve: > Some examples in this documentation can't be executed with doctests due to > required wasm target and tauri modified environment (see [withGlobalTauri](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri)) -### QOL macros - -This crate also adds some quality-of-life macros. These are intended to ease the drawbacks of compiling to -multiple architectures. - -#### Conditional `use` -Because most crates are not intended to be compiled to wasm and most wasm crates are not intended to be compiled to -the host-triplet they have to be excluded in each others compile process. The usual process to exclude uses for a certain -architecture would look something like this: - -```rust -#[cfg(not(target_family = "wasm"))] -use tauri::AppHandle; - -#[tauri_interop::command] -pub fn empty_invoke(_handle: AppHandle) {} -``` - -**General usage:** - -With the help of `tauri_interop::host_usage!()` and `tauri_interop::wasm_usage!()` we don't need to remember which -attribute we have to add and can just convert the above to the following: - -```rust -tauri_interop::host_usage! { - use tauri::AppHandle; -} - -#[tauri_interop::command] -pub fn empty_invoke(_handle: AppHandle) {} -``` - -**Multiple `use` usage:** - -When multiple `use` should be excluded, they need to be separated by a single pipe (`|`). For example: - -```rust -tauri_interop::host_usage! { - use tauri::State; - | use std::sync::RwLock; -} - -#[tauri_interop::command] -pub fn empty_invoke(_state: State>) {} -``` - ### Command (Frontend => Backend Communication) > For more examples see [cmd.rs](./test-project/api/src/cmd.rs) in test-project @@ -86,8 +65,11 @@ Using `tauri_interop::command` does two things: - it provides the command with two macros which are used depending on the `target_family` - `tauri_interop::binding` is used when compiling to `wasm` - `tauri::command` is used otherwise -- it adds an entry to `tauri_interop::collect_commands!()` so that the generated `get_handlers()` function includes the given commands for the tauri context - - the function is not generated when targeting `wasm` +- it adds an entry to `tauri_interop::collect_commands!()` so that the generated `get_handlers()` function includes + the given commands for the tauri context + - it can be invoked inside `.invoke_handler` methode of the `tauri::Builder` instead of the usual `generate_handler` macro + - it is not generated when targeting `wasm` + The defined command above can then be used in wasm as below. Due to receiving data from tauri via a promise, the command response has to be awaited. @@ -158,6 +140,52 @@ async fn heavy_computation() { } ``` +### QOL macros + +This crate also adds some quality-of-life macros. These are intended to ease the drawbacks of compiling to +multiple architectures. + +#### Conditional `use` +Because most crates are not intended to be compiled to wasm and most wasm crates are not intended to be compiled to +the host-triplet they have to be excluded in each others compile process. The usual process to exclude uses for a certain +architecture would look something like this: + +```rust +#[cfg(not(target_family = "wasm"))] +use tauri::AppHandle; + +#[tauri_interop::command] +pub fn empty_invoke(_handle: AppHandle) {} +``` + +**General usage:** + +With the help of `tauri_interop::host_usage!()` and `tauri_interop::wasm_usage!()` we don't need to remember which +attribute we have to add and can just convert the above to the following: + +```rust +tauri_interop::host_usage! { + use tauri::AppHandle; +} + +#[tauri_interop::command] +pub fn empty_invoke(_handle: AppHandle) {} +``` + +**Multiple `use` usage:** + +When multiple `use` should be excluded, they need to be separated by a single pipe (`|`). For example: + +```rust +tauri_interop::host_usage! { + use tauri::State; + | use std::sync::RwLock; +} + +#[tauri_interop::command] +pub fn empty_invoke(_state: State>) {} +``` + ### Event (Backend => Frontend Communication) Definition for both tauri supported triplet and wasm: ```rust From e07ba3f548e5cf3dbdf94acd3de9792ab58a9b6c Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sun, 3 Mar 2024 23:38:21 +0100 Subject: [PATCH 40/60] update test project --- tauri-interop-macro/src/lib.rs | 10 +++++----- test-project/api/src/command.rs | 7 +++++++ test-project/api/src/{ => command}/cmd.rs | 4 +--- test-project/api/src/command/other_cmd.rs | 2 ++ test-project/api/src/lib.rs | 2 +- test-project/src-tauri/src/main.rs | 2 +- test-project/src/main.rs | 14 +++++++------- 7 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 test-project/api/src/command.rs rename test-project/api/src/{ => command}/cmd.rs (96%) create mode 100644 test-project/api/src/command/other_cmd.rs diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index a5f95cf..7cbd41d 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -5,10 +5,7 @@ use proc_macro::TokenStream; use std::{collections::BTreeSet, sync::Mutex}; use quote::{format_ident, quote, ToTokens}; -use syn::{ - parse::Parser, parse_macro_input, punctuated::Punctuated, token::Comma, Ident, ItemFn, ItemUse, - Token, -}; +use syn::{parse::Parser, parse_macro_input, punctuated::Punctuated, token::Comma, Ident, ItemFn, ItemUse, Token}; mod command; mod event; @@ -98,7 +95,7 @@ pub fn command(_attributes: TokenStream, stream: TokenStream) -> TokenStream { /// The provided function isn't available for wasm #[proc_macro] pub fn collect_commands(_: TokenStream) -> TokenStream { - let handler = HANDLER_LIST.lock().unwrap(); + let mut handler = HANDLER_LIST.lock().unwrap(); let to_generated_handler = handler .iter() .map(|s| format_ident!("{s}")) @@ -115,6 +112,9 @@ pub fn collect_commands(_: TokenStream) -> TokenStream { } }; + // clearing the already used handlers + handler.clear(); + TokenStream::from(stream.to_token_stream()) } diff --git a/test-project/api/src/command.rs b/test-project/api/src/command.rs new file mode 100644 index 0000000..316bc64 --- /dev/null +++ b/test-project/api/src/command.rs @@ -0,0 +1,7 @@ +mod cmd; +mod other_cmd; + +pub use cmd::*; +pub use other_cmd::*; + +tauri_interop::collect_commands!(); \ No newline at end of file diff --git a/test-project/api/src/cmd.rs b/test-project/api/src/command/cmd.rs similarity index 96% rename from test-project/api/src/cmd.rs rename to test-project/api/src/command/cmd.rs index 9b61c0a..10049ca 100644 --- a/test-project/api/src/cmd.rs +++ b/test-project/api/src/command/cmd.rs @@ -19,7 +19,7 @@ pub async fn await_heavy_computing() { } #[tauri_interop::command] -fn greet(name_to_greet: &str) -> String { +pub fn greet(name_to_greet: &str) -> String { format!("Hello, {}! You've been greeted from Rust!", name_to_greet) } @@ -86,5 +86,3 @@ pub mod broken { Ok(()) } } - -tauri_interop::collect_commands!(); diff --git a/test-project/api/src/command/other_cmd.rs b/test-project/api/src/command/other_cmd.rs new file mode 100644 index 0000000..06a3f49 --- /dev/null +++ b/test-project/api/src/command/other_cmd.rs @@ -0,0 +1,2 @@ +#[tauri_interop::command] +pub fn other() {} diff --git a/test-project/api/src/lib.rs b/test-project/api/src/lib.rs index 7cd7289..b9edb82 100644 --- a/test-project/api/src/lib.rs +++ b/test-project/api/src/lib.rs @@ -1,7 +1,7 @@ #![allow(clippy::disallowed_names)] #![feature(iter_intersperse)] -pub mod cmd; +pub mod command; pub mod model; #[cfg(target_family = "wasm")] diff --git a/test-project/src-tauri/src/main.rs b/test-project/src-tauri/src/main.rs index 3bbdafb..0250c40 100644 --- a/test-project/src-tauri/src/main.rs +++ b/test-project/src-tauri/src/main.rs @@ -10,7 +10,7 @@ fn main() { .unwrap(); tauri::Builder::default() - .invoke_handler(api::cmd::get_handlers()) + .invoke_handler(api::command::get_handlers()) .setup(move |app| { let main_window = app.handle().get_window("main").unwrap(); diff --git a/test-project/src/main.rs b/test-project/src/main.rs index f47c588..bcba842 100644 --- a/test-project/src/main.rs +++ b/test-project/src/main.rs @@ -10,13 +10,13 @@ fn main() { console_log::init_with_level(log::Level::Trace).expect("no errors during logger init"); console_error_panic_hook::set_once(); - api::cmd::empty_invoke(); - api::cmd::underscore_invoke(69); + api::command::empty_invoke(); + api::command::underscore_invoke(69); wasm_bindgen_futures::spawn_local(async { - log::info!("{}", api::cmd::greet("frontend").await); + log::info!("{}", api::command::greet("frontend").await); - api::cmd::await_heavy_computing().await; + api::command::await_heavy_computing().await; log::info!("heavy computing finished") }); @@ -33,8 +33,8 @@ fn main() { Timeout::new(2000, move || drop(handle_bar)).forget(); }); - Timeout::new(1000, api::cmd::emit).forget(); - Timeout::new(3000, api::cmd::emit).forget(); + Timeout::new(1000, api::command::emit).forget(); + Timeout::new(3000, api::command::emit).forget(); #[cfg(feature = "leptos")] Timeout::new(5000, || leptos::mount_to_body(|| view! { })).forget(); @@ -70,7 +70,7 @@ fn App() -> impl IntoView { #[cfg(feature = "leptos")] #[component] fn Foo() -> impl IntoView { - Timeout::new(2000, api::cmd::emit).forget(); + Timeout::new(2000, api::command::emit).forget(); let foo = TestState::use_field::("Test".into()); From 663f1b2efe395c9671469ce4fad1c91b6a381191 Mon Sep 17 00:00:00 2001 From: Oliver Kogel Date: Sun, 3 Mar 2024 23:54:27 +0100 Subject: [PATCH 41/60] Update README.md --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 7c1d635..20a0ec0 100644 --- a/README.md +++ b/README.md @@ -8,30 +8,30 @@ This crate tries to provide a general more enjoyable experience for developing t > tbf it is a saner approach to write the app in a mix of js + rust, because the frameworks are more mature, there are > way more devs who have experience with js and their respective frameworks etc... > -> but tbh... because something is saner, doesn't stop us from doing things differently ^ヮ^ +> but tbh... just because something is saner, it doesn't stop us from doing things differently ^ヮ^ -Writing an app in a single language give the option to build a common crate/module which connects the backend and -frontend. A common model itself can be most of the time easily compile to both architectures (arch's) when the types +Writing an app in a single language gives us the option of building a common crate/module which connects the backend and +frontend. A common model itself can most of the time be easily compiled to both architectures (arch's) when the types are compatible with both. The commands on the other hand don't have an option to be compiled to wasm. Which means they -need to be handled manually or be call via a wrapper/helper each time. +need to be handled manually or be called via a wrapper/helper each time. Repeating the implementation and handling for a function that is already defined properly seems to be a waste of time. For that reason this crate provides the `tauri_interop::command` macro. This macro is explained in detail in the [command representation](#command-representation-hostwasm) section. This new macro provides the option to invoke the -command in wasm and by that call the defined command in tauri. On the other side, when compiling for tauri additionally +command in wasm and by therefore call the defined command in tauri. On the other side, when compiling for tauri in addition to the tauri logic, the macro provides the option to collect all commands in a single file via the invocation of the `tauri_interop::collect_commands` macro at the end of the file (see [command](#command-frontend--backend-communication)). -In addition, some quality-of-life macros are provided to eas some inconveniences when compiling to multiple arch's. See +In addition, some quality-of-life macros are provided to ease some inconveniences when compiling to multiple arch's. See the [QOL](#qol-macros) section. **Feature `event`**: -Tauri has an [event](https://tauri.app/v1/guides/features/events) mechanic with that the tauri side can communicate to +Tauri has an [event](https://tauri.app/v1/guides/features/events) mechanic which allows the tauri side to communicate with the frontend. The usage is not as intuitive and has to some inconveniences that make it quite hard to recommend. To -improve the usage the crate provides the derive-marcos `Event`, `Emit` and `Listen`. The `Event` macro is just a +improve the usage, this crate provides the derive-marcos `Event`, `Emit` and `Listen`. The `Event` macro is just a conditional wrapper that expands to `Emit` for the tauri compilation and `Listen` for the wasm compilation. It is -the indent way to use this feature. The usage is explained in more detail in the [event](#event-backend--frontend-communication) +the intended way to use this feature. The usage is explained in more detail in the [event](#event-backend--frontend-communication) section. ## Basic usage: @@ -39,7 +39,7 @@ section. > **Disclaimer**: > > Some examples in this documentation can't be executed with doctests due to -> required wasm target and tauri modified environment (see [withGlobalTauri](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri)) +> the required wasm target and tauri modified environment (see [withGlobalTauri](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri)) ### Command (Frontend => Backend Communication) > For more examples see [cmd.rs](./test-project/api/src/cmd.rs) in test-project From 29c986d9c0b395b63979ff118a324158ef37cde5 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sun, 3 Mar 2024 23:38:43 +0100 Subject: [PATCH 42/60] update readme --- README.md | 21 ++++++++++++++++++++- test-project/api/src/command.rs | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a11663..28a30b2 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ Using `tauri_interop::command` does two things: - it provides the command with two macros which are used depending on the `target_family` - `tauri_interop::binding` is used when compiling to `wasm` - `tauri::command` is used otherwise -- it adds an entry to `tauri_interop::collect_commands!()` so that the generated `get_handlers()` function includes the given commands for the tauri context +- it adds an entry to `tauri_interop::collect_commands!()` (see [collect commands](#collect-commands)) - the function is not generated when targeting `wasm` The defined command above can then be used in wasm as below. Due to receiving data from @@ -153,6 +153,25 @@ async fn heavy_computation() { } ``` +#### Collect commands + +The `tauri_invoke::collect_commands` macro generates a `get_handlers` function in the current mod, which calls the +`tauri::generate_handler` macro with all function which are annotated with the `tauri_interop::command` macro. The +function is only generated for tauri and not for wasm. + +Due to technical limitations we sadly can't combine multiple `get_handlers` functions. This limitation comes to the +underlying mechanic. The `tauri::generate_handler` macro generates a function which consumes `tauri::Invoke` as single +parameter. Because it fully consumes the given parameter we can't call multiple handlers with it. In addition, the +`Builder::invoke_handler` function, which usually consumes the generated `tauri::generate_handler` can't be called +twice without losing the previous registered commands. + +Because of this limitation for splitting commands into multiple files it is recommended to create a root mod for the +command which includes other command mod's. The functions in the included mods need to be public and re-imported into +the root mod. With these prerequisites the `tauri_invoke::collect_commands` can be called at the end of the file, which +generates the usual `get_handlers` function, but with all "commands" defined inside the others mods. + +For an example see the [test-project/api/src/command.rs](test-project/api/src/command.rs). + ### Event (Backend => Frontend Communication) Definition for both tauri supported triplet and wasm: ```rust diff --git a/test-project/api/src/command.rs b/test-project/api/src/command.rs index 316bc64..6478f7b 100644 --- a/test-project/api/src/command.rs +++ b/test-project/api/src/command.rs @@ -4,4 +4,4 @@ mod other_cmd; pub use cmd::*; pub use other_cmd::*; -tauri_interop::collect_commands!(); \ No newline at end of file +tauri_interop::collect_commands!(); From 95bbf5a77d5f1f574a688235bd5e24a17702f43d Mon Sep 17 00:00:00 2001 From: photovoltex Date: Wed, 6 Mar 2024 23:10:55 +0100 Subject: [PATCH 43/60] add combine handler functionality --- Cargo.lock | 3 + tauri-interop-macro/Cargo.toml | 7 +- tauri-interop-macro/src/command.rs | 1 + tauri-interop-macro/src/command/collect.rs | 58 +++++++ tauri-interop-macro/src/lib.rs | 175 ++++++++++++++++++--- test-project/Cargo.lock | 1 + test-project/api/src/{command => }/cmd.rs | 2 + test-project/api/src/command.rs | 7 - test-project/api/src/command/other_cmd.rs | 2 - test-project/api/src/lib.rs | 7 +- test-project/api/src/model.rs | 5 + test-project/api/src/model/other_cmd.rs | 10 ++ test-project/src-tauri/src/main.rs | 2 +- test-project/src/main.rs | 17 +- 14 files changed, 254 insertions(+), 43 deletions(-) create mode 100644 tauri-interop-macro/src/command/collect.rs rename test-project/api/src/{command => }/cmd.rs (98%) delete mode 100644 test-project/api/src/command.rs delete mode 100644 test-project/api/src/command/other_cmd.rs create mode 100644 test-project/api/src/model/other_cmd.rs diff --git a/Cargo.lock b/Cargo.lock index 4fd1193..610a572 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3499,10 +3499,13 @@ version = "2.0.0-dev" dependencies = [ "convert_case 0.6.0", "lazy_static", + "log", + "proc-macro-error", "proc-macro2", "quote", "serde", "syn 2.0.52", + "tauri", ] [[package]] diff --git a/tauri-interop-macro/Cargo.toml b/tauri-interop-macro/Cargo.toml index bca2039..bbc131b 100644 --- a/tauri-interop-macro/Cargo.toml +++ b/tauri-interop-macro/Cargo.toml @@ -13,12 +13,17 @@ description = "Macros for the tauri-interop crate." proc-macro = true [dependencies] -syn = { version = "^2.0", features = [ "full" ]} +syn = { version = "^2.0", features = [ "full", "extra-traits" ]} quote = "^1.0" convert_case = "^0.6" lazy_static = "^1.4" serde = "^1.0" proc-macro2 = "^1.0" +proc-macro-error = "1.0.4" + +[dev-dependencies] +tauri = { version = "^1.5", default-features = false, features = ["wry"] } +log = "^0.4" [features] # todo: remove default feature before publish diff --git a/tauri-interop-macro/src/command.rs b/tauri-interop-macro/src/command.rs index 5f8eca3..8eea0a9 100644 --- a/tauri-interop-macro/src/command.rs +++ b/tauri-interop-macro/src/command.rs @@ -7,6 +7,7 @@ use syn::{parse_macro_input, punctuated::Punctuated, token::Comma, FnArg, ItemFn use crate::command::wrapper::{InvokeArgument, InvokeCommand}; mod wrapper; +pub mod collect; pub fn convert_to_binding(stream: TokenStream) -> TokenStream { let item_fn = parse_macro_input!(stream as ItemFn); diff --git a/tauri-interop-macro/src/command/collect.rs b/tauri-interop-macro/src/command/collect.rs new file mode 100644 index 0000000..8cd0107 --- /dev/null +++ b/tauri-interop-macro/src/command/collect.rs @@ -0,0 +1,58 @@ +use std::collections::HashSet; + +use proc_macro2::{Ident, TokenStream}; +use quote::{format_ident, quote}; +use syn::punctuated::Punctuated; +use syn::token::Comma; +use syn::{parse_quote, ExprPath}; + +pub fn commands_with_mod_name(mod_name: &str, commands: &HashSet) -> HashSet { + commands + .iter() + .map(|cmd| format!("{mod_name}::{cmd}")) + .collect() +} + +pub fn commands_to_punctuated(commands: &HashSet) -> Punctuated { + commands.iter().map(command_to_expr_path).collect() +} + +pub fn command_to_expr_path(command: &String) -> ExprPath { + match get_separated_command(command) { + None => { + let ident = format_ident!("{command}"); + parse_quote!(#ident) + } + Some((mod_name, cmd_name)) => parse_quote!(#mod_name::#cmd_name), + } +} + +pub fn get_separated_command(input: &str) -> Option<(Ident, Ident)> { + let mut split_cmd = input.split("::"); + let mod_name = format_ident!("{}", split_cmd.next()?); + // order matters + let cmd_name = format_ident!("{}", split_cmd.next()?); + + Some((mod_name, cmd_name)) +} + +pub fn get_handler_function( + fn_name: Ident, + commands: &HashSet, + handlers: Punctuated, + include_mods: Vec, +) -> TokenStream { + let commands = commands.iter().collect::>(); + quote! { + #[cfg(not(target_family = "wasm"))] + #[doc = "auto generated function to register all configured commands"] + pub fn #fn_name() -> impl Fn(tauri::Invoke) { + #( use #include_mods; )* + + let handlers = vec! [ #( #commands ),* ]; + log::debug!("Registering following commands to tauri: {handlers:#?}"); + + ::tauri::generate_handler![ #handlers ] + } + } +} diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 7cbd41d..124f860 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -1,11 +1,19 @@ +#![feature(iter_intersperse)] #![warn(missing_docs)] //! The macros use by `tauri_interop` to generate dynamic code depending on the target use proc_macro::TokenStream; -use std::{collections::BTreeSet, sync::Mutex}; +use std::collections::HashSet; +use std::sync::Mutex; +use proc_macro_error::{emit_call_site_error, emit_call_site_warning, proc_macro_error}; use quote::{format_ident, quote, ToTokens}; -use syn::{parse::Parser, parse_macro_input, punctuated::Punctuated, token::Comma, Ident, ItemFn, ItemUse, Token}; +use syn::{ + parse::Parser, parse_macro_input, punctuated::Punctuated, ExprPath, ItemFn, ItemMod, ItemUse, + Token, +}; + +use crate::command::collect::commands_to_punctuated; mod command; mod event; @@ -67,15 +75,21 @@ pub fn binding(_attributes: TokenStream, stream: TokenStream) -> TokenStream { } lazy_static::lazy_static! { - static ref HANDLER_LIST: Mutex> = Mutex::new(Default::default()); + static ref COMMAND_LIST_ALL: Mutex> = Mutex::new(HashSet::new()); +} + +lazy_static::lazy_static! { + static ref COMMAND_LIST: Mutex> = Mutex::new(HashSet::new()); } -/// Conditionally adds `tauri_interop::binding` or `tauri::command` to a struct +static COMMAND_MOD_NAME: Mutex> = Mutex::new(None); + +/// Conditionally adds the `tauri_interop::binding` or `tauri::command` macro to a struct #[proc_macro_attribute] pub fn command(_attributes: TokenStream, stream: TokenStream) -> TokenStream { let fn_item = parse_macro_input!(stream as ItemFn); - HANDLER_LIST + COMMAND_LIST .lock() .unwrap() .insert(fn_item.sig.ident.to_string()); @@ -89,35 +103,148 @@ pub fn command(_attributes: TokenStream, stream: TokenStream) -> TokenStream { TokenStream::from(command_macro.to_token_stream()) } +/// Marks a mod that contains commands +/// +/// A mod needs to be marked when multiple command mods should be combined. +/// See [combine_handlers] for a detailed explanation/example. +/// +/// Requires usage of unstable feature: `#![feature(proc_macro_hygiene)]` +#[proc_macro_attribute] +pub fn commands(_attributes: TokenStream, stream: TokenStream) -> TokenStream { + let item_mod = parse_macro_input!(stream as ItemMod); + let _ = COMMAND_MOD_NAME + .lock() + .unwrap() + .insert(item_mod.ident.to_string()); + + TokenStream::from(item_mod.to_token_stream()) +} + /// Collects all commands annotated with `tauri_interop::command` and -/// provides these with a `get_handlers()` in the current namespace +/// provides these with a `get_handlers()` in the current mod /// -/// The provided function isn't available for wasm +/// The provided function isn't available in wasm #[proc_macro] pub fn collect_commands(_: TokenStream) -> TokenStream { - let mut handler = HANDLER_LIST.lock().unwrap(); - let to_generated_handler = handler - .iter() - .map(|s| format_ident!("{s}")) - .collect::>(); - - let stream = quote! { - #[cfg(not(target_family = "wasm"))] - /// the all mighty handler collector - pub fn get_handlers() -> impl Fn(tauri::Invoke) { - let handlers = vec! [ #( #handler ),* ]; - log::debug!("Registering following commands to tauri: {handlers:#?}"); - - ::tauri::generate_handler![ #to_generated_handler ] - } - }; + let mut commands = COMMAND_LIST.lock().unwrap(); + let stream = command::collect::get_handler_function( + format_ident!("get_handlers"), + &commands, + commands_to_punctuated(&commands), + Vec::new(), + ); + + // logic for renaming the commands, so that combine methode can just use the provided commands + if let Some(mod_name) = COMMAND_MOD_NAME.lock().unwrap().as_ref() { + COMMAND_LIST_ALL + .lock() + .unwrap() + .extend(command::collect::commands_with_mod_name( + mod_name, &commands, + )); + } else { + // if there is no mod provided we can just move/clear the commands + COMMAND_LIST_ALL.lock().unwrap().extend(commands.iter().cloned()); + } // clearing the already used handlers - handler.clear(); + commands.clear(); + // set mod name to none + let _ = COMMAND_MOD_NAME.lock().unwrap().take(); TokenStream::from(stream.to_token_stream()) } +/// Combines multiple modules containing commands +/// +/// Takes multiple module paths as input and provides a `get_all_handlers()` function in +/// the current mod that registers all commands from the provided mods. This macro does +/// still require the invocation of [collect_commands] at the end of a command mod. In +/// addition, a mod has to be marked with [commands]. +/// +/// ### Example +/// +/// ``` +/// #[tauri_interop_macro::commands] +/// mod cmd1 { +/// #[tauri_interop_macro::command] +/// pub fn cmd1() {} +/// +/// tauri_interop_macro::collect_commands!(); +/// } +/// +/// mod whatever { +/// #[tauri_interop_macro::commands] +/// pub mod cmd2 { +/// #[tauri_interop_macro::command] +/// pub fn cmd2() {} +/// +/// tauri_interop_macro::collect_commands!(); +/// } +/// } +/// +/// tauri_interop_macro::combine_handlers!( cmd1, whatever::cmd2 ); +/// +/// ``` +#[proc_macro_error] +#[proc_macro] +pub fn combine_handlers(stream: TokenStream) -> TokenStream { + let command_mods = Punctuated::::parse_terminated + .parse2(stream.into()) + .unwrap() + .into_iter() + .collect::>(); + + let org_commands = COMMAND_LIST_ALL.lock().unwrap(); + let commands = org_commands + .iter() + .flat_map(|command| { + let (mod_name, _) = command::collect::get_separated_command(command)?; + command_mods + .iter() + .any(|r#mod| { + r#mod + .path + .segments + .iter() + .any(|seg| mod_name.eq(&seg.ident)) + }) + .then_some(command.clone()) + }) + .collect::>(); + + if commands.is_empty() { + emit_call_site_error!("No commands will be registered") + } + + let remaining_commands = COMMAND_LIST.lock().unwrap(); + if !remaining_commands.is_empty() { + emit_call_site_error!( + "Their are dangling commands that won't be registered. See {:?}", + remaining_commands + ) + } + + if org_commands.len() > commands.len() { + let diff = org_commands + .difference(&commands) + .cloned() + .intersperse(String::from(",")) + .collect::(); + emit_call_site_warning!( + "Not all commands will be registered. Missing commands: {:?}", + diff + ); + } + + TokenStream::from(command::collect::get_handler_function( + format_ident!("get_all_handlers"), + &commands, + commands_to_punctuated(&commands), + command_mods, + )) +} + fn collect_uses(stream: TokenStream) -> Vec { Punctuated::::parse_terminated .parse2(stream.into()) diff --git a/test-project/Cargo.lock b/test-project/Cargo.lock index b1147bc..790d25d 100644 --- a/test-project/Cargo.lock +++ b/test-project/Cargo.lock @@ -3662,6 +3662,7 @@ version = "2.0.0-dev" dependencies = [ "convert_case 0.6.0", "lazy_static", + "proc-macro-error", "proc-macro2", "quote", "serde", diff --git a/test-project/api/src/command/cmd.rs b/test-project/api/src/cmd.rs similarity index 98% rename from test-project/api/src/command/cmd.rs rename to test-project/api/src/cmd.rs index 10049ca..78c36d8 100644 --- a/test-project/api/src/command/cmd.rs +++ b/test-project/api/src/cmd.rs @@ -86,3 +86,5 @@ pub mod broken { Ok(()) } } + +tauri_interop::collect_commands!(); diff --git a/test-project/api/src/command.rs b/test-project/api/src/command.rs deleted file mode 100644 index 6478f7b..0000000 --- a/test-project/api/src/command.rs +++ /dev/null @@ -1,7 +0,0 @@ -mod cmd; -mod other_cmd; - -pub use cmd::*; -pub use other_cmd::*; - -tauri_interop::collect_commands!(); diff --git a/test-project/api/src/command/other_cmd.rs b/test-project/api/src/command/other_cmd.rs deleted file mode 100644 index 06a3f49..0000000 --- a/test-project/api/src/command/other_cmd.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[tauri_interop::command] -pub fn other() {} diff --git a/test-project/api/src/lib.rs b/test-project/api/src/lib.rs index b9edb82..d3f056c 100644 --- a/test-project/api/src/lib.rs +++ b/test-project/api/src/lib.rs @@ -1,8 +1,13 @@ #![allow(clippy::disallowed_names)] #![feature(iter_intersperse)] +#![feature(proc_macro_hygiene)] + +#[tauri_interop::commands] +pub mod cmd; -pub mod command; pub mod model; #[cfg(target_family = "wasm")] pub use tauri_interop::*; + +tauri_interop::combine_handlers!( cmd, model::other_cmd ); diff --git a/test-project/api/src/model.rs b/test-project/api/src/model.rs index c7c5a18..3fa67e9 100644 --- a/test-project/api/src/model.rs +++ b/test-project/api/src/model.rs @@ -2,6 +2,11 @@ #![allow(dead_code)] #![allow(path_statements)] +// this mod at this position doesn't make much sense logic vise +// for testing the combine feature tho its a quite convienend spot :D +#[tauri_interop::commands] +pub mod other_cmd; + use tauri_interop::Event; #[derive(Default, Event)] diff --git a/test-project/api/src/model/other_cmd.rs b/test-project/api/src/model/other_cmd.rs new file mode 100644 index 0000000..c03f87e --- /dev/null +++ b/test-project/api/src/model/other_cmd.rs @@ -0,0 +1,10 @@ +tauri_interop::host_usage! { + use tauri_interop::command::TauriAppHandle; +} + +#[tauri_interop::command] +pub fn stop_application(handle: TauriAppHandle) { + handle.exit(0) +} + +tauri_interop::collect_commands!(); diff --git a/test-project/src-tauri/src/main.rs b/test-project/src-tauri/src/main.rs index 0250c40..6adb47a 100644 --- a/test-project/src-tauri/src/main.rs +++ b/test-project/src-tauri/src/main.rs @@ -10,7 +10,7 @@ fn main() { .unwrap(); tauri::Builder::default() - .invoke_handler(api::command::get_handlers()) + .invoke_handler(api::get_all_handlers()) .setup(move |app| { let main_window = app.handle().get_window("main").unwrap(); diff --git a/test-project/src/main.rs b/test-project/src/main.rs index bcba842..7fe2925 100644 --- a/test-project/src/main.rs +++ b/test-project/src/main.rs @@ -10,13 +10,13 @@ fn main() { console_log::init_with_level(log::Level::Trace).expect("no errors during logger init"); console_error_panic_hook::set_once(); - api::command::empty_invoke(); - api::command::underscore_invoke(69); + api::cmd::empty_invoke(); + api::cmd::underscore_invoke(69); wasm_bindgen_futures::spawn_local(async { - log::info!("{}", api::command::greet("frontend").await); + log::info!("{}", api::cmd::greet("frontend").await); - api::command::await_heavy_computing().await; + api::cmd::await_heavy_computing().await; log::info!("heavy computing finished") }); @@ -33,8 +33,8 @@ fn main() { Timeout::new(2000, move || drop(handle_bar)).forget(); }); - Timeout::new(1000, api::command::emit).forget(); - Timeout::new(3000, api::command::emit).forget(); + Timeout::new(1000, api::cmd::emit).forget(); + Timeout::new(3000, api::cmd::emit).forget(); #[cfg(feature = "leptos")] Timeout::new(5000, || leptos::mount_to_body(|| view! { })).forget(); @@ -55,8 +55,11 @@ fn App() -> impl IntoView { Timeout::new(5000, move || drop(handle_bar)).forget(); }); + let exit = move |_| api::model::other_cmd::stop_application(); + view! {
+ {move || if bar.get() { "No Foo".into_view() @@ -70,7 +73,7 @@ fn App() -> impl IntoView { #[cfg(feature = "leptos")] #[component] fn Foo() -> impl IntoView { - Timeout::new(2000, api::command::emit).forget(); + Timeout::new(2000, api::cmd::emit).forget(); let foo = TestState::use_field::("Test".into()); From 614ec152008c7ed1d512324bd9746f8cd4205d1f Mon Sep 17 00:00:00 2001 From: photovoltex Date: Wed, 6 Mar 2024 23:14:49 +0100 Subject: [PATCH 44/60] run proc-macro tests in ci --- .github/workflows/rust.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b9d9162..f496112 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -26,6 +26,11 @@ jobs: sudo apt-get update sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf + - name: Run tests for crate + run: | + cd tauri-interop-macro + cargo test + - name: Run tests for crate run: cargo test From 13615b580364884cdd842cea179201317a8c8617 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 7 Mar 2024 20:15:27 +0100 Subject: [PATCH 45/60] add binding documentation --- src/command/bindings.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/command/bindings.rs b/src/command/bindings.rs index 2ef2b3a..8d17999 100644 --- a/src/command/bindings.rs +++ b/src/command/bindings.rs @@ -3,15 +3,27 @@ use wasm_bindgen::prelude::*; #[wasm_bindgen] extern "C" { + /// Fire and forget invoke/command call + /// + /// [Tauri Commands](https://tauri.app/v1/guides/features/command) #[wasm_bindgen(js_name = "invoke", js_namespace = ["window", "__TAURI__", "tauri"])] pub fn invoke(cmd: &str, args: JsValue); + /// [invoke] variant that awaits the returned value + /// + /// [Async Commands](https://tauri.app/v1/guides/features/command/#async-commands) #[wasm_bindgen(js_name = "invoke", js_namespace = ["window", "__TAURI__", "tauri"])] pub async fn async_invoke(cmd: &str, args: JsValue) -> JsValue; + /// [async_invoke] variant that additionally returns a possible error + /// + /// [Error Handling](https://tauri.app/v1/guides/features/command/#error-handling) #[wasm_bindgen(catch, js_name = "invoke", js_namespace = ["window", "__TAURI__", "tauri"])] pub async fn invoke_catch(cmd: &str, args: JsValue) -> Result; + /// The binding for the frontend that listens to events + /// + /// [Events](https://tauri.app/v1/guides/features/events) #[cfg(feature = "event")] #[wasm_bindgen(catch, js_namespace = ["window", "__TAURI__", "event"])] pub async fn listen( From f959e190c5b24928e20aa0779d7e3b59b9b91485 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 7 Mar 2024 20:16:27 +0100 Subject: [PATCH 46/60] maybe hide _wasm feature --- Cargo.toml | 4 ++-- src/command.rs | 2 +- src/event.rs | 4 ++-- tauri-interop-macro/Cargo.toml | 2 +- tauri-interop-macro/src/lib.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dcfa8a4..6756b87 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ leptos = { version = "0.5", optional = true } tauri = { version = "1.5", default-features = false, features = ["wry"] } [target.'cfg(target_family = "wasm")'.dependencies] -tauri-interop-macro = { path = "./tauri-interop-macro", features = [ "wasm" ] } +tauri-interop-macro = { path = "./tauri-interop-macro", features = [ "_wasm" ] } # tauri-interop-macro = { version = "2", features = [ "wasm" ] } [target.'cfg(not(target_family = "wasm"))'.dev-dependencies] @@ -51,4 +51,4 @@ default = [ "event" ] event = [ "tauri-interop-macro/event" ] leptos = [ "dep:leptos", "tauri-interop-macro/leptos" ] # used to generate the missing documentation, otherwise it's only generated for "target_family = wasm" -wasm = [] +_wasm = [] diff --git a/src/command.rs b/src/command.rs index 140efd8..0c8d5b5 100644 --- a/src/command.rs +++ b/src/command.rs @@ -2,7 +2,7 @@ pub use type_aliases::*; /// wasm bindings for tauri's provided js functions (target: `wasm` or feat: `wasm`) -#[cfg(any(target_family = "wasm", feature = "wasm"))] +#[cfg(any(target_family = "wasm", feature = "_wasm"))] pub mod bindings; #[cfg(not(target_family = "wasm"))] diff --git a/src/event.rs b/src/event.rs index b7c957f..3049bd4 100644 --- a/src/event.rs +++ b/src/event.rs @@ -4,7 +4,7 @@ use tauri::{AppHandle, Error, Wry}; #[cfg(not(target_family = "wasm"))] pub use emit::*; -#[cfg(any(target_family = "wasm", feature = "wasm"))] +#[cfg(any(target_family = "wasm", feature = "_wasm"))] pub use listen::*; /// traits for event emitting in the host code (feat: `tauri`) @@ -12,7 +12,7 @@ pub use listen::*; mod emit; /// related generic struct and functions for autogenerated listen functions (target: `wasm` or feat: `wasm`) -#[cfg(any(target_family = "wasm", feature = "wasm"))] +#[cfg(any(target_family = "wasm", feature = "_wasm"))] mod listen; /// The trait which needs to be implemented for a [Field] diff --git a/tauri-interop-macro/Cargo.toml b/tauri-interop-macro/Cargo.toml index bbc131b..5234966 100644 --- a/tauri-interop-macro/Cargo.toml +++ b/tauri-interop-macro/Cargo.toml @@ -31,4 +31,4 @@ default = [ "event" ] leptos = [ "event" ] event = [] # feature to get info that context is wasm -wasm = [] +_wasm = [] diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 124f860..0ede9e3 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -22,7 +22,7 @@ mod event; #[cfg(feature = "event")] #[proc_macro_derive(Event, attributes(auto_naming, mod_name))] pub fn derive_event(stream: TokenStream) -> TokenStream { - if cfg!(feature = "wasm") { + if cfg!(feature = "_wasm") { event::listen::derive(stream) } else { event::emit::derive(stream) From c173bbc008f877f21e4b61a8fee4ed40d8166466 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 7 Mar 2024 20:59:00 +0100 Subject: [PATCH 47/60] macro docs and cleanup --- Cargo.lock | 1 + src/event/listen.rs | 2 +- tauri-interop-macro/Cargo.toml | 5 +- tauri-interop-macro/src/command/collect.rs | 29 ++++- tauri-interop-macro/src/lib.rs | 119 +++++++++++++-------- test-project/Cargo.lock | 1 - 6 files changed, 109 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 610a572..37c53ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3506,6 +3506,7 @@ dependencies = [ "serde", "syn 2.0.52", "tauri", + "tauri-interop", ] [[package]] diff --git a/src/event/listen.rs b/src/event/listen.rs index a55b6c1..6297ba4 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -30,7 +30,7 @@ pub enum ListenError { NotAFunction(JsValue), } -/// Handle which holds the unlisten function and the correlated callback +/// Handle which holds the function to detach the listener and the correlated callback pub struct ListenHandle { /// The callback which is invoked for the registered event /// diff --git a/tauri-interop-macro/Cargo.toml b/tauri-interop-macro/Cargo.toml index 5234966..e6a79c2 100644 --- a/tauri-interop-macro/Cargo.toml +++ b/tauri-interop-macro/Cargo.toml @@ -17,13 +17,16 @@ syn = { version = "^2.0", features = [ "full", "extra-traits" ]} quote = "^1.0" convert_case = "^0.6" lazy_static = "^1.4" -serde = "^1.0" proc-macro2 = "^1.0" proc-macro-error = "1.0.4" [dev-dependencies] tauri = { version = "^1.5", default-features = false, features = ["wry"] } log = "^0.4" +serde = "^1.0" +# required because the intented usage is to use the main crate, +# for testing we need the reexported macros from tauri-interop +tauri-interop = { path = ".." } [features] # todo: remove default feature before publish diff --git a/tauri-interop-macro/src/command/collect.rs b/tauri-interop-macro/src/command/collect.rs index 8cd0107..8fff2c6 100644 --- a/tauri-interop-macro/src/command/collect.rs +++ b/tauri-interop-macro/src/command/collect.rs @@ -2,9 +2,10 @@ use std::collections::HashSet; use proc_macro2::{Ident, TokenStream}; use quote::{format_ident, quote}; +use syn::parse::Parser; use syn::punctuated::Punctuated; use syn::token::Comma; -use syn::{parse_quote, ExprPath}; +use syn::{parse_quote, ExprPath, ItemUse, Token}; pub fn commands_with_mod_name(mod_name: &str, commands: &HashSet) -> HashSet { commands @@ -36,6 +37,24 @@ pub fn get_separated_command(input: &str) -> Option<(Ident, Ident)> { Some((mod_name, cmd_name)) } +pub fn get_filtered_commands(commands: &HashSet, mods: &[ExprPath]) -> HashSet { + commands + .iter() + .flat_map(|command| { + let (mod_name, _) = get_separated_command(command)?; + mods.iter() + .any(|r#mod| { + r#mod + .path + .segments + .iter() + .any(|seg| mod_name.eq(&seg.ident)) + }) + .then_some(command.clone()) + }) + .collect::>() +} + pub fn get_handler_function( fn_name: Ident, commands: &HashSet, @@ -56,3 +75,11 @@ pub fn get_handler_function( } } } + +pub fn uses(stream: proc_macro::TokenStream) -> Vec { + Punctuated::::parse_terminated + .parse2(stream.into()) + .unwrap() + .into_iter() + .collect::>() +} diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 0ede9e3..afbe5fb 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -9,8 +9,7 @@ use std::sync::Mutex; use proc_macro_error::{emit_call_site_error, emit_call_site_warning, proc_macro_error}; use quote::{format_ident, quote, ToTokens}; use syn::{ - parse::Parser, parse_macro_input, punctuated::Punctuated, ExprPath, ItemFn, ItemMod, ItemUse, - Token, + parse::Parser, parse_macro_input, punctuated::Punctuated, ExprPath, ItemFn, ItemMod, Token, }; use crate::command::collect::commands_to_punctuated; @@ -18,7 +17,34 @@ use crate::command::collect::commands_to_punctuated; mod command; mod event; -/// Conditionally adds [Listen] or [Emit] to a struct +/// Conditionally adds [Listen] or [Emit] to a struct. +/// +/// The field values inside the struct require to be self owned. +/// That means references aren't allowed inside the event struct. +/// +/// Depending on the targeted architecture the macro generates +/// different results. When compiling to `wasm` the [Listen] trait is +/// derived. Otherwise, [Emit] is derived. +/// +/// Both traits generate a new mod in which the related field-structs +/// are generated in. The field-struct represent a field of the struct +/// and are used for the derived trait functions. +/// +/// ### Example +/// +/// ``` +/// use tauri_interop_macro::Event; +/// +/// #[derive(Event)] +/// struct EventModel { +/// foo: String, +/// pub bar: bool +/// } +/// +/// // has to be defined in this example, otherwise the +/// // macro expansion panics because of missing super +/// fn main() {} +/// ``` #[cfg(feature = "event")] #[proc_macro_derive(Event, attributes(auto_naming, mod_name))] pub fn derive_event(stream: TokenStream) -> TokenStream { @@ -29,11 +55,10 @@ pub fn derive_event(stream: TokenStream) -> TokenStream { } } -/// Generates a default `Emit` implementation for the given struct with a -/// correlation enum, mod and field-structs for emitting a single field of -/// the struct. +/// Generates a default `Emit` implementation for the given struct. /// -/// Used for host code generation. +/// Used for host code generation. It is not intended to be used directly. +/// See [Event] #[cfg(feature = "event")] #[proc_macro_derive(Emit, attributes(auto_naming, mod_name))] pub fn derive_emit(stream: TokenStream) -> TokenStream { @@ -42,17 +67,16 @@ pub fn derive_emit(stream: TokenStream) -> TokenStream { /// Generates a default `EmitField` implementation for the given struct. /// -/// Used for host code generation. +/// Used for host code generation. It is not intended to be used directly. #[cfg(feature = "event")] #[proc_macro_derive(EmitField, attributes(parent, parent_field_name, parent_field_ty))] pub fn derive_emit_field(stream: TokenStream) -> TokenStream { event::emit::derive_field(stream) } -/// Generates `listen_to_` functions for the given -/// struct for the correlating host code. +/// Generates `listen_to_` functions for the given struct. /// -/// Used for wasm code generation +/// Used for wasm code generation. It is not intended to be used directly. #[cfg(feature = "event")] #[proc_macro_derive(Listen, attributes(auto_naming, mod_name))] pub fn derive_listen(stream: TokenStream) -> TokenStream { @@ -61,7 +85,7 @@ pub fn derive_listen(stream: TokenStream) -> TokenStream { /// Generates a default `ListenField` implementation for the given struct. /// -/// Used for wasm code generation. +/// Used for wasm code generation. It is not intended to be used directly. #[cfg(feature = "event")] #[proc_macro_derive(ListenField, attributes(parent, parent_field_ty))] pub fn derive_listen_field(stream: TokenStream) -> TokenStream { @@ -84,7 +108,7 @@ lazy_static::lazy_static! { static COMMAND_MOD_NAME: Mutex> = Mutex::new(None); -/// Conditionally adds the `tauri_interop::binding` or `tauri::command` macro to a struct +/// Conditionally adds the [binding] or `tauri::command` macro to a struct #[proc_macro_attribute] pub fn command(_attributes: TokenStream, stream: TokenStream) -> TokenStream { let fn_item = parse_macro_input!(stream as ItemFn); @@ -95,7 +119,7 @@ pub fn command(_attributes: TokenStream, stream: TokenStream) -> TokenStream { .insert(fn_item.sig.ident.to_string()); let command_macro = quote! { - #[cfg_attr(target_family = "wasm", tauri_interop::binding)] + #[cfg_attr(target_family = "wasm", ::tauri_interop::binding)] #[cfg_attr(not(target_family = "wasm"), tauri::command(rename_all = "snake_case"))] #fn_item }; @@ -106,7 +130,7 @@ pub fn command(_attributes: TokenStream, stream: TokenStream) -> TokenStream { /// Marks a mod that contains commands /// /// A mod needs to be marked when multiple command mods should be combined. -/// See [combine_handlers] for a detailed explanation/example. +/// See [combine_handlers!] for a detailed explanation/example. /// /// Requires usage of unstable feature: `#![feature(proc_macro_hygiene)]` #[proc_macro_attribute] @@ -124,6 +148,18 @@ pub fn commands(_attributes: TokenStream, stream: TokenStream) -> TokenStream { /// provides these with a `get_handlers()` in the current mod /// /// The provided function isn't available in wasm +/// +/// ### Example +/// +/// The following will generate a function name `get_handlers` that registers `cmd1` when +/// used in [tauri::Builder::invoke_handler](https://docs.rs/tauri/latest/tauri/struct.Builder.html#method.invoke_handler) +/// +/// ``` +/// #[tauri_interop_macro::command] +/// pub fn cmd1() {} +/// +/// tauri_interop_macro::collect_commands!(); +/// ``` #[proc_macro] pub fn collect_commands(_: TokenStream) -> TokenStream { let mut commands = COMMAND_LIST.lock().unwrap(); @@ -144,7 +180,10 @@ pub fn collect_commands(_: TokenStream) -> TokenStream { )); } else { // if there is no mod provided we can just move/clear the commands - COMMAND_LIST_ALL.lock().unwrap().extend(commands.iter().cloned()); + COMMAND_LIST_ALL + .lock() + .unwrap() + .extend(commands.iter().cloned()); } // clearing the already used handlers @@ -159,8 +198,8 @@ pub fn collect_commands(_: TokenStream) -> TokenStream { /// /// Takes multiple module paths as input and provides a `get_all_handlers()` function in /// the current mod that registers all commands from the provided mods. This macro does -/// still require the invocation of [collect_commands] at the end of a command mod. In -/// addition, a mod has to be marked with [commands]. +/// still require the invocation of [collect_commands!] at the end of a command mod. In +/// addition, a mod has to be marked with [macro@commands]. /// /// ### Example /// @@ -196,22 +235,7 @@ pub fn combine_handlers(stream: TokenStream) -> TokenStream { .collect::>(); let org_commands = COMMAND_LIST_ALL.lock().unwrap(); - let commands = org_commands - .iter() - .flat_map(|command| { - let (mod_name, _) = command::collect::get_separated_command(command)?; - command_mods - .iter() - .any(|r#mod| { - r#mod - .path - .segments - .iter() - .any(|seg| mod_name.eq(&seg.ident)) - }) - .then_some(command.clone()) - }) - .collect::>(); + let commands = command::collect::get_filtered_commands(&org_commands, &command_mods); if commands.is_empty() { emit_call_site_error!("No commands will be registered") @@ -245,18 +269,22 @@ pub fn combine_handlers(stream: TokenStream) -> TokenStream { )) } -fn collect_uses(stream: TokenStream) -> Vec { - Punctuated::::parse_terminated - .parse2(stream.into()) - .unwrap() - .into_iter() - .collect::>() -} - /// Simple macro to include multiple imports (seperated by `|`) not in wasm +/// +/// ### Example +/// +/// ```rust +/// tauri_interop_macro::host_usage! { +/// use tauri::State; +/// | use std::sync::RwLock; +/// } +/// +/// #[tauri_interop_macro::command] +/// pub fn empty_invoke(_state: State>) {} +/// ``` #[proc_macro] pub fn host_usage(stream: TokenStream) -> TokenStream { - let uses = collect_uses(stream); + let uses = command::collect::uses(stream); TokenStream::from(quote! { #( #[cfg(not(target_family = "wasm"))] @@ -266,9 +294,12 @@ pub fn host_usage(stream: TokenStream) -> TokenStream { } /// Simple macro to include multiple imports (seperated by `|`) only in wasm +/// +/// Equivalent to [host_usage!] for wasm imports only required in wasm. +/// For an example see [host_usage!]. #[proc_macro] pub fn wasm_usage(stream: TokenStream) -> TokenStream { - let uses = collect_uses(stream); + let uses = command::collect::uses(stream); TokenStream::from(quote! { #( #[cfg(target_family = "wasm")] diff --git a/test-project/Cargo.lock b/test-project/Cargo.lock index 790d25d..9e3dd8f 100644 --- a/test-project/Cargo.lock +++ b/test-project/Cargo.lock @@ -3665,7 +3665,6 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "serde", "syn 2.0.52", ] From 3284269625b34aa6b184986977379e75a5b4513f Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 7 Mar 2024 21:52:24 +0100 Subject: [PATCH 48/60] moved examples to their respected definition --- README.md | 116 --------------------------------- src/event/emit.rs | 57 ++++++++++++++++ src/event/listen.rs | 40 +++++++++++- tauri-interop-macro/src/lib.rs | 14 ++-- 4 files changed, 106 insertions(+), 121 deletions(-) diff --git a/README.md b/README.md index 2c64bab..d2f2b40 100644 --- a/README.md +++ b/README.md @@ -44,23 +44,6 @@ section. ### Command (Frontend => Backend Communication) > For more examples see [cmd.rs](./test-project/api/src/cmd.rs) in test-project -Definition for both tauri supported triplet and wasm: -```rust , ignore-wasm32-unknown-unknown -#[tauri_interop::command] -fn greet(name: &str) -> String { - format!("Hello, {}! You've been greeted from Rust!", name) -} - -// generated the `get_handlers()` function -tauri_interop::collect_commands!(); - -fn main() { - tauri::Builder::default() - // This is where you pass in the generated handler collector - .invoke_handler(get_handlers()); -} -``` - Using `tauri_interop::command` does two things: - it provides the command with two macros which are used depending on the `target_family` - `tauri_interop::binding` is used when compiling to `wasm` @@ -201,102 +184,3 @@ tauri_interop::host_usage! { #[tauri_interop::command] pub fn empty_invoke(_state: State>) {} ``` - -### Event (Backend => Frontend Communication) -Definition for both tauri supported triplet and wasm: -```rust -use tauri_interop::Event; - -#[derive(Default, Event)] -pub struct Test { - foo: String, - pub bar: bool, -} - -// when main isn't defined, `super::Test` results in an error -fn main() {} -``` - -When using the derive macro `tauri_interop::Event` it expands depending on the `target_family` to - - derive trait `tauri_interop::Listen` (when compiling to `wasm`) - - derive trait `tauri_interop::Emit` (otherwise) - -To emit a variable from the above struct (which is mostly intended to be used as state) in the host triplet -```rust , ignore-wasm32-unknown-unknown -use tauri_interop::{Event, event::Emit}; - -#[derive(Default, Event)] -pub struct Test { - foo: String, - pub bar: bool, -} - -// via `tauri_interop::Emit` a new module named after the struct (as snake_case) -// is created where the struct Test is defined, here it creates module `test` -// in this module the related Fields are generated - -// one context where `tauri::AppHandle` can be obtained -#[tauri_interop::command] -fn emit_bar(handle: tauri::AppHandle) { - let mut t = Test::default(); - - t.emit::(&handle); // emits the current state: `false` -} - -// a different context where `tauri::AppHandle` can be obtained -fn main() { - tauri::Builder::default() - .setup(|app| { - let handle: tauri::AppHandle = app.handle(); - - let mut t = Test::default(); - - // to emit and update a field an update function for each field is generated - t.update::(&handle, "Bar".into()); // assigns "Bar" to t.foo and emits the same value - - Ok(()) - }); -} -``` - -the above emitted value can then be received in wasm as: -```rust , ignore -use tauri_interop::Event; - -#[derive(Default, Event)] -pub struct Test { - foo: String, - pub bar: bool, -} - -async fn main() { - use tauri_interop::event::listen::Listen; - - let _listen_handle: ListenHandle<'_> = Test::listen_to::(|foo| { /* use received foo: String here */ }).await; -} -``` - -The `ListenHandle` contains the provided closure and the "unlisten" method. It has to be hold in scope as long -as the event should be received. Dropping it will automatically detach the closure from the event. See -[cmd.rs](./test-project/api/src/cmd.rs) for other example how it could be used. - -#### Feature: leptos -When the `leptos` feature is enabled the `use_field` method is added to the `Listen` trait when compiling to wasm. -The method takes care of the initial asynchronous call to register the listener and will hold the handle in scope -as long as the leptos component is rendered. - -```rust , ignore -use tauri_interop::Event; - -#[derive(Default, Event)] -pub struct Test { - foo: String, - pub bar: bool, -} - -fn main() { - use tauri_interop::event::listen::Listen; - - let foo: leptos::ReadSignal = Test::use_field::(String::default()); -} -``` diff --git a/src/event/emit.rs b/src/event/emit.rs index 3abad17..95318d3 100644 --- a/src/event/emit.rs +++ b/src/event/emit.rs @@ -5,14 +5,71 @@ use super::Field; /// Trait that defines the available event emitting methods pub trait Emit { /// Emit all field events + /// + /// ### Example + /// + /// ``` + /// use tauri_interop::{command::TauriAppHandle, event::Emit, Event}; + /// + /// #[derive(Default, Event)] + /// pub struct Test { + /// foo: String, + /// pub bar: bool, + /// } + /// + /// #[tauri_interop::command] + /// fn emit_bar(handle: TauriAppHandle) { + /// Test::default().emit_all(&handle).expect("emitting failed"); + /// } + /// + /// fn main() {} + /// ``` fn emit_all(&self, handle: &AppHandle) -> Result<(), Error>; /// Emit a single field event + /// + /// ### Example + /// + /// ``` + /// use tauri_interop::{command::TauriAppHandle, event::Emit, Event}; + /// + /// #[derive(Default, Event)] + /// pub struct Test { + /// foo: String, + /// pub bar: bool, + /// } + /// + /// #[tauri_interop::command] + /// fn emit_bar(handle: TauriAppHandle) { + /// Test::default().emit::(&handle).expect("emitting failed"); + /// } + /// + /// fn main() {} + /// ``` fn emit>(&self, handle: &AppHandle) -> Result<(), Error> where Self: Sized + Emit; /// Update a single field and emit it afterward + /// + /// ### Example + /// + /// ``` + /// use tauri_interop::{command::TauriAppHandle, event::Emit, Event}; + /// + /// #[derive(Default, Event)] + /// pub struct Test { + /// foo: String, + /// pub bar: bool, + /// } + /// + /// #[tauri_interop::command] + /// fn emit_bar(handle: TauriAppHandle) { + /// Test::default().update::(&handle, true).expect("emitting failed"); + /// } + /// + /// fn main() {} + /// ``` fn update>( &mut self, handle: &AppHandle, diff --git a/src/event/listen.rs b/src/event/listen.rs index 6297ba4..16e2c8e 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -118,9 +118,29 @@ impl ListenHandle { /// Trait that defines the available listen methods pub trait Listen { - /// Registers an callback to a [Field] + /// Registers a callback to a [Field] /// /// Default Implementation: see [ListenHandle::register] + /// + /// ### Example + /// + /// ```ignore + /// use tauri_interop::Event; + /// + /// #[derive(Default, Event)] + /// pub struct Test { + /// foo: String, + /// pub bar: bool, + /// } + /// + /// async fn main() { + /// use tauri_interop::event::listen::Listen; + /// + /// let _listen_handle: ListenHandle<'_> = Test::listen_to::(|foo| { + /// /* use received foo: String here */ + /// }).await; + /// } + /// ``` fn listen_to>( callback: impl Fn(F::Type) + 'static, ) -> impl std::future::Future @@ -133,6 +153,24 @@ pub trait Listen { /// Creates a signal to a [Field] /// /// Default Implementation: see [ListenHandle::use_register] + /// + /// ### Example + /// + /// ```ignore + /// use tauri_interop::Event; + /// + /// #[derive(Default, Event)] + /// pub struct Test { + /// foo: String, + /// pub bar: bool, + /// } + /// + /// fn main() { + /// use tauri_interop::event::listen::Listen; + /// + /// let foo: leptos::ReadSignal = Test::use_field::(String::default()); + /// } + /// ``` #[cfg(feature = "leptos")] fn use_field>(initial: F::Type) -> ReadSignal where diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index afbe5fb..c896fa8 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -151,14 +151,20 @@ pub fn commands(_attributes: TokenStream, stream: TokenStream) -> TokenStream { /// /// ### Example /// -/// The following will generate a function name `get_handlers` that registers `cmd1` when -/// used in [tauri::Builder::invoke_handler](https://docs.rs/tauri/latest/tauri/struct.Builder.html#method.invoke_handler) -/// /// ``` /// #[tauri_interop_macro::command] -/// pub fn cmd1() {} +/// fn greet(name: &str) -> String { +/// format!("Hello, {}! You've been greeted from Rust!", name) +/// } /// /// tauri_interop_macro::collect_commands!(); +/// +/// fn main() { +/// let _ = tauri::Builder::default() +/// // This is where you pass in the generated handler collector +/// // in this example this would only register cmd1 +/// .invoke_handler(get_handlers()); +/// } /// ``` #[proc_macro] pub fn collect_commands(_: TokenStream) -> TokenStream { From 2341e339076a22e61501ef60114097e2f8bdaef7 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 7 Mar 2024 22:33:54 +0100 Subject: [PATCH 49/60] move more examples and add more docs to the Event trait --- README.md | 52 +++++-------------------------- tauri-interop-macro/src/lib.rs | 57 ++++++++++++++++++++++++++++++---- 2 files changed, 59 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index d2f2b40..7fe1fd9 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Tauri has an [event](https://tauri.app/v1/guides/features/events) mechanic which the frontend. The usage is not as intuitive and has to some inconveniences that make it quite hard to recommend. To improve the usage, this crate provides the derive-marcos `Event`, `Emit` and `Listen`. The `Event` macro is just a conditional wrapper that expands to `Emit` for the tauri compilation and `Listen` for the wasm compilation. It is -the intended way to use this feature. The usage is explained in more detail in the [event](#event-backend--frontend-communication) +the intended way to use this feature. The usage is explained in the documentation of the `Event` macro. section. ## Basic usage: @@ -44,18 +44,18 @@ section. ### Command (Frontend => Backend Communication) > For more examples see [cmd.rs](./test-project/api/src/cmd.rs) in test-project -Using `tauri_interop::command` does two things: -- it provides the command with two macros which are used depending on the `target_family` +The newly provides macro `tauri_interop::command` does two things: +- it provides the function with two macros which are used depending on the targeted architecture - `tauri_interop::binding` is used when compiling to `wasm` - `tauri::command` is used otherwise -- it adds an entry to `tauri_interop::collect_commands!()` (see [collect commands](#collect-commands)) +- additionally it provides the possibility to collect all defined commands via `tauri_interop::collect_commands!()` + - for more info see [collect commands](#collect-commands)) - the function is not generated when targeting `wasm` -The defined command above can then be used in wasm as below. Due to receiving data from -tauri via a promise, the command response has to be awaited. +The generated command can then be used in `wasm` like the following: ```rust , ignore #[tauri_interop::command] -fn greet(name: &str) -> String { +fn greet(name: &str, _handle: tauri::AppHandle) -> String { format!("Hello, {}! You've been greeted from Rust!", name) } @@ -69,7 +69,7 @@ fn main() { } ``` -#### Command representation Host/Wasm +**Command representation Host/Wasm (and a bit background knowledge)** - the returned type of the wasm binding should be 1:1 the same type as send from the "backend" - technically all commands need to be of type `Result` because there is always the possibility of a command @@ -84,42 +84,6 @@ fn main() { - that also means, if you create a type alias for `Result` and don't include `Result` in the name of the alias, it will not map the `Result` correctly -```rust , ignore-wasm32-unknown-unknown -// let _: () = trigger_something(); -#[tauri_interop::command] -fn trigger_something(name: &str) { - print!("triggers something, but doesn't need to wait for it") -} - -// let value: String = wait_for_sync_execution("value").await; -#[tauri_interop::command] -fn wait_for_sync_execution(value: &str) -> String { - format!("Has to wait that the backend completes the computation and returns the {value}") -} - -// let result: Result = asynchronous_execution(true).await; -#[tauri_interop::command] -async fn await_heavy_computing() { - std::thread::sleep(std::time::Duration::from_millis(5000)) -} - -// let result: Result = asynchronous_execution(true).await; -#[tauri_interop::command] -async fn asynchronous_execution(change: bool) -> Result { - if change { - Ok("asynchronous execution returning result, need Result in their type name".into()) - } else { - Err("if they don't it, the error will be not be parsed/handled".into()) - } -} - -// let _wait_for_completion: () = heavy_computation().await; -#[tauri_interop::command] -async fn heavy_computation() { - std::thread::sleep(std::time::Duration::from_millis(5000)) -} -``` - #### Collect commands The `tauri_invoke::collect_commands` macro generates a `get_handlers` function in the current mod, which calls the diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index c896fa8..a32febe 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -22,13 +22,18 @@ mod event; /// The field values inside the struct require to be self owned. /// That means references aren't allowed inside the event struct. /// -/// Depending on the targeted architecture the macro generates -/// different results. When compiling to `wasm` the [Listen] trait is -/// derived. Otherwise, [Emit] is derived. +/// Depending on the targeted architecture the macro generates different results. +/// When compiling to `wasm` the [Listen] trait is derived. Otherwise, [Emit] is derived. /// -/// Both traits generate a new mod in which the related field-structs -/// are generated in. The field-struct represent a field of the struct -/// and are used for the derived trait functions. +/// Both traits generate a new mod in which the related field-structs are generated in. +/// The mod can be automatically renamed with `#[auto_naming(EnumLike)]` to behave +/// enum-like (for example a struct `Test`s mod would usually be named `test`, 'EnumLike' +/// names it `TestField` instead) and `#[mod_name(...)]` is a direct possibility to rename +/// the mod to any given name. +/// +/// The generated field-structs represent a field of the struct and are used for the +/// derived trait functions. The fields are used to `emit`, `update` or `listen_to` a +/// given field. For detail usages see the individual traits defined in `tauri-interop`. /// /// ### Example /// @@ -109,6 +114,40 @@ lazy_static::lazy_static! { static COMMAND_MOD_NAME: Mutex> = Mutex::new(None); /// Conditionally adds the [binding] or `tauri::command` macro to a struct +/// +/// ### Example +/// +/// The commands above the commands is the equivalent usage in wasm +/// +/// ```rust +/// // let _: () = trigger_something(); +/// #[tauri_interop::command] +/// fn trigger_something(name: &str) { +/// print!("triggers something, but doesn't need to wait for it") +/// } +/// +/// // let value: String = wait_for_sync_execution("value").await; +/// #[tauri_interop::command] +/// fn wait_for_sync_execution(value: &str) -> String { +/// format!("Has to wait that the backend completes the computation and returns the {value}") +/// } +/// +/// // let result: Result = asynchronous_execution(true).await; +/// #[tauri_interop::command] +/// async fn asynchronous_execution(change: bool) -> Result { +/// if change { +/// Ok("asynchronous execution returning result, need Result in their type name".into()) +/// } else { +/// Err("if they don't it, the error will be not be parsed/handled".into()) +/// } +/// } +/// +/// // let _wait_for_completion: () = heavy_computation().await; +/// #[tauri_interop::command] +/// async fn heavy_computation() { +/// std::thread::sleep(std::time::Duration::from_millis(5000)) +/// } +/// ``` #[proc_macro_attribute] pub fn command(_attributes: TokenStream, stream: TokenStream) -> TokenStream { let fn_item = parse_macro_input!(stream as ItemFn); @@ -230,6 +269,12 @@ pub fn collect_commands(_: TokenStream) -> TokenStream { /// /// tauri_interop_macro::combine_handlers!( cmd1, whatever::cmd2 ); /// +/// fn main() { +/// let _ = tauri::Builder::default() +/// // This is where you pass in the combined handler collector +/// // in this example it will register cmd1::cmd1 and whatever::cmd2::cmd2 +/// .invoke_handler(get_all_handlers()); +/// } /// ``` #[proc_macro_error] #[proc_macro] From f776451ce020b8a805995742b3292e0738f5ffc9 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sun, 10 Mar 2024 23:05:59 +0100 Subject: [PATCH 50/60] move command docs into code --- README.md | 73 +--------------------------------- tauri-interop-macro/src/lib.rs | 54 +++++++++++++++++++------ 2 files changed, 44 insertions(+), 83 deletions(-) diff --git a/README.md b/README.md index 7fe1fd9..b54e58a 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,12 @@ This crate tries to provide a general more enjoyable experience for developing t > tbf it is a saner approach to write the app in a mix of js + rust, because the frameworks are more mature, there are > way more devs who have experience with js and their respective frameworks etc... > -> but tbh... just because something is saner, it doesn't stop us from doing things differently ^ヮ^ +> but tbh... just because something is saner, doesn't stop us from doing things differently ^ヮ^ Writing an app in a single language gives us the option of building a common crate/module which connects the backend and frontend. A common model itself can most of the time be easily compiled to both architectures (arch's) when the types are compatible with both. The commands on the other hand don't have an option to be compiled to wasm. Which means they -need to be handled manually or be called via a wrapper/helper each time. +need to be handled manually or be called via a wrapper/helper each time. Repeating the implementation and handling for a function that is already defined properly seems to be a waste of time. For that reason this crate provides the `tauri_interop::command` macro. This macro is explained in detail in the @@ -34,75 +34,6 @@ conditional wrapper that expands to `Emit` for the tauri compilation and `Listen the intended way to use this feature. The usage is explained in the documentation of the `Event` macro. section. -## Basic usage: - -> **Disclaimer**: -> -> Some examples in this documentation can't be executed with doctests due to -> the required wasm target and tauri modified environment (see [withGlobalTauri](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri)) - -### Command (Frontend => Backend Communication) -> For more examples see [cmd.rs](./test-project/api/src/cmd.rs) in test-project - -The newly provides macro `tauri_interop::command` does two things: -- it provides the function with two macros which are used depending on the targeted architecture - - `tauri_interop::binding` is used when compiling to `wasm` - - `tauri::command` is used otherwise -- additionally it provides the possibility to collect all defined commands via `tauri_interop::collect_commands!()` - - for more info see [collect commands](#collect-commands)) - - the function is not generated when targeting `wasm` - -The generated command can then be used in `wasm` like the following: -```rust , ignore -#[tauri_interop::command] -fn greet(name: &str, _handle: tauri::AppHandle) -> String { - format!("Hello, {}! You've been greeted from Rust!", name) -} - -fn main() { - console_log::init_with_level(log::Level::Info).unwrap(); - - wasm_bindgen_futures::spawn_local(async move { - let greetings = greet("frontend").await; - log::info!("{greetings}"); - }); -} -``` - -**Command representation Host/Wasm (and a bit background knowledge)** - -- the returned type of the wasm binding should be 1:1 the same type as send from the "backend" - - technically all commands need to be of type `Result` because there is always the possibility of a command - getting called, that isn't registered in the context of tauri - - when using `tauri_interop::collect_commands!()` this possibility is fully™️ removed - - for convenience, we ignore that possibility, and even if the error occurs it will be logged into the console -- all arguments with `tauri` in their name (case-insensitive) are removed as argument in a defined command - - that includes `tauri::*` usages and `Tauri` named types - - the crate itself provides type aliases for tauri types usable in a command (see [type_aliases](./src/command/type_aliases.rs)) -- most return types are automatically determined - - when using a return type with `Result` in the name, the function will also return a `Result` - - that also means, if you create a type alias for `Result` and don't include `Result` in the name of the alias, - it will not map the `Result` correctly - -#### Collect commands - -The `tauri_invoke::collect_commands` macro generates a `get_handlers` function in the current mod, which calls the -`tauri::generate_handler` macro with all function which are annotated with the `tauri_interop::command` macro. The -function is only generated for tauri and not for wasm. - -Due to technical limitations we sadly can't combine multiple `get_handlers` functions. This limitation comes to the -underlying mechanic. The `tauri::generate_handler` macro generates a function which consumes `tauri::Invoke` as single -parameter. Because it fully consumes the given parameter we can't call multiple handlers with it. In addition, the -`Builder::invoke_handler` function, which usually consumes the generated `tauri::generate_handler` can't be called -twice without losing the previous registered commands. - -Because of this limitation for splitting commands into multiple files it is recommended to create a root mod for the -command which includes other command mod's. The functions in the included mods need to be public and re-imported into -the root mod. With these prerequisites the `tauri_invoke::collect_commands` can be called at the end of the file, which -generates the usual `get_handlers` function, but with all "commands" defined inside the others mods. - -For an example see the [test-project/api/src/command.rs](test-project/api/src/command.rs). - ### QOL macros This crate also adds some quality-of-life macros. These are intended to ease the drawbacks of compiling to diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index a32febe..23926e1 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -1,6 +1,8 @@ #![feature(iter_intersperse)] #![warn(missing_docs)] -//! The macros use by `tauri_interop` to generate dynamic code depending on the target +//! The macros use by `tauri-interop` to generate dynamic code depending on the target +//! +//! Without `tauri-interop` the generated code can't compile. use proc_macro::TokenStream; use std::collections::HashSet; @@ -63,7 +65,7 @@ pub fn derive_event(stream: TokenStream) -> TokenStream { /// Generates a default `Emit` implementation for the given struct. /// /// Used for host code generation. It is not intended to be used directly. -/// See [Event] +/// See [Event] for the usage. #[cfg(feature = "event")] #[proc_macro_derive(Emit, attributes(auto_naming, mod_name))] pub fn derive_emit(stream: TokenStream) -> TokenStream { @@ -79,9 +81,10 @@ pub fn derive_emit_field(stream: TokenStream) -> TokenStream { event::emit::derive_field(stream) } -/// Generates `listen_to_` functions for the given struct. +/// Generates an implementation of [tauri_interop::Event] /// /// Used for wasm code generation. It is not intended to be used directly. +/// See [Event] for the usage. #[cfg(feature = "event")] #[proc_macro_derive(Listen, attributes(auto_naming, mod_name))] pub fn derive_listen(stream: TokenStream) -> TokenStream { @@ -113,26 +116,40 @@ lazy_static::lazy_static! { static COMMAND_MOD_NAME: Mutex> = Mutex::new(None); -/// Conditionally adds the [binding] or `tauri::command` macro to a struct -/// -/// ### Example -/// -/// The commands above the commands is the equivalent usage in wasm +/// Conditionally adds the macro [macro@binding] or `tauri::command` to a struct +/// +/// By using this macro, when compiling to wasm, a version that invokes the +/// current function is generated. +/// +/// ### Collecting commands +/// When this macro is compiled to the host target, additionally to adding the +/// `tauri::command` macro, the option to auto collect the command via +/// [macro@collect_commands] and [macro@combine_handlers] is provided. +/// +/// ### Binding generation +/// All parameter arguments with `tauri` in their name (case-insensitive) are +/// removed as argument in a defined command. That includes `tauri::*` usages +/// and `Tauri` named types. +/// +/// The type returned is evaluated automatically and is most of the time 1:1 +/// to the defined type. When using a wrapped `Result` type, it should +/// include the phrase "Result" in the type name. Otherwise, the returned type +/// can't be successfully interpreted as a result and by that will result in +/// wrong type/error handling/serialization. +/// +/// ### Example - Definition /// /// ```rust -/// // let _: () = trigger_something(); /// #[tauri_interop::command] /// fn trigger_something(name: &str) { /// print!("triggers something, but doesn't need to wait for it") /// } /// -/// // let value: String = wait_for_sync_execution("value").await; /// #[tauri_interop::command] /// fn wait_for_sync_execution(value: &str) -> String { /// format!("Has to wait that the backend completes the computation and returns the {value}") /// } /// -/// // let result: Result = asynchronous_execution(true).await; /// #[tauri_interop::command] /// async fn asynchronous_execution(change: bool) -> Result { /// if change { @@ -142,12 +159,25 @@ static COMMAND_MOD_NAME: Mutex> = Mutex::new(None); /// } /// } /// -/// // let _wait_for_completion: () = heavy_computation().await; /// #[tauri_interop::command] /// async fn heavy_computation() { /// std::thread::sleep(std::time::Duration::from_millis(5000)) /// } /// ``` +/// +/// ### Example - Usage +/// +/// ```rust , ignore +/// fn main() { +/// trigger_something(); +/// +/// wasm_bindgen_futures::spawn_local(async move { +/// wait_for_sync_execution("value").await; +/// asynchronous_execution(true).await.expect("returns ok"); +/// heavy_computation().await; +/// }); +/// } +/// ``` #[proc_macro_attribute] pub fn command(_attributes: TokenStream, stream: TokenStream) -> TokenStream { let fn_item = parse_macro_input!(stream as ItemFn); From 7d4fc369b02205d2e7f2e7bec948bb790a9b64b5 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sun, 10 Mar 2024 23:06:15 +0100 Subject: [PATCH 51/60] add own docs for the main crate --- src/lib.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 93fd0fc..34e731e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,22 @@ #![warn(missing_docs)] -#![doc = include_str!("../README.md")] #![feature(trait_alias)] +//! Tauri-Interop is a library that provides macros to improve developing tauri apps with a rust +//! frontend by generating frontend implementation out of the backend definitions. +//! +//! The main macros intended to be used are: +//! - [macro@command], which is intended to be used as replacement to [macro@tauri::command] +//! - [macro@Event], that provides an easier usage of the [Events feature of tauri](https://tauri.app/v1/guides/features/events/) +//! - derives [event::Listen] when compiling to wasm and [event::Emit] otherwise +//! +//! Additionally, some QOL macros ([host_usage] and [wasm_usage]) are provided that +//! reduce some drawbacks when simultaneously compiling to wasm and the host architecture. +//! +//! ### Explanation and Examples +//! +//! Detail explanations and example can be found on the respected traits or macros. Some +//! examples are ignored because they are only valid when compiling to wasm. + pub use tauri_interop_macro::*; /// wrapped bindings for easier use in the generated wasm commands From 66d93682b65b495d1d7b4183629127911f29af2d Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sun, 10 Mar 2024 23:23:24 +0100 Subject: [PATCH 52/60] summarize crate function in readme --- README.md | 69 ++++--------------------------------------------------- 1 file changed, 5 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index b54e58a..96a0c7d 100644 --- a/README.md +++ b/README.md @@ -15,67 +15,8 @@ frontend. A common model itself can most of the time be easily compiled to both are compatible with both. The commands on the other hand don't have an option to be compiled to wasm. Which means they need to be handled manually or be called via a wrapper/helper each time. -Repeating the implementation and handling for a function that is already defined properly seems to be a waste of time. -For that reason this crate provides the `tauri_interop::command` macro. This macro is explained in detail in the -[command representation](#command-representation-hostwasm) section. This new macro provides the option to invoke the -command in wasm and by therefore call the defined command in tauri. On the other side, when compiling for tauri in addition -to the tauri logic, the macro provides the option to collect all commands in a single file via the invocation of the -`tauri_interop::collect_commands` macro at the end of the file (see [command](#command-frontend--backend-communication)). - -In addition, some quality-of-life macros are provided to ease some inconveniences when compiling to multiple arch's. See -the [QOL](#qol-macros) section. - -**Feature `event`**: - -Tauri has an [event](https://tauri.app/v1/guides/features/events) mechanic which allows the tauri side to communicate with -the frontend. The usage is not as intuitive and has to some inconveniences that make it quite hard to recommend. To -improve the usage, this crate provides the derive-marcos `Event`, `Emit` and `Listen`. The `Event` macro is just a -conditional wrapper that expands to `Emit` for the tauri compilation and `Listen` for the wasm compilation. It is -the intended way to use this feature. The usage is explained in the documentation of the `Event` macro. -section. - -### QOL macros - -This crate also adds some quality-of-life macros. These are intended to ease the drawbacks of compiling to -multiple architectures. - -#### Conditional `use` -Because most crates are not intended to be compiled to wasm and most wasm crates are not intended to be compiled to -the host-triplet they have to be excluded in each others compile process. The usual process to exclude uses for a certain -architecture would look something like this: - -```rust -#[cfg(not(target_family = "wasm"))] -use tauri::AppHandle; - -#[tauri_interop::command] -pub fn empty_invoke(_handle: AppHandle) {} -``` - -**General usage:** - -With the help of `tauri_interop::host_usage!()` and `tauri_interop::wasm_usage!()` we don't need to remember which -attribute we have to add and can just convert the above to the following: - -```rust -tauri_interop::host_usage! { - use tauri::AppHandle; -} - -#[tauri_interop::command] -pub fn empty_invoke(_handle: AppHandle) {} -``` - -**Multiple `use` usage:** - -When multiple `use` should be excluded, they need to be separated by a single pipe (`|`). For example: - -```rust -tauri_interop::host_usage! { - use tauri::State; - | use std::sync::RwLock; -} - -#[tauri_interop::command] -pub fn empty_invoke(_state: State>) {} -``` +The crates therefore provides the following features: +- generate a wasm function out of the defined tauri-command +- collect and register all defined tauri-commands +- QOL-macros to exclude multiple imports in wasm or the host architecture +- easier usage of [tauri's event feature](https://tauri.app/v1/guides/features/events/) From 686a93348d45d0f3c9c13ff92cd8a2f33a58a7f0 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Sun, 10 Mar 2024 23:23:38 +0100 Subject: [PATCH 53/60] cleanup --- src/command.rs | 2 +- src/lib.rs | 22 +++++++++++----------- tauri-interop-macro/src/lib.rs | 34 +++++++++++++++++----------------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/command.rs b/src/command.rs index 0c8d5b5..3e7aee7 100644 --- a/src/command.rs +++ b/src/command.rs @@ -1,7 +1,7 @@ #[cfg(not(target_family = "wasm"))] pub use type_aliases::*; -/// wasm bindings for tauri's provided js functions (target: `wasm` or feat: `wasm`) +/// wasm bindings for tauri's provided js functions (target: `wasm`) #[cfg(any(target_family = "wasm", feature = "_wasm"))] pub mod bindings; diff --git a/src/lib.rs b/src/lib.rs index 34e731e..7354e13 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,22 +1,22 @@ -#![warn(missing_docs)] -#![feature(trait_alias)] - -//! Tauri-Interop is a library that provides macros to improve developing tauri apps with a rust -//! frontend by generating frontend implementation out of the backend definitions. -//! +//! Tauri-Interop is a library that provides macros to improve developing tauri apps with a rust +//! frontend by generating frontend implementation out of the backend definitions. +//! //! The main macros intended to be used are: //! - [macro@command], which is intended to be used as replacement to [macro@tauri::command] //! - [macro@Event], that provides an easier usage of the [Events feature of tauri](https://tauri.app/v1/guides/features/events/) //! - derives [event::Listen] when compiling to wasm and [event::Emit] otherwise -//! -//! Additionally, some QOL macros ([host_usage] and [wasm_usage]) are provided that +//! +//! Additionally, some QOL macros ([host_usage] and [wasm_usage]) are provided that //! reduce some drawbacks when simultaneously compiling to wasm and the host architecture. -//! +//! //! ### Explanation and Examples -//! -//! Detail explanations and example can be found on the respected traits or macros. Some +//! +//! Detail explanations and example can be found on the respected traits or macros. Some //! examples are ignored because they are only valid when compiling to wasm. +#![warn(missing_docs)] +#![feature(trait_alias)] + pub use tauri_interop_macro::*; /// wrapped bindings for easier use in the generated wasm commands diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index 23926e1..a3929c9 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -81,7 +81,7 @@ pub fn derive_emit_field(stream: TokenStream) -> TokenStream { event::emit::derive_field(stream) } -/// Generates an implementation of [tauri_interop::Event] +/// Generates a default `Listen` implementation for the given struct. /// /// Used for wasm code generation. It is not intended to be used directly. /// See [Event] for the usage. @@ -118,39 +118,39 @@ static COMMAND_MOD_NAME: Mutex> = Mutex::new(None); /// Conditionally adds the macro [macro@binding] or `tauri::command` to a struct /// -/// By using this macro, when compiling to wasm, a version that invokes the +/// By using this macro, when compiling to wasm, a version that invokes the /// current function is generated. -/// +/// /// ### Collecting commands /// When this macro is compiled to the host target, additionally to adding the -/// `tauri::command` macro, the option to auto collect the command via +/// `tauri::command` macro, the option to auto collect the command via /// [macro@collect_commands] and [macro@combine_handlers] is provided. /// /// ### Binding generation -/// All parameter arguments with `tauri` in their name (case-insensitive) are -/// removed as argument in a defined command. That includes `tauri::*` usages +/// All parameter arguments with `tauri` in their name (case-insensitive) are +/// removed as argument in a defined command. That includes `tauri::*` usages /// and `Tauri` named types. -/// -/// The type returned is evaluated automatically and is most of the time 1:1 +/// +/// The type returned is evaluated automatically and is most of the time 1:1 /// to the defined type. When using a wrapped `Result` type, it should /// include the phrase "Result" in the type name. Otherwise, the returned type /// can't be successfully interpreted as a result and by that will result in /// wrong type/error handling/serialization. -/// +/// /// ### Example - Definition /// /// ```rust -/// #[tauri_interop::command] +/// #[tauri_interop_macro::command] /// fn trigger_something(name: &str) { /// print!("triggers something, but doesn't need to wait for it") /// } /// -/// #[tauri_interop::command] +/// #[tauri_interop_macro::command] /// fn wait_for_sync_execution(value: &str) -> String { /// format!("Has to wait that the backend completes the computation and returns the {value}") /// } /// -/// #[tauri_interop::command] +/// #[tauri_interop_macro::command] /// async fn asynchronous_execution(change: bool) -> Result { /// if change { /// Ok("asynchronous execution returning result, need Result in their type name".into()) @@ -159,18 +159,18 @@ static COMMAND_MOD_NAME: Mutex> = Mutex::new(None); /// } /// } /// -/// #[tauri_interop::command] +/// #[tauri_interop_macro::command] /// async fn heavy_computation() { /// std::thread::sleep(std::time::Duration::from_millis(5000)) /// } /// ``` -/// +/// /// ### Example - Usage -/// +/// /// ```rust , ignore /// fn main() { /// trigger_something(); -/// +/// /// wasm_bindgen_futures::spawn_local(async move { /// wait_for_sync_execution("value").await; /// asynchronous_execution(true).await.expect("returns ok"); @@ -189,7 +189,7 @@ pub fn command(_attributes: TokenStream, stream: TokenStream) -> TokenStream { let command_macro = quote! { #[cfg_attr(target_family = "wasm", ::tauri_interop::binding)] - #[cfg_attr(not(target_family = "wasm"), tauri::command(rename_all = "snake_case"))] + #[cfg_attr(not(target_family = "wasm"), ::tauri::command(rename_all = "snake_case"))] #fn_item }; From e625ed4c1ab535fb8ebbfdb82f4d6ee2a027f491 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Wed, 13 Mar 2024 18:57:03 +0100 Subject: [PATCH 54/60] remove _wasm feature with doc --- Cargo.toml | 2 -- src/command.rs | 2 +- src/event.rs | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6756b87..d218521 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,5 +50,3 @@ tauri = "1.5" default = [ "event" ] event = [ "tauri-interop-macro/event" ] leptos = [ "dep:leptos", "tauri-interop-macro/leptos" ] -# used to generate the missing documentation, otherwise it's only generated for "target_family = wasm" -_wasm = [] diff --git a/src/command.rs b/src/command.rs index 3e7aee7..25461e5 100644 --- a/src/command.rs +++ b/src/command.rs @@ -2,7 +2,7 @@ pub use type_aliases::*; /// wasm bindings for tauri's provided js functions (target: `wasm`) -#[cfg(any(target_family = "wasm", feature = "_wasm"))] +#[cfg(any(target_family = "wasm", doc))] pub mod bindings; #[cfg(not(target_family = "wasm"))] diff --git a/src/event.rs b/src/event.rs index 3049bd4..f72ed41 100644 --- a/src/event.rs +++ b/src/event.rs @@ -4,7 +4,7 @@ use tauri::{AppHandle, Error, Wry}; #[cfg(not(target_family = "wasm"))] pub use emit::*; -#[cfg(any(target_family = "wasm", feature = "_wasm"))] +#[cfg(any(target_family = "wasm", doc))] pub use listen::*; /// traits for event emitting in the host code (feat: `tauri`) @@ -12,7 +12,7 @@ pub use listen::*; mod emit; /// related generic struct and functions for autogenerated listen functions (target: `wasm` or feat: `wasm`) -#[cfg(any(target_family = "wasm", feature = "_wasm"))] +#[cfg(any(target_family = "wasm", doc))] mod listen; /// The trait which needs to be implemented for a [Field] From b76cbd6843986464795973909d6761065c164a4d Mon Sep 17 00:00:00 2001 From: photovoltex Date: Wed, 13 Mar 2024 23:40:29 +0100 Subject: [PATCH 55/60] initial initial_value implementation --- Cargo.toml | 15 ++++++----- src/event.rs | 25 ++++++++++++++++-- src/event/listen.rs | 26 ++++++++++++------ tauri-interop-macro/Cargo.toml | 3 ++- tauri-interop-macro/src/event.rs | 3 +++ tauri-interop-macro/src/event/emit.rs | 35 ++++++++++++++++++++++--- tauri-interop-macro/src/event/listen.rs | 17 ++++++++++++ tauri-interop-macro/src/lib.rs | 4 +++ test-project/api/Cargo.toml | 2 +- test-project/api/src/lib.rs | 3 ++- test-project/src/main.rs | 4 +-- 11 files changed, 112 insertions(+), 25 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d218521..9e5e8c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [workspace] -members = [ "tauri-interop-macro" ] +members = ["tauri-interop-macro"] package.edition = "2021" package.version = "2.0.0-dev" -package.keywords = [ "wasm", "tauri", "command", "event", "leptos" ] -package.authors = [ "photovoltex" ] +package.keywords = ["wasm", "tauri", "command", "event", "leptos"] +package.authors = ["photovoltex"] package.repository = "https://github.com/photovoltex/tauri-interop.git" package.license = "MIT OR Apache-2.0" @@ -39,7 +39,7 @@ leptos = { version = "0.5", optional = true } tauri = { version = "1.5", default-features = false, features = ["wry"] } [target.'cfg(target_family = "wasm")'.dependencies] -tauri-interop-macro = { path = "./tauri-interop-macro", features = [ "_wasm" ] } +tauri-interop-macro = { path = "./tauri-interop-macro", features = ["_wasm"] } # tauri-interop-macro = { version = "2", features = [ "wasm" ] } [target.'cfg(not(target_family = "wasm"))'.dev-dependencies] @@ -47,6 +47,7 @@ tauri = "1.5" [features] # todo: remove default feature before publish -default = [ "event" ] -event = [ "tauri-interop-macro/event" ] -leptos = [ "dep:leptos", "tauri-interop-macro/leptos" ] +default = ["event"] +event = ["tauri-interop-macro/event"] +initial_value = ["tauri-interop-macro/initial_value"] +leptos = ["dep:leptos", "tauri-interop-macro/leptos"] diff --git a/src/event.rs b/src/event.rs index f72ed41..af58d5b 100644 --- a/src/event.rs +++ b/src/event.rs @@ -1,4 +1,4 @@ -use serde::{de::DeserializeOwned, Serialize}; +use serde::{de::DeserializeOwned, Deserialize, Serialize}; #[cfg(not(target_family = "wasm"))] use tauri::{AppHandle, Error, Wry}; @@ -36,7 +36,7 @@ pub trait Parent = Listen; pub trait Field

where P: Parent, - >::Type: Clone + Serialize + DeserializeOwned, + >::Type: Default + Clone + Serialize + DeserializeOwned, { /// The type of the field type Type; @@ -44,6 +44,19 @@ where /// The event of the field const EVENT_NAME: &'static str; + /// Tries to retrieve the current value from the backend + /// + /// only in wasm available + #[allow(async_fn_in_trait)] + #[cfg(any(all(target_family = "wasm", feature = "initial_value"), doc))] + async fn get_value() -> Result; + + /// Gets the value from the given parent + /// + /// not in wasm available + #[cfg(not(target_family = "wasm"))] + fn get_value(parent: &P) -> Self::Type; + #[cfg(not(target_family = "wasm"))] /// Emits event of the related field with their value /// @@ -56,3 +69,11 @@ where /// not in wasm available fn update(s: &mut P, handle: &AppHandle, v: Self::Type) -> Result<(), Error>; } + +/// General errors that can happen during event exchange +#[derive(Debug, Serialize, Deserialize, thiserror::Error)] +pub enum EventError { + /// The given name (struct) is not as tauri::State registered + #[error("{0} is not as tauri state registered")] + StateIsNotRegistered(String), +} diff --git a/src/event/listen.rs b/src/event/listen.rs index 16e2c8e..66d1559 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -87,22 +87,32 @@ impl ListenHandle { /// Registers a given event and binds a returned signal to these event changes /// + /// Providing [None] will unwrap into the default value. When feature `initial_value` + /// is enabled [None] will try to get the value from tauri. + /// /// Internally it stores a created [ListenHandle] for `event` in a [leptos::RwSignal] to hold it in /// scope, while it is used in a leptos [component](https://docs.rs/leptos_macro/0.5.2/leptos_macro/attr.component.html) #[cfg(feature = "leptos")] - pub fn use_register(event: &'static str, initial_value: T) -> ReadSignal - where - T: DeserializeOwned, + pub fn use_register>(initial_value: Option) -> ReadSignal + where P: Sized + super::Parent { use leptos::SignalSet; - let (signal, set_signal) = leptos::create_signal(initial_value); + let acquire_initial_value = initial_value.is_none(); + let (signal, set_signal) = leptos::create_signal(initial_value.unwrap_or_default()); // creating this signal in a leptos component holds the value in scope, and drops it automatically let handle = leptos::create_rw_signal(None); leptos::spawn_local(async move { - let listen_handle = ListenHandle::register(event, move |value: T| { - log::trace!("update for {}", event); + if cfg!(feature = "initial_value") && acquire_initial_value { + match F::get_value().await { + Ok(value) => set_signal.set(value), + Err(why) => log::error!("{why}") + } + } + + let listen_handle = ListenHandle::register(F::EVENT_NAME, move |value: F::Type| { + log::trace!("update for {}", F::EVENT_NAME); set_signal.set(value) }) .await @@ -172,10 +182,10 @@ pub trait Listen { /// } /// ``` #[cfg(feature = "leptos")] - fn use_field>(initial: F::Type) -> ReadSignal + fn use_field>(initial: Option) -> ReadSignal where Self: Sized + super::Parent, { - ListenHandle::use_register(F::EVENT_NAME, initial) + ListenHandle::use_register::(initial) } } diff --git a/tauri-interop-macro/Cargo.toml b/tauri-interop-macro/Cargo.toml index e6a79c2..ca885c2 100644 --- a/tauri-interop-macro/Cargo.toml +++ b/tauri-interop-macro/Cargo.toml @@ -31,7 +31,8 @@ tauri-interop = { path = ".." } [features] # todo: remove default feature before publish default = [ "event" ] -leptos = [ "event" ] event = [] +leptos = [] +initial_value = [] # feature to get info that context is wasm _wasm = [] diff --git a/tauri-interop-macro/src/event.rs b/tauri-interop-macro/src/event.rs index 44cc505..f82e4ff 100644 --- a/tauri-interop-macro/src/event.rs +++ b/tauri-interop-macro/src/event.rs @@ -78,6 +78,7 @@ struct Field { name: Ident, attributes: FieldAttributes, event_name: String, + get_cmd: Ident, } struct FieldAttributes { @@ -117,10 +118,12 @@ fn prepare_field(derive_input: DeriveInput) -> Field { let name = derive_input.ident.clone(); let attributes = get_field_values(derive_input.attrs); let event_name = format!("{}::{}", &attributes.parent, &name); + let get_cmd = format_ident!("get_{}_{}", &attributes.parent, name); Field { event_name, name, attributes, + get_cmd } } diff --git a/tauri-interop-macro/src/event/emit.rs b/tauri-interop-macro/src/event/emit.rs index 3bbfdd3..9c5eaa7 100644 --- a/tauri-interop-macro/src/event/emit.rs +++ b/tauri-interop-macro/src/event/emit.rs @@ -31,13 +31,17 @@ pub fn derive(stream: TokenStream) -> TokenStream { }); let event_fields = fields.iter().map(|field| &field.field_name); + let commands_attr = cfg!(feature = "initial_value").then_some(quote!(#[::tauri_interop::commands])).unwrap_or_default(); + let collect_command = cfg!(feature = "initial_value").then_some(quote!(::tauri_interop::collect_commands!();)).unwrap_or_default(); let stream = quote! { + #commands_attr pub mod #mod_name { use super::#name; - use tauri_interop::event::{Field, Emit}; #( #emit_fields )* + + #collect_command } impl ::tauri_interop::event::Emit for #name { @@ -78,6 +82,7 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { name, attributes, event_name, + get_cmd } = super::prepare_field(derive_input); let FieldAttributes { @@ -90,18 +95,40 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { .as_ref() .expect("name attribute was expected"); + // todo: currently we only resolve the parent type, if the parent type is wrapped to allow inner mutability we can't acquire the state + let get_cmd = cfg!(feature = "initial_value").then_some(quote! { + #[allow(non_snake_case)] + #[tauri_interop::command] + pub fn #get_cmd(handle: ::tauri::AppHandle) -> Result<#parent_field_ty, ::tauri_interop::event::EventError> { + use ::tauri::Manager; + use ::tauri_interop::event::Field; + + let state = handle.try_state::<#parent>() + .ok_or(::tauri_interop::event::EventError::StateIsNotRegistered(stringify!(#parent).into()))?; + Ok(#name::get_value(&state)) + } + }).unwrap_or_default(); + + let get_value = cfg!(feature = "initial_value").then_some(quote!{ + fn get_value(parent: &#parent) -> Self::Type { + parent.#parent_field_name.clone() + } + }).unwrap_or_default(); + let stream = quote! { - impl Field<#parent> for #name { + impl ::tauri_interop::event::Field<#parent> for #name { type Type = #parent_field_ty; const EVENT_NAME: &'static str = #event_name; + #get_value + fn emit(parent: &#parent, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { use ::tauri::Manager; log::trace!("Emitted event [{}]", #event_name); - handle.emit_all(#event_name, parent.#parent_field_name.clone()) + handle.emit_all(#event_name, Self::get_value(parent)) } fn update(parent: &mut #parent, handle: &::tauri::AppHandle, v: Self::Type) -> Result<(), ::tauri::Error> { @@ -109,6 +136,8 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { Self::emit(parent, handle) } } + + #get_cmd }; TokenStream::from(stream.to_token_stream()) diff --git a/tauri-interop-macro/src/event/listen.rs b/tauri-interop-macro/src/event/listen.rs index 3c1abc6..fb38b9d 100644 --- a/tauri-interop-macro/src/event/listen.rs +++ b/tauri-interop-macro/src/event/listen.rs @@ -50,6 +50,7 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { name, attributes, event_name, + get_cmd } = super::prepare_field(derive_input); let FieldAttributes { @@ -58,10 +59,26 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { .. } = attributes; + let get_cmd_fn = cfg!(feature = "initial_value").then_some(quote! { + #[allow(non_snake_case)] + #[tauri_interop::command] + pub fn #get_cmd() -> Result<#parent_field_ty, ::tauri_interop::event::EventError> {} + }).unwrap_or_default(); + + let get_value = cfg!(feature = "initial_value").then_some(quote! { + async fn get_value() -> Result { + #get_cmd().await + } + }).unwrap_or_default(); + let stream = quote! { + #get_cmd_fn + impl Field<#parent> for #name { type Type = #parent_field_ty; const EVENT_NAME: &'static str = #event_name; + + #get_value } }; diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index a3929c9..dd268cc 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -309,6 +309,10 @@ pub fn collect_commands(_: TokenStream) -> TokenStream { #[proc_macro_error] #[proc_macro] pub fn combine_handlers(stream: TokenStream) -> TokenStream { + if cfg!(feature = "_wasm") { + return Default::default() + } + let command_mods = Punctuated::::parse_terminated .parse2(stream.into()) .unwrap() diff --git a/test-project/api/Cargo.toml b/test-project/api/Cargo.toml index 196cf24..d16b49c 100644 --- a/test-project/api/Cargo.toml +++ b/test-project/api/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -tauri-interop = { path = "../..", default-features = false, features = [ "event" ]} +tauri-interop = { path = "../..", default-features = false, features = ["event", "initial_value"] } # common log = "0.4" diff --git a/test-project/api/src/lib.rs b/test-project/api/src/lib.rs index d3f056c..e0ec511 100644 --- a/test-project/api/src/lib.rs +++ b/test-project/api/src/lib.rs @@ -10,4 +10,5 @@ pub mod model; #[cfg(target_family = "wasm")] pub use tauri_interop::*; -tauri_interop::combine_handlers!( cmd, model::other_cmd ); +// todo: see that we maybe resolve this automatically when the commands are autogenerated by the feature +tauri_interop::combine_handlers!( cmd, model::other_cmd, model::test_mod, model::NamingTestEnumField, model::naming_test_default ); diff --git a/test-project/src/main.rs b/test-project/src/main.rs index 5969166..fe1dcab 100644 --- a/test-project/src/main.rs +++ b/test-project/src/main.rs @@ -45,7 +45,7 @@ fn main() { fn App() -> impl IntoView { use leptos::SignalGet; - let bar = TestState::use_field::(true); + let bar = TestState::use_field::(Some(true)); let exit = move |_| api::model::other_cmd::stop_application(); @@ -71,7 +71,7 @@ fn Foo() -> impl IntoView { api::cmd::emit(); }).forget(); - let foo = TestState::use_field::("Test".into()); + let foo = TestState::use_field::(None); view! {

{foo}

} } From da05e903af6dff939003c87930b58bd058e78044 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 14 Mar 2024 21:28:50 +0100 Subject: [PATCH 56/60] move parent --- src/event.rs | 17 ----------------- src/event/emit.rs | 11 +++++++++++ src/event/listen.rs | 8 ++++++++ 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/event.rs b/src/event.rs index af58d5b..d0e86a5 100644 --- a/src/event.rs +++ b/src/event.rs @@ -15,23 +15,6 @@ mod emit; #[cfg(any(target_family = "wasm", doc))] mod listen; -/// The trait which needs to be implemented for a [Field] -/// -/// Conditionally changes between [Listen] and [Emit] -/// -/// When compiled to "target_family = wasm" then following is true. -/// ```ignore -/// trait Parent = listen::Listen; -/// ``` -#[cfg(not(target_family = "wasm"))] -pub trait Parent = Emit; - -/// The trait which needs to be implemented for a [Field] -/// -/// Conditionally changes between [Listen] and [Emit] -#[cfg(target_family = "wasm")] -pub trait Parent = Listen; - /// Trait defining a [Field] to a related struct implementing [Parent] with the related [Field::Type] pub trait Field

where diff --git a/src/event/emit.rs b/src/event/emit.rs index 95318d3..6c706b8 100644 --- a/src/event/emit.rs +++ b/src/event/emit.rs @@ -1,6 +1,17 @@ use tauri::{AppHandle, Error, Wry}; use super::Field; +#[cfg(doc)] +use super::Listen; + +/// The trait which needs to be implemented for a [Field] +/// +/// Conditionally changes between [Listen] and [Emit] +/// +/// - When compiled to "target_family = wasm", the trait alias is set to [Listen] +/// - Otherwise the trait alias is set to [Emit] +#[cfg(any(not(feature = "initial_value"), doc))] +pub trait Parent = Emit; /// Trait that defines the available event emitting methods pub trait Emit { diff --git a/src/event/listen.rs b/src/event/listen.rs index 66d1559..b49518f 100644 --- a/src/event/listen.rs +++ b/src/event/listen.rs @@ -6,8 +6,16 @@ use wasm_bindgen::{closure::Closure, JsCast, JsValue}; use crate::command::bindings::listen; +#[cfg(doc)] +use super::Emit; use super::Field; +/// The trait which needs to be implemented for a [Field] +/// +/// Conditionally changes between [Listen] and [Emit] +#[cfg(target_family = "wasm")] +pub trait Parent = Listen; + /// The result type that is returned by [ListenHandle::register] pub type ListenResult = Result; From cf75b6201ae33fd58a60de9861cbd3c8cb84877e Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 14 Mar 2024 21:31:18 +0100 Subject: [PATCH 57/60] add option to adjust state acquirement --- src/event.rs | 8 +----- src/event/emit.rs | 38 ++++++++++++++++++++++--- tauri-interop-macro/src/event/emit.rs | 34 +++++++++------------- tauri-interop-macro/src/event/listen.rs | 2 +- test-project/api/src/model.rs | 4 ++- test-project/api/src/model/host_impl.rs | 15 ++++++++++ 6 files changed, 68 insertions(+), 33 deletions(-) create mode 100644 test-project/api/src/model/host_impl.rs diff --git a/src/event.rs b/src/event.rs index d0e86a5..7a07c2f 100644 --- a/src/event.rs +++ b/src/event.rs @@ -19,7 +19,7 @@ mod listen; pub trait Field

where P: Parent, - >::Type: Default + Clone + Serialize + DeserializeOwned, + Self::Type: Default + Clone + Serialize + DeserializeOwned, { /// The type of the field type Type; @@ -34,12 +34,6 @@ where #[cfg(any(all(target_family = "wasm", feature = "initial_value"), doc))] async fn get_value() -> Result; - /// Gets the value from the given parent - /// - /// not in wasm available - #[cfg(not(target_family = "wasm"))] - fn get_value(parent: &P) -> Self::Type; - #[cfg(not(target_family = "wasm"))] /// Emits event of the related field with their value /// diff --git a/src/event/emit.rs b/src/event/emit.rs index 6c706b8..71c35a5 100644 --- a/src/event/emit.rs +++ b/src/event/emit.rs @@ -1,4 +1,4 @@ -use tauri::{AppHandle, Error, Wry}; +use tauri::{AppHandle, Error, Manager, Wry}; use super::Field; #[cfg(doc)] @@ -6,13 +6,43 @@ use super::Listen; /// The trait which needs to be implemented for a [Field] /// -/// Conditionally changes between [Listen] and [Emit] +/// Conditionally changes between [Listen] and [Emit] or [ManagedEmit] /// /// - When compiled to "target_family = wasm", the trait alias is set to [Listen] +/// - When feature "initial_value" is enabled, the trait alias is set to [ManagedEmit] /// - Otherwise the trait alias is set to [Emit] #[cfg(any(not(feature = "initial_value"), doc))] pub trait Parent = Emit; +/// The trait which needs to be implemented for a [Field] +#[cfg(all(feature = "initial_value", not(doc)))] +pub trait Parent = ManagedEmit; + +/// Extension of [Emit] to additionally require [Self] to be managed by tauri +#[cfg(feature = "initial_value")] +pub trait ManagedEmit: Emit +where + Self: 'static, +{ + /// Gets the value of a [Field] from [AppHandle] + /// + /// The default implementation acquires [Self] directly. Override the provided + /// method when [Self] is not directly managed. For example, this could be the + /// case when the [interior mutability](https://doc.rust-lang.org/reference/interior-mutability.html) + /// pattern is used to allow mutation of [Self] while being managed by tauri. + fn get_value>( + handle: &AppHandle, + get_field_value: impl Fn(&Self) -> F::Type, + ) -> Option + where + Self: Sized + Send + Sync, + { + let state = handle.try_state::()?; + let state = get_field_value(&state); + Some(state) + } +} + /// Trait that defines the available event emitting methods pub trait Emit { /// Emit all field events @@ -59,7 +89,7 @@ pub trait Emit { /// ``` fn emit>(&self, handle: &AppHandle) -> Result<(), Error> where - Self: Sized + Emit; + Self: Sized + Parent; /// Update a single field and emit it afterward /// @@ -87,5 +117,5 @@ pub trait Emit { field: F::Type, ) -> Result<(), Error> where - Self: Sized + Emit; + Self: Sized + Parent; } diff --git a/tauri-interop-macro/src/event/emit.rs b/tauri-interop-macro/src/event/emit.rs index 9c5eaa7..f4fffb5 100644 --- a/tauri-interop-macro/src/event/emit.rs +++ b/tauri-interop-macro/src/event/emit.rs @@ -31,8 +31,12 @@ pub fn derive(stream: TokenStream) -> TokenStream { }); let event_fields = fields.iter().map(|field| &field.field_name); - let commands_attr = cfg!(feature = "initial_value").then_some(quote!(#[::tauri_interop::commands])).unwrap_or_default(); - let collect_command = cfg!(feature = "initial_value").then_some(quote!(::tauri_interop::collect_commands!();)).unwrap_or_default(); + let commands_attr = cfg!(feature = "initial_value") + .then_some(quote!(#[::tauri_interop::commands])) + .unwrap_or_default(); + let collect_command = cfg!(feature = "initial_value") + .then_some(quote!(::tauri_interop::collect_commands!();)) + .unwrap_or_default(); let stream = quote! { #commands_attr @@ -40,7 +44,7 @@ pub fn derive(stream: TokenStream) -> TokenStream { use super::#name; #( #emit_fields )* - + #collect_command } @@ -82,7 +86,7 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { name, attributes, event_name, - get_cmd + get_cmd, } = super::prepare_field(derive_input); let FieldAttributes { @@ -95,25 +99,17 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { .as_ref() .expect("name attribute was expected"); - // todo: currently we only resolve the parent type, if the parent type is wrapped to allow inner mutability we can't acquire the state let get_cmd = cfg!(feature = "initial_value").then_some(quote! { #[allow(non_snake_case)] #[tauri_interop::command] pub fn #get_cmd(handle: ::tauri::AppHandle) -> Result<#parent_field_ty, ::tauri_interop::event::EventError> { use ::tauri::Manager; - use ::tauri_interop::event::Field; - - let state = handle.try_state::<#parent>() - .ok_or(::tauri_interop::event::EventError::StateIsNotRegistered(stringify!(#parent).into()))?; - Ok(#name::get_value(&state)) + use ::tauri_interop::event::{Field, ManagedEmit, EventError}; + + #parent::get_value::<#name>(&handle, |parent| parent.#parent_field_name.clone()) + .ok_or(EventError::StateIsNotRegistered(stringify!(#parent).into())) } }).unwrap_or_default(); - - let get_value = cfg!(feature = "initial_value").then_some(quote!{ - fn get_value(parent: &#parent) -> Self::Type { - parent.#parent_field_name.clone() - } - }).unwrap_or_default(); let stream = quote! { impl ::tauri_interop::event::Field<#parent> for #name { @@ -121,14 +117,12 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { const EVENT_NAME: &'static str = #event_name; - #get_value - fn emit(parent: &#parent, handle: &::tauri::AppHandle) -> Result<(), ::tauri::Error> { use ::tauri::Manager; log::trace!("Emitted event [{}]", #event_name); - handle.emit_all(#event_name, Self::get_value(parent)) + handle.emit_all(#event_name, parent.#parent_field_name.clone()) } fn update(parent: &mut #parent, handle: &::tauri::AppHandle, v: Self::Type) -> Result<(), ::tauri::Error> { @@ -136,7 +130,7 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { Self::emit(parent, handle) } } - + #get_cmd }; diff --git a/tauri-interop-macro/src/event/listen.rs b/tauri-interop-macro/src/event/listen.rs index fb38b9d..49a9f07 100644 --- a/tauri-interop-macro/src/event/listen.rs +++ b/tauri-interop-macro/src/event/listen.rs @@ -61,7 +61,7 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { let get_cmd_fn = cfg!(feature = "initial_value").then_some(quote! { #[allow(non_snake_case)] - #[tauri_interop::command] + #[tauri_interop::binding] pub fn #get_cmd() -> Result<#parent_field_ty, ::tauri_interop::event::EventError> {} }).unwrap_or_default(); diff --git a/test-project/api/src/model.rs b/test-project/api/src/model.rs index 3fa67e9..6e4f700 100644 --- a/test-project/api/src/model.rs +++ b/test-project/api/src/model.rs @@ -3,9 +3,11 @@ #![allow(path_statements)] // this mod at this position doesn't make much sense logic vise -// for testing the combine feature tho its a quite convienend spot :D +// for testing the combine feature tho it's a quite convenient spot :D #[tauri_interop::commands] pub mod other_cmd; +#[cfg(not(target_family = "wasm"))] +mod host_impl; use tauri_interop::Event; diff --git a/test-project/api/src/model/host_impl.rs b/test-project/api/src/model/host_impl.rs new file mode 100644 index 0000000..553c3fd --- /dev/null +++ b/test-project/api/src/model/host_impl.rs @@ -0,0 +1,15 @@ +use std::sync::RwLock; + +use tauri::{AppHandle, Manager}; +use tauri_interop::event::{Field, ManagedEmit}; + +impl ManagedEmit for super::TestState { + fn get_value>(handle: &AppHandle, get_field_value: impl Fn(&Self) -> F::Type) -> Option { + let state = handle.try_state::>()?; + let state = state.read().ok()?; + Some(get_field_value(&state)) + } +} + +impl ManagedEmit for super::NamingTestEnum {} +impl ManagedEmit for super::NamingTestDefault {} From 523848236c1efc8b7bf65d93682a748fd6db6c75 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 14 Mar 2024 22:45:04 +0100 Subject: [PATCH 58/60] formatting and doc adjustment --- src/command/type_aliases.rs | 2 +- test-project/api/src/lib.rs | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/command/type_aliases.rs b/src/command/type_aliases.rs index 5e016e0..65449b1 100644 --- a/src/command/type_aliases.rs +++ b/src/command/type_aliases.rs @@ -1,6 +1,6 @@ use tauri::{AppHandle, State, Window}; -#[allow(unused_imports)] +#[cfg(doc)] use tauri_interop_macro::command; /// Type alias to easier identify [State] via [command] macro diff --git a/test-project/api/src/lib.rs b/test-project/api/src/lib.rs index e0ec511..5a74af0 100644 --- a/test-project/api/src/lib.rs +++ b/test-project/api/src/lib.rs @@ -2,13 +2,18 @@ #![feature(iter_intersperse)] #![feature(proc_macro_hygiene)] +#[cfg(target_family = "wasm")] +pub use tauri_interop::*; + #[tauri_interop::commands] pub mod cmd; pub mod model; -#[cfg(target_family = "wasm")] -pub use tauri_interop::*; - -// todo: see that we maybe resolve this automatically when the commands are autogenerated by the feature -tauri_interop::combine_handlers!( cmd, model::other_cmd, model::test_mod, model::NamingTestEnumField, model::naming_test_default ); +tauri_interop::combine_handlers!( + cmd, + model::other_cmd, + model::test_mod, + model::NamingTestEnumField, + model::naming_test_default +); From a602b30518bc36019192c421a423ea54bdcac2f4 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Thu, 14 Mar 2024 23:13:35 +0100 Subject: [PATCH 59/60] test all-features in ci --- .github/workflows/rust.yml | 4 ++-- src/event/emit.rs | 11 ++++++++++- tauri-interop-macro/Cargo.toml | 2 +- tauri-interop-macro/src/event/listen.rs | 2 +- tauri-interop-macro/src/lib.rs | 2 ++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f496112..5bdbc4e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -29,10 +29,10 @@ jobs: - name: Run tests for crate run: | cd tauri-interop-macro - cargo test + cargo test --features event,leptos,initial_value - name: Run tests for crate - run: cargo test + run: cargo test --all-features - name: Build test-project (wasm) run: | diff --git a/src/event/emit.rs b/src/event/emit.rs index 71c35a5..668aeb3 100644 --- a/src/event/emit.rs +++ b/src/event/emit.rs @@ -1,4 +1,4 @@ -use tauri::{AppHandle, Error, Manager, Wry}; +use tauri::{AppHandle, Error, Wry}; use super::Field; #[cfg(doc)] @@ -37,6 +37,8 @@ where where Self: Sized + Send + Sync, { + use tauri::Manager; + let state = handle.try_state::()?; let state = get_field_value(&state); Some(state) @@ -57,6 +59,8 @@ pub trait Emit { /// foo: String, /// pub bar: bool, /// } + /// + /// impl tauri_interop::event::ManagedEmit for Test {} /// /// #[tauri_interop::command] /// fn emit_bar(handle: TauriAppHandle) { @@ -80,6 +84,8 @@ pub trait Emit { /// pub bar: bool, /// } /// + /// impl tauri_interop::event::ManagedEmit for Test {} + /// /// #[tauri_interop::command] /// fn emit_bar(handle: TauriAppHandle) { /// Test::default().emit::(&handle).expect("emitting failed"); @@ -104,6 +110,9 @@ pub trait Emit { /// pub bar: bool, /// } /// + /// // require because we compile + /// impl tauri_interop::event::ManagedEmit for Test {} + /// /// #[tauri_interop::command] /// fn emit_bar(handle: TauriAppHandle) { /// Test::default().update::(&handle, true).expect("emitting failed"); diff --git a/tauri-interop-macro/Cargo.toml b/tauri-interop-macro/Cargo.toml index ca885c2..c9b30f0 100644 --- a/tauri-interop-macro/Cargo.toml +++ b/tauri-interop-macro/Cargo.toml @@ -26,7 +26,7 @@ log = "^0.4" serde = "^1.0" # required because the intented usage is to use the main crate, # for testing we need the reexported macros from tauri-interop -tauri-interop = { path = ".." } +tauri-interop = { path = "..", features = ["initial_value"] } [features] # todo: remove default feature before publish diff --git a/tauri-interop-macro/src/event/listen.rs b/tauri-interop-macro/src/event/listen.rs index 49a9f07..fb38b9d 100644 --- a/tauri-interop-macro/src/event/listen.rs +++ b/tauri-interop-macro/src/event/listen.rs @@ -61,7 +61,7 @@ pub fn derive_field(stream: TokenStream) -> TokenStream { let get_cmd_fn = cfg!(feature = "initial_value").then_some(quote! { #[allow(non_snake_case)] - #[tauri_interop::binding] + #[tauri_interop::command] pub fn #get_cmd() -> Result<#parent_field_ty, ::tauri_interop::event::EventError> {} }).unwrap_or_default(); diff --git a/tauri-interop-macro/src/lib.rs b/tauri-interop-macro/src/lib.rs index dd268cc..ad3c3f5 100644 --- a/tauri-interop-macro/src/lib.rs +++ b/tauri-interop-macro/src/lib.rs @@ -47,6 +47,8 @@ mod event; /// foo: String, /// pub bar: bool /// } +/// +/// impl tauri_interop::event::ManagedEmit for EventModel {} /// /// // has to be defined in this example, otherwise the /// // macro expansion panics because of missing super From d49616fd190c8a435ce7bbe4734d12921b7940c5 Mon Sep 17 00:00:00 2001 From: photovoltex Date: Fri, 15 Mar 2024 17:00:55 +0100 Subject: [PATCH 60/60] v2.0.0 --- Cargo.lock | 4 ++-- Cargo.toml | 13 ++++++------- tauri-interop-macro/Cargo.toml | 3 +-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 37c53ee..fe6ce20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3479,7 +3479,7 @@ dependencies = [ [[package]] name = "tauri-interop" -version = "2.0.0-dev" +version = "2.0.0" dependencies = [ "js-sys", "leptos", @@ -3495,7 +3495,7 @@ dependencies = [ [[package]] name = "tauri-interop-macro" -version = "2.0.0-dev" +version = "2.0.0" dependencies = [ "convert_case 0.6.0", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index 9e5e8c2..088fd85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] members = ["tauri-interop-macro"] package.edition = "2021" -package.version = "2.0.0-dev" +package.version = "2.0.0" package.keywords = ["wasm", "tauri", "command", "event", "leptos"] package.authors = ["photovoltex"] package.repository = "https://github.com/photovoltex/tauri-interop.git" @@ -20,8 +20,8 @@ description = "Easily connect your rust frontend and backend without writing dup readme = "README.md" [dependencies] -tauri-interop-macro = { path = "./tauri-interop-macro" } -#tauri-interop-macro = "2.0.0" +#tauri-interop-macro = { path = "./tauri-interop-macro" } +tauri-interop-macro = "2.0.0" js-sys = "0.3" serde = { version = "1.0", features = ["derive"] } @@ -39,15 +39,14 @@ leptos = { version = "0.5", optional = true } tauri = { version = "1.5", default-features = false, features = ["wry"] } [target.'cfg(target_family = "wasm")'.dependencies] -tauri-interop-macro = { path = "./tauri-interop-macro", features = ["_wasm"] } -# tauri-interop-macro = { version = "2", features = [ "wasm" ] } +#tauri-interop-macro = { path = "./tauri-interop-macro", features = ["_wasm"] } +tauri-interop-macro = { version = "2.0.0", features = [ "_wasm" ] } [target.'cfg(not(target_family = "wasm"))'.dev-dependencies] tauri = "1.5" [features] -# todo: remove default feature before publish -default = ["event"] +default = [] event = ["tauri-interop-macro/event"] initial_value = ["tauri-interop-macro/initial_value"] leptos = ["dep:leptos", "tauri-interop-macro/leptos"] diff --git a/tauri-interop-macro/Cargo.toml b/tauri-interop-macro/Cargo.toml index c9b30f0..820d56b 100644 --- a/tauri-interop-macro/Cargo.toml +++ b/tauri-interop-macro/Cargo.toml @@ -29,8 +29,7 @@ serde = "^1.0" tauri-interop = { path = "..", features = ["initial_value"] } [features] -# todo: remove default feature before publish -default = [ "event" ] +default = [] event = [] leptos = [] initial_value = []