added useful converter
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
//! CFDP Packet Data Unit (PDU) support.
|
||||
use crate::cfdp::pdu::ack::InvalidAckedDirectiveCodeError;
|
||||
use crate::cfdp::*;
|
||||
use crate::crc::CRC_CCITT_FALSE;
|
||||
use crate::util::{UnsignedByteField, UnsignedByteFieldU8, UnsignedEnum};
|
||||
@@ -85,6 +86,15 @@ pub enum PduError {
|
||||
TlvLv(#[from] TlvLvError),
|
||||
}
|
||||
|
||||
impl From<InvalidAckedDirectiveCodeError> for PduError {
|
||||
fn from(value: InvalidAckedDirectiveCodeError) -> Self {
|
||||
Self::InvalidDirectiveType {
|
||||
found: value.0 as u8,
|
||||
expected: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait WritablePduPacket {
|
||||
fn len_written(&self) -> usize;
|
||||
fn write_to_bytes(&self, buf: &mut [u8]) -> Result<usize, PduError>;
|
||||
|
||||
Reference in New Issue
Block a user