1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use std::{error, fmt};
#[derive(Debug, Clone)]
pub enum Error {
FullBuffer,
IndexOutOfBounds,
GPUError(String),
DecodingError,
Other(String),
}
impl error::Error for Error {}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
match self {
Error::FullBuffer => write!(
f,
"The size of the buffer cannot be greater than the hash arity."
),
Error::IndexOutOfBounds => write!(f, "The referenced index is outs of bounds."),
Error::GPUError(s) => write!(f, "GPU Error: {}", s),
Error::DecodingError => write!(f, "PrimeFieldDecodingError"),
Error::Other(s) => write!(f, "{}", s),
}
}
}