@@ -3,12 +3,12 @@ use std::marker::PhantomData;
33use std:: str:: FromStr ;
44use thiserror:: Error ;
55
6- #[ derive( Clone , Debug ) ]
6+ #[ derive( Debug ) ]
77pub struct Tagged < Rep , Tag > ( Rep , PhantomData < Tag > )
88where
99 Rep : Refine < Tag > ;
1010
11- pub trait Refine < Tag > : Clone + Sized {
11+ pub trait Refine < Tag > : Sized {
1212 type RefineErrorRep : Debug + Display ;
1313 fn refine ( self ) -> Result < Self , Self :: RefineErrorRep > {
1414 Ok ( self )
@@ -37,23 +37,32 @@ where
3737 }
3838}
3939
40+ impl < Rep , Tag > Clone for Tagged < Rep , Tag >
41+ where
42+ Rep : Clone + Refine < Tag > ,
43+ {
44+ fn clone ( & self ) -> Self {
45+ Tagged ( self . rep ( ) . clone ( ) , PhantomData )
46+ }
47+ }
48+
4049impl < Rep , Tag > PartialEq for Tagged < Rep , Tag >
4150where
42- Rep : Refine < Tag > + PartialEq ,
51+ Rep : PartialEq + Refine < Tag > ,
4352{
4453 fn eq ( & self , other : & Self ) -> bool {
4554 self . rep ( ) == other. rep ( )
4655 }
4756}
4857
4958impl < Rep , Tag > Eq for Tagged < Rep , Tag > where
50- Rep : Refine < Tag > + Eq
59+ Rep : Eq + Refine < Tag >
5160{
5261}
5362
5463impl < Rep , Tag > PartialOrd for Tagged < Rep , Tag >
5564where
56- Rep : Refine < Tag > + PartialOrd ,
65+ Rep : PartialOrd + Refine < Tag > ,
5766{
5867 fn partial_cmp (
5968 & self ,
6574
6675impl < Rep , Tag > Ord for Tagged < Rep , Tag >
6776where
68- Rep : Refine < Tag > + Ord ,
77+ Rep : Ord + Refine < Tag > ,
6978{
7079 fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
7180 self . rep ( ) . cmp ( other. rep ( ) )
@@ -145,7 +154,7 @@ mod diesel_impl {
145154
146155 impl < Rep , Tag , ST > AsExpression < ST > for Tagged < Rep , Tag >
147156 where
148- Rep : Refine < Tag > + AsExpression < ST > ,
157+ Rep : Clone + Refine < Tag > + AsExpression < ST > ,
149158 ST : SqlType + SingleValue ,
150159 {
151160 type Expression =
@@ -157,7 +166,7 @@ mod diesel_impl {
157166
158167 impl < Rep , Tag , ST > AsExpression < ST > for & Tagged < Rep , Tag >
159168 where
160- Rep : Refine < Tag > + AsExpression < ST > ,
169+ Rep : Clone + Refine < Tag > + AsExpression < ST > ,
161170 ST : SqlType + SingleValue ,
162171 {
163172 type Expression =
0 commit comments