diff --git a/Cargo.lock b/Cargo.lock index 089938ed6d..c73ddb8f32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -366,15 +366,6 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - [[package]] name = "bindgen" version = "0.69.4" @@ -3364,9 +3355,9 @@ dependencies = [ name = "nu-plugin-protocol" version = "0.97.2" dependencies = [ - "bincode", "nu-protocol", "nu-utils", + "rmp-serde", "semver", "serde", "typetag", diff --git a/crates/nu-plugin-protocol/Cargo.toml b/crates/nu-plugin-protocol/Cargo.toml index 45d8fe3a97..1d8aab6a1a 100644 --- a/crates/nu-plugin-protocol/Cargo.toml +++ b/crates/nu-plugin-protocol/Cargo.toml @@ -17,7 +17,7 @@ workspace = true nu-protocol = { path = "../nu-protocol", version = "0.97.2", features = ["plugin"] } nu-utils = { path = "../nu-utils", version = "0.97.2" } -bincode = "1.3" +rmp-serde = { workspace = true } serde = { workspace = true, features = ["derive"] } semver = "1.0" typetag = "0.2" diff --git a/crates/nu-plugin-protocol/src/plugin_custom_value/mod.rs b/crates/nu-plugin-protocol/src/plugin_custom_value/mod.rs index ea2b1551c9..db7ea733d7 100644 --- a/crates/nu-plugin-protocol/src/plugin_custom_value/mod.rs +++ b/crates/nu-plugin-protocol/src/plugin_custom_value/mod.rs @@ -142,7 +142,7 @@ impl PluginCustomValue { ) -> Result { let name = custom_value.type_name(); let notify_on_drop = custom_value.notify_plugin_on_drop(); - bincode::serialize(custom_value) + rmp_serde::to_vec(custom_value) .map(|data| PluginCustomValue::new(name, data, notify_on_drop)) .map_err(|err| ShellError::CustomValueFailedToEncode { msg: err.to_string(), @@ -156,7 +156,7 @@ impl PluginCustomValue { &self, span: Span, ) -> Result, ShellError> { - bincode::deserialize::>(self.data()).map_err(|err| { + rmp_serde::from_slice::>(self.data()).map_err(|err| { ShellError::CustomValueFailedToDecode { msg: err.to_string(), span, diff --git a/crates/nu-plugin-protocol/src/test_util.rs b/crates/nu-plugin-protocol/src/test_util.rs index 579b1ee758..7d3bfb28ca 100644 --- a/crates/nu-plugin-protocol/src/test_util.rs +++ b/crates/nu-plugin-protocol/src/test_util.rs @@ -31,8 +31,8 @@ impl CustomValue for TestCustomValue { /// A [`TestCustomValue`] serialized as a [`PluginCustomValue`]. pub fn test_plugin_custom_value() -> PluginCustomValue { - let data = bincode::serialize(&expected_test_custom_value() as &dyn CustomValue) - .expect("bincode serialization of the expected_test_custom_value() failed"); + let data = rmp_serde::to_vec(&expected_test_custom_value() as &dyn CustomValue) + .expect("MessagePack serialization of the expected_test_custom_value() failed"); PluginCustomValue::new("TestCustomValue".into(), data, false) }