mod bind;
pub mod erasure;
pub mod galois;
pub use bind::ec;
pub use bind::gf;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Too Many Erased Blocks: {0} erased, up to {1} allowed")]
TooManyErasures(usize, usize),
#[error("Invalid Arguments: {0}")]
InvalidArguments(String),
#[error("Internal Error: {0}")]
InternalError(String),
#[error("Error: {0}")]
Other(String),
}
#[allow(dead_code)]
impl Error {
fn too_many_erasures(erasures: usize, max_erasures: usize) -> Self {
Self::TooManyErasures(erasures, max_erasures)
}
fn invalid_arguments(msg: impl Into<String>) -> Self {
Self::InvalidArguments(msg.into())
}
fn internal_error(msg: impl Into<String>) -> Self {
Self::InternalError(msg.into())
}
fn other(msg: impl Into<String>) -> Self {
Self::Other(msg.into())
}
}