File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 71
71
use crate :: { io, io_extras} ;
72
72
use crate :: prelude:: * ;
73
73
use core:: { cmp, fmt} ;
74
+ use core:: borrow:: Borrow ;
74
75
use core:: hash:: { Hash , Hasher } ;
75
76
use core:: marker:: PhantomData ;
76
77
@@ -425,15 +426,21 @@ pub struct Features<T: sealed::Context> {
425
426
mark : PhantomData < T > ,
426
427
}
427
428
429
+ impl < T : sealed:: Context , Rhs : Borrow < Self > > core:: ops:: BitOrAssign < Rhs > for Features < T > {
430
+ fn bitor_assign ( & mut self , rhs : Rhs ) {
431
+ let total_feature_len = cmp:: max ( self . flags . len ( ) , rhs. borrow ( ) . flags . len ( ) ) ;
432
+ self . flags . resize ( total_feature_len, 0u8 ) ;
433
+ for ( byte, rhs_byte) in self . flags . iter_mut ( ) . zip ( rhs. borrow ( ) . flags . iter ( ) ) {
434
+ * byte |= * rhs_byte;
435
+ }
436
+ }
437
+ }
438
+
428
439
impl < T : sealed:: Context > core:: ops:: BitOr for Features < T > {
429
440
type Output = Self ;
430
441
431
442
fn bitor ( mut self , o : Self ) -> Self {
432
- let total_feature_len = cmp:: max ( self . flags . len ( ) , o. flags . len ( ) ) ;
433
- self . flags . resize ( total_feature_len, 0u8 ) ;
434
- for ( byte, o_byte) in self . flags . iter_mut ( ) . zip ( o. flags . iter ( ) ) {
435
- * byte |= * o_byte;
436
- }
443
+ self |= o;
437
444
self
438
445
}
439
446
}
You can’t perform that action at this time.
0 commit comments