pub fn from_json(json: Option<Value>) -> (Self, Vec<InitializationDiagnostic>) {
        let opts: SerializedInitializationOptions =
            match serde_json::from_value(json.unwrap_or_default()) {
                Ok(opts) => opts,
                Err(e) => {
                    return (
                        Default::default(),
                        vec![InitializationDiagnostic::CouldntParse(e.to_string())],
                    );
                }
            };

        let SerializedInitializationOptions { document_parsers } = opts;
        let mut diags = vec![];
        let document_parsers = {
            match document_parsers.as_ref() {
                None => diags.push(InitializationDiagnostic::NoDocumentParserMap),
                Some(d) if d.is_empty() => {
                    diags.push(InitializationDiagnostic::NoDocumentParserMap)
                }
                _ => {}
            };
            document_parsers
                .unwrap_or_default()
                .into_iter()
                .filter_map(|(name, parser)| match DocumentParser::build(&parser) {
                    Ok(parser) => Some((name, parser)),
                    Err(why) => {
                        diags.push(InitializationDiagnostic::InvalidDocumentParser(
                            name,
                            why.to_string(),
                        ));
                        None
                    }
                })
                .collect()
        };

        let opts = Self { document_parsers };
        (opts, diags)
    }
/// Creates a fresh [`InitializationOptions`](InitializationOptions) from a JSON value, also
/// returning any [diagnostics](InitializationDiagnostic) discovered during the options'
/// construction.
Creates a fresh [`InitializationOptions`](InitializationOptions) from a JSON value, also
returning any [diagnostics](InitializationDiagnostic) discovered during the options'
construction.
Creates a fresh [ ` InitializationOptions ` ] ( InitializationOptions ) from a JSON value also returning any [ diagnostics ] ( InitializationDiagnostic ) discovered during the options ' construction .
pub fn from_json(json: Option<Value>) -> (Self, Vec<InitializationDiagnostic>) {
        let opts: SerializedInitializationOptions =
            match serde_json::from_value(json.unwrap_or_default()) {
                Ok(opts) => opts,
                Err(e) => {
                    return (
                        Default::default(),
                        vec![InitializationDiagnostic::CouldntParse(e.to_string())],
                    );
                }
            };
        let SerializedInitializationOptions { document_parsers } = opts;
        let mut diags = vec![];
        let document_parsers = {
            match document_parsers.as_ref() {
                None => diags.push(InitializationDiagnostic::NoDocumentParserMap),
                Some(d) if d.is_empty() => {
                    diags.push(InitializationDiagnostic::NoDocumentParserMap)
                }
                _ => {}
            };
            document_parsers
                .unwrap_or_default()
                .into_iter()
                .filter_map(|(name, parser)| match DocumentParser::build(&parser) {
                    Ok(parser) => Some((name, parser)),
                    Err(why) => {
                        diags.push(InitializationDiagnostic::InvalidDocumentParser(
                            name,
                            why.to_string(),
                        ));
                        None
                    }
                })
                .collect()
        };
        let opts = Self { document_parsers };
        (opts, diags)
    }
pub fn from_json ( json : Option < Value > ) -> ( Self , Vec < InitializationDiagnostic > ) { let opts : SerializedInitializationOptions = match serde_json :: from_value ( json . unwrap_or_default ( ) ) { Ok ( opts ) => opts , Err ( e ) => { return ( Default :: default ( ) , vec ! [ InitializationDiagnostic CouldntParse ( e to_string ( ) ) ] , ) ; } } ; let SerializedInitializationOptions { document_parsers } = opts ; let mut diags = vec ! [ ] ; let document_parsers = { match document_parsers . as_ref ( ) { None => diags . push ( InitializationDiagnostic :: NoDocumentParserMap ) , Some ( d ) if d . is_empty ( ) => { diags . push ( InitializationDiagnostic :: NoDocumentParserMap ) } _ => { } } ; document_parsers . unwrap_or_default ( ) . into_iter ( ) . filter_map ( | ( name , parser ) | match DocumentParser :: build ( & parser ) { Ok ( parser ) => Some ( ( name , parser ) ) , Err ( why ) => { diags . push ( InitializationDiagnostic :: InvalidDocumentParser ( name , why . to_string ( ) , ) ) ; None } } ) . collect ( ) } ; let opts = Self { document_parsers } ; ( opts , diags ) }
Creates a fresh [`InitializationOptions`](InitializationOptions) from a JSON value, also
returning any [diagnostics](InitializationDiagnostic) discovered during the options'
construction.
Creates a fresh [ ` InitializationOptions ` ] ( InitializationOptions ) from a JSON value also returning any [ diagnostics ] ( InitializationDiagnostic ) discovered during the options ' construction .
json
Option<Value>
json
Option<Value>