How to actually use Patch? With good examples?

So I can't even post this issue properly because I can't post more than two links!

So I'm using tauri. I asked how to save window positions, and I was directed to use GitHub - tauri-apps/tauri-plugin-window-state.
The plugin depends on an outdated version of tauri via git, which in turn depends on a broken wry. I'm not sure if the dependency name is wry or tauri-runtime-wry. Actually, these are just two different crates with the same source but two different versions! https://crates.io/search?q=wry.

Anyways, I started reading http s://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section, and these examples don't work in my context.

A snippet of my cargo.toml

tauri-plugin-window-state = { git = "http s://github.com/tauri-apps/tauri-plugin-window-state", tag = "tauri-
plugin-window-state-v0.1.0" }
# the following does nothing
# tauri-runtime-wry = "0.3.3" 

[patch.'https://github.com/tauri-apps/tauri/?branch=next#43348652']
tauri = "1.0.0-rc.4"
# tauri-runtime-wry = "0.3.3"

# I can't do this because patches must point to a different source???????????
# [patch.crates-io]
# tauri-runtime-wry = "0.3.3" 
PS C:\Users\maste\Documents\GitHub\r2-t2\src-tauri> cargo c
    Updating crates.io index
    Updating git repository `https://github.com/tauri-apps/tauri-plugin-window-state`
    Updating git repository `https://github.com/tauri-apps/tauri/`
    Checking tauri-runtime-wry v0.2.1 (https://github.com/tauri-apps/tauri/?branch=next#43348652)
error[E0277]: the trait bound `ICoreWebView2FocusChangedEventHandler: IntoParam<'_, webview2_com_sys::Microsoft::Web::WebView2::Win32::ICoreWebView2FocusChangedEventHandler>` is not satisfied
    --> C:\Users\maste\.cargo\git\checkouts\tauri-9dcc2f9152472c1a\4334865\core\tauri-runtime-wry\src\lib.rs:1715:15
     |
1714 |               controller.GotFocus(
     |                          -------- required by a bound introduced by this call
1715 | /               FocusChangedEventHandler::create(Box::new(move |_, _| {
1716 | |                 let _ = proxy.send_event(Message::Webview(
1717 | |                   id,
1718 | |                   WebviewMessage::WebviewEvent(WebviewEvent::Focused(true)),
1719 | |                 ));
1720 | |                 Ok(())
1721 | |               })),
     | |_________________^ the trait `IntoParam<'_, webview2_com_sys::Microsoft::Web::WebView2::Win32::ICoreWebView2FocusChangedEventHandler>` is not implemented for `ICoreWebView2FocusChangedEventHandler`
     |
     = help: the following implementations were found:
               <&ICoreWebView2FocusChangedEventHandler as IntoParam<'a, IUnknown>>
               <ICoreWebView2FocusChangedEventHandler as IntoParam<'a, IUnknown>>

error[E0277]: the trait bound `ICoreWebView2FocusChangedEventHandler: IntoParam<'_, webview2_com_sys::Microsoft::Web::WebView2::Win32::ICoreWebView2FocusChangedEventHandler>` is not satisfied
    --> C:\Users\maste\.cargo\git\checkouts\tauri-9dcc2f9152472c1a\4334865\core\tauri-runtime-wry\src\lib.rs:1729:15
     |
1728 |               controller.LostFocus(
     |                          --------- required by a bound introduced by this call
1729 | /               FocusChangedEventHandler::create(Box::new(move |_, _| {
1730 | |                 let _ = proxy.send_event(Message::Webview(
1731 | |                   id,
1732 | |                   WebviewMessage::WebviewEvent(WebviewEvent::Focused(false)),
1733 | |                 ));
1734 | |                 Ok(())
1735 | |               })),
     | |_________________^ the trait `IntoParam<'_, webview2_com_sys::Microsoft::Web::WebView2::Win32::ICoreWebView2FocusChangedEventHandler>` is not implemented for `ICoreWebView2FocusChangedEventHandler`
     |
     = help: the following implementations were found:
               <&ICoreWebView2FocusChangedEventHandler as IntoParam<'a, IUnknown>>
               <ICoreWebView2FocusChangedEventHandler as IntoParam<'a, IUnknown>>

For more information about this error, try `rustc --explain E0277`.
error: could not compile `tauri-runtime-wry` due to 2 previous errors

Deleting cargo.lock does nothing btw.

1 Like