Skip to content

Commit

Permalink
only enable new PartialEq impls when alloc is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Jan 11, 2024
1 parent 2287f8e commit a2f82f8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions capnp/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,16 @@ impl<'a> core::cmp::PartialEq<Reader<'a>> for &'a str {
}
}

impl<'a> core::cmp::PartialEq<String> for Reader<'a> {
#[cfg(feature = "alloc")]
impl<'a> core::cmp::PartialEq<alloc::string::String> for Reader<'a> {
#[inline]
fn eq(&self, other: &String) -> bool {
fn eq(&self, other: &alloc::string::String) -> bool {
self.as_bytes() == other.as_bytes()
}
}

impl<'a> core::cmp::PartialEq<Reader<'a>> for String {
#[cfg(feature = "alloc")]
impl<'a> core::cmp::PartialEq<Reader<'a>> for alloc::string::String {
#[inline]
fn eq(&self, other: &Reader<'a>) -> bool {
self.as_bytes() == other.as_bytes()
Expand Down

0 comments on commit a2f82f8

Please sign in to comment.