File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 3838 args : BuildArguments < Self :: Attributes , Self :: BuiltPayload > ,
3939 ) -> Result < BuildOutcome < Self :: BuiltPayload > , PayloadBuilderError > {
4040 match self . inner . try_build ( args) {
41- Ok ( BuildOutcome :: Better { payload, cached_reads } ) => {
42- let _ = self . better_payloads_tx . send ( Arc :: new ( payload. clone ( ) ) ) ;
43- Ok ( BuildOutcome :: Better { payload, cached_reads } )
41+ Ok ( res) => {
42+ if let Some ( payload) = res. payload ( ) . cloned ( ) {
43+ let _ = self . better_payloads_tx . send ( Arc :: new ( payload) ) ;
44+ }
45+ Ok ( res)
4446 }
4547 res => res,
4648 }
Original file line number Diff line number Diff line change @@ -706,19 +706,32 @@ pub enum BuildOutcome<Payload> {
706706}
707707
708708impl < Payload > BuildOutcome < Payload > {
709- /// Consumes the type and returns the payload if the outcome is `Better`.
709+ /// Consumes the type and returns the payload if the outcome is `Better` or `Freeze` .
710710 pub fn into_payload ( self ) -> Option < Payload > {
711711 match self {
712712 Self :: Better { payload, .. } | Self :: Freeze ( payload) => Some ( payload) ,
713713 _ => None ,
714714 }
715715 }
716716
717+ /// Consumes the type and returns the payload if the outcome is `Better` or `Freeze`.
718+ pub const fn payload ( & self ) -> Option < & Payload > {
719+ match self {
720+ Self :: Better { payload, .. } | Self :: Freeze ( payload) => Some ( payload) ,
721+ _ => None ,
722+ }
723+ }
724+
717725 /// Returns true if the outcome is `Better`.
718726 pub const fn is_better ( & self ) -> bool {
719727 matches ! ( self , Self :: Better { .. } )
720728 }
721729
730+ /// Returns true if the outcome is `Freeze`.
731+ pub const fn is_frozen ( & self ) -> bool {
732+ matches ! ( self , Self :: Freeze { .. } )
733+ }
734+
722735 /// Returns true if the outcome is `Aborted`.
723736 pub const fn is_aborted ( & self ) -> bool {
724737 matches ! ( self , Self :: Aborted { .. } )
You can’t perform that action at this time.
0 commit comments