11//! A module for working with referenced data.
22
3-
43use crate :: FixedTag ;
54
65/// A trait for borrowing data from an owned struct
@@ -27,7 +26,7 @@ pub trait OwnedToRef<'a> {
2726/// own the content.
2827pub trait RefToOwned < ' a > {
2928 /// The resulting type after obtaining ownership.
30- type Owned : OwnedToRef < ' a , Borrowed = Self >
29+ type Owned : OwnedToRef < ' a , Borrowed = Self >
3130 where
3231 Self : ' a ;
3332
@@ -39,8 +38,7 @@ impl<'a, T> OwnedToRef<'a> for Option<T>
3938where
4039 T : OwnedToRef < ' a > ,
4140{
42- type Borrowed
43- = Option < T :: Borrowed > ;
41+ type Borrowed = Option < T :: Borrowed > ;
4442
4543 fn owned_to_ref ( & ' a self ) -> Self :: Borrowed {
4644 self . as_ref ( ) . map ( |o| o. owned_to_ref ( ) )
@@ -102,25 +100,23 @@ where
102100 const TAG : crate :: Tag = B :: TAG ;
103101}
104102
105- impl < ' a , B > PartialEq for DerCow < ' a , B >
106- where
107- B : RefToOwned < ' a > + Sized + PartialEq ,
108- <B as RefToOwned < ' a > >:: Owned : PartialEq + OwnedToRef < ' a > ,
109- {
110- fn eq ( & self , other : & Self ) -> bool {
111- match ( self , other) {
112- ( Self :: Borrowed ( l0) , Self :: Borrowed ( r0) ) => l0 == r0,
113- ( Self :: Owned ( l0) , Self :: Owned ( r0) ) => l0 == r0,
114- ( Self :: Owned ( l0) , Self :: Borrowed ( r0) ) => {
115- let l1 = l0. owned_to_ref ( ) ;
116- & l1 == * r0
117- } ,
118- _ => false ,
119- }
120- }
121- }
122-
123-
103+ // impl<'a, B> PartialEq for DerCow<'a, B>
104+ // where
105+ // B: RefToOwned<'a> + Sized + PartialEq,
106+ // <B as RefToOwned<'a>>::Owned: PartialEq + OwnedToRef<'a>,
107+ // {
108+ // fn eq(&self, other: &Self) -> bool {
109+ // match (self, other) {
110+ // (Self::Borrowed(l0), Self::Borrowed(r0)) => l0 == r0,
111+ // (Self::Owned(l0), Self::Owned(r0)) => l0 == r0,
112+ // (Self::Owned(l0), Self::Borrowed(r0)) => {
113+ // let l1 = l0.owned_to_ref();
114+ // *r0 == &l1
115+ // }
116+ // _ => false,
117+ // }
118+ // }
119+ // }
124120
125121// impl<'a, B> Deref for DerCow<'a, B>
126122// where
0 commit comments