Fix: drop pollster in lieu of std::sync::mpsc

This commit is contained in:
Jonathan Kelley committed 2025-07-14 17:53:30 -07:00
1 parent 9db593e303
commit 01a50cdcaa
3 files changed
+6 -10

No files matched your search

Generated
-1
View File
@@ -5319,7 +5319,6 @@ dependencies = [
"objc_id", "objc_id",
"openssl", "openssl",
"percent-encoding", "percent-encoding",
"pollster",
"rand 0.9.1", "rand 0.9.1",
"reqwest 0.12.22", "reqwest 0.12.22",
"rfd", "rfd",
-1
View File
@@ -48,7 +48,6 @@ tao = { workspace = true, features = ["rwh_05"] }
dioxus-history = { workspace = true } dioxus-history = { workspace = true }
base64 = { workspace = true } base64 = { workspace = true }
libc = "0.2.174" libc = "0.2.174"
pollster = "0.4.0"
rand = { workspace = true, features = ["std_rng"] } rand = { workspace = true, features = ["std_rng"] }
subtle = { version = "2.6", features = ["const-generics"] } subtle = { version = "2.6", features = ["const-generics"] }
webbrowser = { version = "1.0" } webbrowser = { version = "1.0" }
+6 -8
View File
@@ -19,10 +19,8 @@
//! and key. The webview will then reconnect to the new port and continue receiving edits. //! and key. The webview will then reconnect to the new port and continue receiving edits.
use dioxus_interpreter_js::MutationState; use dioxus_interpreter_js::MutationState;
use futures_channel::mpsc::UnboundedSender;
use futures_channel::oneshot; use futures_channel::oneshot;
use futures_util::{FutureExt, StreamExt}; use futures_util::FutureExt;
use pollster::FutureExt as _;
use rand::{RngCore, SeedableRng}; use rand::{RngCore, SeedableRng};
use std::cell::RefCell; use std::cell::RefCell;
use std::collections::{HashMap, VecDeque}; use std::collections::{HashMap, VecDeque};
@@ -299,14 +297,14 @@ impl EditWebsocket {
}; };
// Handle the websocket connection in a separate thread // Handle the websocket connection in a separate thread
let (edits_outgoing, mut edits_incoming_rx) = futures_channel::mpsc::unbounded::<MsgPair>(); let (edits_outgoing, edits_incoming_rx) = std::sync::mpsc::channel::<MsgPair>();
let connections_ = connections.clone(); let connections_ = connections.clone();
// Spawn a task to handle the websocket connection // Spawn a task to handle the websocket connection
std::thread::spawn(move || { std::thread::spawn(move || {
let mut queued_message = None; let mut queued_message = None;
// Wait until there are edits ready to send // Wait until there are edits ready to send
'connection: while let Some(msg) = edits_incoming_rx.next().block_on() { 'connection: while let Ok(msg) = edits_incoming_rx.recv() {
let data = msg.edits.clone(); let data = msg.edits.clone();
queued_message = Some(msg); queued_message = Some(msg);
// Send the edits to the webview // Send the edits to the webview
@@ -353,7 +351,7 @@ impl EditWebsocket {
// If there are pending edits, send them to the new connection // If there are pending edits, send them to the new connection
Some(WebviewConnectionState::Pending { mut pending }) => { Some(WebviewConnectionState::Pending { mut pending }) => {
while let Some(pair) = pending.pop_front() { while let Some(pair) = pending.pop_front() {
_ = edits_outgoing.unbounded_send(pair); _ = edits_outgoing.send(pair);
} }
} }
@@ -408,7 +406,7 @@ enum WebviewConnectionState {
pending: VecDeque<MsgPair>, pending: VecDeque<MsgPair>,
}, },
Connected { Connected {
edits_outgoing: UnboundedSender<MsgPair>, edits_outgoing: std::sync::mpsc::Sender<MsgPair>,
}, },
} }
@@ -441,7 +439,7 @@ impl WebviewConnectionState {
queue.push_back(pair); queue.push_back(pair);
} }
WebviewConnectionState::Connected { edits_outgoing } => { WebviewConnectionState::Connected { edits_outgoing } => {
_ = edits_outgoing.unbounded_send(pair); _ = edits_outgoing.send(pair);
} }
} }
} }