pub struct ConfigParser;Expand description
Parser and validator for datafake configuration.
ConfigParser provides static methods for parsing JSON strings or values
into validated DataFakeConfig structures.
Implementations§
Source§impl ConfigParser
impl ConfigParser
Sourcepub fn parse(json_str: &str) -> Result<DataFakeConfig>
pub fn parse(json_str: &str) -> Result<DataFakeConfig>
Parses a JSON string into a validated configuration.
§Errors
Returns an error if the JSON is invalid or fails validation.
Sourcepub fn parse_value(json_value: Value) -> Result<DataFakeConfig>
pub fn parse_value(json_value: Value) -> Result<DataFakeConfig>
Parses a serde_json::Value into a validated configuration.
§Errors
Returns an error if the value cannot be converted or fails validation.
Sourcepub fn create_context(config: &DataFakeConfig) -> GenerationContext
pub fn create_context(config: &DataFakeConfig) -> GenerationContext
Creates a generation context from the configuration’s variables.
Auto Trait Implementations§
impl Freeze for ConfigParser
impl RefUnwindSafe for ConfigParser
impl Send for ConfigParser
impl Sync for ConfigParser
impl Unpin for ConfigParser
impl UnwindSafe for ConfigParser
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