pub(super) fn read_swo_stream(&self, timeout: Duration) -> Result<Vec<u8>, CmsisDapError> {
        match self {
            CmsisDapDevice::V1 { .. } => Err(CmsisDapError::SwoModeNotAvailable),
            CmsisDapDevice::V2 { handle, swo_ep, .. } => match swo_ep {
                Some((ep, len)) => {
                    let mut buf = vec![0u8; *len];
                    match handle.read_bulk(*ep, &mut buf, timeout) {
                        Ok(n) => {
                            buf.truncate(n);
                            Ok(buf)
                        }
                        Err(rusb::Error::Timeout) => {
                            buf.truncate(0);
                            Ok(buf)
                        }
                        Err(e) => Err(SendError::from(e).into()),
                    }
                }
                None => Err(CmsisDapError::SwoModeNotAvailable),
            },
        }
    }
/// Read from the SWO streaming endpoint.
///
/// Returns SWOModeNotAvailable if this device does not support SWO streaming.
///
/// On timeout, returns a zero-length buffer.
Read from the SWO streaming endpoint.
Returns SWOModeNotAvailable if this device does not support SWO streaming.

On timeout, returns a zero-length buffer.
Read from the SWO streaming endpoint . Returns SWOModeNotAvailable if this device does not support SWO streaming . On timeout returns a zero - length buffer .
pub(super) fn read_swo_stream(&self, timeout: Duration) -> Result<Vec<u8>, CmsisDapError> {
        match self {
            CmsisDapDevice::V1 { .. } => Err(CmsisDapError::SwoModeNotAvailable),
            CmsisDapDevice::V2 { handle, swo_ep, .. } => match swo_ep {
                Some((ep, len)) => {
                    let mut buf = vec![0u8; *len];
                    match handle.read_bulk(*ep, &mut buf, timeout) {
                        Ok(n) => {
                            buf.truncate(n);
                            Ok(buf)
                        }
                        Err(rusb::Error::Timeout) => {
                            buf.truncate(0);
                            Ok(buf)
                        }
                        Err(e) => Err(SendError::from(e).into()),
                    }
                }
                None => Err(CmsisDapError::SwoModeNotAvailable),
            },
        }
    }
pub ( super ) fn read_swo_stream ( & self , timeout : Duration ) -> Result < Vec < u8 > , CmsisDapError > { match self { CmsisDapDevice :: V1 { .. } => Err ( CmsisDapError :: SwoModeNotAvailable ) , CmsisDapDevice :: V2 { handle , swo_ep , .. } => match swo_ep { Some ( ( ep , len ) ) => { let mut buf = vec ! [ 0u8 len ] ; match handle . read_bulk ( * ep , & mut buf , timeout ) { Ok ( n ) => { buf . truncate ( n ) ; Ok ( buf ) } Err ( rusb :: Error :: Timeout ) => { buf . truncate ( 0 ) ; Ok ( buf ) } Err ( e ) => Err ( SendError :: from ( e ) . into ( ) ) , } } None => Err ( CmsisDapError :: SwoModeNotAvailable ) , } , } }
Read from the SWO streaming endpoint.
Read from the SWO streaming endpoint .
&self
timeout
Duration
&self
timeout
Duration