pub trait ConfigurationBinder {
// Required methods
fn reify<T: DeserializeOwned>(&self) -> T;
fn bind<T: DeserializeOwned>(&self, instance: &mut T);
fn bind_at<T: DeserializeOwned>(
&self,
key: impl AsRef<str>,
instance: &mut T,
);
fn get_value<T: FromStr>(
&self,
key: impl AsRef<str>,
) -> Result<Option<T>, T::Err>;
fn get_value_or_default<T: FromStr + Default>(
&self,
key: impl AsRef<str>,
) -> Result<T, T::Err>;
}
Available on crate feature
binder
only.Expand description
Provides binder extension methods for a Configuration
.
Required Methods§
Sourcefn reify<T: DeserializeOwned>(&self) -> T
fn reify<T: DeserializeOwned>(&self) -> T
Creates and returns a structure bound to the configuration.
Sourcefn bind<T: DeserializeOwned>(&self, instance: &mut T)
fn bind<T: DeserializeOwned>(&self, instance: &mut T)
Binds the configuration to the specified instance.
§Arguments
instance
- The instance to bind the configuration to
Sourcefn bind_at<T: DeserializeOwned>(&self, key: impl AsRef<str>, instance: &mut T)
fn bind_at<T: DeserializeOwned>(&self, key: impl AsRef<str>, instance: &mut T)
Binds the specified configuration section to the provided instance.
§Arguments
key
- The key of the configuration section to bindinstance
- The instance to bind the configuration to
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.