#[derive(Debug, PartialEq)]
pub enum RLNCError {
CodingVectorLengthMismatch,
DataLengthMismatch,
PieceCountZero,
DataLengthZero,
PieceLengthZero,
NotEnoughPiecesToRecode,
PieceLengthTooShort,
PieceNotUseful,
ReceivedAllPieces,
NotAllPiecesReceivedYet,
InvalidDecodedDataFormat,
InvalidPieceLength,
}
impl std::fmt::Display for RLNCError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
RLNCError::CodingVectorLengthMismatch => write!(f, "Coding vector length mismatch"),
RLNCError::DataLengthMismatch => write!(f, "Data length mismatch"),
RLNCError::PieceCountZero => write!(f, "Piece count is zero"),
RLNCError::DataLengthZero => write!(f, "Data length is zero"),
RLNCError::PieceLengthZero => write!(f, "Piece length is zero"),
RLNCError::NotEnoughPiecesToRecode => write!(f, "Not enough pieces received to recode"),
RLNCError::PieceLengthTooShort => write!(f, "Piece length is too short"),
RLNCError::PieceNotUseful => write!(f, "Received piece is not useful"),
RLNCError::ReceivedAllPieces => write!(f, "Received all pieces"),
RLNCError::NotAllPiecesReceivedYet => write!(f, "Not all pieces are received yet"),
RLNCError::InvalidDecodedDataFormat => write!(f, "Invalid decoded data format"),
RLNCError::InvalidPieceLength => write!(f, "Invalid piece length"),
}
}
}