pub enum ConfigError {
    Env(VarError),
    NotFound {
        path: PathBuf,
    },
    Io {
        path: PathBuf,
        error: Error,
    },
    Parse {
        path: PathBuf,
        error: Box<dyn Error + Send + Sync + 'static>,
    },
    ParseDisabled {
        path: PathBuf,
    },
}Expand description
Error returned from various methods of Config.
Variants§
Env(VarError)
The loading method expected CARGO_MANIFEST_DIR to be set and it wasn’t.
This is necessary to locate the root of the crate currently being compiled.
See the “Environment Variables” page of the Cargo Book for details.
NotFound
No configuration file was found. Not necessarily fatal.
Io
An I/O error occurred while attempting to read the config file at path.
If the error is io::ErrorKind::NotFound, Self::NotFound is returned instead.
Parse
An error in the TOML was encountered while parsing the config file at path.
The error gives line numbers and context when printed with Display/ToString.
Only returned if the sqlx-toml feature is enabled.
ParseDisabled
A sqlx.toml file was found or specified, but the sqlx-toml feature is not enabled.
Implementations§
Source§impl ConfigError
 
impl ConfigError
Sourcepub fn from_io(path: impl Into<PathBuf>, error: Error) -> Self
 
pub fn from_io(path: impl Into<PathBuf>, error: Error) -> Self
Create a ConfigError from a std::io::Error.
Maps to either NotFound or Io.
Sourcepub fn not_found_path(&self) -> Option<&Path>
 
pub fn not_found_path(&self) -> Option<&Path>
If this error means the file was not found, return the path that was attempted.
Trait Implementations§
Source§impl Debug for ConfigError
 
impl Debug for ConfigError
Source§impl Display for ConfigError
 
impl Display for ConfigError
Source§impl Error for ConfigError
 
impl Error for ConfigError
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
Source§impl From<ConfigError> for Error
 
impl From<ConfigError> for Error
Source§fn from(source: ConfigError) -> Self
 
fn from(source: ConfigError) -> Self
Auto Trait Implementations§
impl Freeze for ConfigError
impl !RefUnwindSafe for ConfigError
impl Send for ConfigError
impl Sync for ConfigError
impl Unpin for ConfigError
impl !UnwindSafe for ConfigError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
 
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
 
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more