Projects using a pre‑0.5 release can upgrade with the following steps:
#[derive(OrthoConfig)]remains the correct way to annotate configuration structs. No additional derives are required.- Remove any
load_with_reference_fallbackhelpers. The merge logic insideload_and_merge_subcommand_forsupersedes this workaround. - Replace calls to deprecated helpers such as
load_subcommand_config_forwithortho_config::subcommand::load_and_merge_subcommand_foror importortho_config::SubcmdConfigMergeto callload_and_mergedirectly.
Import it with:
use ortho_config::SubcmdConfigMerge;
Subcommand structs can leverage the SubcmdConfigMerge trait to expose a
load_and_merge method automatically:
use ortho_config::{OrthoConfig, OrthoResult};
use ortho_config::SubcmdConfigMerge;
use serde::Deserialize;
#[derive(Deserialize, OrthoConfig)]
struct PrArgs {
reference: String,
}
# fn demo(pr_args: &PrArgs) -> OrthoResult<()> {
let merged = pr_args.load_and_merge()?;
# let _ = merged;
# Ok(())
# }
After parsing the relevant subcommand struct, call load_and_merge()? on that
value (for example, pr_args.load_and_merge()?) to obtain the merged
configuration for that subcommand.