Struct smart_config::Json
source · pub struct Json { /* private fields */ }
Expand description
JSON-based configuration source.
Implementations§
source§impl Json
impl Json
sourcepub fn new(filename: &str, object: Map<String, Value>) -> Self
pub fn new(filename: &str, object: Map<String, Value>) -> Self
Creates a source with the specified name and contents.
sourcepub fn merge(&mut self, at: &str, value: impl Serialize)
pub fn merge(&mut self, at: &str, value: impl Serialize)
Merges a value at the specified path into JSON.
If any ancestors in at
are not objects, they are replaced with objects.
§Panics
- Panics if serializing
value
to the JSON object model fails. - Panics if
at
is empty andvalue
doesn’t serialize to an object (which would lead to the root object being replaced with non-object data).
Trait Implementations§
source§impl ConfigSource for Json
impl ConfigSource for Json
§type Kind = Hierarchical
type Kind = Hierarchical
Kind of the source.
source§fn into_contents(self) -> WithOrigin<Map>
fn into_contents(self) -> WithOrigin<Map>
Converts this source into config contents.
Auto Trait Implementations§
impl Freeze for Json
impl RefUnwindSafe for Json
impl Send for Json
impl Sync for Json
impl Unpin for Json
impl UnwindSafe for Json
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)