/// Normalizes a list of `WITH` options.
///
/// # Panics
/// - If any `WithOption`'s `value` is `None`. You can prevent generating these
///   values during parsing.
Normalizes a list of `WITH` options.
Normalizes a list of ` WITH ` options .
pub fn options<T: AstInfo>(options: &[WithOption<T>]) -> BTreeMap<String, Value> {
    options
        .iter()
        .map(|o| {
            (
                o.key.to_string(),
                match o
                    .value
                    .as_ref()
                    // The only places that generate options that do not require
                    // keys and values do not currently use this code path.
                    .expect("check that all entries have values before calling `options`")
                {
                    WithOptionValue::Value(value) => value.clone(),
                    WithOptionValue::ObjectName(object_name) => {
                        Value::String(object_name.to_ast_string())
                    }
                    WithOptionValue::DataType(data_type) => {
                        Value::String(data_type.to_ast_string())
                    }
                },
            )
        })
        .collect()
}
pub fn options < T : AstInfo > ( options : & [ WithOption < T > ] ) -> BTreeMap < String , Value > { options . iter ( ) . map ( | o | { ( o . key . to_string ( ) , match o . value . as_ref ( ) // The only places that generate options that do not require // keys and values do not currently use this code path. . expect ( " " ) { WithOptionValue :: Value ( value ) => value . clone ( ) , WithOptionValue :: ObjectName ( object_name ) => { Value :: String ( object_name . to_ast_string ( ) ) } WithOptionValue :: DataType ( data_type ) => { Value :: String ( data_type . to_ast_string ( ) ) } } , ) } ) . collect ( ) }
Normalizes a list of `WITH` options.
Normalizes a list of ` WITH ` options .
options
&[WithOption<T>]
panics
If any `WithOption`'s `value` is `None`. You can prevent generating these
values during parsing.
If any ` WithOption ` ' s ` value ` is ` None ` . You can prevent generating these values during parsing .