feat(rust): change `Defer` type for `CowStr` and `CowBytes`
@@ -5,7 +5,7 @@ pub mod nodes;
pub mod error;
use core::fmt;
-use core::ops::{Deref, DerefMut};
+use core::ops::Deref;
use minicbor::decode::{self, Decoder};
use minicbor::encode::{self, Encoder, Write};
use minicbor::{Decode, Encode};
@@ -495,19 +495,13 @@ impl<'a> From<CowStr<'a>> for Cow<'a, str> {
}
impl<'a> Deref for CowStr<'a> {
- type Target = Cow<'a, str>;
+ type Target = str;
fn deref(&self) -> &Self::Target {
&self.0
}
}
-impl<'a> DerefMut for CowStr<'a> {
- fn deref_mut(&mut self) -> &mut Self::Target {
- &mut self.0
- }
-}
-
/// A newtype around `Cow<'_, [u8]>` that borrows from input.
///
/// Contrary to `Cow<_, [u8]>` the `Decode` impl for this type will always borrow
@@ -550,19 +544,13 @@ impl<'a> From<CowBytes<'a>> for Cow<'a, [u8]> {
}
impl<'a> Deref for CowBytes<'a> {
- type Target = Cow<'a, [u8]>;
+ type Target = [u8];
fn deref(&self) -> &Self::Target {
&self.0
}
}
-impl<'a> DerefMut for CowBytes<'a> {
- fn deref_mut(&mut self) -> &mut Self::Target {
- &mut self.0
- }
-}
-
#[allow(unused_variables)]
pub(crate) fn assert_request_match<'a>(schema: impl Into<Option<&'a str>>, cbor: &[u8]) {
#[cfg(feature = "tag")]
