pub mod alias;
pub mod comdat;
pub mod datalayout;
pub mod function;
use std::num::TryFromIntError;
use std::string::FromUtf8Error;
use thiserror::Error;
pub use self::alias::*;
pub use self::comdat::*;
pub use self::datalayout::*;
pub use self::function::*;
use crate::block::StrtabError;
#[non_exhaustive]
#[derive(Debug, Error)]
pub enum RecordStringError {
#[error("impossible string index: {0} >= {1} (field count)")]
BadIndex(usize, usize),
#[error("impossible character value in string: {0}")]
BadCharacter(#[from] TryFromIntError),
#[error("invalid string encoding: {0}")]
BadEncoding(#[from] FromUtf8Error),
}
#[non_exhaustive]
#[derive(Debug, Error)]
pub enum RecordBlobError {
#[error("impossible blob index: {0} >= {1} (field count)")]
BadIndex(usize, usize),
#[error("impossible byte value in blob: {0}")]
BadByte(#[from] TryFromIntError),
}
#[non_exhaustive]
#[derive(Debug, Error)]
pub enum RecordMapError {
#[error("error while mapping COMDAT record: {0}")]
Comdat(#[from] ComdatError),
#[error("error while parsing datalayout: {0}")]
DataLayout(#[from] DataLayoutError),
#[error("error while mapping function record: {0}")]
Function(#[from] FunctionError),
#[error("error while extracting string: {0}")]
BadRecordString(#[from] RecordStringError),
}