@@ -11,7 +11,7 @@ use crate::{
1111 filter:: CompiledExpr ,
1212 lex:: { Lex , LexErrorKind , LexResult , LexWith , expect, skip_space, span} ,
1313 range_set:: RangeSet ,
14- rhs_types:: { Bytes , ExplicitIpRange , ListName , Regex , Wildcard } ,
14+ rhs_types:: { BytesExpr , ExplicitIpRange , ListName , Regex , Wildcard } ,
1515 scheme:: { Field , Identifier , List } ,
1616 searcher:: { EmptySearcher , TwoWaySearcher } ,
1717 strict_partial_ord:: StrictPartialOrd ,
@@ -148,7 +148,7 @@ pub enum ComparisonOpExpr {
148148
149149 /// "contains" comparison
150150 #[ serde( serialize_with = "serialize_contains" ) ]
151- Contains ( Bytes ) ,
151+ Contains ( BytesExpr ) ,
152152
153153 /// "matches / ~" comparison
154154 #[ serde( serialize_with = "serialize_matches" ) ]
@@ -168,7 +168,7 @@ pub enum ComparisonOpExpr {
168168
169169 /// "contains {...}" comparison
170170 #[ serde( serialize_with = "serialize_contains_one_of" ) ]
171- ContainsOneOf ( Vec < Bytes > ) ,
171+ ContainsOneOf ( Vec < BytesExpr > ) ,
172172
173173 /// "in $..." comparison
174174 #[ serde( serialize_with = "serialize_list" ) ]
@@ -201,7 +201,7 @@ fn serialize_is_true<S: Serializer>(ser: S) -> Result<S::Ok, S::Error> {
201201 out. end ( )
202202}
203203
204- fn serialize_contains < S : Serializer > ( rhs : & Bytes , ser : S ) -> Result < S :: Ok , S :: Error > {
204+ fn serialize_contains < S : Serializer > ( rhs : & BytesExpr , ser : S ) -> Result < S :: Ok , S :: Error > {
205205 serialize_op_rhs ( "Contains" , rhs, ser)
206206}
207207
@@ -224,7 +224,7 @@ fn serialize_one_of<S: Serializer>(rhs: &RhsValues, ser: S) -> Result<S::Ok, S::
224224 serialize_op_rhs ( "OneOf" , rhs, ser)
225225}
226226
227- fn serialize_contains_one_of < S : Serializer > ( rhs : & [ Bytes ] , ser : S ) -> Result < S :: Ok , S :: Error > {
227+ fn serialize_contains_one_of < S : Serializer > ( rhs : & [ BytesExpr ] , ser : S ) -> Result < S :: Ok , S :: Error > {
228228 serialize_op_rhs ( "ContainsOneOf" , rhs, ser)
229229}
230230
@@ -372,7 +372,7 @@ impl ComparisonExpr {
372372 }
373373 ( Type :: Bytes , ComparisonOp :: Bytes ( op) ) => match op {
374374 BytesOp :: Contains => {
375- let ( bytes, input) = Bytes :: lex ( input) ?;
375+ let ( bytes, input) = BytesExpr :: lex ( input) ?;
376376 ( ComparisonOpExpr :: Contains ( bytes) , input)
377377 }
378378 BytesOp :: Matches => {
@@ -472,7 +472,7 @@ impl Expr for ComparisonExpr {
472472 ( $op: tt, $def: ident) => {
473473 match rhs {
474474 RhsValue :: Bytes ( bytes) => {
475- struct BytesOp ( Bytes ) ;
475+ struct BytesOp ( BytesExpr ) ;
476476
477477 impl <U > Compare <U > for BytesOp {
478478 #[ inline]
@@ -1939,7 +1939,7 @@ mod tests {
19391939 identifier: IdentifierExpr :: Field ( field( "http.host" ) . to_owned( ) ) ,
19401940 indexes: vec![ ] ,
19411941 } ) ,
1942- FunctionCallArgExpr :: Literal ( RhsValue :: Bytes ( Bytes :: from(
1942+ FunctionCallArgExpr :: Literal ( RhsValue :: Bytes ( BytesExpr :: from(
19431943 ".org" . to_owned( )
19441944 ) ) ) ,
19451945 ] ,
@@ -2079,7 +2079,7 @@ mod tests {
20792079 identifier: IdentifierExpr :: Field ( field( "http.cookies" ) . to_owned( ) ) ,
20802080 indexes: vec![ FieldIndex :: MapEach ] ,
20812081 } ) ,
2082- FunctionCallArgExpr :: Literal ( RhsValue :: Bytes ( Bytes :: from(
2082+ FunctionCallArgExpr :: Literal ( RhsValue :: Bytes ( BytesExpr :: from(
20832083 "-cf" . to_owned( )
20842084 ) ) ) ,
20852085 ] ,
@@ -2148,7 +2148,7 @@ mod tests {
21482148 identifier: IdentifierExpr :: Field ( field( "http.headers" ) . to_owned( ) ) ,
21492149 indexes: vec![ FieldIndex :: MapEach ] ,
21502150 } ) ,
2151- FunctionCallArgExpr :: Literal ( RhsValue :: Bytes ( Bytes :: from(
2151+ FunctionCallArgExpr :: Literal ( RhsValue :: Bytes ( BytesExpr :: from(
21522152 "-cf" . to_owned( )
21532153 ) ) ) ,
21542154 ] ,
@@ -2314,7 +2314,7 @@ mod tests {
23142314 identifier: IdentifierExpr :: Field ( field( "http.cookies" ) . to_owned( ) ) ,
23152315 indexes: vec![ FieldIndex :: MapEach ] ,
23162316 } ) ,
2317- FunctionCallArgExpr :: Literal ( RhsValue :: Bytes ( Bytes :: from(
2317+ FunctionCallArgExpr :: Literal ( RhsValue :: Bytes ( BytesExpr :: from(
23182318 "-cf" . to_owned( )
23192319 ) ) ) ,
23202320 ] ,
@@ -2782,7 +2782,7 @@ mod tests {
27822782 } ,
27832783 op: ComparisonOpExpr :: Ordering {
27842784 op: OrderingOp :: Equal ,
2785- rhs: RhsValue :: Bytes ( Bytes :: new( "ab" . as_bytes( ) , BytesFormat :: Raw ( 3 ) ) ) ,
2785+ rhs: RhsValue :: Bytes ( BytesExpr :: new( "ab" . as_bytes( ) , BytesFormat :: Raw ( 3 ) ) ) ,
27862786 } ,
27872787 }
27882788 ) ;
@@ -2839,7 +2839,7 @@ mod tests {
28392839
28402840 // Wildcard operator
28412841 let wildcard = Wildcard :: new (
2842- Bytes :: new ( r"foo*\*\\" . as_bytes ( ) , BytesFormat :: Raw ( 2 ) ) ,
2842+ BytesExpr :: new ( r"foo*\*\\" . as_bytes ( ) , BytesFormat :: Raw ( 2 ) ) ,
28432843 usize:: MAX ,
28442844 )
28452845 . unwrap ( ) ;
@@ -2883,7 +2883,7 @@ mod tests {
28832883
28842884 // Strict wildcard operator
28852885 let wildcard = Wildcard :: new (
2886- Bytes :: new ( r"foo*\*\\" . as_bytes ( ) , BytesFormat :: Raw ( 2 ) ) ,
2886+ BytesExpr :: new ( r"foo*\*\\" . as_bytes ( ) , BytesFormat :: Raw ( 2 ) ) ,
28872887 usize:: MAX ,
28882888 )
28892889 . unwrap ( ) ;
@@ -2938,7 +2938,7 @@ mod tests {
29382938 identifier: IdentifierExpr :: Field ( field( "http.host" ) . to_owned( ) ) ,
29392939 indexes: vec![ ] ,
29402940 } ) ,
2941- FunctionCallArgExpr :: Literal ( RhsValue :: Bytes ( Bytes :: new(
2941+ FunctionCallArgExpr :: Literal ( RhsValue :: Bytes ( BytesExpr :: new(
29422942 "cd" . as_bytes( ) ,
29432943 BytesFormat :: Raw ( 1 )
29442944 ) ) )
@@ -2949,7 +2949,7 @@ mod tests {
29492949 } ,
29502950 op: ComparisonOpExpr :: Ordering {
29512951 op: OrderingOp :: Equal ,
2952- rhs: RhsValue :: Bytes ( Bytes :: new( "abcd" . as_bytes( ) , BytesFormat :: Raw ( 2 ) ) )
2952+ rhs: RhsValue :: Bytes ( BytesExpr :: new( "abcd" . as_bytes( ) , BytesFormat :: Raw ( 2 ) ) )
29532953 }
29542954 }
29552955 ) ;
0 commit comments