Skip to content

Commit fbd57a1

Browse files
feat(core): make invoke_system take AsRef<str> (#13175)
* feat(core): make `invoke_system` take `AsRef<str>` * Use minor bump
1 parent dd4f13c commit fbd57a1

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.changes/eval-take-into-string.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
tauri: patch:enhance
2+
tauri: minor:enhance
33
---
44

55
`Webview::eval` and `WebviewWindow::eval` now takes `impl Into<String>` instead of `&str` to allow passing the scripts more flexible and efficiently
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
tauri: minor:enhance
3+
---
4+
5+
`Builder::invoke_system` takes `AsRef<str>` now

crates/tauri/src/app.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,9 +1535,10 @@ impl<R: Runtime> Builder<R> {
15351535
///
15361536
/// Note that the implementation details is up to your implementation.
15371537
#[must_use]
1538-
pub fn invoke_system(mut self, initialization_script: String) -> Self {
1539-
self.invoke_initialization_script =
1540-
initialization_script.replace("__INVOKE_KEY__", &format!("\"{}\"", self.invoke_key));
1538+
pub fn invoke_system(mut self, initialization_script: impl AsRef<str>) -> Self {
1539+
self.invoke_initialization_script = initialization_script
1540+
.as_ref()
1541+
.replace("__INVOKE_KEY__", &format!("\"{}\"", self.invoke_key));
15411542
self
15421543
}
15431544

0 commit comments

Comments
 (0)