Repository: ParkMyCar/compact_str (rust)

Issue:
impl PartialEq<CompactStr> for &str
Example that works:
```rust
use compact_str::CompactStr;
fn main() {
    dbg!(CompactStr::from("hello") == "hello");
}
```

Example that don't work:
```rust
use compact_str::CompactStr;
fn main() {
    dbg!("hello" == CompactStr::from("hello"));  
}
```

Error:
```
error[E0277]: can't compare `&str` with `CompactStr`
 --> src/main.rs:4:18
  |
4 |     dbg!("hello" == CompactStr::from("hello"));
  |                  ^^ no implementation for `&str == CompactStr`
  |
  = help: the trait `PartialEq<CompactStr>` is not implemented for `&str`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `test01` due to previous error
```

I think it shouldn't make any differences whether you want to compare `&str` with `CompactStr`, `&str` with `&CompactStr`, `CompactStr` with `&str` or `&CompactStr` with `&str`.

Pull request description:
Add impl PartialEq<CompactStr> for &str
Fixes #14

Patch:
diff --git a/compact_str/src/lib.rs b/compact_str/src/lib.rs
index 52e7f527..ed5785f7 100644
--- a/compact_str/src/lib.rs
+++ b/compact_str/src/lib.rs
@@ -139,6 +139,12 @@ impl PartialEq<CompactStr> for String {
     }
 }
 
+impl PartialEq<CompactStr> for &str {
+    fn eq(&self, other: &CompactStr) -> bool {
+        *self == other.as_str()
+    }
+}
+
 impl Ord for CompactStr {
     fn cmp(&self, other: &Self) -> Ordering {
         self.as_str().cmp(other.as_str())


Test patch:
diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs
index ec03277b..23031e6d 100644
--- a/compact_str/src/tests.rs
+++ b/compact_str/src/tests.rs
@@ -60,6 +60,7 @@ fn test_short_ascii() {
     for s in strs {
         let compact = CompactStr::new(s);
         assert_eq!(compact, s);
+        assert_eq!(s, compact);
         assert_eq!(compact.is_heap_allocated(), false);
     }
 }
@@ -79,6 +80,7 @@ fn test_short_unicode() {
     for (s, is_heap) in strs {
         let compact = CompactStr::new(s);
         assert_eq!(compact, s);
+        assert_eq!(s, compact);
         assert_eq!(compact.is_heap_allocated(), is_heap);
     }
 }
@@ -95,6 +97,7 @@ fn test_medium_ascii() {
     for s in strs {
         let compact = CompactStr::new(s);
         assert_eq!(compact, s);
+        assert_eq!(s, compact);
 
         #[cfg(target_pointer_width = "64")]
         let is_heap = false;
@@ -116,6 +119,7 @@ fn test_medium_unicode() {
     for (s, is_heap) in strs {
         let compact = CompactStr::new(s);
         assert_eq!(compact, s);
+        assert_eq!(s, compact);
 
         #[cfg(target_pointer_width = "64")]
         let is_heap = is_heap;