Create a new `Configurator` instance. # Arguments `config` - The configuration to use in JSON. # Errors This function will return an error if the configuration is invalid or the underlying discovery fails.
(json: &str, progress_format: ProgressFormat)
| 445 | /// |
| 446 | /// This function will return an error if the configuration is invalid or the underlying discovery fails. |
| 447 | pub fn new(json: &str, progress_format: ProgressFormat) -> Result<Configurator, DscError> { |
| 448 | let discovery = Discovery::new(); |
| 449 | let mut config = Configurator { |
| 450 | json: json.to_owned(), |
| 451 | config: Configuration::new(), |
| 452 | context: Context::new(), |
| 453 | discovery: discovery.clone(), |
| 454 | statement_parser: Statement::new()?, |
| 455 | progress_format, |
| 456 | }; |
| 457 | config.validate_config()?; |
| 458 | for extension in discovery.extensions.values() { |
| 459 | config.context.extensions.push(extension.clone()); |
| 460 | } |
| 461 | Ok(config) |
| 462 | } |
| 463 | |
| 464 | /// Get the configuration. |
| 465 | /// |
nothing calls this directly
no test coverage detected