diff --git a/.changes/prefer-into-to-asref-to-reduce-alloc.md b/.changes/prefer-into-to-asref-to-reduce-alloc.md new file mode 100644 index 000000000..03244c2a4 --- /dev/null +++ b/.changes/prefer-into-to-asref-to-reduce-alloc.md @@ -0,0 +1,5 @@ +--- +"wry": "minor" +--- + +Change the type of `WebViewBuilderExtWindows::with_additional_browser_args` argument from `AsRef` to `Into` to reduce extra allocation. diff --git a/src/webview/mod.rs b/src/webview/mod.rs index 01784eccf..c5613e19d 100644 --- a/src/webview/mod.rs +++ b/src/webview/mod.rs @@ -592,13 +592,13 @@ pub trait WebViewBuilderExtWindows { /// /// By default wry passes `--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection` /// so if you use this method, you also need to disable these components by yourself if you want. - fn with_additional_browser_args>(self, additional_args: S) -> Self; + fn with_additional_browser_args>(self, additional_args: S) -> Self; } #[cfg(windows)] impl WebViewBuilderExtWindows for WebViewBuilder<'_> { - fn with_additional_browser_args>(mut self, additional_args: S) -> Self { - self.platform_specific.additional_browser_args = Some(additional_args.as_ref().to_string()); + fn with_additional_browser_args>(mut self, additional_args: S) -> Self { + self.platform_specific.additional_browser_args = Some(additional_args.into()); self } }