pub enum ConfigError {
Env(VarError),
NotFound {
path: PathBuf,
},
Io {
path: PathBuf,
error: Error,
},
Parse {
path: PathBuf,
error: Box<dyn Error + Send + Sync>,
},
ParseDisabled {
path: PathBuf,
},
}_unstable-docs only.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) -> ConfigError
pub fn from_io(path: impl Into<PathBuf>, error: Error) -> ConfigError
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) -> Error
fn from(source: ConfigError) -> Error
Sourceยงimpl From<VarError> for ConfigError
impl From<VarError> for ConfigError
Sourceยงfn from(source: VarError) -> ConfigError
fn from(source: VarError) -> ConfigError
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