Skip to content

Commit 8216cba

Browse files
chipperswoubuc
andauthored
App.create_window() to accept any Into<String> type (fix #2290) (#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>
1 parent 70a1941 commit 8216cba

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.changes/fix-create-window-str.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Change `App.create_window()` and `AppHandle.create_window()` to accept an `Into<String>` type instead of `String`.

core/tauri/src/app.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,12 @@ macro_rules! shared_app_impl {
225225
($app: ty) => {
226226
impl<R: Runtime> $app {
227227
/// Creates a new webview window.
228-
pub fn create_window<F>(&self, label: String, url: WindowUrl, setup: F) -> crate::Result<()>
228+
pub fn create_window<F>(
229+
&self,
230+
label: impl Into<String>,
231+
url: WindowUrl,
232+
setup: F,
233+
) -> crate::Result<()>
229234
where
230235
F: FnOnce(
231236
<R::Dispatcher as Dispatch>::WindowBuilder,

examples/api/src-tauri/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn main() {
8282
}
8383
"new" => app
8484
.create_window(
85-
"new".into(),
85+
"new",
8686
WindowUrl::App("index.html".into()),
8787
|window_builder, webview_attributes| {
8888
(window_builder.title("Tauri"), webview_attributes)

0 commit comments

Comments
 (0)