use core::fmt; /// All possible errors /// /// Downstream crates should implement `From` to compose more custom errors. #[derive(Debug)] pub enum Error { /// Insufficient capacity CapacityError(arrayvec::CapacityError), /// Couldn't be a string Fmt(fmt::Error), /// No row was returned by the database NoDatabaseRowResult, /// All SQL-related errors Sqlx(sqlx_core::error::Error), } impl From for () { #[inline] fn from(_: Error) -> Self {} } impl From> for Error { #[inline] fn from(_: arrayvec::CapacityError) -> Self { Self::CapacityError(arrayvec::CapacityError::new(())) } } impl From for Error { #[inline] fn from(from: fmt::Error) -> Self { Self::Fmt(from) } } impl From for Error { #[inline] fn from(from: sqlx_core::error::Error) -> Self { Self::Sqlx(from) } }