fn choose_task_result(
    &self,
    context: Context,
    results: Vec<Result<Value, Failure>>,
    variant_value: &Option<String>,
  ) -> Result<Value, Failure> {
    let mut matches = Vec::new();
    let mut max_noop = Noop::NoTask;
    for result in results {
      match result {
        Ok(value) => {
          if let Some(v) = self.select_literal(&context, value, variant_value) {
            matches.push(v);
          }
        }
        Err(err) => {
          match err {
            Failure::Noop(noop) => {
              // Record the highest priority Noop value.
              if noop > max_noop {
                max_noop = noop;
              }
              continue;
            }
            i @ Failure::Invalidated => return Err(i),
            f @ Failure::Throw(..) => return Err(f),
          }
        }
      }
    }

    if matches.len() > 1 {
      // TODO: Multiple successful tasks are not currently supported. We could allow for this
      // by adding support for "mergeable" products. see:
      //   https://github.com/pantsbuild/pants/issues/2526
      return Err(throw("Conflicting values produced for subject and type."));
    }

    match matches.pop() {
      Some(matched) =>
        // Exactly one value was available.
        Ok(matched),
      None =>
        // Propagate the highest priority Noop value.
        Err(Failure::Noop(max_noop)),
    }
  }
///
/// Given the results of configured Task nodes, select a single successful value, or fail.
///
Given the results of configured Task nodes, select a single successful value, or fail.
Given the results of configured Task nodes select a single successful value or fail .
fn choose_task_result(
    &self,
    context: Context,
    results: Vec<Result<Value, Failure>>,
    variant_value: &Option<String>,
  ) -> Result<Value, Failure> {
    let mut matches = Vec::new();
    let mut max_noop = Noop::NoTask;
    for result in results {
      match result {
        Ok(value) => {
          if let Some(v) = self.select_literal(&context, value, variant_value) {
            matches.push(v);
          }
        }
        Err(err) => {
          match err {
            Failure::Noop(noop) => {
              // Record the highest priority Noop value.
              if noop > max_noop {
                max_noop = noop;
              }
              continue;
            }
            i @ Failure::Invalidated => return Err(i),
            f @ Failure::Throw(..) => return Err(f),
          }
        }
      }
    }
    if matches.len() > 1 {
      // TODO: Multiple successful tasks are not currently supported. We could allow for this
      // by adding support for "mergeable" products. see:
      //   https://github.com/pantsbuild/pants/issues/2526
      return Err(throw("Conflicting values produced for subject and type."));
    }
    match matches.pop() {
      Some(matched) =>
        // Exactly one value was available.
        Ok(matched),
      None =>
        // Propagate the highest priority Noop value.
        Err(Failure::Noop(max_noop)),
    }
  }
fn choose_task_result ( & self , context : Context , results : Vec < Result < Value , Failure > > , variant_value : & Option < String > , ) -> Result < Value , Failure > { let mut matches = Vec :: new ( ) ; let mut max_noop = Noop :: NoTask ; for result in results { match result { Ok ( value ) => { if let Some ( v ) = self . select_literal ( & context , value , variant_value ) { matches . push ( v ) ; } } Err ( err ) => { match err { Failure :: Noop ( noop ) => { // Record the highest priority Noop value. if noop > max_noop { max_noop = noop ; } continue ; } i @ Failure :: Invalidated => return Err ( i ) , f @ Failure :: Throw ( .. ) => return Err ( f ) , } } } } if matches . len ( ) > 1 { // TODO: Multiple successful tasks are not currently supported. We could allow for this // by adding support for "mergeable" products. see: //   https://github.com/pantsbuild/pants/issues/2526 return Err ( throw ( " " ) ) ; } match matches . pop ( ) { Some ( matched ) => // Exactly one value was available. Ok ( matched ) , None => // Propagate the highest priority Noop value. Err ( Failure :: Noop ( max_noop ) ) , } }
Given the results of configured Task nodes, select a single successful value, or fail.
Given the results of configured Task nodes select a single successful value or fail .
&self
context
Context
results
Vec<Result<Value, Failure>>
variant_value
&Option<String>
&self
context
Context
results
Vec<Result<Value, Failure>>
variant_value
&Option<String>