config/prelude/typed.rs
1use crate::{typed, Builder};
2use serde::Serialize;
3
4/// Defines typed configuration extension methods for a [configuration builder](Builder).
5pub trait TypedExt: Sized {
6 /// Adds a typed configuration source using a serializable type.
7 ///
8 /// # Arguments
9 ///
10 /// * `value` - The `Serialize`-able value to use as a configuration source
11 fn add_typed<T: Serialize + Send + Sync + 'static>(self, value: T) -> Self;
12}
13
14impl TypedExt for Builder {
15 fn add_typed<T: Serialize + Send + Sync + 'static>(mut self, value: T) -> Self {
16 self.add(typed::Provider::new(value));
17 self
18 }
19}