#[non_exhaustive]pub enum CastError {
InvalidInputSyntax(PgType),
ValueOutOfRange(PgType),
OutOfRange(PgType),
NumericFieldOverflow,
NumericFormatOverflow,
DateTimeFieldOutOfRange,
DateOutOfRange,
TimestampOutOfRange,
TimeZoneDisplacementOutOfRange,
CannotCast {
from: PgType,
to: PgType,
},
Unsupported,
}Expand description
Why PostgreSQL refuses a cast, one variant per message it raises, or why this crate declines to answer for it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidInputSyntax(PgType)
Text the target’s input function cannot read.
ValueOutOfRange(PgType)
Text the integer input function reads as a number beyond the type.
OutOfRange(PgType)
A constant the cast to an integer type finds beyond the type.
NumericFieldOverflow
A value beyond the precision of numeric(p, s) after rounding to its scale, or an
infinity cast to it.
NumericFormatOverflow
A numeric beyond the weight or display scale PostgreSQL stores.
DateTimeFieldOutOfRange
A year, month or day no calendar has.
DateOutOfRange
A date before 4714-11-24 BC.
TimestampOutOfRange
A timestamp before 4714-11-24 BC.
TimeZoneDisplacementOutOfRange
An offset of 16 hours or more, or with minutes or seconds of 60 or more.
CannotCast
A numeric constant of a type with no cast to the target.
Unsupported
A literal or cast this crate does not model. A date or timestamp is read only in the
spellings PgDate::parse and PgTimestamp::parse read, and a timestamptz only
with its offset, since without one the session’s TimeZone decides the instant.
Trait Implementations§
impl Copy for CastError
impl Eq for CastError
Source§impl Error for CastError
impl Error for CastError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()