fn open_probe(options: &Opt) -> Result<Probe, CargoFlashError> {
    if options.dry_run {
        return Ok(Probe::from_specific_probe(Box::new(FakeProbe::new())));
    }

    // If we got a probe selector as an argument, open the probe matching the selector if possible.
    match &options.probe_selector {
        Some(selector) => Probe::open(selector.clone()).map_err(CargoFlashError::FailedToOpenProbe),
        None => {
            // Only automatically select a probe if there is only
            // a single probe detected.
            let list = Probe::list_all();
            if list.len() > 1 {
                return Err(CargoFlashError::MultipleProbesFound { number: list.len() });
            }

            if let Some(info) = list.first() {
                METADATA.lock().unwrap().probe = Some(format!("{:?}", info.probe_type));
                Probe::open(info).map_err(CargoFlashError::FailedToOpenProbe)
            } else {
                Err(CargoFlashError::NoProbesFound)
            }
        }
    }
}
/// Tries to open the debug probe from the given commandline arguments.
/// This ensures that there is only one probe connected or if multiple probes are found,
/// a single one is specified via the commandline parameters.
Tries to open the debug probe from the given commandline arguments.
This ensures that there is only one probe connected or if multiple probes are found,
a single one is specified via the commandline parameters.
Tries to open the debug probe from the given commandline arguments . This ensures that there is only one probe connected or if multiple probes are found a single one is specified via the commandline parameters .
fn open_probe(options: &Opt) -> Result<Probe, CargoFlashError> {
    if options.dry_run {
        return Ok(Probe::from_specific_probe(Box::new(FakeProbe::new())));
    }
    // If we got a probe selector as an argument, open the probe matching the selector if possible.
    match &options.probe_selector {
        Some(selector) => Probe::open(selector.clone()).map_err(CargoFlashError::FailedToOpenProbe),
        None => {
            // Only automatically select a probe if there is only
            // a single probe detected.
            let list = Probe::list_all();
            if list.len() > 1 {
                return Err(CargoFlashError::MultipleProbesFound { number: list.len() });
            }
            if let Some(info) = list.first() {
                METADATA.lock().unwrap().probe = Some(format!("{:?}", info.probe_type));
                Probe::open(info).map_err(CargoFlashError::FailedToOpenProbe)
            } else {
                Err(CargoFlashError::NoProbesFound)
            }
        }
    }
}
fn open_probe ( options : & Opt ) -> Result < Probe , CargoFlashError > { if options . dry_run { return Ok ( Probe :: from_specific_probe ( Box :: new ( FakeProbe :: new ( ) ) ) ) ; } // If we got a probe selector as an argument, open the probe matching the selector if possible. match & options . probe_selector { Some ( selector ) => Probe :: open ( selector . clone ( ) ) . map_err ( CargoFlashError :: FailedToOpenProbe ) , None => { // Only automatically select a probe if there is only // a single probe detected. let list = Probe :: list_all ( ) ; if list . len ( ) > 1 { return Err ( CargoFlashError :: MultipleProbesFound { number : list . len ( ) } ) ; } if let Some ( info ) = list . first ( ) { METADATA . lock ( ) . unwrap ( ) . probe = Some ( format ! ( " " info probe_type ) ) ; Probe :: open ( info ) . map_err ( CargoFlashError :: FailedToOpenProbe ) } else { Err ( CargoFlashError :: NoProbesFound ) } } } }
Tries to open the debug probe from the given commandline arguments.
Tries to open the debug probe from the given commandline arguments .
options
&Opt