1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Config input (config §3.3, §3.5): turn a TOML string or an on-disk file into
//! a `PartialConfig`, and materialize the embedded defaults. The embedded table
//! travels the SAME `toml::from_str` path as a user file — "lowest precedence"
//! is just "last operand," no bootstrap case. A missing file is the fold identity
//! `default()`; a present-but-broken one is the only `MalformedFile` (78).
use Path;
use crateCanonicalError;
use crateConfigError;
use cratePartialConfig;
/// The embedded provider table (arch §4.2), parsed through the SAME path as a
/// user file — "lowest precedence" is just "last operand," no bootstrap case.
const DEFAULTS_TOML: &str = include_str!;
/// Parse a config string into a `PartialConfig`, mapping any TOML/serde failure
/// (typo'd key, duplicate provider name, bad syntax) to `MalformedFile` — the
/// one place a present-but-broken file becomes an error, distinct from a missing
/// file's identity element (config §3.3, §7).
/// Read the config file at `path` into a `PartialConfig` (config §3.3): a present
/// file parses (malformed → 78), a missing/unreadable one is the fold identity
/// `default()`. The one sanctioned config-file read in the lib — `run` and `bz
/// login` both go through it, so the path-resolution and malformed handling have
/// one home. The path came from the injected env, so it is tempfile-testable.
/// The embedded defaults as a `PartialConfig`. The one sanctioned `expect`: it
/// is on our own compile-time-committed constant, validated by a unit test, not
/// on external input (config §3.5).