pub fn from_bytes(mut buffer: &[u8]) -> Result<Vec<FitDataRecord>> {
    let mut processor = FitStreamProcessor::new();
    let mut records = Vec::new();

    while !buffer.is_empty() {
        let (buf, obj) = processor.deserialize_next(buffer)?;
        match obj {
            FitObject::Crc(..) => processor.reset(),
            FitObject::Header(..) => {}
            FitObject::DataMessage(msg) => records.push(processor.decode_message(msg)?),
            FitObject::DefinitionMessage(..) => {}
        }
        buffer = buf;
    }

    Ok(records)
}
/// Deserialize a FIT file stored as an array of bytes and return the decoded data messages.
Deserialize a FIT file stored as an array of bytes and return the decoded data messages.
Deserialize a FIT file stored as an array of bytes and return the decoded data messages .
pub fn from_bytes(mut buffer: &[u8]) -> Result<Vec<FitDataRecord>> {
    let mut processor = FitStreamProcessor::new();
    let mut records = Vec::new();
    while !buffer.is_empty() {
        let (buf, obj) = processor.deserialize_next(buffer)?;
        match obj {
            FitObject::Crc(..) => processor.reset(),
            FitObject::Header(..) => {}
            FitObject::DataMessage(msg) => records.push(processor.decode_message(msg)?),
            FitObject::DefinitionMessage(..) => {}
        }
        buffer = buf;
    }
    Ok(records)
}
pub fn from_bytes ( mut buffer : & [ u8 ] ) -> Result < Vec < FitDataRecord > > { let mut processor = FitStreamProcessor :: new ( ) ; let mut records = Vec :: new ( ) ; while ! buffer . is_empty ( ) { let ( buf , obj ) = processor . deserialize_next ( buffer ) ? ; match obj { FitObject :: Crc ( .. ) => processor . reset ( ) , FitObject :: Header ( .. ) => { } FitObject :: DataMessage ( msg ) => records . push ( processor . decode_message ( msg ) ? ) , FitObject :: DefinitionMessage ( .. ) => { } } buffer = buf ; } Ok ( records ) }
Deserialize a FIT file stored as an array of bytes and return the decoded data messages.
Deserialize a FIT file stored as an array of bytes and return the decoded data messages .
buffer
&[u8]
buffer
&[u8]