Skip to content

Commit 8c1f2de

Browse files
committed
Pass window as borrow not ownership
1 parent 39dd0cf commit 8c1f2de

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src-tauri/src/http.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@ fn handle_code_request(request: Request, window: &Window) {
100100
request.respond(response).unwrap();
101101
}
102102

103-
pub fn apply_http(window: Window) {
103+
pub fn apply_http(window: &Window) {
104+
let win = window.clone();
105+
104106
tauri::async_runtime::spawn(async move {
105107
let server = Server::http("0.0.0.0:23846").unwrap();
106108

107109
for request in server.incoming_requests() {
108-
handle_code_request(request, &window);
110+
handle_code_request(request, &win);
109111
}
110112
});
111113
}

src-tauri/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn handle_setup(app: &mut App) -> Result<(), Box<dyn std::error::Error>> {
5858
)
5959
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");
6060

61-
apply_http(win);
61+
apply_http(&win);
6262

6363
Ok(())
6464
}

0 commit comments

Comments
 (0)