From efce84522daf7de4e61f7b8f060e921d7357b9a5 Mon Sep 17 00:00:00 2001 From: chrysn Date: Wed, 28 Aug 2024 12:59:17 +0200 Subject: [PATCH] gcoap: Allow upgrading MinimalWritableMessage to MutableWritableMessage --- Cargo.toml | 2 +- src/coap_message/impl_0_3.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 3db923a..344864f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ coap-numbers = "^0.2.0" embedded-graphics = "0.6" -coap-message-0-3 = { package = "coap-message", version = "^0.3.0" } +coap-message-0-3 = { package = "coap-message", version = "^0.3.3" } coap-handler-0-2 = { package = "coap-handler", version = "^0.2.0" } embedded-nal = { version = "0.6.0", optional = true } embedded-nal-tcpextensions = { version = "0.1", optional = true } diff --git a/src/coap_message/impl_0_3.rs b/src/coap_message/impl_0_3.rs index 7ceeeac..39b8d49 100644 --- a/src/coap_message/impl_0_3.rs +++ b/src/coap_message/impl_0_3.rs @@ -86,6 +86,12 @@ impl<'a> MinimalWritableMessage for super::ResponseMessage<'a> { self.payload_mut_with_len(data.len())?.copy_from_slice(data); Ok(()) } + + #[inline] + #[allow(refining_impl_trait_reachable)] + fn promote_to_mutable_writable_message(&mut self) -> Option<&mut Self> { + Some(self) + } } impl<'a> MutableWritableMessage for super::ResponseMessage<'a> {