@@ -17,6 +17,7 @@ use std::{fmt::Display, ops::Deref, vec::Vec as StdVec};
1717
1818/// An immutable, ABI-stable [`Vec`][std::vec::Vec].
1919#[ repr( C ) ]
20+ #[ derive( Debug ) ]
2021pub struct Vec < T > {
2122 ptr : * mut T ,
2223 len : usize ,
@@ -48,8 +49,18 @@ impl<T> From<StdVec<T>> for Vec<T> {
4849 }
4950}
5051
52+ impl < T > PartialEq for Vec < T >
53+ where
54+ T : PartialEq ,
55+ {
56+ fn eq ( & self , other : & Self ) -> bool {
57+ self . len == other. len && self . as_ref ( ) == other. as_ref ( )
58+ }
59+ }
60+
5161/// An immutable, ABI-stable borrowed [`&'static str`][str].
5262#[ repr( C ) ]
63+ #[ derive( Debug ) ]
5364pub struct Str {
5465 ptr : * const u8 ,
5566 len : usize ,
@@ -86,8 +97,15 @@ impl Display for Str {
8697 }
8798}
8899
100+ impl PartialEq for Str {
101+ fn eq ( & self , other : & Self ) -> bool {
102+ self . len == other. len && self . str ( ) == other. str ( )
103+ }
104+ }
105+
89106/// An ABI-stable String
90107#[ repr( C ) ]
108+ #[ derive( Debug , PartialEq ) ]
91109pub struct RString {
92110 inner : Vec < u8 > ,
93111}
@@ -134,6 +152,7 @@ impl Display for RString {
134152
135153/// An ABI-stable [`Option`][std::option::Option].
136154#[ repr( C , u8 ) ]
155+ #[ derive( Debug ) ]
137156pub enum Option < T > {
138157 /// [`Option::Some`][std::option::Option::Some] variant.
139158 Some ( T ) ,
@@ -149,3 +168,16 @@ impl<T> From<std::option::Option<T>> for Option<T> {
149168 }
150169 }
151170}
171+
172+ impl < T > PartialEq for Option < T >
173+ where
174+ T : PartialEq ,
175+ {
176+ fn eq ( & self , other : & Self ) -> bool {
177+ match ( self , other) {
178+ ( Self :: Some ( a) , Self :: Some ( b) ) => a == b,
179+ ( Self :: None , Self :: None ) => true ,
180+ _ => false ,
181+ }
182+ }
183+ }
0 commit comments