File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -737,6 +737,11 @@ impl EncodingMask {
737737 self . 0 & ( 1 << ( val as i32 ) ) != 0
738738 }
739739
740+ /// Test if this mask has only the bit for the given [`Encoding`] set.
741+ pub fn is_only ( & self , val : Encoding ) -> bool {
742+ self . 0 == ( 1 << ( val as i32 ) )
743+ }
744+
740745 /// Test if all [`Encoding`]s in a given set are present in this mask.
741746 pub fn all_set < ' a > ( & self , mut encodings : impl Iterator < Item = & ' a Encoding > ) -> bool {
742747 encodings. all ( |& e| self . is_set ( e) )
@@ -2498,4 +2503,14 @@ mod tests {
24982503 "Parquet error: Attempt to create invalid mask: 0x2"
24992504 ) ;
25002505 }
2506+
2507+ #[ test]
2508+ fn test_encoding_mask_is_only ( ) {
2509+ let mask = EncodingMask :: new_from_encodings ( [ Encoding :: PLAIN ] . iter ( ) ) ;
2510+ assert ! ( mask. is_only( Encoding :: PLAIN ) ) ;
2511+
2512+ let mask =
2513+ EncodingMask :: new_from_encodings ( [ Encoding :: PLAIN , Encoding :: PLAIN_DICTIONARY ] . iter ( ) ) ;
2514+ assert ! ( !mask. is_only( Encoding :: PLAIN ) ) ;
2515+ }
25012516}
You can’t perform that action at this time.
0 commit comments