pub struct Config {
pub migration: MigrationConfig,
}Expand description
Configuration for Toasty CLI operations.
Holds all settings that control how the CLI behaves. Currently this is
limited to MigrationConfig. A Config can be built programmatically
with the builder methods or loaded from a Toasty.toml file via
Config::load.
§Examples
use toasty_cli::{Config, MigrationConfig, MigrationPrefixStyle};
let config = Config::new()
.migration(
MigrationConfig::new()
.path("db")
.prefix_style(MigrationPrefixStyle::Timestamp),
);
assert_eq!(
config.migration.get_migrations_dir(),
std::path::PathBuf::from("db/migrations"),
);Fields§
§migration: MigrationConfigMigration-related configuration
Implementations§
Source§impl Config
impl Config
Sourcepub fn load_or_default(project_root: &Path) -> Result<Self>
pub fn load_or_default(project_root: &Path) -> Result<Self>
Load configuration from <project_root>/Toasty.toml, creating it with
default contents if the file does not exist.
Sourcepub fn migration(self, migration: MigrationConfig) -> Self
pub fn migration(self, migration: MigrationConfig) -> Self
Set the migration configuration
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin 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