pub enum ConfigDocument {
Json(Value),
Yaml(Value),
Toml(Value),
Properties(PropertiesDocument),
Text(String),
Binary(Vec<u8>),
}Expand description
Parsed configuration content returned by the library.
Variants§
Json(Value)
Parsed JSON payload.
Yaml(Value)
Parsed YAML payload converted into a JSON-like value.
Toml(Value)
Parsed TOML payload converted into a JSON-like value.
Properties(PropertiesDocument)
Parsed Java properties payload.
Text(String)
UTF-8 text with no built-in structure.
Binary(Vec<u8>)
Raw binary content.
Implementations§
Source§impl ConfigDocument
impl ConfigDocument
Sourcepub fn format(&self) -> DocumentFormat
pub fn format(&self) -> DocumentFormat
Returns the document format.
Sourcepub fn to_value(&self) -> Result<Value>
pub fn to_value(&self) -> Result<Value>
Converts the document into a JSON-like nested value without scalar coercion.
Sourcepub fn to_value_with_coercion(&self, coercion: ScalarCoercion) -> Result<Value>
pub fn to_value_with_coercion(&self, coercion: ScalarCoercion) -> Result<Value>
Converts the document into a JSON-like nested value.
Sourcepub fn deserialize<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub fn deserialize<T>(&self) -> Result<T>where
T: DeserializeOwned,
Deserializes the document into a Rust type using smart scalar coercion.
Sourcepub fn deserialize_with_coercion<T>(
&self,
coercion: ScalarCoercion,
) -> Result<T>where
T: DeserializeOwned,
pub fn deserialize_with_coercion<T>(
&self,
coercion: ScalarCoercion,
) -> Result<T>where
T: DeserializeOwned,
Deserializes the document into a Rust type using the requested coercion mode.
Sourcepub fn deserialize_strict<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub fn deserialize_strict<T>(&self) -> Result<T>where
T: DeserializeOwned,
Deserializes the document without scalar coercion.
Trait Implementations§
Source§impl Clone for ConfigDocument
impl Clone for ConfigDocument
Source§fn clone(&self) -> ConfigDocument
fn clone(&self) -> ConfigDocument
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConfigDocument
impl Debug for ConfigDocument
Source§impl PartialEq for ConfigDocument
impl PartialEq for ConfigDocument
impl StructuralPartialEq for ConfigDocument
Auto Trait Implementations§
impl Freeze for ConfigDocument
impl RefUnwindSafe for ConfigDocument
impl Send for ConfigDocument
impl Sync for ConfigDocument
impl Unpin for ConfigDocument
impl UnsafeUnpin for ConfigDocument
impl UnwindSafe for ConfigDocument
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