zodiac 0.2.0

Rust OS framework that offers safe interfaces for kernel development
Documentation
use thiserror::Error;

#[derive(Debug, Error)]
pub enum ZodiacError {
    #[error("Not found.")]
    NotFound,
    #[error("Invalid arguments.")]
    InvalidArguments,
    #[error("No memory left.")]
    NoMemory,
    #[error("Out of bounds.")]
    OutOfBounds,
    #[error("Arguments not enough.")]
    ArgumentsNotEnough,
    #[error("Permission denied.")]
    PermissionDenied,
    #[error("Failed to map.")]
    FailedToMap(#[from] MapError),
    #[error("Failed to unmap.")]
    FailedToUnmap(#[from] UnmapError),
    #[error("Failed to update.")]
    FailedToUpdate(#[from] UpdateError),
    #[error("Failed to query.")]
    FailedToFlush(#[from] QueryError),
    #[error("Physical memory error.")]
    PhysicalMemoryError(#[from] PhyscialMemoryError),
}

#[derive(Error, Debug)]
pub enum MapError {
    #[error("Page already mapped.")]
    PageAlreadyMapped,
    #[error("Parent entry is a huge page.")]
    ParentEntryHugePage,
    #[error("Unable to allocate frame.")]
    FrameAllocationFailed,
    #[error("Virtual address is not aligned.")]
    VirtualAddressNotAligned,
}

#[derive(Error, Debug)]
pub enum UnmapError {
    #[error("Attempt to unmap an unmapped page.")]
    NotMappedYet,
    #[error("This page is mapped to invalid frame address.")]
    InvalidFrameAddress,
}

#[derive(Error, Debug)]
pub enum QueryError {
    #[error("Attempt to query an unmapped page.")]
    NotMappedYet,
    #[error("This page is mapped to invalid frame address.")]
    InvalidFrameAddress,
}

#[derive(Error, Debug)]
pub enum UpdateError {
    #[error("Attempt to update an unmapped page.")]
    NotMappedYet,
}

#[derive(Error, Debug)]
pub enum PhyscialMemoryError {
    #[error("Unable to allocate {0} pages of memory.")]
    AllocateFailed(usize),
}