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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Loader service for loading configuration from sources.
//!
//! This module provides the [`Loader`] service which is responsible for
//! loading configuration from various sources and parsing it.
//!
//! # Example
//!
//! ```rust,no_run
//! use cfgmatic_source::application::Loader;
//! use cfgmatic_source::infrastructure::MemorySource;
//! use serde::Deserialize;
//!
//! #[derive(Debug, Deserialize, PartialEq)]
//! struct MyConfig {
//! name: String,
//! }
//!
//! let loader = Loader::builder().fail_fast(false).build();
//! let source = MemorySource::builder().set("name", "demo").build();
//! let config: MyConfig = loader.load_as(&source)?;
//! assert_eq!(config, MyConfig { name: "demo".into() });
//! # Ok::<(), cfgmatic_source::SourceError>(())
//! ```
use crateLoadOptions;
use crateFormat;
pub use LoaderBuilder;
/// Service for loading configuration from sources.
///
/// The Loader is responsible for:
/// - Loading raw content from sources
/// - Detecting and parsing formats
/// - Converting to typed configuration