@@ -27,52 +27,6 @@ use typedb_driver::{
2727 TransactionType as TypeDBTransactionType ,
2828} ;
2929
30- #[ derive( Debug , Parameter ) ]
31- #[ param( name = "containment" , regex = r"(?:do not )?contain" ) ]
32- pub struct ContainmentParam ( bool ) ;
33-
34- impl ContainmentParam {
35- pub fn assert < T , U > ( & self , actuals : & [ T ] , item : U )
36- where
37- T : Comparable < U > + fmt:: Debug ,
38- U : PartialEq + fmt:: Debug ,
39- {
40- if self . 0 {
41- assert ! ( actuals. iter( ) . any( |actual| actual. equals( & item) ) , "{item:?} not found in {actuals:?}" )
42- } else {
43- assert ! ( actuals. iter( ) . all( |actual| !actual. equals( & item) ) , "{item:?} found in {actuals:?}" )
44- }
45- }
46- }
47-
48- impl FromStr for ContainmentParam {
49- type Err = Infallible ;
50-
51- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
52- Ok ( Self ( s == "contain" ) )
53- }
54- }
55-
56- pub trait Comparable < U : ?Sized > {
57- fn equals ( & self , item : & U ) -> bool ;
58- }
59-
60- impl < T : Borrow < U > , U : PartialEq + ?Sized > Comparable < & U > for T {
61- fn equals ( & self , item : & & U ) -> bool {
62- self . borrow ( ) == * item
63- }
64- }
65-
66- impl < ' a , T1 , T2 , U1 , U2 > Comparable < ( & ' a U1 , & ' a U2 ) > for ( T1 , T2 )
67- where
68- T1 : Comparable < & ' a U1 > ,
69- T2 : Comparable < & ' a U2 > ,
70- {
71- fn equals ( & self , ( first, second) : & ( & ' a U1 , & ' a U2 ) ) -> bool {
72- self . 0 . equals ( first) && self . 1 . equals ( second)
73- }
74- }
75-
7630#[ derive( Debug , Default , Parameter , Clone ) ]
7731#[ param( name = "value" , regex = ".*?" ) ]
7832pub ( crate ) struct Value {
0 commit comments