pub struct Config { /* private fields */ }Expand description
Akka Config root — a merged, layered value tree.
Implementations§
Source§impl Config
impl Config
pub fn empty() -> Self
pub fn from_toml_str(s: &str) -> Result<Self, ConfigError>
Sourcepub fn from_hocon_str(s: &str) -> Result<Self, ConfigError>
pub fn from_hocon_str(s: &str) -> Result<Self, ConfigError>
Parse a HOCON document (Pekko reference.conf
syntax). See crate::hocon for the supported subset.
Sourcepub fn from_hocon_file(path: impl AsRef<Path>) -> Result<Self, ConfigError>
pub fn from_hocon_file(path: impl AsRef<Path>) -> Result<Self, ConfigError>
Parse a HOCON file from disk; include directives resolve
relative to the file’s parent directory.
Sourcepub fn with_fallback(self, fallback: Self) -> Self
pub fn with_fallback(self, fallback: Self) -> Self
Merge other on top of self; keys from other win for scalars,
objects merge recursively — matches HOCON fallback/merge semantics.
Sourcepub fn merged_with(self, other: Self) -> Self
pub fn merged_with(self, other: Self) -> Self
Merge other on top of self, where other wins.
pub fn get(&self, path: &str) -> Option<&ConfigValue>
pub fn get_string(&self, path: &str) -> Result<String, ConfigError>
pub fn get_int(&self, path: &str) -> Result<i64, ConfigError>
pub fn get_bool(&self, path: &str) -> Result<bool, ConfigError>
Sourcepub fn get_duration(&self, path: &str) -> Result<Duration, ConfigError>
pub fn get_duration(&self, path: &str) -> Result<Duration, ConfigError>
Accepts “10ms”, “5s”, “2m”, “1h”, or integer milliseconds.
pub fn get_sub(&self, path: &str) -> Option<Config>
Sourcepub fn extract<T: DeserializeOwned>(&self, path: &str) -> Result<T, ConfigError>
pub fn extract<T: DeserializeOwned>(&self, path: &str) -> Result<T, ConfigError>
Deserialize a sub-tree at path into a strongly-typed value T.
Bridge through serde_json::Value so any serde::Deserialize
type composes. -equivalent of typed Config.As<T>()
extension.
Returns ConfigError::NotFound if path is absent.
Sourcepub fn extract_root<T: DeserializeOwned>(&self) -> Result<T, ConfigError>
pub fn extract_root<T: DeserializeOwned>(&self) -> Result<T, ConfigError>
Deserialize the entire root config into T.
Trait Implementations§
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more