pub struct Config {
    pub common: Config,
    pub drivers: Config,
    pub macros: Config,
    pub migrate: Config,
}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<Self, ConfigError>
 
pub fn try_from_crate_or_default() -> Result<Self, 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<Self, ConfigError>
 
pub fn try_from_path_or_default(path: PathBuf) -> Result<Self, 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<Self, ConfigError>
 
pub fn try_from_path(path: PathBuf) -> Result<Self, 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