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 77
77
use crate :: { io, io_extras} ;
78
78
use crate :: prelude:: * ;
79
79
use core:: { cmp, fmt} ;
80
+ use core:: borrow:: Borrow ;
80
81
use core:: hash:: { Hash , Hasher } ;
81
82
use core:: marker:: PhantomData ;
82
83
@@ -431,15 +432,21 @@ pub struct Features<T: sealed::Context> {
431
432
mark : PhantomData < T > ,
432
433
}
433
434
435
+ impl < T : sealed:: Context , Rhs : Borrow < Self > > core:: ops:: BitOrAssign < Rhs > for Features < T > {
436
+ fn bitor_assign ( & mut self , rhs : Rhs ) {
437
+ let total_feature_len = cmp:: max ( self . flags . len ( ) , rhs. borrow ( ) . flags . len ( ) ) ;
438
+ self . flags . resize ( total_feature_len, 0u8 ) ;
439
+ for ( byte, rhs_byte) in self . flags . iter_mut ( ) . zip ( rhs. borrow ( ) . flags . iter ( ) ) {
440
+ * byte |= * rhs_byte;
441
+ }
442
+ }
443
+ }
444
+
434
445
impl < T : sealed:: Context > core:: ops:: BitOr for Features < T > {
435
446
type Output = Self ;
436
447
437
448
fn bitor ( mut self , o : Self ) -> Self {
438
- let total_feature_len = cmp:: max ( self . flags . len ( ) , o. flags . len ( ) ) ;
439
- self . flags . resize ( total_feature_len, 0u8 ) ;
440
- for ( byte, o_byte) in self . flags . iter_mut ( ) . zip ( o. flags . iter ( ) ) {
441
- * byte |= * o_byte;
442
- }
449
+ self |= o;
443
450
self
444
451
}
445
452
}
You can’t perform that action at this time.
0 commit comments