pmv_encryption_rs 1.0.0

Implementation of PersonalMediaVault encrypted storage model. This library allows to encrypt and decrypt data, and also read ans write files in the same format PersonalMediaVault uses.
Documentation
// Error for reading

use std::{fmt::Display, io};

/// File read error
#[derive(Debug, Clone)]
pub enum MultiFilePackReadError {
    /// File index out of bounds
    IndexOutOfBounds,
    /// IO Error
    IoError(String),
}

impl Display for MultiFilePackReadError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            MultiFilePackReadError::IndexOutOfBounds => write!(f, "File index out of bounds"),
            MultiFilePackReadError::IoError(error) => write!(f, "{}", error),
        }
    }
}

impl From<io::Error> for MultiFilePackReadError {
    fn from(value: io::Error) -> Self {
        MultiFilePackReadError::IoError(value.to_string())
    }
}