Skip to content

Commit

Permalink
App.create_window() to accept any Into<String> type (fix #2290) (#…
Browse files Browse the repository at this point in the history
…2291)

* Fix `App.create_window()` to accept any `Into<String>` type

* Update changefile to show both changed functions

* Reduce changefile level to patch

Co-authored-by: Wouter Buckens <wouter@epicteddy.com>
  • Loading branch information
chippers and woubuc committed Jul 26, 2021
1 parent 70a1941 commit 8216cba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-create-window-str.md
@@ -0,0 +1,5 @@
---
"tauri": patch
---

Change `App.create_window()` and `AppHandle.create_window()` to accept an `Into<String>` type instead of `String`.
7 changes: 6 additions & 1 deletion core/tauri/src/app.rs
Expand Up @@ -225,7 +225,12 @@ macro_rules! shared_app_impl {
($app: ty) => {
impl<R: Runtime> $app {
/// Creates a new webview window.
pub fn create_window<F>(&self, label: String, url: WindowUrl, setup: F) -> crate::Result<()>
pub fn create_window<F>(
&self,
label: impl Into<String>,
url: WindowUrl,
setup: F,
) -> crate::Result<()>
where
F: FnOnce(
<R::Dispatcher as Dispatch>::WindowBuilder,
Expand Down
2 changes: 1 addition & 1 deletion examples/api/src-tauri/src/main.rs
Expand Up @@ -82,7 +82,7 @@ fn main() {
}
"new" => app
.create_window(
"new".into(),
"new",
WindowUrl::App("index.html".into()),
|window_builder, webview_attributes| {
(window_builder.title("Tauri"), webview_attributes)
Expand Down

0 comments on commit 8216cba

Please sign in to comment.