use std::collections::TryReserveError;
use std::fmt;
pub use Error::*;
#[cfg_attr(feature = "_internal_c_ffi", repr(C))]
#[cfg_attr(not(feature = "_internal_c_ffi"), non_exhaustive)] #[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[allow(non_camel_case_types)]
pub enum Error {
#[cfg(feature = "_internal_c_ffi")]
LIQ_OK = 0,
QualityTooLow = 99,
ValueOutOfRange = 100,
OutOfMemory,
Aborted,
InternalError,
BufferTooSmall,
InvalidPointer,
Unsupported,
}
impl std::error::Error for Error {}
impl fmt::Display for Error {
#[cold]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match *self {
#[cfg(feature = "_internal_c_ffi")]
Self::LIQ_OK => "OK",
Self::QualityTooLow => "QUALITY_TOO_LOW",
Self::ValueOutOfRange => "VALUE_OUT_OF_RANGE",
Self::OutOfMemory => "OUT_OF_MEMORY",
Self::Aborted => "ABORTED",
Self::InternalError => "INTERNAL_ERROR",
Self::BufferTooSmall => "BUFFER_TOO_SMALL",
Self::InvalidPointer => "INVALID_POINTER",
Self::Unsupported => "UNSUPPORTED",
})
}
}
impl From<TryReserveError> for Error {
#[cold]
fn from(_: TryReserveError) -> Self {
Self::OutOfMemory
}
}