@@ -554,58 +554,104 @@ pub struct Retransmits {
554554
555555impl Retransmits {
556556 pub ( super ) fn is_empty ( & self , streams : & StreamsState ) -> bool {
557- !self . max_data
558- && !self . max_stream_id . into_iter ( ) . any ( |x| x)
559- && self . reset_stream . is_empty ( )
560- && self . stop_sending . is_empty ( )
561- && self
562- . max_stream_data
557+ let Self {
558+ max_data,
559+ max_stream_id,
560+ reset_stream,
561+ stop_sending,
562+ max_stream_data,
563+ crypto,
564+ new_cids,
565+ retire_cids,
566+ ack_frequency,
567+ handshake_done,
568+ observed_addr,
569+ max_path_id,
570+ paths_blocked,
571+ new_tokens,
572+ path_abandon,
573+ path_status,
574+ path_cids_blocked,
575+ add_address,
576+ remove_address,
577+ reach_out,
578+ } = & self ;
579+ !max_data
580+ && !max_stream_id. iter ( ) . any ( |x| * x)
581+ && reset_stream. is_empty ( )
582+ && stop_sending. is_empty ( )
583+ && max_stream_data
563584 . iter ( )
564585 . all ( |& id| !streams. can_send_flow_control ( id) )
565- && self . crypto . is_empty ( )
566- && self . new_cids . is_empty ( )
567- && self . retire_cids . is_empty ( )
568- && !self . ack_frequency
569- && !self . handshake_done
570- && !self . observed_addr
571- && self . new_tokens . is_empty ( )
572- && self . path_abandon . is_empty ( )
573- && self . path_status . is_empty ( )
574- && !self . max_path_id
575- && !self . paths_blocked
576- && self . add_address . is_empty ( )
577- && self . remove_address . is_empty ( )
578- && self . reach_out . is_none ( )
586+ && crypto. is_empty ( )
587+ && new_cids. is_empty ( )
588+ && retire_cids. is_empty ( )
589+ && !ack_frequency
590+ && !handshake_done
591+ && !observed_addr
592+ && !max_path_id
593+ && !paths_blocked
594+ && new_tokens. is_empty ( )
595+ && path_abandon. is_empty ( )
596+ && path_status. is_empty ( )
597+ && path_cids_blocked. is_empty ( )
598+ && add_address. is_empty ( )
599+ && remove_address. is_empty ( )
600+ && reach_out. is_none ( )
579601 }
580602}
581603
582604impl :: std:: ops:: BitOrAssign for Retransmits {
583- fn bitor_assign ( & mut self , mut rhs : Self ) {
605+ fn bitor_assign ( & mut self , rhs : Self ) {
606+ let Self {
607+ max_data,
608+ max_stream_id,
609+ reset_stream,
610+ stop_sending,
611+ max_stream_data,
612+ crypto,
613+ new_cids,
614+ retire_cids,
615+ ack_frequency,
616+ handshake_done,
617+ observed_addr,
618+ max_path_id,
619+ paths_blocked,
620+ new_tokens,
621+ mut path_abandon,
622+ mut path_status,
623+ mut path_cids_blocked,
624+ add_address,
625+ remove_address,
626+ reach_out,
627+ } = rhs;
628+
584629 // We reduce in-stream head-of-line blocking by queueing retransmits before other data for
585630 // STREAM and CRYPTO frames.
586- self . max_data |= rhs . max_data ;
631+ self . max_data |= max_data;
587632 for dir in Dir :: iter ( ) {
588- self . max_stream_id [ dir as usize ] |= rhs . max_stream_id [ dir as usize ] ;
633+ self . max_stream_id [ dir as usize ] |= max_stream_id[ dir as usize ] ;
589634 }
590- self . reset_stream . extend_from_slice ( & rhs . reset_stream ) ;
591- self . stop_sending . extend_from_slice ( & rhs . stop_sending ) ;
592- self . max_stream_data . extend ( & rhs . max_stream_data ) ;
593- for crypto in rhs . crypto . into_iter ( ) . rev ( ) {
635+ self . reset_stream . extend_from_slice ( & reset_stream) ;
636+ self . stop_sending . extend_from_slice ( & stop_sending) ;
637+ self . max_stream_data . extend ( & max_stream_data) ;
638+ for crypto in crypto. into_iter ( ) . rev ( ) {
594639 self . crypto . push_front ( crypto) ;
595640 }
596- self . new_cids . extend ( & rhs. new_cids ) ;
597- self . retire_cids . extend ( rhs. retire_cids ) ;
598- self . ack_frequency |= rhs. ack_frequency ;
599- self . handshake_done |= rhs. handshake_done ;
600- self . observed_addr |= rhs. observed_addr ;
601- self . new_tokens . extend_from_slice ( & rhs. new_tokens ) ;
602- self . path_abandon . append ( & mut rhs. path_abandon ) ;
603- self . max_path_id |= rhs. max_path_id ;
604- self . paths_blocked |= rhs. paths_blocked ;
605- self . add_address . extend ( rhs. add_address . iter ( ) . copied ( ) ) ;
606- self . remove_address
607- . extend ( rhs. remove_address . iter ( ) . copied ( ) ) ;
608- if let Some ( ( rhs_round, rhs_addrs) ) = rhs. reach_out {
641+ self . new_cids . extend ( & new_cids) ;
642+ self . retire_cids . extend ( retire_cids) ;
643+ self . ack_frequency |= ack_frequency;
644+ self . handshake_done |= handshake_done;
645+ self . observed_addr |= observed_addr;
646+ self . max_path_id |= max_path_id;
647+ self . paths_blocked |= paths_blocked;
648+ self . new_tokens . extend_from_slice ( & new_tokens) ;
649+ self . path_abandon . append ( & mut path_abandon) ;
650+ self . path_status . append ( & mut path_status) ;
651+ self . path_cids_blocked . append ( & mut path_cids_blocked) ;
652+ self . add_address . extend ( add_address. iter ( ) . copied ( ) ) ;
653+ self . remove_address . extend ( remove_address. iter ( ) . copied ( ) ) ;
654+ if let Some ( ( rhs_round, rhs_addrs) ) = reach_out {
609655 match self . reach_out . as_mut ( ) {
610656 // Use RHS if there is no recorded round.
611657 None => self . reach_out = Some ( ( rhs_round, rhs_addrs) ) ,
@@ -626,7 +672,8 @@ impl ::std::ops::BitOrAssign for Retransmits {
626672
627673impl :: std:: ops:: BitOrAssign < ThinRetransmits > for Retransmits {
628674 fn bitor_assign ( & mut self , rhs : ThinRetransmits ) {
629- if let Some ( retransmits) = rhs. retransmits {
675+ let ThinRetransmits { retransmits } = rhs;
676+ if let Some ( retransmits) = retransmits {
630677 self . bitor_assign ( * retransmits)
631678 }
632679 }
@@ -841,16 +888,28 @@ impl SendableFrames {
841888
842889 /// Whether no data is sendable
843890 pub ( super ) fn is_empty ( & self ) -> bool {
844- !self . acks && !self . other && !self . close && !self . path_exclusive
891+ let Self {
892+ acks,
893+ other,
894+ close,
895+ path_exclusive,
896+ } = * self ;
897+ !acks && !other && !close && !path_exclusive
845898 }
846899}
847900
848901impl :: std:: ops:: BitOrAssign for SendableFrames {
849902 fn bitor_assign ( & mut self , rhs : Self ) {
850- self . acks |= rhs. acks ;
851- self . other |= rhs. other ;
852- self . close |= rhs. close ;
853- self . path_exclusive |= rhs. path_exclusive ;
903+ let Self {
904+ acks,
905+ other,
906+ close,
907+ path_exclusive,
908+ } = rhs;
909+ self . acks |= acks;
910+ self . other |= other;
911+ self . close |= close;
912+ self . path_exclusive |= path_exclusive;
854913 }
855914}
856915
0 commit comments