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 7777use crate :: { io, io_extras} ;
7878use crate :: prelude:: * ;
7979use core:: { cmp, fmt} ;
80+ use core:: borrow:: Borrow ;
8081use core:: hash:: { Hash , Hasher } ;
8182use core:: marker:: PhantomData ;
8283
@@ -431,15 +432,21 @@ pub struct Features<T: sealed::Context> {
431432 mark : PhantomData < T > ,
432433}
433434
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+
434445impl < T : sealed:: Context > core:: ops:: BitOr for Features < T > {
435446 type Output = Self ;
436447
437448 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;
443450 self
444451 }
445452}
You can’t perform that action at this time.
0 commit comments