use core::fmt;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum Error {
AdTooLong,
AlgorithmInvalid,
LanesTooFew,
LanesTooMany,
MemoryTooLittle,
MemoryTooMuch,
OutputTooShort,
OutputTooLong,
PwdTooLong,
SaltTooShort,
SaltTooLong,
SecretTooLong,
ThreadsTooFew,
ThreadsTooMany,
TimeTooSmall,
VersionInvalid,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
Error::AdTooLong => "associated data is too long",
Error::AlgorithmInvalid => "algorithm identifier invalid",
Error::LanesTooFew => "too few lanes",
Error::LanesTooMany => "too many lanes",
Error::MemoryTooLittle => "memory cost is too small",
Error::MemoryTooMuch => "memory cost is too large",
Error::OutputTooShort => "output is too short",
Error::OutputTooLong => "output is too long",
Error::PwdTooLong => "password is too long",
Error::SaltTooShort => "salt is too short",
Error::SaltTooLong => "salt is too long",
Error::SecretTooLong => "secret is too long",
Error::ThreadsTooFew => "not enough threads",
Error::ThreadsTooMany => "too many threads",
Error::TimeTooSmall => "time cost is too small",
Error::VersionInvalid => "invalid version",
})
}
}