diff --git a/Cargo.lock b/Cargo.lock index 8203a33..c4ec109 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -209,11 +209,22 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bincode" -version = "1.3.3" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" dependencies = [ + "bincode_derive", "serde", + "unty", +] + +[[package]] +name = "bincode_derive" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf95709a440f45e986983918d0e8a1f30a9b1df04918fc828670606804ac3c09" +dependencies = [ + "virtue", ] [[package]] @@ -4251,6 +4262,12 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "unty" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" + [[package]] name = "url" version = "2.5.4" @@ -4337,6 +4354,12 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "virtue" +version = "0.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "051eb1abcf10076295e815102942cc58f9d5e3b4560e46e53c21e8ff6f3af7b1" + [[package]] name = "vte" version = "0.14.1" diff --git a/Cargo.toml b/Cargo.toml index b5fd830..87d9ea6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ exclude = ["lib/color-eyre"] ansi-parser = "0.9.1" ansi_term = "0.12.1" async-recursion = "1.0.5" -bincode = "1.3.3" +bincode = "2.0.0" bitflags = "2.5.0" byteorder = "1.4.3" clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "string", "unicode"] } diff --git a/crates/dtmm/src/main.rs b/crates/dtmm/src/main.rs index 6c0bb48..54e101a 100644 --- a/crates/dtmm/src/main.rs +++ b/crates/dtmm/src/main.rs @@ -52,10 +52,14 @@ fn notify_nxm_download( tracing::debug!("Connected to main process at '{}'", IPC_ADDRESS); - bincode::serialize_into(&mut stream, uri.as_ref()).wrap_err("Failed to send URI")?; + let bincode_config = bincode::config::standard(); + + bincode::encode_into_std_write(uri.as_ref(), &mut stream, bincode_config) + .wrap_err("Failed to send URI")?; // We don't really care what the message is, we just need an acknowledgement. - let _: String = bincode::deserialize_from(&mut stream).wrap_err("Failed to receive reply")?; + let _: String = bincode::decode_from_std_read(&mut stream, bincode_config) + .wrap_err("Failed to receive reply")?; tracing::info!( "Notified DTMM with uri '{}'. Check the main window.", @@ -160,22 +164,33 @@ fn main() -> Result<()> { match res { Ok(mut stream) => { - let res = bincode::deserialize_from(&mut stream) - .wrap_err("Failed to read message") - .and_then(|uri: String| { - tracing::trace!(uri, "Received NXM uri"); + let res = bincode::decode_from_std_read( + &mut stream, + bincode::config::standard(), + ) + .wrap_err("Failed to read message") + .and_then(|uri: String| { + tracing::trace!(uri, "Received NXM uri"); - event_sink - .submit_command(ACTION_HANDLE_NXM, uri, druid::Target::Auto) - .wrap_err("Failed to start NXM download") - }); + event_sink + .submit_command(ACTION_HANDLE_NXM, uri, druid::Target::Auto) + .wrap_err("Failed to start NXM download") + }); match res { Ok(()) => { - let _ = bincode::serialize_into(&mut stream, "Ok"); + let _ = bincode::encode_into_std_write( + "Ok", + &mut stream, + bincode::config::standard(), + ); } Err(err) => { tracing::error!("{:?}", err); - let _ = bincode::serialize_into(&mut stream, "Error"); + let _ = bincode::encode_into_std_write( + "Error", + &mut stream, + bincode::config::standard(), + ); } } }