pub struct Config {
pub common: Config,
pub drivers: Config,
pub macros: Config,
pub migrate: Config,
}Available on crate feature
_unstable-docs only.Expand description
The parsed structure of a sqlx.toml file.
Fieldsยง
ยงcommon: ConfigConfiguration shared by multiple components.
See common::Config for details.
drivers: ConfigConfiguration for database drivers.
See drivers::Config for details.
macros: ConfigConfiguration for the query!() family of macros.
See macros::Config for details.
migrate: ConfigConfiguration for migrations when executed using sqlx::migrate!() or through sqlx-cli.
See migrate::Config for details.
Implementationsยง
Sourceยงimpl Config
Internal methods for loading a Config.
impl Config
Internal methods for loading a Config.
Sourcepub fn try_from_crate_or_default() -> Result<Config, ConfigError>
pub fn try_from_crate_or_default() -> Result<Config, ConfigError>
Read $CARGO_MANIFEST_DIR/sqlx.toml or return Config::default() if it does not exist.
ยงErrors
- If
CARGO_MANIFEST_DIRis not set. - If the file exists but could not be read or parsed.
- If the file exists but the
sqlx-tomlfeature is disabled.
Sourcepub fn try_from_path_or_default(path: PathBuf) -> Result<Config, ConfigError>
pub fn try_from_path_or_default(path: PathBuf) -> Result<Config, ConfigError>
Attempt to read Config from the path given, or return Config::default() if it does not exist.
ยงErrors
- If the file exists but could not be read or parsed.
- If the file exists but the
sqlx-tomlfeature is disabled.
Sourcepub fn try_from_path(path: PathBuf) -> Result<Config, ConfigError>
pub fn try_from_path(path: PathBuf) -> Result<Config, ConfigError>
Attempt to read Config from the path given.
ยงErrors
- If the file does not exist.
- If the file exists but could not be read or parsed.
- If the file exists but the
sqlx-tomlfeature is disabled.
Trait Implementationsยง
Auto Trait Implementationsยง
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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
Mutably borrows from an owned value. Read more
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> โ
Converts
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> โ
Converts
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