Skip to main content

config/prelude/
json.rs

1use crate::{json, Builder, FileSource};
2
3/// Defines `*.json` file extension methods for a [configuration builder](Builder).
4pub trait JsonExt: Sized {
5    /// Adds a `*.json` file as a configuration source.
6    ///
7    /// # Arguments
8    ///
9    /// * `file` - The `*.json` [file source](FileSource) information
10    fn add_json_file<T: Into<FileSource>>(self, file: T) -> Self;
11}
12
13impl JsonExt for Builder {
14    fn add_json_file<F: Into<FileSource>>(mut self, file: F) -> Self {
15        self.add(json::Provider::new(file.into()));
16        self
17    }
18}