diff --git a/tendril/src/tendril.rs b/tendril/src/tendril.rs index 26c507dc..4ae589e9 100644 --- a/tendril/src/tendril.rs +++ b/tendril/src/tendril.rs @@ -22,7 +22,7 @@ use encoding::{self, DecoderTrap, EncoderTrap, EncodingRef}; use crate::buf32::{self, Buf32}; use crate::fmt::imp::Fixup; -use crate::fmt::{self, Slice}; +use crate::fmt::{self, Slice, ASCII, UTF8}; use crate::util::{ copy_and_advance, copy_lifetime, copy_lifetime_mut, unsafe_slice, unsafe_slice_mut, }; @@ -468,6 +468,20 @@ where } } +impl PartialEq for Tendril { + #[inline] + fn eq(&self, other: &str) -> bool { + self.as_byte_slice() == other.as_bytes() + } +} + +impl PartialEq for Tendril { + #[inline] + fn eq(&self, other: &str) -> bool { + self.as_byte_slice() == other.as_bytes() + } +} + impl Eq for Tendril where F: fmt::Format, @@ -2333,19 +2347,22 @@ mod test { let bytes_expected = bytes.to_tendril(); // char - assert_eq!(string_expected, string.chars().collect()); + assert_eq!(string_expected, string.chars().collect::>()); let mut tendril = StrTendril::new(); tendril.extend(string.chars()); assert_eq!(string_expected, tendril); // &u8 - assert_eq!(bytes_expected, bytes.iter().collect()); + assert_eq!(bytes_expected, bytes.iter().collect::>()); let mut tendril = ByteTendril::new(); tendril.extend(bytes); assert_eq!(bytes_expected, tendril); // u8 - assert_eq!(bytes_expected, bytes.iter().copied().collect()); + assert_eq!( + bytes_expected, + bytes.iter().copied().collect::>() + ); let mut tendril = ByteTendril::new(); tendril.extend(bytes.iter().copied()); assert_eq!(bytes_expected, tendril);