rusty-cotp 0.8.0

Implements the Kernel Function of Connection Oriented Transport Protocol/ISO 8073/IEC 8073/ITU-T X.224 standard.
Documentation
1
2
3
4
5
use crate::api::CotpError;

pub fn parse_u16(buffer: &[u8]) -> Result<u16, CotpError> {
    Ok(u16::from_be_bytes(buffer.try_into().map_err(|e: std::array::TryFromSliceError| CotpError::InternalError(format!("Failed to parse bytes to u16: {}", e.to_string())))?))
}