Update bincode
All checks were successful
lint/clippy Checking for common mistakes and opportunities for code improvement
build/msvc Build for the target platform: msvc
build/linux Build for the target platform: linux

This commit is contained in:
Lucas Schwiderski 2025-04-22 00:14:43 +02:00
parent afb5bc0795
commit cd4a953a63
Signed by: lucas
GPG key ID: AA12679AAA6DF4D8

View file

@ -52,10 +52,14 @@ fn notify_nxm_download(
tracing::debug!("Connected to main process at '{}'", IPC_ADDRESS); 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. // 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!( tracing::info!(
"Notified DTMM with uri '{}'. Check the main window.", "Notified DTMM with uri '{}'. Check the main window.",
@ -160,7 +164,10 @@ fn main() -> Result<()> {
match res { match res {
Ok(mut stream) => { Ok(mut stream) => {
let res = bincode::deserialize_from(&mut stream) let res = bincode::decode_from_std_read(
&mut stream,
bincode::config::standard(),
)
.wrap_err("Failed to read message") .wrap_err("Failed to read message")
.and_then(|uri: String| { .and_then(|uri: String| {
tracing::trace!(uri, "Received NXM uri"); tracing::trace!(uri, "Received NXM uri");
@ -171,11 +178,19 @@ fn main() -> Result<()> {
}); });
match res { match res {
Ok(()) => { Ok(()) => {
let _ = bincode::serialize_into(&mut stream, "Ok"); let _ = bincode::encode_into_std_write(
"Ok",
&mut stream,
bincode::config::standard(),
);
} }
Err(err) => { Err(err) => {
tracing::error!("{:?}", err); tracing::error!("{:?}", err);
let _ = bincode::serialize_into(&mut stream, "Error"); let _ = bincode::encode_into_std_write(
"Error",
&mut stream,
bincode::config::standard(),
);
} }
} }
} }