[feat] Webview::navigate
borrows &self
instead of &mut self
#12430
Labels
Webview::navigate
borrows &self
instead of &mut self
#12430
Describe the problem
tauri/crates/tauri/src/webview/mod.rs
Lines 1266 to 1269 in 72748cc
Currently,
Webview::navigate
borrows&mut self
, but its underlying implementation tauri_runtime::WebviewDispatch::navigate only requires an immutable borrow&self
.Is there any specific reason why
tauri::Webview
needs to do this? If not, can we change it to only require an immutable borrow&self
?Why don't I want
&mut self
?I am implementing Python bindings for
Webview::navigate
in pytauri: WSH032/pytauri#46.Python is multithreaded, and when implementing pyo3 bindings for a Rust struct, if at least one method requires
&mut self
, we have to add a thread lock, which degrades performance.As of now, except for
navigate
, other methods ofWebview
only require&self
, and I don't want to add a thread lock just for only one method.Describe the solution you'd like
just change WebviewWindow::navigate and Webview::navigate to
&self
.Alternatives considered
None
Additional context
pyo3/Bound and interior mutability
The text was updated successfully, but these errors were encountered: